Javascript for in-browser editor that shows line numbers?

C

carlg

There seem to be plenty of Javascript implemented WYSIWYG editors for
editing rich text in a web browser, but I haven't been able to find one
that shows line numbers. Even if that was the only enhancement over
the standard textarea object it would be great for my needs.

Does anyone know of such a widget?

Thanks,

-Carl Gundel, author of Liberty BASIC
http://www.libertybasic.com
 
R

Roy A.

(e-mail address removed) skrev:
There seem to be plenty of Javascript implemented WYSIWYG editors for
editing rich text in a web browser, but I haven't been able to find one
that shows line numbers. Even if that was the only enhancement over
the standard textarea object it would be great for my needs.

Does anyone know of such a widget?

You could put your WYSIWYG editor in a div-element and use stylesheet
to style the line numbers:

<div class="editor-container">
<!-- Replace paragraphs with WYSIWYG editor -->
<p>text text</p>
<p>text text</p>
</div>

A stylesheet who works in IE, Opera and standards compliant browsers
could look like this:

<style type="text/css">
.editor-container { counter-reset: list-item; list-style-type:
decimal }
.editor-container p { margin: 0 2em; display: list-item }
</style>

A stylesheet who works in Firefox, Opera and standards compliant
browsers could look like this:

<style type="text/css">
.editor-container { list-style-type: decimal; counter-reset: item }
.editor-container p { margin: 0 2em; display: list-item;
list-style-type: none }
.editor-container p:before { content: counter(item) ". ";
counter-increment: item }
</style>

I can't figure out a way to make it work in both firefox and IE. You
might get better css code in a group like
comp.infosystems.www.authoring.stylesheets

In JavaScript you could use regular expression to put the sentenses in
a ordered list, or maybe just a bacground image to show line numbers.
If you have a limit numbers of lines, a background image could be the
easyest way. Then you would not need a widget.

Hope I have given you some clue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top