siyuan-note / siyuan

A privacy-first, self-hosted, fully open source personal knowledge management software, written in typescript and golang.
https://b3log.org/siyuan
GNU Affero General Public License v3.0
21.39k stars 1.54k forks source link

html代码块中scipt标签解析错误,已允许代码块内脚本 #12921

Closed wish5115 closed 1 hour ago

wish5115 commented 4 hours ago

Is there an existing issue for this?

Can the issue be reproduced with the default theme (daylight/midnight)?

Could the issue be due to extensions?

Describe the problem

已开启HTML代码块内脚本选项。

当在html代码块中输入<script>xxxx</script>等内容时,script标签解析错误,如图 image

生成的代码中,不仅两处,还多出了</script></div>内容,导致script内的脚本报错无法执行。 image

关联帖子:https://ld246.com/article/1729935510467/comment/1729948008065?r=wilsons#comments

Expected result

期望能正常生成script脚本内容

Screenshot or screen recording presentation

No response

Version environment

- Version: 3.1.10
- Operating System: macos
- Browser (if used): not use

Log file

no

More information

No response

88250 commented 1 hour ago

我这里测试正常:

image

我是一次性外面写好然后粘贴进去的。

TCOTC commented 1 hour ago

我这里逐个字符输入也正常,而且在 alert(1) 之后每输入一个字符都会弹一次窗口,看起来没问题

88250 commented 1 hour ago

弹窗是正常的……

wish5115 commented 1 hour ago

我这里测试正常:

我是一次性外面写好然后粘贴进去的。

我知道了,这个html代码块是实时解析的,在解析过程中出现的问题,导致我后面怎么改都有问题,我是先粘贴网上的代码,再修改的,刚才的测试代码删了,无法重现刚才的问题了。

现在测试外面编辑好是没问题的。

88250 commented 1 hour ago

好的,那就这样吧,我关闭了。

TCOTC commented 1 hour ago

在解析过程中出现的问题,导致我后面怎么改都有问题

我这里也是控制台报错之后就会一直报错

wish5115 commented 1 hour ago

Quote reply

嗯,再有问题再说。

我这里也是控制台报错之后就会一直报错

@TCOTC 可以研究下能否稳定重现。

TCOTC commented 1 hour ago

咋还会引用 Quote reply 的,是 GitHub 的问题吗

image

wish5115 commented 1 hour ago

咋还会引用 Quote reply 的,是 GitHub 的问题吗

不清楚耶,刚才点引用回复,就这样了