Opened 9 years ago

Closed 8 years ago

#13806 closed Bug (expired)

Removing bookmark around a widget causes an runtime error

Reported by: XipanXiao Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:


Steps to reproduce

  1. Open the attached ckeditor.html
  2. click the testWidget button
  3. click the bookmark button
  4. click the bookmark button again

Expected result

No errors.

Actual result

Error printed to console: Uncaught TypeError: Cannot read property 'type' of nulla @ ckeditor.js:126window.CKEDITOR.window.CKEDITOR.dom.CKEDITOR.dom.range.createBookmark2 @ ckeditor.js:128window.CKEDITOR.window.CKEDITOR.dom.e.createBookmarks2 @ ckeditor.js:452window.CKEDITOR.window.CKEDITOR.dom.CKEDITOR.dom.selection.createBookmarks2 @ ckeditor.js:409window.CKEDITOR.window.CKEDITOR.dom.CKEDITOR.plugins.undo.Image @ @ ckeditor.js:948d @ ckeditor.js:943h @ @ @ @ @ ckeditor.js:740window.CKEDITOR.window.CKEDITOR.dom.CKEDITOR.ui.button.render.n.execute @ ckeditor.js:741(anonymous function) @ ckeditor.js:742(anonymous function) @ @ ckeditor.js:29onclick @ ckeditor.html:1

Other details (browser, OS, CKEditor version, installed plugins)

Chrome, Linux, 4.5.4, only one plugin in the html installed ==

Attachments (2)

ckeditor.html (2.2 KB) - added by XipanXiao 9 years ago.
ckeditor222.html (2.4 KB) - added by Jakub Ś 8 years ago.

Download all attachments as: .zip

Change History (5)

Changed 9 years ago by XipanXiao

Attachment: ckeditor.html added

comment:1 Changed 9 years ago by XipanXiao

The offending line:

f = f.type != CKEDITOR.NODE_ELEMENT || e === 0 || e == f.getChildCount() ? 0 : f.getChild(e - 1).type == CKEDITOR.NODE_TEXT && f.getChild(e).type == CKEDITOR.NODE_TEXT;

Here when 'e > f.getChildCount()' the code fails.

Version 0, edited 9 years ago by XipanXiao (next)

comment:2 Changed 8 years ago by Jakub Ś

Component: Core : Undo & RedoGeneral
Status: newpending
Version: 4.5.4

First of all, I'm sorry for late reply. Second, could you tell us exactly what you are trying to do?

When you create intrusive bookmark which inserts spans into the code, you remove them with this method -!/api/CKEDITOR.dom.range-method-moveToBookmark. Range will be moved to correct position and spans will be removed.
Playing with ranges can be very tricky and produce many unexpected errors. I believe this is what is happening here.

I have changed your example a little bit (please see attached file) and now it works without any error. Is this what you were trying to do?

NOTE: You can't put DIV inside P. The other way around is ok but DIV inside P is disallowed.

Changed 8 years ago by Jakub Ś

Attachment: ckeditor222.html added

comment:3 Changed 8 years ago by Jakub Ś

Resolution: expired
Status: pendingclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy