PDA

View Full Version : Can someone provide me a theory



Dal
10-02-2008, 02:06 PM
Hi,

I'm wanting to create a WYSIWYG editor (I dont mean BBCode) but I cant get my head around the theory.

Can someone explain how it works (This is not a code request!)? ;)


my understanding so far is that I am to hide a textarea behind a div but that fails straight away as I cant get selectionStart and selectionEnd values from text highlighting or cursor key positioning from a div!

Can someone point me in the right direction please? :confused:

Thanks
Kind regards
Dal

Twey
10-02-2008, 08:33 PM
They're mostly done by applying the contentEditable attribute to an <iframe>. It's quite browser-dependent.

Dal
10-02-2008, 08:41 PM
Thanks for the reply.

I had a look at the iframe and the attribute and it works quite well but as far as getting ahold of carot position and mouse selections are concerned I can't seem to get them values.

I would be looking to get it working under the lastest Gecko engine only so hope that narrows down the theory a little. I've had a look at existing WYSIWYG editors and they have extensive code to try and pull apart so I wanted to theory to tackle it from a different point of view (and build my own code). I see a code comment in one that states it inserts the iframe INTO a HTML TextArea - is this possible?

Kind regards
Dal