javascript - Insert HTML in NicEdit WYSIWYG -
how can insert text/code @ cursors place in div created nicedit?
i've tried read documentation , create own plugin, want work without tool bar (modal window)
this quick solution , tested in firefox only. works , should adaptable ie , other browsers.
function insertatcursor(editor, value){ var editor = niceditors.findeditor(editor); var range = editor.getrng(); var editorfield = editor.selelm(); editorfield.nodevalue = editorfield.nodevalue.substring(0, range.startoffset) + value + editorfield.nodevalue.substring(range.endoffset, editorfield.nodevalue.length); }
Comments
Post a Comment