firepages
08-13-2004, 06:43 PM
Hi , I am messing with the Rich Text Editor from http://www.kevinroth.com/rte/demo.htm
its does most of the things I want , however I want to be able to add a string of text at the current cursor position , in IE
obj.document.execCommand('paste', false, '{whatever}');
works (as does insertHTML) but neither work in Moz for, I gather, security reasons (so perhaps may not even work in IE in SP2?), so how would I go about inserting a string of text in the editor ?
the function I have that gets the cursor position or range is ..
function add_template(rte,string_text){
var oRTE;
//get current selected range
if (document.all) {
oRTE = frames[rte];
var selection = oRTE.document.selection;
if (selection != null) {
rng = selection.createRange();
}
} else {
oRTE = document.getElementById(rte).contentWindow;
var selection = oRTE.getSelection();
rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
}
//works in IE//
oRTE.document.execCommand('paste', false,string_text);
}
so is there a way / what is the way ;) of perhaps adding the text via the DOM ?
its does most of the things I want , however I want to be able to add a string of text at the current cursor position , in IE
obj.document.execCommand('paste', false, '{whatever}');
works (as does insertHTML) but neither work in Moz for, I gather, security reasons (so perhaps may not even work in IE in SP2?), so how would I go about inserting a string of text in the editor ?
the function I have that gets the cursor position or range is ..
function add_template(rte,string_text){
var oRTE;
//get current selected range
if (document.all) {
oRTE = frames[rte];
var selection = oRTE.document.selection;
if (selection != null) {
rng = selection.createRange();
}
} else {
oRTE = document.getElementById(rte).contentWindow;
var selection = oRTE.getSelection();
rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
}
//works in IE//
oRTE.document.execCommand('paste', false,string_text);
}
so is there a way / what is the way ;) of perhaps adding the text via the DOM ?