Skip to content

Commit 396ddb9

Browse files
committed
Menubar: stickiness is not lost after switching editors
1 parent 8b48b40 commit 396ddb9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

script.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function showProsemirror(json) {
2222
const $prosemirrorJsonInput = jQuery('#dw__editform').find('[name=prosemirror_json]').val(json);
2323
try {
2424
window.Prosemirror.enableProsemirror();
25+
stickyMenubar();
2526
disableNativeFirefoxTableControls();
2627
} catch (e) {
2728
console.error(e);
@@ -173,9 +174,10 @@ function handleEditSession() {
173174
* @see https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
174175
*/
175176

176-
function menubar() {
177+
function stickyMenubar() {
177178
const editorswitch = document.querySelector('button[name=prosemirror]');
178179
const menubar = document.querySelector('#prosemirror__editor div.menubar');
180+
179181
const observer = new IntersectionObserver(
180182
([e]) => {
181183
return menubar.classList.toggle('prosemirror-menubar-fixed', e.intersectionRatio !== 1);
@@ -195,8 +197,6 @@ jQuery(function () {
195197
initializeProsemirror();
196198
window.proseMirrorIsActive = false;
197199

198-
jQuery(menubar);
199-
200200
if (jQuery('#dw__editform').find('[name=prosemirror_json]').length) {
201201
handleEditSession();
202202
}

0 commit comments

Comments
 (0)