Announcement

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

#1 2007-03-22 06:38:03

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

strange problem with pasteHTML in IE

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

#2 2007-03-22 07:36:20

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

Re: strange problem with pasteHTML in IE

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

#3 2007-03-22 13:52:15

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

Re: strange problem with pasteHTML in IE

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

#4 2007-03-23 06:04:54

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

Re: strange problem with pasteHTML in IE

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

#5 2007-03-23 06:10:00

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

Re: strange problem with pasteHTML in IE

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 smile


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

Offline

Board footer

Powered by FluxBB