mirror of
https://github.com/halo-dev/halo.git
synced 2025-12-20 16:44:38 +08:00
#### What type of PR is this? /kind feature /area ui /area editor #### What this PR does / why we need it: 重构拖拽功能, 使用 Tiptap [extension-drag-handle-vue-3](https://github.com/ueberdosis/tiptap/tree/develop/packages/extension-drag-handle-vue-3) 代替原有的自定义方式。 并且,在此基础上,增加了添加至下一行及拖拽菜单的功能,且支持插件动态扩展拖拽菜单。 <img width="368" height="237" alt="image" src="https://github.com/user-attachments/assets/7f7be771-e549-446f-9f75-c289817965f6" /> 对于插件开发者,尤其是编辑器开发者来说,此 PR 有如下变更: 1. 移除了原有的 `getDraggable` 方法,不再使用它,直接移除即可。 2. 新增了 `getDraggableMenuItems` 方法,用于扩展拖拽菜单。 扩展方式如下: ```ts getDraggableMenuItems() { return { parentKey: CONVERT_TO_KEY, children: { items: [ { priority: 10, icon: markRaw(MdiFormatParagraph), title: i18n.global.t("editor.common.heading.paragraph"), action: ({ editor }: { editor: Editor }) => editor.chain().focus().setParagraph().run(), } ] } } } ``` #### Does this PR introduce a user-facing change? ```release-note 重构编辑器拖拽功能,并为其增加功能操作菜单。 ```