This is similar to #2808907: Empty paragraphs after drupal-entity tag upcast and #2448449: CKEditor Widgets upcasting causes empty paragraph tags to be inserted.

In a block I entered an svg object like this:

<svg class="icon-svg" height="200" width="200">
 <use xlink:href="/themes/mytheme/images/svg-defs.svg?v=1.0#icon-name"></use>
</svg>

Every time the CKEditor is loaded, the number of paragraphs (<p>&nbsp</p>) contained in the text area is doubled or so. I can reproduce it by simply clicking on "source code" in the editor to turn it off and then back on. Obviously, there shouldn't be any empty paragraphs added automatically.

Comments

yan created an issue. See original summary.

yan’s picture

I just noticed that this does NOT happen when the SVG is wrapped into a div container:

<div>
  <svg class="icon-svg" height="200" width="200">
   <use xlink:href="/themes/mytheme/images/svg-defs.svg?v=1.0#icon-name"></use>
  </svg>
</div>
Wim Leers’s picture

Title: Empty paragraphs after svg/use » [upstream] Empty paragraphs after svg/use
Issue tags: +Needs upstream bugfix

Reproduced. This is a bug in CKEditor. Reported: https://github.com/ckeditor/ckeditor-dev/issues/1410.

Version: 8.4.4 » 8.4.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Version: 8.4.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Branches prior to 8.8.x are not supported, and Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

pameeela’s picture

Status: Active » Closed (cannot reproduce)
Issue tags: +Bug Smash Initiative

I can't reproduce this in 9.2.x, even though the upstream bug is not fixed. Using the steps provided:

  1. Load CKEditor without any HTML filtering
  2. Click Source
  3. Paste svg code
  4. Toggle Source on and off

No empty p tags were created.

If anyone has updated steps to reproduce this please add them to the issue summary and re-open this issue.