Radu D
Radu D

Reputation: 3555

Develop custom Javascript html editor

I want to develop a custom javascript html editor. My starting point was: http://hypertextarea.sourceforge.net/

I understood how the mechanism works but the problem is that I cannot find the point where if I focus the iframe I have the cursor displayed.

Then if I press a key I see the letter entered there. Can you please explain me how this javascript shows the editor cursor and how it write in the iframe the characters that I write?

All javascript used by this editor is at http://hypertextarea.sourceforge.net/javascript/HyperTextArea.js

Upvotes: 1

Views: 454

Answers (2)

David Tang
David Tang

Reputation: 93694

It is handled by the function enableDesignMode (line 755), which tries to turn on designMode for the <iframe>.

In other words, this is a browser feature and you can make an HTML page editable with nothing more than a single line of JS (or a single HTML attribute), but the library provides other niceties like the ability to format text and insert tables.

Upvotes: 1

Raoul
Raoul

Reputation: 3909

Depending on exactly what you want: onKeyPress and onFocus

Upvotes: 0

Related Questions