Opened 11 years ago
Closed 11 years ago
#12448 closed New Feature (fixed)
insertHtmlIntoRange
| 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 )
When image is uploaded (#11461) we need to replace uploading image with the final one, so we need to insert html in the given range (not in the editors selection). Because of this situation we need to introduce insertHtmlIntoRange methods.
Change History (10)
comment:1 Changed 11 years ago by
| Owner: | set to Piotr Jasiun |
|---|---|
| Status: | new → assigned |
comment:2 Changed 11 years ago by
| Summary: | insertHtmlIntoRange and insertHtmlIntoSelection → insertHtmlIntoRange |
|---|
comment:3 Changed 11 years ago by
| Description: | modified (diff) |
|---|
comment:4 Changed 11 years ago by
| Status: | assigned → review |
|---|
comment:5 Changed 11 years ago by
| Status: | review → review_failed |
|---|
I rebased branch:t/12448 and pushed additional commit.
insertElementandinsertElementIntoRangedon't need to fire theafterInsertevent. These methods are very different frominsertHtmlandinsertText, because they can't trigger data processor. Also the insertion algorithm is much different.- Since the behaviour is so different, I think that it will be better to rename the event to afterInsertHtml so in the future we can have one specific for insertElement. The goal is to have a total separation between methods inserting elements and methods inserting HTML/text.
data.intoRangeshould carry the range.- Please complete
editor.insertHtml/Textandeditable.insertHtmlIntoRangedocs with information that these methods fire theeditor.afterInsertHtmlevent. Ineditor.inserHtml/Text/Elementyou can also mention theeditor.insertHtml/Text/Elementevents because I see that they are not mentioned there.
comment:6 follow-up: 7 Changed 11 years ago by
I also noticed a difference between:
- insertElement(element, range) chooses between insertElementIntoRange and insertElementIntoSelection based on the range argument.
- For HTML there's only insertHtml and insertHtmlIntoRange.
I find the two methods better than three, but wouldn't it be better to do it the same way as element methods for consistency reasons?
comment:7 follow-up: 8 Changed 11 years ago by
| Status: | review_failed → review |
|---|
Replying to Reinmar:
I also noticed a difference between:
- insertElement(element, range) chooses between insertElementIntoRange and insertElementIntoSelection based on the range argument.
- For HTML there's only insertHtml and insertHtmlIntoRange.
I find the two methods better than three, but wouldn't it be better to do it the same way as element methods for consistency reasons?
We agreed that these methods only look similar, but work differently, so there is no reason do make then look event more similar. It may suggest that then have something common. Especially when the third method is useless.
I fixed rest of issues. Changes in t/12448.
comment:8 Changed 11 years ago by
Replying to pjasiun:
Replying to Reinmar:
I also noticed a difference between:
- insertElement(element, range) chooses between insertElementIntoRange and insertElementIntoSelection based on the range argument.
- For HTML there's only insertHtml and insertHtmlIntoRange.
I find the two methods better than three, but wouldn't it be better to do it the same way as element methods for consistency reasons?
We agreed that these methods only look similar, but work differently, so there is no reason do make then look event more similar. It may suggest that then have something common. Especially when the third method is useless.
I fixed rest of issues. Changes in t/12448.
After the discussion we decided to organized insertHtml methods the same way insertElement is organized. I also fixed and added test and rebased branch on the newest major.
comment:9 Changed 11 years ago by
| Status: | review → review_passed |
|---|
comment:10 Changed 11 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | review_passed → closed |
Merged to major with git:18d651ad.

There were some conceptual problems with this ticket. The main reason is that
insertHtmlis high-level method: it fixes selection, scroll viewport and can make snapshots if widget was inserted. TheinsertHtmlIntoRange, in contrast, is low-level method: it just insert HTML without any additional operations. But in both cases we need to make some operations after insertion (ex.checkWidgets). To solve the problem I introducedafterInsertevent with theintoRangeparameter which is true if this is low level method.Changes in t/12448.