Ticket #121 (closed defect: fixed)

Opened 2 years ago

Last modified 8 months ago

Classes won't apply to images in certain situations

Reported by: visual77 Owned by: jf.hovinne
Priority: minor Milestone: 0.5
Component: editor Version: trunk
Keywords: Cc:

Description

I am attempting to place images into a textarea and then apply a custom class to float left or float right. While doing this, I noticed that the classes would stop applying when certain things were done.

Here are the steps that I followed to create the problem, using both methods that caused it

Method 1:

1. Open WYMEditor and type a paragraph of text.
2. Click Edit HTML.
3. At the beginning of the paragraph, right after the <p> tag, add in an <img /> tag with src as the only attribute.
4. Close Edit HTML
5. Click the image
6. Click the custom class

Method 2:

1. Open WYMEditor and type a paragraph of text.
2. Click Insert Image and type in all three values for an image that is on the same domain as WYMEditor, so the path would be "/images/image.jpg", rather than "http://domain.com/images/image.jpg"
3. Click the image.
4. Use Ctrl+X and Ctrl+V to move the image to any spot in the editor.
5. Click the image.
6. Click the custom class.

In method 2, I also noticed that the URL would change drastically. "/images/image.jpg" would become "../../../images/image.jpg".

The only method that reliably implemented the class was this:

1. Open WYMEditor and type a paragraph of text.
2. Click Insert Image and fill in the values.
3. Click the image
4. Click the custom class

It only appeared to break if I moved the image before putting the class or if I added the image manually through HTML.

I've attached the custom CSS file I am using for this.

Attachments

style.css (0.5 kB) - added by visual77 2 years ago.
this CSS file that i was including in WYMEditor

Change History

Changed 2 years ago by visual77

this CSS file that i was including in WYMEditor

Changed 2 years ago by jf.hovinne

  • status changed from new to assigned

It happens because the click event listener is applied on images at their insertion, using the standard image dialog.

Method 1 bug will easily be fixed by calling listen() (the function which e.g. applies the listeners on images) when the user closes the HTML view.

Method 2 bug needs more work/testing, as browsers don't have the same UI behaviour - so the code will be browser specific.

Note: the image path issue isn't related, see AbsoluteURLs.

Changed 2 years ago by jf.hovinne

r554 fixes bug 1.

Changed 18 months ago by mr_lundis

Maybe the use of event delegation could make things a little bit smoother?

Changed 8 months ago by mr_lundis

  • status changed from assigned to closed
  • resolution set to fixed

r648 fixes both of these issues.

Note: See TracTickets for help on using tickets.