I believe the title is pretty self-explanatory but still, maybe, I should ask in detail. I'm building a WYSIWYG editor and I'm really at the beginning of it. So, I realized that maybe knowing the pros and cons would enlighten me. Basically, my question is, since I want an editor that would work at least with 90% in all major browsers, how further I can go using contenteditable within a div and what are the cons and pros of using contenteditable when compared with designMode and iframe? Also, while researching I've found this editor. I believe it is not using any of these attributes and it's moving the location of textarea. Is this a better approach? Well, I know that there are lots of factors that influence the answer on the last question, but as I mentioned, the most important thing I look up in the editor is that it can be used by the 90% of the users. NB: I do not want to use any third party libraries.
Its totally secure. The contenteditable attribute is an enumerated attribute whose keywords are the empty string, true, and false.
Definition and Usage The contenteditable attribute specifies whether the content of an element is editable or not.
The contentEditable property of the HTMLElement interface specifies whether or not the element is editable. This enumerated attribute can have the following values: ' true ' indicates that the element is contenteditable . ' false ' indicates that the element cannot be edited.
The contenteditable global attribute is an enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies its widget to allow editing.
contentEditable
does not work with floats in IE:
<p>
<img style="float:left" src="foo">
<p contentEditable="true">very long text here ...
... this text won't flow round the image</p>
</p>
This is because contentEditable
triggers the infamous hasLayout
.
Other than that, everything works pretty well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With