Opened 5 years ago

Closed 5 years ago

#12878 closed Bug (fixed)

Move (get|extract)SelectedHtml to selection

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

Description (last modified by Piotr Jasiun)

Now we have:

editor.getSelection().getSelectedText()
editor.editable().getSelectedHtml()

We can not move getSelectedText() because of backward compatibility so we should move getSelectedHtml(). And if we move getSelectedHtml we should also move extractSelectedHtml.

Changes in t/12878.

Change History (5)

comment:1 Changed 5 years ago by Piotr Jasiun

I see that editor.getSelection().getSelectedHtml() method already exist and use native cloneContents which works badly. I believe it should be replaced with the new method. The old method is since 4.4 so I hope we will not break anything and having 2 methods with seems to be the same but works differently is very confusing.

comment:2 Changed 5 years ago by Piotr Jasiun

Status: newconfirmed

comment:3 Changed 5 years ago by Piotr Jasiun

Owner: set to Piotr Jasiun
Status: confirmedassigned

comment:4 Changed 5 years ago by Piotr Jasiun

Description: modified (diff)
Status: assignedreview

After discussion with @Reinmar we decided that the behavior of the functions in editor, editable and selection is different:

  • selection should know nothing about editor, config or editable, it contains only wrappers for the native methods and getSelectedText is such wrapper so it goes to selection,
  • editable knows about editor and the config so it may contains method which behavior depends on configuration, also it contains lower level methods then editor so (get|extract)HtmlFromRange methods go there,
  • editor contains high level API, methods user may often want to use, which works the way user expect, so (get|extract)selectedHtml goes there.

The original idea was to put (get|extract)selectedHtml into editable and link it in editor, but in fact these methods do nothing but join selection (which is property on the editor not editable) and (get|extract)HtmlFromRange so in my opinion there is no point in having them in the editable.

Changes in t/12878.

Last edited 5 years ago by Piotr Jasiun (previous) (diff)

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

Resolution: fixed
Status: reviewclosed

Fixed on major with git:b7a30dd.

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