jquery - Javascript WYSIWYG Logic -
i've searched similar questions, seems wrapped in making div editable using contenteditable="true".  
i curious efficient way keep track of formatting tags added document. wrapping / unwrapping selected text jquery seems corrupt document after few edits because of broken overlapping tags.
would correct approach separate characters array, work out logic add / modify / remove tags @ positions defined window.getselection(), , render output version load editable div?  or there better solution?
it may unnecessary wrap elements in tags manually javascript / jquery.  i've been reading execcommand() , seems supported.  allow formatting options found in wysiwyg editors, color, font size, family, adding links, etc...  realize initial question little broad, perhaps point else in right direction well...  
examples:
document.execcommand('bold', 0); document.execcommand('forecolor', 0, '#ff0000'); document.execcommand('fontsize', 0, '7'); works in chrome / firefox / safari, not sure ie yet. above bold example demonstrates how browser keeps track of existing formatting , can toggle style on/off.
Comments
Post a Comment