Skip to content

Commit

Permalink
fix(tooltop): shift tooltip when overflow on x-axis.
Browse files Browse the repository at this point in the history
  • Loading branch information
quank123wip committed Nov 8, 2024
1 parent a1262cf commit 7892c6e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/plugins/plugin-tooltip/src/tooltip-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TextSelection } from '@milkdown/prose/state'
import type { EditorView } from '@milkdown/prose/view'
import debounce from 'lodash.debounce'
import type { VirtualElement } from '@floating-ui/dom'
import { computePosition, flip, offset } from '@floating-ui/dom'
import { computePosition, flip, offset, shift } from '@floating-ui/dom'
import { posToDOMRect } from '@milkdown/prose'

/// Options for tooltip provider.
Expand Down Expand Up @@ -84,7 +84,7 @@ export class TooltipProvider {
}
computePosition(virtualEl, this.element, {
placement: 'top',
middleware: [flip(), offset(this.#offset)],
middleware: [flip(), offset(this.#offset), shift()],
})
.then(({ x, y }) => {
Object.assign(this.element.style, {
Expand Down

0 comments on commit 7892c6e

Please sign in to comment.