fix: bubble menu not appearing when crossing lines in editor (#6268)

#### What type of PR is this?

/kind bug
/area editor
/milestone 2.18.x

#### What this PR does / why we need it:

在默认编辑器中,选中一个跨多个节点的 text 时,selection 会变为 RangeSelection,此时冒泡菜单将不会出现。

此 RP 将 RangeSelection 添加至 text 的冒泡菜单验证中,使得冒泡菜单可以出现。

#### How to test it?

测试跨行选中多个无序列表时,是否出现冒泡菜单。

#### Which issue(s) this PR fixes:

Fixes #6267 

#### Does this PR introduce a user-facing change?
```release-note
修复默认编辑器中跨行选择节点时冒泡菜单无法出现的问题
```
pull/6297/head
Takagi 2024-07-05 18:29:07 +08:00 committed by GitHub
parent ed5f9aeb50
commit 0f01006606
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;
}