diff --git a/config/update/thunder_post_update_0001_upgrade_to_thunder7.yml b/config/update/thunder_post_update_0001_upgrade_to_thunder7.yml index 527eec933..aaf88b2e6 100644 --- a/config/update/thunder_post_update_0001_upgrade_to_thunder7.yml +++ b/config/update/thunder_post_update_0001_upgrade_to_thunder7.yml @@ -1,276 +1,6 @@ __global_actions: install_themes: - gin -editor.editor.basic_html: - expected_config: - editor: ckeditor - image_upload: - max_dimensions: - height: null - width: null - settings: - plugins: - drupallink: - linkit_enabled: true - linkit_profile: default - toolbar: - rows: - - - - - items: - - Bold - - Italic - name: Formatting - - - items: - - DrupalLink - - DrupalUnlink - name: Linking - - - items: - - BulletedList - - NumberedList - name: Lists - - - items: - - Blockquote - name: Media - - - items: - - Format - name: 'Block Formatting' - - - items: - - Source - name: Tools - update_actions: - delete: - settings: - plugins: - drupallink: - linkit_enabled: true - linkit_profile: default - toolbar: - rows: - - - - - items: - - Bold - - Italic - name: Formatting - - - items: - - DrupalLink - - DrupalUnlink - name: Linking - - - items: - - BulletedList - - NumberedList - name: Lists - - - items: - - Blockquote - name: Media - - - items: - - Format - name: 'Block Formatting' - - - items: - - Source - name: Tools - change: - editor: ckeditor5 - image_upload: - max_dimensions: - height: 0 - width: 0 - settings: - plugins: - ckeditor5_heading: - enabled_headings: - - heading2 - - heading3 - - heading4 - - heading5 - - heading6 - ckeditor5_list: - reversed: false - startIndex: true - ckeditor5_sourceEditing: - allowed_tags: - - '' - - '
' - - '
' - - '
' - - '' - - '
' - - '
    ' - - '
      ' - - '

      ' - - '

      ' - - '

      ' - - '

      ' - - '
      ' - linkit_extension: - linkit_enabled: true - linkit_profile: default - toolbar: - items: - - bold - - italic - - '|' - - link - - '|' - - bulletedList - - numberedList - - '|' - - blockQuote - - '|' - - heading - - '|' - - sourceEditing -editor.editor.full_html: - expected_config: - editor: ckeditor - image_upload: - max_dimensions: - height: null - width: null - settings: - plugins: - drupallink: - linkit_enabled: true - linkit_profile: default - toolbar: - rows: - - - - - items: - - Bold - - Italic - - Strike - - Superscript - - Subscript - - '-' - - RemoveFormat - name: Formatting - - - items: - - DrupalLink - - DrupalUnlink - name: Linking - - - items: - - BulletedList - - NumberedList - name: Lists - - - items: - - Blockquote - - Table - - HorizontalRule - name: Media - - - items: - - Format - name: 'Block Formatting' - - - items: - - ShowBlocks - - Source - name: Tools - update_actions: - delete: - settings: - plugins: - drupallink: - linkit_enabled: true - linkit_profile: default - toolbar: - rows: - - - - - items: - - Bold - - Italic - - Strike - - Superscript - - Subscript - - '-' - - RemoveFormat - name: Formatting - - - items: - - DrupalLink - - DrupalUnlink - name: Linking - - - items: - - BulletedList - - NumberedList - name: Lists - - - items: - - Blockquote - - Table - - HorizontalRule - name: Media - - - items: - - Format - name: 'Block Formatting' - - - items: - - ShowBlocks - - Source - name: Tools - change: - editor: ckeditor5 - image_upload: - max_dimensions: - height: 0 - width: 0 - settings: - plugins: - ckeditor5_heading: - enabled_headings: - - heading2 - - heading3 - - heading4 - - heading5 - - heading6 - ckeditor5_list: - reversed: true - startIndex: true - ckeditor5_sourceEditing: - allowed_tags: { } - linkit_extension: - linkit_enabled: true - linkit_profile: default - toolbar: - items: - - bold - - italic - - strikethrough - - superscript - - subscript - - removeFormat - - '|' - - link - - '|' - - bulletedList - - numberedList - - '|' - - blockQuote - - insertTable - - horizontalLine - - '|' - - heading - - codeBlock - - '|' - - sourceEditing image.style.thumbnail: expected_config: effects: diff --git a/thunder.post_update.php b/thunder.post_update.php index e810f41d6..b20127fab 100644 --- a/thunder.post_update.php +++ b/thunder.post_update.php @@ -6,6 +6,8 @@ */ use Drupal\Core\Entity\Entity\EntityFormDisplay; +use Drupal\ckeditor5\SmartDefaultSettings; +use Drupal\editor\Entity\Editor; use Drupal\entity_browser\Entity\EntityBrowser; use Drupal\user\Entity\Role; @@ -69,6 +71,20 @@ function thunder_post_update_0001_upgrade_to_thunder7(array &$sandbox): string { } } + /** @var \Drupal\ckeditor5\SmartDefaultSettings $ckEditorMigration */ + $ckEditorMigration = new SmartDefaultSettings( + \Drupal::service('plugin.manager.ckeditor5.plugin'), + \Drupal::service('plugin.manager.public_ckeditor4to5upgrade.plugin'), + $updater->logger(), + \Drupal::service('module_handler'), + \Drupal::service('current_user')); + + foreach (Editor::loadMultiple() as $editor) { + $format = $editor->getFilterFormat(); + [$updated_text_editor] = $ckEditorMigration->computeSmartDefaultSettings($editor, $format); + $updated_text_editor->save(); + } + /** @var \Drupal\Core\Extension\ModuleInstallerInterface $moduleInstaller */ $moduleInstaller = \Drupal::service('module_installer'); $moduleInstaller->uninstall([ diff --git a/thunder.services.yml b/thunder.services.yml index 98732eb46..7e030fc02 100644 --- a/thunder.services.yml +++ b/thunder.services.yml @@ -3,3 +3,7 @@ services: class: Drupal\thunder\Breadcrumb\ThunderNodeEditBreadcrumbBuilder tags: - { name: breadcrumb_builder, priority: 100 } + + plugin.manager.public_ckeditor4to5upgrade.plugin: + class: Drupal\ckeditor5\Plugin\CKEditor4To5UpgradePluginManager + parent: default_plugin_manager