Skip to content

Conversation

@LIlGG
Copy link
Member

@LIlGG LIlGG commented Oct 23, 2025

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 代替原有的自定义方式。

并且,在此基础上,增加了添加至下一行及拖拽菜单的功能,且支持插件动态扩展拖拽菜单。

image

对于插件开发者,尤其是编辑器开发者来说,此 PR 有如下变更:

  1. 移除了原有的 getDraggable 方法,不再使用它,直接移除即可。
  2. 新增了 getDraggableMenuItems 方法,用于扩展拖拽菜单。

扩展方式如下:

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?

重构编辑器拖拽功能,并为其增加功能操作菜单。

@f2c-ci-robot f2c-ci-robot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Oct 23, 2025
@f2c-ci-robot f2c-ci-robot bot requested review from guqing and wan92hen October 23, 2025 08:42
@f2c-ci-robot f2c-ci-robot bot added area/ui Issues or PRs related to the Halo UI area/editor Issues or PRs related to the Editor labels Oct 23, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 23, 2025

Open in StackBlitz

@halo-dev/api-client

npm i https://pkg.pr.new/@halo-dev/api-client@7861

@halo-dev/components

npm i https://pkg.pr.new/@halo-dev/components@7861

@halo-dev/richtext-editor

npm i https://pkg.pr.new/@halo-dev/richtext-editor@7861

@halo-dev/console-shared

npm i https://pkg.pr.new/@halo-dev/console-shared@7861

@halo-dev/ui-plugin-bundler-kit

npm i https://pkg.pr.new/@halo-dev/ui-plugin-bundler-kit@7861

commit: 532a4c3

@ruibaby ruibaby changed the title feat: reafactor the drag function and add support for the drag menu WIP: feat: reafactor the drag function and add support for the drag menu Oct 23, 2025
@f2c-ci-robot f2c-ci-robot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 23, 2025
@LIlGG LIlGG changed the title WIP: feat: reafactor the drag function and add support for the drag menu WIP: feat: refactor the drag function and add support for the drag menu Oct 23, 2025
supplement document

fix type issues

change icon

resolve some minor bugs

Perform some minor optimizations

Perform some minor optimizations
@LIlGG LIlGG force-pushed the feat/add-next-line-button branch from 6263288 to 29c4f8b Compare October 23, 2025 10:55
@LIlGG LIlGG changed the title WIP: feat: refactor the drag function and add support for the drag menu feat: refactor the drag function and add support for the drag menu Oct 24, 2025
@f2c-ci-robot f2c-ci-robot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 24, 2025
@ruibaby
Copy link
Member

ruibaby commented Oct 24, 2025

@LIlGG
Copy link
Member Author

LIlGG commented Oct 24, 2025

需要同时修改 docs.halo.run/developer-guide/plugin/extension-points/ui/default-editor-extension-create 文档

稍后进行补充

@codecov
Copy link

codecov bot commented Oct 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.21%. Comparing base (42c374d) to head (532a4c3).
⚠️ Report is 230 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #7861      +/-   ##
============================================
+ Coverage     59.55%   61.21%   +1.66%     
- Complexity     3812     3930     +118     
============================================
  Files           677      688      +11     
  Lines         23248    23483     +235     
  Branches       1500     1519      +19     
============================================
+ Hits          13846    14376     +530     
+ Misses         8764     8382     -382     
- Partials        638      725      +87     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Replaces `parentKey` with `extendsKey` for drag menu item extension, enabling multiple extensions to target the same menu item. Updates merging logic to support AND/OR behaviors for `visible`, `isActive`, and `disabled` properties, and allows extensions to override or append child menu items. Documentation and affected extensions updated to reflect new API.
@JohnNiang JohnNiang requested a review from ruibaby October 27, 2025 13:12
@ruibaby
Copy link
Member

ruibaby commented Oct 28, 2025

当前节点为代码块时,点击 + 按钮时会在代码快内部打开指令菜单。

image

@f2c-ci-robot f2c-ci-robot bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 2025
LIlGG added 2 commits October 30, 2025 15:27
Replaces isEmpty with isBlockEmpty in EditorDragHandle and updates block insertion to use insertContentAt with paragraph and text. Refactors is-node-empty utility to add isNodeContentEmpty and isBlockEmpty, improving node emptiness checks. Exports new utility functions in index.ts.
@f2c-ci-robot f2c-ci-robot bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 30, 2025
@sonarqubecloud
Copy link

@LIlGG
Copy link
Member Author

LIlGG commented Oct 30, 2025

当前节点为代码块时,点击 + 按钮时会在代码快内部打开指令菜单。

已解决

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Oct 30, 2025
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Oct 30, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ruibaby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 30, 2025
@f2c-ci-robot f2c-ci-robot bot merged commit 0f8ef82 into halo-dev:main Oct 30, 2025
11 checks passed
@ruibaby ruibaby added this to the 2.22.0 milestone Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/editor Issues or PRs related to the Editor area/ui Issues or PRs related to the Halo UI kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants