Opened 6 years ago

Last modified 5 years ago

#11636 closed New Feature

Introduce new, focused on UX, methods for getting selected HTML and deleting it — at Version 5

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

Description (last modified by Piotrek Koszuliński)

Short description - we need methods which will retrieve and extract HTML in a way correct from user experience POV. For example when selection is inside <strong>, we need not only text that's selected, but also information about the style applied in this location, so that <strong> tag.

Outdated description:

Because of custom implementation of drag & drop (#11460) we will use selection.getSelectedHTML and range.deleteContents more often to read and remove dragged HTML. Current implementation of selection.getSelectedHTML can not be based on range.cloneContents because it changes range (#11586) and works not as we could expected.

For this reasons we need to reimplement selection.getSelectedHTML, range.cloneContents and range.deleteContents.

range.cloneContents and range.deleteContents should behave more as user could expect than simple clone or delete. For example:

  • for 'xx<a href="foo">b[a]r</a>xx' range.cloneContents should return '<a href="foo">a</a>',
  • for '<p>[foo]</p>' range.deleteContents' should remove whole paragraph,
  • for '<table><tr>[<td>foo</td><td>b]ar</td></tr></table>' range.deleteContents should change contents to the '<table><tr><td></td><td>ar</td></tr></table>'.

selection.getSelectedHTML should be based on range.cloneContents.

Change History (5)

comment:1 Changed 6 years ago by Piotr Jasiun

During the testing phase for D&D two issues related to this ticket were found: Bug 4 and Bug 7.

https://docs.google.com/document/d/1hG4H0r21MXNkRd3amDEOBPygJe3ehBAXFWAal2DptGQ/edit?usp=sharing

comment:2 Changed 6 years ago by Olek Nowodziński

cc

comment:3 Changed 6 years ago by Olek Nowodziński

Owner: set to Olek Nowodziński
Status: newassigned

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

Description: modified (diff)
Summary: Improve selection.getSelectedHTML, range.cloneContents and range.deleteContentsIntroduce new, focused on UX, methods for getting selected HTML and deleting it

comment:5 Changed 5 years ago by Piotrek Koszuliński

Description: modified (diff)
Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy