From b78863090abb069b57e212ab9043907b51b6c734 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Wed, 25 Sep 2024 18:35:18 +0200 Subject: [PATCH] Right hand-side toolbar positions and minor bugs --- private/css/cms.tiptap.css | 6 +----- private/js/cms.dialog.js | 8 +++++--- private/js/cms.editor.js | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/private/css/cms.tiptap.css b/private/css/cms.tiptap.css index 897f62aa..fa85c83a 100644 --- a/private/css/cms.tiptap.css +++ b/private/css/cms.tiptap.css @@ -65,11 +65,7 @@ font-size: 1rem; font-weight: normal; visibility: hidden; - position: sticky; - inset-inline-start: 0; - inset-inline-end: auto; - width: auto; - top: 48px; /* Keep below toolbar */ + position: absolute; pointer-events: all; display: flex; flex-flow: row wrap; diff --git a/private/js/cms.dialog.js b/private/js/cms.dialog.js index 3d9d4e85..0469681d 100644 --- a/private/js/cms.dialog.js +++ b/private/js/cms.dialog.js @@ -275,11 +275,13 @@ class CmsForm { if (options && options.x && options.y) { const el_pos = this.el.getBoundingClientRect(); - if (options.x > el_pos.width/2) { + if (options.x > window.innerWidth / 2) { + console.log("options.x", options.x); + console.log("el_pos.width", el_pos.width); this.dialog.classList.add("right"); - this.dialog.style.right = (options.x - el_pos.width - 5) + 'px'; + this.dialog.style.right = ( el_pos.x + el_pos.width - options.x - 28) + 'px'; } else { - this.dialog.style.left = (options.x - el_pos.x - 25) + 'px'; + this.dialog.style.left = (options.x - el_pos.x - 28) + 'px'; } this.dialog.style.top = (options.y - el_pos.y + 5) + 'px'; this.dialog.style.transform = 'none'; diff --git a/private/js/cms.editor.js b/private/js/cms.editor.js index 10fd9eef..ed524617 100644 --- a/private/js/cms.editor.js +++ b/private/js/cms.editor.js @@ -198,7 +198,7 @@ class CMSEditor { // Prevent tooltip on hover this.CMS.$(wrapper).off('pointerover.cms.plugin pointerout.cms.plugin') .on('pointerover.cms-editor', function (event) { - this.CMS.API.Tooltip.displayToggle(false, event.target, '', id); + window.CMS.API.Tooltip.displayToggle(false, event.target, '', id); event.stopPropagation(); }); }