Opened 12 years ago

Closed 12 years ago

#136 closed defect (fixed)

insert image twice on first position -> attributes lost

Reported by: JFiege Owned by: gogo
Priority: normal Milestone:
Component: Xinha Core Version:
Severity: normal Keywords: insert image


There is a problem when you insert an image on the first position in the document in Firefox (or Mozilla). I tested the following in your example:

I open the Editor and put the Cursor on first position on the document in WYSIWYG-Mode. Then i insert an image _with_ attributs like vspace, hspace... The output in html-Mode is this:

<img vspace="3" hspace="3" border="4" align="right" src=",1020,361725,00.jpg" alt="alternate text" />

Now i delete the image in WYSIWYG-Mode. After that i try to insert a new image on the same position with the same attributes, but the output is this:

<img src=",1020,361725,00.jpg" />

Where are my attributes?

This doesnt happen when the cursor position is another. In IE it works fine, too. Has anyone an idea to solute this?

Attachments (4)

logo.jpg (21.4 KB) - added by anonymous 12 years ago.
micky.jpg (2.8 KB) - added by anonymous 12 years ago.
micky.2.jpg (2.8 KB) - added by anonymous 12 years ago.
Sample.jpg (9.7 KB) - added by anonymous 12 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 12 years ago by wsqzreimer@…

I wrestled with this one a long time in my hacked up version of HA. The problem more specifically is when you insert an image either at the beginning or end of the existing content in the editor (or maybe at the end of any text node), the attributes go missing.

I narrowed it down to this in the insert image function (my comments):

if (!img) { 
   //bunch of other (mostly IE) code

   img = range.startContainer.previousSibling;

   // when an image gets created this way, it's not a real image object
   // I have no idea how this code could possibly create an image object

My hack was to send the actual HTML as a string param from the dialog, and insert it here using the HTMLArea.insertHTML() function, replacing the above line (sorry I don't have my actual code here to paste in ).

Another possibility might be:

img = new Image()


img = this._doc.createElement("img")

...although I think I tried the first one and it didn't work...

  • Wes

comment:2 Changed 12 years ago by niko

  • Resolution set to fixed
  • Status changed from new to closed

thanks, i got it fixed in changeset:102

(the image-object is created with the editor._doc.execCommand("insertimage", false, param.f_url)!
we then have to get this just created image - as the execCommand doesn't return the element directly like createElement would do.)

Changed 12 years ago by anonymous

Changed 12 years ago by anonymous

Changed 12 years ago by anonymous

Changed 12 years ago by anonymous

Note: See TracTickets for help on using tickets.