I am trying to write my own spellcheck and for that I need to wrap words in a span element. Where can I get started here? If I directly modify the dom with innerHTML, I am the losing cursor position. Also I can't find the place where standart scayt plugin (_source/plugins/scayt/plugin.js) wraps a word into a
<span data-scaytid="1" data-scayt_word="exampl">exampl</span>Thanks in advance.
I apologize for reviving such
I apologize for reviving such an old post but this is exactly a problem I am trying to resolve myself at the moment. I am working on creating a spellcheck plugin and while I can wrap a <span> with style around specific words and then setData, I lose my cursor position. I have dug into the SCAYT plugin as well and see where it sometimes references wrapping elements with a span and custom tags like agentcooper specified above but I don't seem to be able to parse how it ever actually applies that span in the first place.
Is there some way to use the DOM tools to get individual words as elements in the editor? I know that getElementByTag() is something I can do but that does not get me individual words that are not wrapped by anything beyond the top level body element.
Is there some way to tell the editor to automatically wrap stuff that is typed with tags? I have looked through the ability to add rules and the list of events but I haven't found anything that makes sense or works yet.
Is there some way to track the cursor location and reapply the range after replacing the entire DOM structure inside the body? I have been trying to figure this out as well but it seems very convoluted and I haven't been able to make it work yet.
Anyhow I did not see any way from the user page to send a message directly to agentcooper to ask him if he ever came up with a solution so I figured a reply to his post was my best bet. Thanks.