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

添加html标签会被转义掉 #567

Closed
HarrisonLee1998 opened this issue Apr 14, 2020 · 4 comments
Closed

添加html标签会被转义掉 #567

HarrisonLee1998 opened this issue Apr 14, 2020 · 4 comments

Comments

@HarrisonLee1998
Copy link

在编辑器中输入html标签,所有的“<” or ">"都会被转义, 导致我无法写行内样式,比如

<div style="background:deeppink;width:200px;height:200px;"></div>

会被转义为

<div></div>

而编辑器的查看代码里面是这样的:

&lt;div&gt;&lt;/div&gt;

这个问题和我上次反映的不一样 😂 ,我上次反应的问题是在html 代码块 里面,标签会被转义,但是还是没能全部修复,虽然标签没有转义,但是内部的样式都消失了

@HarrisonLee1998
Copy link
Author

试了一下以前的版本,2.7.5,就没有上述问题,后面两次分别使用2.8.0和2.8.3,就有问题

@code-farmer-i
Copy link

code-farmer-i commented Apr 15, 2020

试了一下以前的版本,2.7.5,就没有上述问题,后面两次分别使用2.8.0和2.8.3,就有问题

试试这个 v-md-editor

@yzyeengang
Copy link

yzyeengang commented Apr 16, 2020

这个问题应该是最近XSS修复引起的 ,详见#548 #538
添加的 'xss' module 会使

<div style="background:deeppink;width:200px;height:200px;"></div>

变成

<div></div>

而 ‘markdown-it-sanitizer’ 会使

<div></div>

变成

&lt;div&gt;&lt;/div&gt;

而且现在的task-list功能也已经失效了

- [ ] JavaScript 

只会输出

<input class="task-list-item-checkbox" disabled="" type="checkbox"> JavaScript

这个在官网示例上面也是这样
我试着把它处理掉看看

@hinesboy
Copy link
Owner

已发布v2.9.0版本,为xss设置prop: xssOptions, 默认为null,表示不启用xss,若启用,课根据需要传入xssOptions, 具体参考Readme prop部分。
截屏2020-04-20下午8 23 26
@HarrisonLee1998 @code-farmer-i @yzyeengang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants