Milkdown / milkdown

🍼 Plugin driven WYSIWYG markdown editor framework.
https://milkdown.dev
MIT License
9k stars 412 forks source link

[Bug] Toolbar near edge of container is cut off #1548

Closed nickreynolds closed 1 week ago

nickreynolds commented 1 month ago

Initial checklist

Affected packages and versions

crepe

Link to runnable example

No response

Steps to reproduce

highlight text near the edge of a crepe editor and notice the toolbar is partially cut-off

this is visible on the current Playground deployed to the Milkdown site (reduce width of browser window so text extends near edge of window)

image

Expected behavior

toolbar should adjust position so that entire toolbar is visible

Actual behavior

toolbar is centered over highlighted text and so can go off the edge (and be cut-off)

Runtime

Firefox

OS

macOS

Build and bundle tools

No response

7eben commented 4 weeks ago

Hi,

The same thing happens in the linkTooltip plugin, as can be seen in this screenshot.

image

I think adding the same change in this line is enough (add a shift()).

https://github.com/Milkdown/milkdown/blob/7892c6e7eede249ab6db26f020cf2f49e498e3e7/packages/plugins/plugin-tooltip/src/tooltip-provider.ts#L140

@quank123wip

Thanks you