Additional paragraphs added when embedding an entity in CKEditor and linking it

Created on 25 May 2022, over 2 years ago
Updated 26 March 2024, 9 months ago

Problem/Motivation

The problem also occurs in Drupal core media, when embedding media, it's the same here, extra paragraphs are added on save and when the user switches between source code and back.

Steps to reproduce

Edit an entity field in wysiwyg, embed an image, add a paragraph below, link the image to any URL.
Now switch to source and back and to source again, observe paragraphs with   added.
Save the entity, see that the displayed content also has those additional line breaks.

Proposed resolution

plugin.js, added:

    init: function init(editor) {
      // Prevent adding extra lines.
      editor.dataProcessor.writer.setRules('drupal-entity', {
        breakAfterClose: false
      });
    },

to CKEDITOR.plugins.add('drupalentity', {.

Not sure if that's the correct solution though.

🐛 Bug report
Status

Needs review

Version

1.0

Component

CKEditor integration

Created by

🇵🇱Poland Graber

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024