Verified Commit 4befb2b4 authored by Dave Long's avatar Dave Long
Browse files

Issue #3380637 by lauriii, Wim Leers: Update CKEditor 5 to 39.0.1

(cherry picked from commit 5cc339ea)
parent 45f2847c
Loading
Loading
Loading
Loading
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+44 −44
Original line number Diff line number Diff line
@@ -19,10 +19,10 @@ internal.backbone:

ckeditor5:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    # This file is not aggregated to force the creation of a new aggregate file
@@ -36,10 +36,10 @@ ckeditor5:

ckeditor5.editorClassic:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/editor-classic/editor-classic.js: { minified: true }
@@ -48,10 +48,10 @@ ckeditor5.editorClassic:

ckeditor5.editorDecoupled:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/editor-decoupled/editor-decoupled.js: { minified: true }
@@ -74,10 +74,10 @@ ckeditor5.essentials:

ckeditor5.heading:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/heading/heading.js: { minified: true }
@@ -87,10 +87,10 @@ ckeditor5.heading:

ckeditor5.basic:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/basic-styles/basic-styles.js: { minified: true }
@@ -100,10 +100,10 @@ ckeditor5.basic:

ckeditor5.specialCharacters:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/special-characters/special-characters.js: { minified: true }
@@ -113,10 +113,10 @@ ckeditor5.specialCharacters:

ckeditor5.blockquote:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/block-quote/block-quote.js: { minified: true }
@@ -126,10 +126,10 @@ ckeditor5.blockquote:

ckeditor5.image:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/image/image.js: { minified: true }
@@ -139,10 +139,10 @@ ckeditor5.image:

ckeditor5.link:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/link/link.js: { minified: true }
@@ -152,10 +152,10 @@ ckeditor5.link:

ckeditor5.list:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/list/list.js: { minified: true }
@@ -165,10 +165,10 @@ ckeditor5.list:

ckeditor5.horizontalLine:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/horizontal-line/horizontal-line.js: { minified: true }
@@ -178,10 +178,10 @@ ckeditor5.horizontalLine:

ckeditor5.htmlSupport:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/html-support/html-support.js: { minified: true }
@@ -191,10 +191,10 @@ ckeditor5.htmlSupport:

ckeditor5.alignment:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/alignment/alignment.js: { minified: true }
@@ -204,10 +204,10 @@ ckeditor5.alignment:

ckeditor5.removeFormat:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/remove-format/remove-format.js: { minified: true }
@@ -217,10 +217,10 @@ ckeditor5.removeFormat:

ckeditor5.pasteFromOffice:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/paste-from-office/paste-from-office.js: { minified: true }
@@ -229,10 +229,10 @@ ckeditor5.pasteFromOffice:

ckeditor5.indent:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/indent/indent.js: { minified: true }
@@ -242,10 +242,10 @@ ckeditor5.indent:

ckeditor5.sourceEditing:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/source-editing/source-editing.js: { minified: true }
@@ -255,10 +255,10 @@ ckeditor5.sourceEditing:

ckeditor5.table:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/table/table.js: { minified: true }
@@ -268,10 +268,10 @@ ckeditor5.table:

ckeditor5.language:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/language/language.js: { minified: true }
@@ -281,10 +281,10 @@ ckeditor5.language:

ckeditor5.codeBlock:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/code-block/code-block.js: { minified: true }
@@ -294,10 +294,10 @@ ckeditor5.codeBlock:

ckeditor5.style:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/style/style.js: { minified: true }
@@ -316,10 +316,10 @@ ckeditor5.translations:

ckeditor5.autoformat:
  remote: https://github.com/ckeditor/ckeditor5
  version: "39.0.0"
  version: "39.0.1"
  license:
    name: GNU-GPL-2.0-or-later
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.0/LICENSE.md
    url: https://raw.githubusercontent.com/ckeditor/ckeditor5/v39.0.1/LICENSE.md
    gpl-compatible: true
  js:
    assets/vendor/ckeditor5/autoformat/autoformat.js: { minified: true }
+1 −1

File changed.

Preview size limit exceeded, changes collapsed.

+67 −3
Original line number Diff line number Diff line
/* eslint-disable import/no-extraneous-dependencies */
// cSpell:words downcasted linkimageediting emptyelement downcastdispatcher
// cSpell:words datafilter downcasted linkimageediting emptyelement downcastdispatcher
import { Plugin } from 'ckeditor5/src/core';
import { setViewAttributes } from '@ckeditor/ckeditor5-html-support/src/utils';

@@ -538,6 +538,61 @@ function viewImageToModelImage(editor) {
  };
}

/**
 * General HTML Support integration for attributes on links wrapping images.
 *
 * This plugin needs to integrate with GHS manually because upstream image link
 * plugin GHS integration assumes that the `<a>` element is inside the
 * `<imageBlock>` which is not true in the case of Drupal.
 *
 * @param {module:html-support/datafilter~DataFilter} dataFilter
 *   The General HTML support data filter.
 *
 * @return {function}
 *   Callback that binds an event to its parameter.
 */
function upcastImageBlockLinkGhsAttributes(dataFilter) {
  /**
   * Callback for the element:img upcast event.
   *
   * @type {converterHandler}
   */
  function converter(event, data, conversionApi) {
    if (!data.modelRange) {
      return;
    }

    const viewImageElement = data.viewItem;
    const viewContainerElement = viewImageElement.parent;

    if (!viewContainerElement.is('element', 'a')) {
      return;
    }
    if (!data.modelRange.getContainedElement().is('element', 'imageBlock')) {
      return;
    }

    const viewAttributes = dataFilter.processViewAttributes(
      viewContainerElement,
      conversionApi,
    );

    if (viewAttributes) {
      conversionApi.writer.setAttribute(
        'htmlLinkAttributes',
        viewAttributes,
        data.modelRange,
      );
    }
  }

  return (dispatcher) => {
    dispatcher.on('element:img', converter, {
      priority: 'high',
    });
  };
}

/**
 * Modified alternative implementation of linkimageediting.js' downcastImageLink.
 *
@@ -598,8 +653,10 @@ function downcastBlockImageLink() {
}

/**
 * Add handling of 'dataEntityUuid', 'dataEntityType', 'isDecorative', 'width',
 * 'height' attributes on image elements.
 * Drupal Image plugin.
 *
 * This plugin extends the CKEditor 5 image plugin with custom attributes, and
 * removes a wrapping `<figure>` from `<img>` elements in the data downcast.
 *
 * @private
 */
@@ -685,6 +742,13 @@ export default class DrupalImageEditing extends Plugin {
        },
      });

    if (editor.plugins.has('DataFilter')) {
      const dataFilter = editor.plugins.get('DataFilter');
      conversion
        .for('upcast')
        .add(upcastImageBlockLinkGhsAttributes(dataFilter));
    }

    conversion
      .for('downcast')
      .add(modelEntityUuidToDataAttribute())
Loading