Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2007-02-28 09:25:20

jedi58
Xinha Authority
From: Leicester, UK
Registered: 2007-01-14
Posts: 113
Website

IE and insertNodeAtSelection

I've been using:

editor.insertNodeAtSelection(....);


to insert a new element in the document from a plugin I'm working on, in Firefox it inserts it at the position as expected, but in IE it inserts it at the start of the document.....any suggestions what might be causing this, or how to fix it?

I did try using:

var sel = editor.getSelection();
var range = editor.createRange(sel);
range.pasteHTML(...);

but that didn't insert it into the document, instead it inserted it at the top of the page sad

thanks

Last edited by jedi58 (2007-02-28 09:31:29)


David G. Paul
[url]http://www.newearthonline.co.uk[/url]

Offline

#2 2007-02-28 09:49:10

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: IE and insertNodeAtSelection

You would have to do

editor.focusEditor();
var sel = editor.getSelection();
var range = editor.createRange(sel);
range.pasteHTML(...);

but actually that's just what's done at the moment (see modules/InternetExplorer/InternetExplorer.js l. 315/l. 157).
Note that until recently insertNodeAtSelection() wasn't supported in IE at all, and I just implemented this free-handedly, assuming this should work.
If you gain any  insights, please tell

Offline

Board footer

Powered by FluxBB