From 1c5c378e02a692dc59952c3904dd5131bbe6971e Mon Sep 17 00:00:00 2001
From: catch <catch@35733.no-reply.drupal.org>
Date: Fri, 17 Jun 2022 16:40:04 +0100
Subject: [PATCH] Issue #3291018 by Spokje, Wim Leers: Move
 \Drupal\Tests\ckeditor5\Functional\CKEditor5QuickEditLibraryTest to the
 quickedit namespace/directory

---
 core/modules/ckeditor5/ckeditor5.libraries.yml           | 6 ------
 core/modules/ckeditor5/ckeditor5.module                  | 4 ----
 .../css/editors/formattedText/ckeditor5.workaround.css}  | 0
 core/modules/quickedit/quickedit.libraries.yml           | 6 ++++++
 core/modules/quickedit/quickedit.module                  | 5 +++++
 .../CKEditor5}/CKEditor5QuickEditLibraryTest.php         | 8 +++-----
 .../CKEditor5/CKEditor5QuickEditLibraryTest.php.orig     | 0
 .../editors/formattedText/ckeditor5.workaround.css       | 9 +++++++++
 core/themes/stable/stable.info.yml                       | 5 +++++
 .../editors/formattedText/ckeditor5.workaround.css       | 9 +++++++++
 core/themes/stable9/stable9.info.yml                     | 5 +++++
 11 files changed, 42 insertions(+), 15 deletions(-)
 rename core/modules/{ckeditor5/css/quickedit-override.css => quickedit/css/editors/formattedText/ckeditor5.workaround.css} (100%)
 rename core/modules/{ckeditor5/tests/src/Functional => quickedit/tests/src/Functional/CKEditor5}/CKEditor5QuickEditLibraryTest.php (89%)
 create mode 100644 core/modules/quickedit/tests/src/Functional/CKEditor5/CKEditor5QuickEditLibraryTest.php.orig
 create mode 100644 core/themes/stable/css/quickedit/editors/formattedText/ckeditor5.workaround.css
 create mode 100644 core/themes/stable9/css/quickedit/editors/formattedText/ckeditor5.workaround.css

diff --git a/core/modules/ckeditor5/ckeditor5.libraries.yml b/core/modules/ckeditor5/ckeditor5.libraries.yml
index 21e2af573de2..53554f8cbc1c 100644
--- a/core/modules/ckeditor5/ckeditor5.libraries.yml
+++ b/core/modules/ckeditor5/ckeditor5.libraries.yml
@@ -37,12 +37,6 @@ drupal.ckeditor5.stylesheets:
   version: VERSION
   css: []
 
-drupal.ckeditor5.quickedit-temporary-work-around:
-  deprecated: "Temporary work-around until https://www.drupal.org/project/drupal/issues/3196689 lands."
-  css:
-    theme:
-      css/quickedit-override.css: {}
-
 drupal.ckeditor5.codeBlock:
   dependencies:
     - core/ckeditor5.codeBlock
diff --git a/core/modules/ckeditor5/ckeditor5.module b/core/modules/ckeditor5/ckeditor5.module
index 1120649b2d4f..e93fb5dd5105 100644
--- a/core/modules/ckeditor5/ckeditor5.module
+++ b/core/modules/ckeditor5/ckeditor5.module
@@ -434,10 +434,6 @@ function ckeditor5_library_info_alter(&$libraries, $extension) {
         'theme' => array_fill_keys(array_values($css), []),
       ],
     ];
