Skip to content

Commit 6185894

Browse files
committed
fix: Writer toolbar position without Panel menu
1 parent 2813068 commit 6185894

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

panel/src/components/Forms/Writer/Toolbar.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,9 +373,6 @@ export default {
373373
// Get sizes for the toolbar itself but also the editor box
374374
const toolbar = this.$el.getBoundingClientRect();
375375
const editor = this.editor.element.getBoundingClientRect();
376-
const menu = document
377-
.querySelector(".k-panel-menu")
378-
.getBoundingClientRect();
379376
380377
// Create pseudo rectangle for the selection
381378
const { from, to } = this.editor.selection;
@@ -401,9 +398,13 @@ export default {
401398
}
402399
} else {
403400
// Contain in viewport
401+
const menu = document
402+
.querySelector(".k-panel-menu")
403+
?.getBoundingClientRect();
404+
404405
const left = editor.x + x;
405406
const right = left + toolbar.width;
406-
const safeSpaceLeft = menu.width + 20;
407+
const safeSpaceLeft = menu?.width + 20;
407408
const safeSpaceRight = 20;
408409
409410
if (left < safeSpaceLeft) {
@@ -421,8 +422,8 @@ export default {
421422
422423
<style>
423424
.k-writer-input:has(
424-
.k-toolbar:not([data-inline="true"], [data-disabled="true"])
425-
) {
425+
.k-toolbar:not([data-inline="true"], [data-disabled="true"])
426+
) {
426427
grid-template-areas: "topbar" "content";
427428
grid-template-rows: var(--toolbar-size) 1fr;
428429
gap: 0;

0 commit comments

Comments
 (0)