Skip to content

Supports replacing tags with other inline elements #11238

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

Closed
TCOTC opened this issue May 3, 2024 · 21 comments
Closed

Supports replacing tags with other inline elements #11238

TCOTC opened this issue May 3, 2024 · 21 comments
Assignees
Milestone

Comments

@TCOTC
Copy link
Contributor

TCOTC commented May 3, 2024

行级标签支持替换为纯文本

In what scenarios do you need this feature?

侧边栏里目前只有重命名和删除,做不到删除标签还留下行级标签的文本:

image

在搜索里替换又没有效果:

image

image

Describe the optimal solution

行级标签支持批量转换为文本

Describe the candidate solution

No response

Other information

备注:#11058

@TCOTC
Copy link
Contributor Author

TCOTC commented May 4, 2024

我只尝试了行级标签,其他行级元素不知道支不支持替换

@TCOTC
Copy link
Contributor Author

TCOTC commented May 10, 2024

刚刚发现,如果实现了搜索替换支持转换元素类型,理论上就能直接实现 块引用与标签互转 · Issue #11026 · siyuan-note/siyuan

@TCOTC TCOTC changed the title 行级标签支持批量转换为文本 行级标签支持替换 May 10, 2024
@88250 88250 self-assigned this May 10, 2024
@88250
Copy link
Member

88250 commented May 10, 2024

目前替换标签内容有 bug 导致替换失败,但修复 bug 以后也只能支持替换标签内容,不支持替换类型。

88250 added a commit that referenced this issue May 10, 2024

Verified

This commit was signed with the committer’s verified signature.
@TCOTC
Copy link
Contributor Author

TCOTC commented May 10, 2024

只能支持替换标签内容,不支持替换类型

意思就是说不能把标签替换为纯文本?

@88250
Copy link
Member

88250 commented May 10, 2024

是的,目前只能替换内容,要改变类型的话还没想到适合的方案。

@TCOTC TCOTC changed the title 行级标签支持替换 搜索替换支持转换元素类型 May 10, 2024
@88250 88250 changed the title 搜索替换支持转换元素类型 搜索替换支持转换行级元素类型 May 10, 2024
@TCOTC
Copy link
Contributor Author

TCOTC commented Nov 30, 2024

我突然想到让搜索输入框支持富文本

@88250
Copy link
Member

88250 commented Nov 30, 2024

支持不了的,数据库里面没有存 DOM,无法匹配到的,另外好像没有应用的搜索这样做吧,不一定好用。

@TCOTC
Copy link
Contributor Author

TCOTC commented Nov 30, 2024

富文本不行那就只能靠匹配 Markdown 了,感觉可以增加一种搜索模式是有 Markdown 标记符的

@88250
Copy link
Member

88250 commented Dec 1, 2024

SQL 搜索吧

@TCOTC
Copy link
Contributor Author

TCOTC commented Dec 21, 2024

@88250 这个是同样的问题吗?

如果替换的内容中包含行级元素,则无法替换成功:

image

@88250
Copy link
Member

88250 commented Dec 22, 2024

基本是同一个问题,元素交叉的情况更复杂些。

@88250 88250 added this to the 3.1.28 milestone Apr 13, 2025
@88250 88250 changed the title 搜索替换支持转换行级元素类型 行级标签支持替换为纯文本 Apr 13, 2025
@88250
Copy link
Member

88250 commented Apr 13, 2025

评估了下要做行级元素替换的话情况比较复杂,先实现标签转换纯文本吧。

@88250 88250 changed the title 行级标签支持替换为纯文本 Support replacing inline tags with plain text Apr 13, 2025
88250 added a commit that referenced this issue Apr 13, 2025

Verified

This commit was signed with the committer’s verified signature.
@88250 88250 closed this as completed Apr 13, 2025
@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 13, 2025

两个问题:

  • 高亮错误,高亮了标签以外的文本
  • 可以转换为纯文本,但无法替换文本
video.webm

@88250
Copy link
Member

88250 commented Apr 13, 2025

  1. 高亮这个没有办法,因为是文本匹配
  2. 稍后改进

88250 added a commit that referenced this issue Apr 13, 2025

Verified

This commit was signed with the committer’s verified signature.
88250 added a commit that referenced this issue Apr 13, 2025

Verified

This commit was signed with the committer’s verified signature.
@88250 88250 changed the title Support replacing inline tags with plain text Supports replacing tags with other inline elements Apr 13, 2025
@88250
Copy link
Member

88250 commented Apr 13, 2025

刚刚发现,如果实现了搜索替换支持转换元素类型,理论上就能直接实现 块引用与标签互转 · Issue #11026 · siyuan-note/siyuan

改进了一下,已经可以支持将标签替换为其他行级元素了(不只是块引元素):

原文:

Image

替换:

Image

结果:

Image

88250 added a commit that referenced this issue Apr 13, 2025

Verified

This commit was signed with the committer’s verified signature.
@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 13, 2025

替换为块引用之后块引计数好像不会更新

@88250
Copy link
Member

88250 commented Apr 13, 2025

替换为块引用之后块引计数好像不会更新

我这里测试正常

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 13, 2025

我这里看起来不正常

video.webm

@88250
Copy link
Member

88250 commented Apr 13, 2025

文档树上的确实有点问题,稍后看看如何改进,谢谢。

88250 added a commit that referenced this issue Apr 13, 2025

Verified

This commit was signed with the committer’s verified signature.
@5kyfkr
Copy link

5kyfkr commented Apr 14, 2025

能在标签的右击菜单里增加个转换为块引用功能吗?藏在替换功能里感觉有点麻烦了。直接标签右击->转换为块引用->然后弹个窗->填目标块id确认后就替换

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 14, 2025

思源本体做这个不合适,等插件实现吧

88250 added a commit that referenced this issue Apr 14, 2025

Verified

This commit was signed with the committer’s verified signature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants