πŸ‡ΊπŸ‡ΈUnited States @krisahil

Account created on 14 December 2007, about 17 years ago
  • Senior Software Engineer at Red HatΒ  …
#

Merge Requests

Recent comments

πŸ‡ΊπŸ‡ΈUnited States krisahil

@slucero, I re-opened this issue, because the latest update hook did not save the config entity. I'm proposing a fix in this MR: https://git.drupalcode.org/project/patternkit/-/merge_requests/144

Thank you.

πŸ‡ΊπŸ‡ΈUnited States krisahil

krisahil β†’ made their first commit to this issue’s fork.

πŸ‡ΊπŸ‡ΈUnited States krisahil

Included in release 3.3.0.

πŸ‡ΊπŸ‡ΈUnited States krisahil

@mark_fullmer, we released version 3.3.0 today, which includes this support for Drupal 11.

πŸ‡ΊπŸ‡ΈUnited States krisahil

The MR is against latest 9.1.x. Here's a patch against release 9.1.0-beta10.

πŸ‡ΊπŸ‡ΈUnited States krisahil

Attaching static patch from the state of the MR https://git.drupalcode.org/project/drupal/-/merge_requests/9173 today (at commit 3fe50913). (I prefer a static patch because, if you link directly to the patch endpoint on Gitlab (e.g., https://git.drupalcode.org/project/drupal/-/merge_requests/9173.patch), you might get newer commits that you don't want).

πŸ‡ΊπŸ‡ΈUnited States krisahil

Here is a patch that installs chapter and verse ranges for existing terms. Or use the merge request.

πŸ‡ΊπŸ‡ΈUnited States krisahil

This has been merged. It is in release 3.2.0.

πŸ‡ΊπŸ‡ΈUnited States krisahil

@slucero, I started work to support these changes. The MR, as it stands now, loads the JSON Editor theme assets as a Drupal library, using #attached, instead of manually adding the scripts and styles to the DOM. On one site, this change has made loading the CSS and JS much more reliable (the manual method loaded CSS and JS in unpredictable order, which led to race conditions, evidenced in CKEditor 5 integration).

πŸ‡ΊπŸ‡ΈUnited States krisahil

krisahil β†’ made their first commit to this issue’s fork.

πŸ‡ΊπŸ‡ΈUnited States krisahil

Thanks for pointing that out. However, that attribute only takes effect if the site is hosted on PHP 8.2+ (IIUC). I am maintaining a site on PHP 8.1, so I need this patch, until we upgrade to PHP 8.2

πŸ‡ΊπŸ‡ΈUnited States krisahil

Re-rolled patch against Drupal 10.2.

πŸ‡ΊπŸ‡ΈUnited States krisahil

I confirmed that this change dramatically decreased the number of those cache_discovery update queries for 'patternkit.library_namespaces' (from 497 down to 1). This was tested on a small site with Patternkit 1.0-beta7.

πŸ‡ΊπŸ‡ΈUnited States krisahil

I recently set up this module with config_split (note that this is a Drupal 10.1 site on the 1.x series of config_split, not 2.0 yet). It sounds like you have everything configured correctly. One tricky thing to remember: You might need to import config twice (e.g., drush config:import), once so that Drupal reads the new config-split settings, and the second to actually import that environment's split.

πŸ‡ΊπŸ‡ΈUnited States krisahil

Attaching a patch that works with both Drupal core 10.0 and 10.1. It's not a long-term fix, but might be a workable bridge, until we can refactor how we attach JSON Editor theme assets.

πŸ‡ΊπŸ‡ΈUnited States krisahil

Fixed. Available in release 1.0.0.

πŸ‡ΊπŸ‡ΈUnited States krisahil

Clarified the use case a little bit

πŸ‡ΊπŸ‡ΈUnited States krisahil

Yes, I now have maintainer access. Thank you!

πŸ‡ΊπŸ‡ΈUnited States krisahil

The error logging for mysql error 2002 (connection refused) has been fixed in https://www.drupal.org/project/drupal/issues/2610858 πŸ› Add informative error message for 'Connection refused' errors in MySQL Fixed , released in Drupal core 10.0.6.

Here's a re-roll of the current issue's patch that includes error code 2006 (server gone away).

πŸ‡ΊπŸ‡ΈUnited States krisahil

This is working for me. I also reviewed the code.

πŸ‡ΊπŸ‡ΈUnited States krisahil

An alternative approach is to delay loading CKEditor until after the JSON Editor (JE) theme assets have been loaded. Here's a patch that tries to do this. This would be a quicker fix than loading the JE theme assets via Drupal's library system.

πŸ‡ΊπŸ‡ΈUnited States krisahil

Turns out that Drupal core already provides a feature to add "donut scoping" to stylesheets, so that those stylesheets don't target CKEditor 5 instances (see offCanvasCss in ckeditor5.es6.js). However, this method is not consistently applying to stylesheets for Patternkit's JSON Editor (JE) themes (in a large Drupal 9 site, this feature is working, but in a small D9 site, it is not). I believe the problem is due to a race condition, where PK adds stylesheets to the DOM, but those stylesheets are not in the `document.styleSheets` list.

I think we should re-consider how we add JE theme assets to the DOM. Instead of using JS to add the stylesheets, why not attach them as regular Drupal libraries?

Here's a change that seems to work ok for the Cygnet JE theme, in my very limited testing:

diff --git a/js/patternkit.jsoneditor.js b/js/patternkit.jsoneditor.js
index 9bbbefc..42a2fb6 100644
--- a/js/patternkit.jsoneditor.js
+++ b/js/patternkit.jsoneditor.js
@@ -1410,17 +1410,6 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
 
         var editor_dom = '';
 
-        if (this.settings.themeStylesheet) {
-          var theme_element = document.createElement('link');
-          theme_element.rel = "stylesheet";
-          theme_element.id = "theme_stylesheet";
-          theme_element.href = this.settings.themeStylesheet;
-          document.getElementsByTagName('head')[0].appendChild(theme_element);
-          editor_dom = '<link rel="stylesheet" id="theme_stylesheet" href="' + this.settings.themeStylesheet + '">';
-        } // @todo Re-eval with this shadow dom webfont bug:
-        // https://bugs.chromium.org/p/chromium/issues/detail?id=336876
-
-
         if (this.settings.iconStylesheet) {
           var icons_element = document.createElement('link');
           icons_element.rel = "stylesheet";
diff --git a/src/JSONSchemaEditorTrait.php b/src/JSONSchemaEditorTrait.php
index ac2e45d..512d29e 100644
--- a/src/JSONSchemaEditorTrait.php
+++ b/src/JSONSchemaEditorTrait.php
@@ -114,15 +114,6 @@ trait JSONSchemaEditorTrait {
 
     if (isset(PatternLibraryJSONForm::THEMES[$theme])) {
       $theme_info = PatternLibraryJSONForm::THEMES[$theme];
-      if (!$editor_settings['useShadowDom'] && !empty($theme_info['css_no_shadow_dom'])) {
-        $editor_settings['themeStylesheet'] = $this->getLibraryAssetUrlFromUri($theme_info['css_no_shadow_dom']);
-      }
-      elseif (!empty($theme_info['css'])) {
-        $editor_settings['themeStylesheet'] = $this->getLibraryAssetUrlFromUri($theme_info['css']);
-      }
-      else {
-        $editor_settings['themeStylesheet'] = '';
-      }
       if (!empty($theme_info['js'])) {
         $editor_settings['themeJS'][] = $this->getLibraryAssetUrlFromUri($theme_info['js']);
       }
@@ -196,6 +187,13 @@ trait JSONSchemaEditorTrait {
       ],
     ];
 
+    if (!$editor_settings['useShadowDom'] && !empty($theme_info['css_no_shadow_dom'])) {
+      $element['#attached']['library'][] = 'patternkit/cygnet_no_shadow_dom';
+    }
+    elseif (!empty($theme_info['css'])) {
+      $element['#attached']['library'][] = 'patternkit/cygnet';
+    }
+
     if (!empty($editor)) {
       $element['#attached']['library'][] = 'editor/drupal.editor';
πŸ‡ΊπŸ‡ΈUnited States krisahil

@slucero, I'm now unable to reproduce the problem, following the steps I originally reported. :-/
Like you said, I had to explicitly go to the Patternkit settings and select CKEditor5 for the editor, then I got the error about the missing class.

I tested the patch in #4, and it works great!
- On Patternkit settings page, I could only select CKEditor 5 is ckeditor5 module was installed.
- If I did select CKEditor 5 but kept a CKEditor 4-only toolbar, the settings didn't save due to the validation error.

Sorry for the incorrect steps to reproduce. I'm not sure what happened there.

πŸ‡ΊπŸ‡ΈUnited States krisahil

Was your test user allowed to log in because the domain was in the whitelisted domains? Just want to be sure.

πŸ‡ΊπŸ‡ΈUnited States krisahil

I started hacking on this idea today. Here are two patches which capture my progress. One is for Patternkit and the other for entity_usage module.

Production build 0.71.5 2024