-
-    if ($moduleHandler->moduleExists('quickedit')) {
-      $libraries['drupal.ckeditor5']['dependencies'][] = 'ckeditor5/drupal.ckeditor5.quickedit-temporary-work-around';
-    }
   }
 
   if ($extension === 'core') {
diff --git a/core/modules/ckeditor5/css/quickedit-override.css b/core/modules/quickedit/css/editors/formattedText/ckeditor5.workaround.css
similarity index 100%
rename from core/modules/ckeditor5/css/quickedit-override.css
rename to core/modules/quickedit/css/editors/formattedText/ckeditor5.workaround.css
diff --git a/core/modules/quickedit/quickedit.libraries.yml b/core/modules/quickedit/quickedit.libraries.yml
index c6ead41d328d..84df03a98513 100644
--- a/core/modules/quickedit/quickedit.libraries.yml
+++ b/core/modules/quickedit/quickedit.libraries.yml
@@ -48,6 +48,12 @@ quickedit.inPlaceEditor.form:
   dependencies:
     - quickedit/quickedit
 
+quickedit.ckeditor5-temporary-work-around:
+  # "Temporary work-around until https://www.drupal.org/project/drupal/issues/3196689 lands."
+  css:
+    theme:
+      css/editors/formattedText/ckeditor5.workaround.css: { }
+
 quickedit.inPlaceEditor.formattedText:
   version: VERSION
   css:
diff --git a/core/modules/quickedit/quickedit.module b/core/modules/quickedit/quickedit.module
index d571c667a7a6..01bcc1e2ae0d 100644
--- a/core/modules/quickedit/quickedit.module
+++ b/core/modules/quickedit/quickedit.module
@@ -101,6 +101,11 @@ function quickedit_library_info_alter(&$libraries, $extension) {
 
     $alter_library($libraries['quickedit'], $theme);
   }
+
+  $moduleHandler = \Drupal::moduleHandler();
+  if ($moduleHandler->moduleExists('ckeditor5')) {
+    $libraries['drupal.ckeditor5']['dependencies'][] = 'quickedit/quickedit.ckeditor5-temporary-work-around';
+  }
 }
 
 /**
diff --git a/core/modules/ckeditor5/tests/src/Functional/CKEditor5QuickEditLibraryTest.php b/core/modules/quickedit/tests/src/Functional/CKEditor5/CKEditor5QuickEditLibraryTest.php
similarity index 89%
rename from core/modules/ckeditor5/tests/src/Functional/CKEditor5QuickEditLibraryTest.php
rename to core/modules/quickedit/tests/src/Functional/CKEditor5/CKEditor5QuickEditLibraryTest.php
index 513f6af515c0..d5e59343f26d 100644
--- a/core/modules/ckeditor5/tests/src/Functional/CKEditor5QuickEditLibraryTest.php
+++ b/core/modules/quickedit/tests/src/Functional/CKEditor5/CKEditor5QuickEditLibraryTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Drupal\Tests\ckeditor5\Functional;
+namespace Drupal\Tests\quickedit\Functional\CKEditor5;
 
 use Drupal\ckeditor5\Plugin\Editor\CKEditor5;
 use Drupal\editor\Entity\Editor;
@@ -14,6 +14,7 @@
  * Tests that a Quick Edit specific library loads when Quick Edit is enabled.
  *
  * @group ckeditor5
+ * @group quickedit
  * @group legacy
  */
 class CKEditor5QuickEditLibraryTest extends BrowserTestBase {
@@ -85,11 +86,8 @@ function (ConstraintViolation $v) {
    */
   public function testQuickeditTemporaryWorkaround() {
     $assert_session = $this->assertSession();
-
-    $this->expectDeprecation('Temporary work-around until https://www.drupal.org/project/drupal/issues/3196689 lands.');
-
     $this->drupalGet('node/add/article');
-    $assert_session->responseContains('css/quickedit-override.css');
+    $assert_session->responseContains('css/editors/formattedText/ckeditor5.workaround.css');
   }
 
 }
diff --git a/core/modules/quickedit/tests/src/Functional/CKEditor5/CKEditor5QuickEditLibraryTest.php.orig b/core/modules/quickedit/tests/src/Functional/CKEditor5/CKEditor5QuickEditLibraryTest.php.orig
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/core/themes/stable/css/quickedit/editors/formattedText/ckeditor5.workaround.css b/core/themes/stable/css/quickedit/editors/formattedText/ckeditor5.workaround.css
new file mode 100644
index 000000000000..e64eb0d03cf1
--- /dev/null
+++ b/core/themes/stable/css/quickedit/editors/formattedText/ckeditor5.workaround.css
@@ -0,0 +1,9 @@
+.quickedit-editable,
+.quickedit-editing.ck.ck-editor__editable_inline {
+  top: inherit !important;
+  left: inherit !important;
+  margin-bottom: inherit !important;
+}
+.quickedit-editing.ck.ck-editor__editable_inline > :first-child {
+  margin-top: inherit;
+}
diff --git a/core/themes/stable/stable.info.yml b/core/themes/stable/stable.info.yml
index 687f25319702..50c618910547 100644
--- a/core/themes/stable/stable.info.yml
+++ b/core/themes/stable/stable.info.yml
@@ -199,6 +199,11 @@ libraries-override:
         css/editors/image.css: css/quickedit/editors/image.css
       theme:
         css/editors/image.theme.css: css/quickedit/editors/image.theme.css
+  quickedit/quickedit.ckeditor5-temporary-work-around:
+    # "Temporary work-around until https://www.drupal.org/project/drupal/issues/3196689 lands."
+    css:
+      theme:
+        css/editors/formattedText/ckeditor5.workaround.css: css/quickedit/editors/formattedText/ckeditor5.workaround.css
 
   settings_tray/drupal.settings_tray:
     css:
diff --git a/core/themes/stable9/css/quickedit/editors/formattedText/ckeditor5.workaround.css b/core/themes/stable9/css/quickedit/editors/formattedText/ckeditor5.workaround.css
new file mode 100644
index 000000000000..e64eb0d03cf1
--- /dev/null
+++ b/core/themes/stable9/css/quickedit/editors/formattedText/ckeditor5.workaround.css
@@ -0,0 +1,9 @@
+.quickedit-editable,
+.quickedit-editing.ck.ck-editor__editable_inline {
+  top: inherit !important;
+  left: inherit !important;
+  margin-bottom: inherit !important;
+}
+.quickedit-editing.ck.ck-editor__editable_inline > :first-child {
+  margin-top: inherit;
+}
diff --git a/core/themes/stable9/stable9.info.yml b/core/themes/stable9/stable9.info.yml
index dfd3849acd85..dc7ba753308a 100644
--- a/core/themes/stable9/stable9.info.yml
+++ b/core/themes/stable9/stable9.info.yml
@@ -219,6 +219,11 @@ libraries-override:
         css/editors/image.css: css/quickedit/editors/image.css
       theme:
         css/editors/image.theme.css: css/quickedit/editors/image.theme.css
+  quickedit/quickedit.ckeditor5-temporary-work-around:
+    # "Temporary work-around until https://www.drupal.org/project/drupal/issues/3196689 lands."
+    css:
+      theme:
+        css/editors/formattedText/ckeditor5.workaround.css: css/quickedit/editors/formattedText/ckeditor5.workaround.css
 
   settings_tray/drupal.settings_tray:
     css:
-- 
GitLab