Last active
May 12, 2020 09:47
-
-
Save szeidler/b7da5c42054538f5c39fe396bbc6e3f3 to your computer and use it in GitHub Desktop.
Adds modal support for ckeditor_fixed_toolbar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/js/plugins/fixed_toolbar/plugin.js b/js/plugins/fixed_toolbar/plugin.js | |
index 4a0757c..fa51d2e 100644 | |
--- a/js/plugins/fixed_toolbar/plugin.js | |
+++ b/js/plugins/fixed_toolbar/plugin.js | |
@@ -8,6 +8,16 @@ CKEDITOR.plugins.add('fixed_toolbar', { | |
toolBar.style.position = 'sticky'; | |
// We use the same offset as Drupal uses for body to make up for Admin Toolbar. | |
toolBar.style.top = document.body.style.paddingTop; | |
+ | |
+ // Loop through the parents and see if we're in a modal. | |
+ var parents = e.editor.container.getParents(); | |
+ for (var i = 0; i < parents.length; i++) { | |
+ // The field is part of a modal, so change it's offset top. | |
+ if (parents[i].hasClass('ui-dialog')) { | |
+ // Adjust this value according to your admin theme. | |
+ toolBar.style.top = '-20px'; | |
+ } | |
+ } | |
}); | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment