Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save junaidpv/469b1874670d877604117b99b3c8c2f8 to your computer and use it in GitHub Desktop.

Select an option

Save junaidpv/469b1874670d877604117b99b3c8c2f8 to your computer and use it in GitHub Desktop.
Fix "Uncaught TypeError: can't access property "querySelector", document.querySelector(...) is null" in editor config page on clicking on Add Group button
diff --git a/js/ckeditor.admin.js b/js/ckeditor.admin.js
index a1a0d1a..0dc97a6 100644
--- a/js/ckeditor.admin.js
+++ b/js/ckeditor.admin.js
@@ -191,7 +191,10 @@
}
});
dialog.showModal();
- $(document.querySelector('.ckeditor-name-toolbar-group').querySelector('input')).attr('value', $group.attr('data-drupal-ckeditor-toolbar-group-name')).trigger('focus');
+ let group = document.querySelector('.ckeditor-name-toolbar-group');
+ if (group) {
+ $(group.querySelector('input')).attr('value', $group.attr('data-drupal-ckeditor-toolbar-group-name')).trigger('focus');
+ }
}
};
Drupal.behaviors.ckeditorAdminButtonPluginSettings = {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment