Opened 11 years ago
Closed 11 years ago
#11500 closed Bug (fixed)
CKEditor on [Webkit/Blink] drops cursor when changes in one editor update another
Reported by: | David | Owned by: | Piotrek Koszuliński |
---|---|---|---|
Priority: | Normal | Milestone: | CKEditor 4.4.0 |
Component: | General | Version: | 4.0 Beta |
Keywords: | IBM Blink | Cc: | david_karam@…, fiedler@… |
Description (last modified by )
- Go to http://ckeditor.com/demo#inline on a Webkit-based browser
- Bind contents of editor1 and editor2 on a key listener
CKEDITOR.instances.editor1.on("key", function() { CKEDITOR.instances.editor2.setData(CKEDITOR.instances.editor1.getData()) });
- Update editor1 text.
Expected: editor2 updates. editor1 cursor remains at original place. Observed: editor2 updates. editor1 cursor goes back to start of editor.
Screencast attached. Firefox works fine.
Attachments (3)
Change History (17)
Changed 11 years ago by
Attachment: | CK Editor - Webkit issue.mp4 added |
---|
comment:1 Changed 11 years ago by
Cc: | david_karam@… added |
---|
comment:2 Changed 11 years ago by
Further debugging found the issue in CKEditor in selection.js - line 452.
Webkit's selection will mess up after the data loading.
CKEDITOR.env.webkit && editor.on( 'setData', clearSelection );
Would it be enough to only clear the selection if the selection is in the current element?
Is there any possible workaround that can be provided as this issue is blocking us.
comment:4 Changed 11 years ago by
Description: | modified (diff) |
---|---|
Keywords: | IBM Blink added; ibm removed |
Status: | new → confirmed |
Summary: | CKEditor on Webkit drops cursor when changes in one editor update another → CKEditor on [Webkit/Blink] drops cursor when changes in one editor update another |
Version: | 4.3.2 → 4.0 Beta |
Problem can be reproduced from CKEditor 4.0 beta in Webkit and Blink in inline editors only.
comment:5 follow-up: 6 Changed 11 years ago by
Milestone: | → CKEditor 4.3.3 |
---|---|
Owner: | set to Piotrek Koszuliński |
Status: | confirmed → assigned |
I pushed t/11500 with a proposal of patch that solves the problem. I'm not sure if check shouldn't be moved to removeAllRanges()
though.
comment:6 Changed 11 years ago by
Replying to Reinmar:
I pushed t/11500 with a proposal of patch that solves the problem. I'm not sure if check shouldn't be moved to
removeAllRanges()
though.
I tested your idea for a while
removeAllRanges: function() { if ( this.getType() == CKEDITOR.SELECTION_NONE ) return; ... }
...and it looks fine. IIRC, in real-world usage CKEDITOR.SELECTION_NONE
is only possible when editor never got focus or setData
is being executed. If that's true, I'm OK with the solution because I see no pitfalls.
Changed 11 years ago by
Attachment: | 11500.html added |
---|
comment:7 Changed 11 years ago by
Status: | assigned → review |
---|
Pushed branch:t/11500b on dev and tests.
comment:8 Changed 11 years ago by
Status: | review → review_passed |
---|
comment:9 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | review_passed → closed |
Fixed on master with git:9d666dc on dev and 23400e2 on tests.
comment:10 Changed 11 years ago by
This still does not work properly.
Add a listener from editor1 to editor2 and from editor2 to editor1 (this is our use case).
- Type "a" in editor1. Both editors have "a".
- Type "b" in editor2. Both editors have "ab".
- Type "c" in editor 1. Both editors have "abc".
Further typing in editor1 will show the same cursor issue. Attached a screencast.
Changed 11 years ago by
Attachment: | Bug still exists.mp4 added |
---|
Bug reproducible after incorporating fix
comment:11 Changed 11 years ago by
Milestone: | CKEditor 4.3.3 → CKEditor 4.3.4 |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Unfortunately I can confirm this. The TC is simple:
- Focus one of inline editors.
- Start typing in the second one.
The reason why this happens is that the first editor, when blurred locks selection and this code:
function clearSelection() { var sel = editor.getSelection(); sel && sel.removeAllRanges(); }
Gets that locked selection, which is not empty. This code should get real selection (getSelection( 1 )
) and that fixes the issue.
However, we should ask why the selection stays locked if there's a setData()
call which we know will invalidate the locked selection. Surprise, surprise, this thread moves us straight to http://dev.ckeditor.com/ticket/5217#comment:32 which we found during 4.3.3's testing phase. So both tickets will have the same fix apparently.
comment:12 Changed 11 years ago by
Status: | reopened → confirmed |
---|
comment:14 Changed 11 years ago by
Milestone: | CKEditor 4.3.4 → CKEditor 4.4 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
Fixed by #5217 on major.
Screencast of issue