T
Thomas -Balu- Walter
Hello everyone,
first my question in short - I am looking for a working replacement
of the following function for Mozilla (this was written for IE):
// encloses the selected area into starting and closing tag
// if no closing tag is given the starting tag will replace the selection
function encloseSelection(startingTag, closingTag)
{
editRange = editArea.document.selection.createRange();
if (closingTag) {
editRange.pasteHTML(startingTag+editRange.htmlText+closingTag);
return;
}
//editRange.collapse(false); // move insertion point to end of text range (append tag)
editRange.pasteHTML(startingTag); // replace selection with startingTag
}
Longer version:
I am working on making an older "WYSIWYMG"-editor (written for IE)
Mozilla-compatible. Everything works fine so far, but I am not able
to figure out a solution to the above problem.
I'd like to enclose a selected text in one of the famous
"designMode=on" iframes with HTML-strings. I've tried numerous
ways - by now without luck.
Perhaps anyone here has a solution or hint that can help me?
Balu
first my question in short - I am looking for a working replacement
of the following function for Mozilla (this was written for IE):
// encloses the selected area into starting and closing tag
// if no closing tag is given the starting tag will replace the selection
function encloseSelection(startingTag, closingTag)
{
editRange = editArea.document.selection.createRange();
if (closingTag) {
editRange.pasteHTML(startingTag+editRange.htmlText+closingTag);
return;
}
//editRange.collapse(false); // move insertion point to end of text range (append tag)
editRange.pasteHTML(startingTag); // replace selection with startingTag
}
Longer version:
I am working on making an older "WYSIWYMG"-editor (written for IE)
Mozilla-compatible. Everything works fine so far, but I am not able
to figure out a solution to the above problem.
I'd like to enclose a selected text in one of the famous
"designMode=on" iframes with HTML-strings. I've tried numerous
ways - by now without luck.
Perhaps anyone here has a solution or hint that can help me?
Balu