Opened 6 years ago

Last modified 6 years ago

#10594 confirmed Bug

Error when replacing element with <br> in HTML filter

Reported by: Piotrek Koszuliński Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description

  1. Open attached sample.
  2. Switch to source mode.
  3. Error is thrown.

Attachments (1)

10594.html (6.3 KB) - added by Piotrek Koszuliński 6 years ago.

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by Piotrek Koszuliński

Attachment: 10594.html added

comment:1 Changed 6 years ago by Piotrek Koszuliński

Status: newconfirmed

comment:2 Changed 6 years ago by Piotrek Koszuliński

The possible workaround would be to store all images found during filtering and replace them with brs after filters are applied.

To do this listener for editor#toDataFormat is needed. It should be registered with priority 10 to be applied after filters, but before ACF (or if ACF is not a problem - it can be 10-14).

The idea is simple:

  • instead of returning new br element in filter's function (like in the attached sample), just remember the original image element in some array,
  • then, in editor#toDataFormat listener replace all images using element#replaceWith method.
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy