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

feat: add gap cursor for top-level block nodes in default editor #6103

Merged
merged 14 commits into from
Jun 26, 2024

Conversation

LIlGG
Copy link
Member

@LIlGG LIlGG commented Jun 19, 2024

What type of PR is this?

/kind feature
/area editor
/milestone 2.17.x

What this PR does / why we need it:

目前想对块级节点进行换行是一件比较困难的事情,尤其是两个相邻的块级节点之间的想插入额外的一行时更加困难。间隙光标可以解决这一问题。

为默认编辑器的顶级块节点(pos.depth = 1)增加间隙光标的功能。当 NodeType 属性 allowGapCursor 为 true 时,将会在目标节点上启用间隙光标的功能。间隙光标将可能出现在目标节点的左上方与右下方。

image

已知问题:

  1. 对于 inlineContent 的节点,点击生成间隙光标时,光标会先出现在对应的内容上,会出现闪动的问题。
  2. 在间隙光标上使用组合输入(例如中文输入)时,首个字母会被新增至新的一行。
  3. CodeBlock 无法使用间隙光标(CodeBlock 自身问题,待适配)
    4. 首行空文本无法被删除(与 Gap Cursor 问题无关,待适配 Paragraph)
    5. 删除文本上方有可以添加间隙光标的块级节点时,无法触发间隙光标的 Backspace 事件(同 4,属于 Paragraph 适配问题)

目前已经启用此功能的节点:

  • 表格
  • 分栏卡片
  • CodeBlock (无法生效)

How to test it?

测试间隙光标是否能够在表格与分栏卡片上出现。
测试间隙光标出现后,输入文本、使用快捷键等操作是否符合逻辑。
测试使用方向键调整间隙光标位置。

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 Jun 19, 2024
@f2c-ci-robot f2c-ci-robot bot added this to the 2.17.x milestone Jun 19, 2024
@f2c-ci-robot f2c-ci-robot bot added the area/editor Issues or PRs related to the Editor label Jun 19, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from guqing and wan92hen June 19, 2024 17:26
Copy link

codecov bot commented Jun 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.04%. Comparing base (5fdf6c0) to head (7d3e16b).
Report is 273 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6103      +/-   ##
============================================
- Coverage     56.91%   55.04%   -1.88%     
- Complexity     3319     3490     +171     
============================================
  Files           587      635      +48     
  Lines         18968    21388    +2420     
  Branches       1401     1496      +95     
============================================
+ Hits          10795    11772     +977     
- Misses         7594     9010    +1416     
- Partials        579      606      +27     

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

@LIlGG LIlGG force-pushed the feat/add-node-card-placeholder branch 2 times, most recently from e48b24e to de84822 Compare June 20, 2024 14:56
@LIlGG LIlGG force-pushed the feat/add-node-card-placeholder branch from de84822 to 357bf34 Compare June 25, 2024 03:00
@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 Jun 25, 2024
@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 Jun 26, 2024
@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 Jun 26, 2024
@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 Jun 26, 2024
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.

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Jun 26, 2024
Copy link

f2c-ci-robot bot commented Jun 26, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JohnNiang

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 Jun 26, 2024
@f2c-ci-robot f2c-ci-robot bot merged commit 73798e8 into halo-dev:main Jun 26, 2024
7 checks passed
@ruibaby ruibaby modified the milestones: 2.17.x, 2.17.0 Jun 26, 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/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.

3 participants