Forum Moderators: open

Message Too Old, No Replies

Building a text editor

         

optik

1:13 pm on Jun 5, 2009 (gmt 0)

10+ Year Member



Hi

I have already built a simple text editor which allows the changing of a whole div's font style however I now want to make a bit more advanced and allow direct styling of highlighted text.

I've found a nice example of how to capture selected text for use in javascript but I now need be able to edit the selected text and it's surrounding tags. For example a user types "Hello World" selects "World" and adds a bold style, so the html is now "Hello <b>World</b>" (the tags are not displayed to the user), they then highlight "World" again and press delete.

I'm not sure how I would now make sure the tags as well as the word "World" are deleted. Some how I need to search for the next > character form the select point and the previous< although I'm not sure how to do this.

Jesdisciple

4:07 am on Jun 12, 2009 (gmt 0)

10+ Year Member



In case you're still wondering, see here [openwebware.com] for the wheel you're trying to re-invent. I really don't understand why this is such a popular ambition.