ckeditor4 icon indicating copy to clipboard operation
ckeditor4 copied to clipboard

When bbcode tags aren't terminated it breaks completly the editor

Open xillibit opened this issue 4 years ago • 6 comments

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. you have by example this code in source : [b]Hello world![/b]
  2. then modifiy it to : [b]Hello world![/b
  3. go in normal mode, change to [b]Hello world![/b]
  4. go into source, CKeditor fails and you have nothing in edit area

Expected result

The editor shouldn't fails completly

Actual result

The editor fails completly and you that in browser console :

Uncaught TypeError: candidate is null in plugins/bbcode/plugin.js:344:16 onTagClose file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/plugins/bbcode/plugin.js:344 parse file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/plugins/bbcode/plugin.js:171 fromBBCode file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/plugins/bbcode/plugin.js:408 BBCodeToHtml file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/plugins/bbcode/plugin.js:588 onSetData file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/plugins/bbcode/plugin.js:763 listenerFirer file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/event.js:169 fire file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/event.js:313 fire file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/editor_basic.js:24 setData file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/editor.js:1152 onLoad file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/plugins/wysiwygarea/plugin.js:97 listenerFirer file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/event.js:169 fire file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/event.js:313 getNativeListener file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/dom/domobject.js:46 on file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/dom/domobject.js:93 init file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/plugins/wysiwygarea/plugin.js:52 setMode file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/creators/themedui.js:225 exec file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/plugins/sourcearea/plugin.js:145 exec file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/command.js:56 execCommand file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/editor.js:983 click file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/plugins/button/plugin.js:87 execute file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/plugins/button/plugin.js:165 clickFn file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/plugins/button/plugin.js:197 addFunction file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/tools.js:828 callFunction file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/core/tools.js:856 onclick file:///C:/Users/xillibit/Downloads/ckeditor_4.16.1_41a8791ce01b_source_big/ckeditor/samples/index.html:1

Other details

  • Browser: Firefox 88.0.1
  • OS: Windows 10 21H1
  • CKEditor version: 4.16.1
  • Installed CKEditor plugins: bbcode

xillibit avatar May 25 '21 20:05 xillibit

Hi @xillibit ,

Thank you for the report. I try to follow the steps you provide and I'm kind of lost. Could you confirm my version: 1.Put [b]Hello·world![/b as editor content in HTML. 2. Open the editor. The text is bolded, including improper closing bbcode tag [/b 3. Add missing ] to the incorrectly closed tag [/b. 4. Switch to sourcemode. 5. Switch to normal mode.

Now editor hangs with errors in the console. bbcode plugin fails

sculpt0r avatar May 27 '21 08:05 sculpt0r

Yes it's like that, i hadn't added the error showed in the console when the editor hangs. I have added it in my issue above

xillibit avatar May 27 '21 16:05 xillibit

The source data is interesting in the gif from https://github.com/ckeditor/ckeditor4/issues/4730#issuecomment-849459732:

<b>Hello·world![/b</b>

Since the editor uses bbcode plugin, I think output should contain bbcode only (so [b]) instead of <b> which may mean there is more complex issue somewhere deeper related to how invalid bbcode is parsed :thinking:

f1ames avatar May 28 '21 11:05 f1ames

@xillibit - thank you for confirmation. Now I can properly label this issue.

@f1ames - definitely looks more complex... I mark it with proper size label :+1:

sculpt0r avatar May 28 '21 20:05 sculpt0r

Probably related to this if not the same: https://github.com/ckeditor/ckeditor4/issues/2782

blackcoder87 avatar Jun 04 '21 17:06 blackcoder87