Skip to content

Indicates the insertion position when dragging docs or block icon#17056

Open
TCOTC wants to merge 3 commits into
siyuan-note:devfrom
TCOTC:fix/16882
Open

Indicates the insertion position when dragging docs or block icon#17056
TCOTC wants to merge 3 commits into
siyuan-note:devfrom
TCOTC:fix/16882

Conversation

@TCOTC

@TCOTC TCOTC commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Description / 描述

Fix #16882

目前存在的问题:

  • 在文档树拖拽文档到编辑器里,不能插入光标
  • 拖拽块标到其他块上面,按住 Alt 时(插入块引用)不能插入光标、按住 Shift 时(插入嵌入块)不能插入指示器
video.webm

本 PR 进行改进,增加了以下逻辑:

  • 在文档树拖拽文档到编辑器里(插入块引用),插入光标;按住 Alt 时(移动块)则移除光标
  • 拖拽块标到其他块上面(移动块),移除光标;按住 Alt 时(插入块引用)则插入光标;按住 Shift 时(插入嵌入块)则插入指示器
video.webm

但是本 PR 仍然存在我无法解决的缺陷,需要帮助:

  • 按住 Shift 时(插入嵌入块)插入了指示器,但松手之后不会按照指示器的方位来插入,只会插入到段落块的后面。因为这个嵌入块是通过 insertHTML(protyle.lute.SpinBlockDOM(html), protyle, true) 插入的,我不懂怎么更换为其他方式。

    video.webm
  • 本来还想试试能不能按照指示器位置插入外部拖拽进来的视频文件,但感觉应该会遇到跟前面相同的问题,所以先搁置了

Type of change / 变更类型

  • Bug fix
    缺陷修复
  • New feature
    新功能
  • Text updates or new language additions
    修改文案或增加新语言

Checklist / 检查清单

  • I have performed a self-review of my own code
    我对自己的代码进行了自我审查
  • I have full rights to the submitted code and agree to license it under this project's AGPL-3.0 license
    我拥有所提交代码的完整权利,并同意其以本项目的 AGPL-3.0 许可证授权
  • PR is submitted to the dev branch and has no merge conflicts
    PR 提交到 dev 分支,并且没有合并冲突

@TCOTC TCOTC marked this pull request as ready for review February 16, 2026 18:39
@88250 88250 requested a review from Vanessa219 February 17, 2026 03:14
@Vanessa219

Copy link
Copy Markdown
Member

按住 shift 是应该没有 dragover__left 这些样式的

@TCOTC

TCOTC commented Feb 17, 2026

Copy link
Copy Markdown
Contributor Author

按Shift的时候显示光标的话明显不对,所以是显示指示器,但因为插入嵌入块的实现方式跟移动块不一致,所以没法按指示器位置插入。这个问题我搞不定。

@Vanessa219

Vanessa219 commented Feb 17, 2026

Copy link
Copy Markdown
Member

但是也不能显示 dragover__left,否则会合并为超级块

@TCOTC

TCOTC commented Feb 17, 2026

Copy link
Copy Markdown
Contributor Author

这个还不是重点,现在是 dragover__top 和 dragover__bottom 也不准确,插入的位置不是指示器的位置

@Vanessa219

Copy link
Copy Markdown
Member

是不是插入的时候没有根据 dragover__xx 进行插入

@TCOTC

TCOTC commented Feb 18, 2026

Copy link
Copy Markdown
Contributor Author

对,上面说了具体原因,我不懂怎么改

@88250 88250 added this to the 3.5.10 milestone Mar 5, 2026
@Vanessa219 Vanessa219 removed this from the 3.5.10 milestone Mar 7, 2026
@88250 88250 added this to the 3.6.2 milestone Mar 16, 2026
@Vanessa219

Vanessa219 commented Mar 17, 2026

Copy link
Copy Markdown
Member

那就修改为不要显示 dragover__xx 就可以了。
3.6.2 中是否能修改好?不行的话就放在下个版本中。

@TCOTC

TCOTC commented Mar 22, 2026

Copy link
Copy Markdown
Contributor Author

还在改其他的,不太有空,要延后一下

@Vanessa219 Vanessa219 removed this from the 3.6.2 milestone Mar 23, 2026
@Vanessa219

Copy link
Copy Markdown
Member

那我先移除版本,改好了说一声。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants