designMode on an iframe - relocating images in the dom and keeping their focus
I'm using designMode on an iframe to create a simple html editor, based
on widgEdit from www.themaninblue.com.
I've added toolbar buttons that let you nudge an image up and down the
dom tree. You click on an image in the design view and then press the
buttons to move the image up or down through the paragraphs. Behind the
scenes when the button is pressed I create a duplicate of the image
node, delete it from where it is and locate the previous or next block
level element and append the duplicated image to that new parent node.
This works ok and the image moves up or down as you'd expect.
The problem is that I want to give the new image focus once it has been
relocated. In firefox the focus indicators remain in the old position
where the image used to be. It's selecting the image which is no longer
there, this is wrong. So when I press the "move image upwards" button a
second time, the newly positioned image isn't in focus and nothing
happens, you have to manually refocus on the image again (by clicking
on it) once it has been moved.
In IE the focus indicators correctly vanish.
By "focus indicators" I mean the 8 draggable nodes that appear around
the image so that it can be resized.
In both browsers I can't give the newly positioned image focus. After
the button has been pressed I want the newly positioned image to have
the "focus indicators". The idea is that the user can keep pressing the
nudge up/down buttons to move the image to wherever they want it to be.
I have tried oImage.focus(), oImage.click().. Nothing seems to work.
Can anybody tell me how to do this?
I can put an example online if you want.
|All times are GMT. The time now is 02:49 PM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.