[release-2.17] fix: bubble menu not appearing when crossing lines in editor (#6283)

This is an automated cherry-pick of #6268

/assign ruibaby

```release-note
修复默认编辑器中跨行选择节点时冒泡菜单无法出现的问题
```
pull/6324/head v2.17.1
Halo Dev Bot 2024-07-05 18:45:07 +08:00 committed by GitHub
parent 34f789ec30
commit 226c5c3bfc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import ColorBubbleItem from "@/extensions/color/ColorBubbleItem.vue";
import HighlightBubbleItem from "@/extensions/highlight/HighlightBubbleItem.vue";
import LinkBubbleButton from "@/extensions/link/LinkBubbleButton.vue";
import { RangeSelection } from "@/extensions/range-selection";
import { i18n } from "@/locales";
import type { EditorState } from "@/tiptap/pm";
import { isActive, isTextSelection } from "@/tiptap/vue-3";
@ -56,7 +57,10 @@ const Text = TiptapText.extend<ExtensionOptions>({
return false;
}
if (!isTextSelection(selection)) {
if (
!isTextSelection(selection) &&
!(selection instanceof RangeSelection)
) {
return false;
}