You are not logged in.
Anybody ever had any wierd problems not being able to use pasteHTML?
sel = editor._getSelection();
range = editor._createRange(sel);
range.pasteHTML(Xinha.getOuterHTML(toPaste));
The range.pasteHTML gives me an "Unspecified error".
David G. Paul
[url]http://www.newearthonline.co.uk[/url]
Offline
Ok this is quite odd actually, I've done some testing to see what's going on - and by the time it reaches that code the text is no longer selected on the page.
To see what was causing it I commented out the function so that clicking the button only does the code from the above post - however the text in Xinha still becomes deselected. Commenting out that too so the function for the button is empty, I found it still does the same with the text becoming deselected.
Since the button isn't on a modal window, could it be that Xinha is deselecting text when it loses focus? If so, anyone know how to stop it from doing this?
Note: it's only in IE it deselects the text
EDIT: I've checked the examples page and clicking outside Xinha deselects text there too
Last edited by jedi58 (2007-03-22 08:13:51)
David G. Paul
[url]http://www.newearthonline.co.uk[/url]
Offline
Unfortunate, but true. Maybe you could save the selection, check out the related functions I added in http://xinha.python-hosting.com/changeset/794
Offline
Thanks a lot for adding the functions, but I'm wondering if I'm using them wrong - when trying to restore the selection I get "Object does not support that property or method"
in the function that runs when the lightbox loads I use:
sav_range = editor.saveSelection();
sav_range is defined outside the function to make it global, and then in the function that is run when the button is clicked I do:
if (Xinha.is_ie) {
editor.restoreSelection(sav_range);
}
(I put it inside the Xinha.is_ie block as in Gecko it causes unhandled exception errors)
David G. Paul
[url]http://www.newearthonline.co.uk[/url]
Offline
Ah nevermind, it was just me being incredibly stupid - I'd called the function that runs when the lightbox is opened before I'd declared the variables that it was going to setup for the other functions to use
Thanks a lot for helping, those two functions are going to be incredibly useful
David G. Paul
[url]http://www.newearthonline.co.uk[/url]
Offline