Skip to content

Commit

Permalink
Right hand-side toolbar positions and minor bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Sep 25, 2024
1 parent a9cbf20 commit b788630
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 1 addition & 5 deletions private/css/cms.tiptap.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions private/js/cms.dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion private/js/cms.editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
Expand Down

0 comments on commit b788630

Please sign in to comment.