Unverified Commit f6dbd06a authored by Lauri Timmanee's avatar Lauri Timmanee
Browse files

Issue #3224652 by Wim Leers, hooroomoo, vlyalko, lauriii, bnjmnm, huzooka:...

Issue #3224652 by Wim Leers, hooroomoo, vlyalko, lauriii, bnjmnm, huzooka: [drupalImage] Add ckeditor5-image's imageresize plugin to allow image resizing

(cherry picked from commit fa8929ec)
parent 52d0388b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -140,6 +140,8 @@
 *   - 'filter': a filter that must be enabled
 *   - 'imageUploadStatus': TRUE if image upload must be enabled, FALSE if it
 *      must not be enabled
 *   - 'requiresConfiguration': a subset of the configuration for this plugin
 *      that must match (exactly)
 *   - 'plugins': a list of CKEditor 5 Drupal plugin IDs that must be enabled
 *
 * All of these can be defined in YAML or annotations. A given plugin should
+21 −0
Original line number Diff line number Diff line
@@ -430,6 +430,27 @@ ckeditor5_image:
      toolbarItem: uploadImage
      imageUploadStatus: true

ckeditor5_imageResize:
  ckeditor5:
    plugins:
      - image.ImageResize
    config:
      image:
        resizeUnit: '%'
        resizeOptions:
          -
            name: 'resizeImage:original'
            value: null
        toolbar: [resizeImage]
  drupal:
    label: Image resize
    class: \Drupal\ckeditor5\Plugin\CKEditor5Plugin\ImageResize
    elements: false
    conditions:
      requiresConfiguration:
        allow_resize: true
      plugins: [ckeditor5_image]

ckeditor5_imageCaption:
  ckeditor5:
    plugins:
+11 −0
Original line number Diff line number Diff line
@@ -62,6 +62,17 @@ ckeditor5.plugin.ckeditor5_heading:
          Choice:
            callback: \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Heading::validChoices

# Plugin \Drupal\ckeditor5\Plugin\CKEditor5Plugin\ImageResize
ckeditor5.plugin.ckeditor5_imageResize:
  type: mapping
  label: Image Resize
  mapping:
    allow_resize:
      type: boolean
      label: 'Allow resize'
      constraints:
        NotNull: []

ckeditor5.plugin.ckeditor5_sourceEditing:
  type: mapping
  label: Source Editing
+4 −0
Original line number Diff line number Diff line
@@ -97,6 +97,10 @@

    return Object.entries(config).reduce((processed, [key, value]) => {
      if (typeof value === 'object') {
        // Check for null values.
        if (!value) {
          return processed;
        }
        if (value.hasOwnProperty('func')) {
          processed[key] = buildFunc(value);
        } else if (value.hasOwnProperty('regexp')) {
+4 −0
Original line number Diff line number Diff line
@@ -88,6 +88,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
          value = _ref2[1];

      if (_typeof(value) === 'object') {
        if (!value) {
          return processed;
        }

        if (value.hasOwnProperty('func')) {
          processed[key] = buildFunc(value);
        } else if (value.hasOwnProperty('regexp')) {
Loading