Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.x] Fix Bard set picker position #8574

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion resources/css/components/fieldtypes/bard.css
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
}

.bard-add-set-button {
@apply flex items-center justify-center absolute -left-6 top-[-6px] @xl/bard:-left-8 z-1;
@apply flex items-center justify-center absolute -left-4 top-[-6px] z-1;
}

.bard-footer-toolbar {
Expand Down
4 changes: 2 additions & 2 deletions resources/js/components/fieldtypes/bard/BardFieldtype.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
:should-show="shouldShowSetButton"
:is-showing="showAddSetButton"
v-if="editor"
v-slot="{ x, y }"
v-slot="{ y }"
@shown="showAddSetButton = true"
@hidden="showAddSetButton = false"
>
Expand All @@ -72,7 +72,7 @@
<button
type="button"
class="btn-round group bard-add-set-button"
:style="{ transform: `translate(${x}px, ${y}px)` }"
:style="{ transform: `translateY(${y}px)` }"
:aria-label="__('Add Set')"
v-tooltip="__('Add Set')"
@click="addSetButtonClicked"
Expand Down
5 changes: 2 additions & 3 deletions resources/js/components/fieldtypes/bard/FloatingMenuPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ class FloatingMenuView {
// The dimension from posToDOMRect are relative to the window.
// But since bard is inside a @container which creates a new stacking
// context, we need the dimensions relative to the bard editor.
const { top: selectionTop, left: selectionLeft } = posToDOMRect(view, from, to);
const { top: editorTop, left: editorLeft } = this.editor.options.element.getBoundingClientRect();
this.vm.x = Math.round(selectionLeft-editorLeft);
const { top: selectionTop } = posToDOMRect(view, from, to);
const { top: editorTop } = this.editor.options.element.getBoundingClientRect();
this.vm.y = Math.round(selectionTop-editorTop);

this.show();
Expand Down
Loading