Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolving the issue of the draggable extension not working in the editor #5570

Merged
merged 2 commits into from Mar 27, 2024

Conversation

LIlGG
Copy link
Member

@LIlGG LIlGG commented Mar 22, 2024

What type of PR is this?

/kind bug
/area editor
/milestone 2.14.x

What this PR does / why we need it:

解决在默认编辑器中,插件扩展 getDraggable 方法可能无效的问题。向 handleDrop 中添加属性 selection,方便插件对当前拖拽元素进行处理。

部分插件拖拽之后可能无效果,此时需要插件自行实现 handleDrop 方法来处理拖拽后的情况。

How to test it?

测试 getDraggable 方法是否正常。插件中使用此方法是否显示拖拽图标。

Which issue(s) this PR fixes:

Fixes #5208

Does this PR introduce a user-facing change?

解决默认编辑器 getDraggable 在部分插件中失效的问题。

@f2c-ci-robot f2c-ci-robot bot added kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Mar 22, 2024
@f2c-ci-robot f2c-ci-robot bot added this to the 2.14.x milestone Mar 22, 2024
@f2c-ci-robot f2c-ci-robot bot added the area/editor Issues or PRs related to the Editor label Mar 22, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from JohnNiang and wzrove March 22, 2024 08:31
Copy link

codecov bot commented Mar 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 56.54%. Comparing base (5fdf6c0) to head (e21fe3e).
Report is 87 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #5570      +/-   ##
============================================
- Coverage     56.91%   56.54%   -0.38%     
+ Complexity     3319     3313       -6     
============================================
  Files           587      592       +5     
  Lines         18968    19204     +236     
  Branches       1401     1355      -46     
============================================
+ Hits          10795    10858      +63     
- Misses         7594     7784     +190     
+ Partials        579      562      -17     

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

Copy link

sonarcloud bot commented Mar 24, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.4% Duplication on New Code

See analysis details on SonarCloud

@ruibaby
Copy link
Member

ruibaby commented Mar 24, 2024

插件需要主动修改吗?我这里似乎还是无效。

Screen.Recording.2024-03-24.at.22.13.33.mov

@LIlGG
Copy link
Member Author

LIlGG commented Mar 25, 2024

插件需要主动修改吗?我这里似乎还是无效。

插件需要在 PR 合并之后进行主动修改,因为插件需要依赖于 handleDrop 中的 selection 属性。目前插件只要能够在鼠标划过时显示拖拽图标即可。

倒是有方法可以直接在此 PR 中控制所有 Node 节点拖拽后的替换和删除操作,这样插件就不需要再手动处理了。但这样可能会影响到所有的 Node 节点。权衡利弊之后,决定还是选择由插件自行实现拖拽后的逻辑。

Copy link
Member

@JohnNiang JohnNiang left a comment

Choose a reason for hiding this comment

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

/approve

@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 Mar 27, 2024
f2c-ci-robot bot pushed a commit to halo-dev/docs that referenced this pull request Mar 27, 2024
将 selection 属性添加至默认编辑器的 handleDrop 扩展中。相关改动查看 halo-dev/halo#5570

/kind documentation

```release-note
None
```
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 Mar 27, 2024
Copy link

f2c-ci-robot bot commented Mar 27, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang, 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 merged commit 1a19bdc into halo-dev:main Mar 27, 2024
8 checks passed
@LIlGG LIlGG deleted the fix/editor-draggable-invalid branch March 27, 2024 04:59
@ruibaby ruibaby modified the milestones: 2.14.x, 2.14.0 Mar 27, 2024
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 kind/bug Categorizes issue or PR as related to a bug. 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.

默认编辑器的 getDraggable 扩展无效
3 participants