Opened 9 years ago

Closed 9 years ago

#12617 closed Bug (fixed)

uploadWidget.replaceWith should use insertHtmlIntoRange

Reported by: Piotr Jasiun Owned by: Piotr Jasiun
Priority: Normal Milestone: CKEditor 4.5.0 Beta
Component: General Version:
Keywords: Cc:


uploadWidget.replaceWith should use insertHtmlIntoRange and support multiple elements.

Change History (6)

comment:1 Changed 9 years ago by Piotr Jasiun

Status: newconfirmed

comment:2 Changed 9 years ago by Piotr Jasiun

Owner: set to Piotr Jasiun
Status: confirmedassigned

comment:3 Changed 9 years ago by Piotr Jasiun

Status: assignedreview

Integration seems to work smoothly. Changes in t/12617.

comment:4 Changed 9 years ago by Piotrek Koszuliński

Status: reviewreview_failed

I rebased the branch and added new tests. They fail. When operating over DOM with editable.insertHtmlIntoRange you must remember that selection may be lost so it must be always restored. I think that it will be enough to create bookmark before calling insertHtmlIntoRange and restoring it afterwards (both should only be done if wasSelected == false).

Moreover, there's no test for preserving widget selection (if wasSelected works).

Moreover, I understood one sad thing. Since we use insertHtmlIntoRange with the default mode it will always work like pasting, so inserting "foo" in <b>xx^xx</b> will result with <b>xx</b>foo<b>xx</b>. In some cases this will be undesired behaviour. I think that we can solve this by adding the mode param to the replaceWith method. You can extract this to a new ticket.

comment:5 Changed 9 years ago by Piotr Jasiun

Status: review_failedreview

I have improved handling selection (code and test) and added mode parameter. Changes in t/12617.

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

Resolution: fixed
Status: reviewclosed

It works ok. Not perfectly, because e.g. selection direction is lost (unfortunately, not much we can do about this) and on FF the image selection isn't visible (dunno why), but most important cases work.

Merged to major with git:b4b3a83.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy