If there is content for CKEditor with 'data-widget="image"' for non img tag, the CKEditor is broken with js error:Uncaught TypeError: Cannot read property 'getAttribute' of null
To reproduce #1:
1) Install Drupal 8.5.x with standard profile
2) Go to the node/add/article page
3) Switch body's text format to 'Full HTML'
4) Hit 'Source' button on CKEditor to switch to source code mode
5) Enter text, e.g.:<p data-widget="image">test</p>
or<a data-widget="image" href="http://drupal.org">drupal.org</p>
5) Switch back to edit mode
6) There is js error:Uncaught TypeError: Cannot read property 'getAttribute' of null
and CKEditor is broken
To reproduce #2:
1) Install Drupal 8.5.x with standard profile
2) Go to the node/add/article page
3) Switch body's text format to 'Restricted HTML'
4) Enter text, e.g.:<p data-widget="image">test</p>
or<a data-widget="image" href="http://drupal.org">drupal.org</p>
5) Switch text format to 'Full HTML'
FYI: An old issue for CKEditor: https://dev.ckeditor.com/ticket/12388