Verified Commit 151b5e45 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3314511 by Wim Leers: CKEditor 4 → 5 upgrade path may trigger warnings...

Issue #3314511 by Wim Leers: CKEditor 4 → 5 upgrade path may trigger warnings in some edge cases, making upgrade path tests impossible

(cherry picked from commit 1de949a5)
parent 53e06d90
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -281,6 +281,7 @@ public function computeSmartDefaultSettings(?EditorInterface $text_editor, Filte
      }

      $help_enabled = $this->moduleHandler->moduleExists('help');
      $can_access_dblog = ($this->currentUser->hasPermission('access site reports') && $this->moduleHandler->moduleExists('dblog'));

      if (!empty($plugins_enabled) || !$source_editing_additions->allowsNothing()) {
        $beginning = $help_enabled ?
@@ -305,7 +306,6 @@ public function computeSmartDefaultSettings(?EditorInterface $text_editor, Filte
            $this->t("Added these tags/attributes to the Source Editing Plugin's Manually editable HTML tags setting: @tag_list", ['@tag_list' => $source_editing_additions->toFilterHtmlAllowedTagsString()]);
        }

        $can_access_dblog = ($this->currentUser->hasPermission('access site reports') && $this->moduleHandler->moduleExists('dblog'));
        $end = $can_access_dblog ?
          $this->t('Additional details are available <a target="_blank" href=":dblog_url">in your logs</a>.',
            [
+53 −0
Original line number Diff line number Diff line
@@ -90,6 +90,38 @@ protected function setUp(): void {

    $this->installSchema('dblog', ['watchdog']);

    FilterFormat::create([
      'format' => 'minimal_ckeditor_wrong_allowed_html',
      'name' => 'Most basic HTML, but with allowed_html misconfigured',
      'filters' => [
        'filter_html' => [
          'status' => 1,
          'settings' => [
            'allowed_html' => '<p> <br> <a>',
          ],
        ],
      ],
    ])->setSyncing(TRUE)->save();
    Editor::create([
      'format' => 'minimal_ckeditor_wrong_allowed_html',
      'editor' => 'ckeditor',
      'settings' => [
        'toolbar' => [
          'rows' => [
            0 => [
              [
                'name' => 'Basic Formatting',
                'items' => [
                  'DrupalLink',
                ],
              ],
            ],
          ],
        ],
        'plugins' => [],
      ],
    ])->setSyncing(TRUE)->save();

    FilterFormat::create(
      Yaml::parseFile('core/profiles/standard/config/install/filter.format.full_html.yml')
    )
@@ -1379,6 +1411,27 @@ public function provider() {
      'expected_db_logs' => [],
      'expected_messages' => [],
    ];

    yield "minimal_ckeditor_wrong_allowed_html does not have sufficient allowed HTML => necessary allowed HTML added (1 upgrade message)" => [
      'format_id' => 'minimal_ckeditor_wrong_allowed_html',
      'filters_to_drop' => [],
      'expected_ckeditor5_settings' => [
        'toolbar' => [
          'items' => [
            'link',
          ],
        ],
        'plugins' => [],
      ],
      'expected_superset' => '<a href>',
      'expected_fundamental_compatibility_violations' => [],
      'expected_db_logs' => [],
      'expected_messages' => [
        'warning' => [
          0 => 'Updating to CKEditor 5 added support for some previously unsupported tags/attributes. A plugin introduced support for the following:   This attribute: <em class="placeholder"> href (for &lt;a&gt;)</em>; Additional details are available in your logs.',
        ],
      ],
    ];
  }

}