469,927 Members | 1,880 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Javascript for in-browser editor that shows line numbers?

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

Jan 5 '07 #1
1 3046
ca***@libertybasic.com 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.

Jan 5 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Ronan | last post: by
30 posts views Thread by Mason A. Clark | last post: by
22 posts views Thread by Mason A. Clark | last post: by
4 posts views Thread by Martin Feuersteiner | last post: by
5 posts views Thread by ANTISPAM_garycnew_ANTISPAM | last post: by
8 posts views Thread by | last post: by
1 post views Thread by JumpingOffPlace | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.