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

Account created on 2 May 2008, over 16 years ago
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States sumachaa

currently this uses address:1x, is there a plan to update to this use address:2x as 2x seems to be the recommended version

πŸ‡ΊπŸ‡ΈUnited States sumachaa

was able to get this working referencing an example shown in test module
https://git.drupalcode.org/project/diff/-/blob/8.x-1.x/tests/modules/dif...

πŸ‡ΊπŸ‡ΈUnited States sumachaa

one way to achieve this would be to allow class attribute for the bootstrapTabWrapper & update the downcast function to remove the hard-coded classes

a snapshot of how this is done is shown below

diff --git a/js/ckeditor5_plugins/ckeditor5-bootstrap-tabs/src/bootstraptabsediting.js b/js/ckeditor5_plugins/ckeditor5-bootstrap-tabs/src/bootstraptabsediting.js
index 596a8c3..637a1fc 100644
--- a/js/ckeditor5_plugins/ckeditor5-bootstrap-tabs/src/bootstraptabsediting.js
+++ b/js/ckeditor5_plugins/ckeditor5-bootstrap-tabs/src/bootstraptabsediting.js
@@ -49,6 +49,9 @@ export default class BootstrapTabsEditing extends Plugin {
       schema.register('bootstrapTabWrapper', {
         allowIn: 'bootstrapTabs',
         isLimit: true,
+        allowAttributes: [
+          'class',
+        ],
       });
       schema.register('bootstrapTab', {
         isLimit: true,
@@ -120,12 +123,18 @@ export default class BootstrapTabsEditing extends Plugin {
     conversion.for( 'downcast' ).elementToElement( {
       model: 'bootstrapTabWrapper',
       view: ( modelElement, { writer: viewWriter } ) => {
+        let attributes = {
+          role: 'tablist'
+        }
+        if (!modelElement.getAttribute('class')) {
+          attributes = {
+            ...attributes,
+            class: 'nav nav-tabs'
+          }
+        }
         return viewWriter.createContainerElement(
             'ul',
-            {
-              class: 'nav nav-tabs',
-              role: 'tablist',
-            }
+            attributes
         );
       }
Production build 0.71.5 2024