Opened 10 years ago
Closed 10 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 )
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 10 years ago by
comment:2 Changed 10 years ago by
Status: | new → confirmed |
---|
comment:3 Changed 10 years ago by
Owner: | set to Piotr Jasiun |
---|---|
Status: | confirmed → assigned |
comment:4 Changed 10 years ago by
Description: | modified (diff) |
---|---|
Status: | assigned → review |
After discussion with @Reinmar we decided that the behavior of the functions in editor
, editable
and selection
is different:
selection
should know nothing abouteditor
,config
oreditable
, it contains only wrappers for the native methods andgetSelectedText
is such wrapper so it goes toselection
,editable
knows abouteditor
and theconfig
so it may contains method which behavior depends on configuration, also it contains lower level methods theneditor
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.
comment:5 Changed 10 years ago by
Resolution: | → fixed |
---|---|
Status: | review → closed |
Fixed on major with git:b7a30dd.
I see that
editor.getSelection().getSelectedHtml()
method already exist and use nativecloneContents
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.