cherry-markdown
cherry-markdown copied to clipboard
[Feature Request]建议支持对 style 属性的过滤
Prerequisites
- [X] There isn't an existing issue that requests the same feature, to avoid duplicates.
Clear and concise description of the problem
使用场景是聊天室,内容来自于用户输入.用户可能会输入如<h1 style="color: red; font-size: 40px|'>Test
这样的内容.我们希望将style过滤掉
Suggested solution
建议支持对 style 属性的过滤
Further Information
No response
Contributing
None
🤔 这个不应该是在输入框的时候进行限制嘛? 而不是在渲染的时候,如果是聊天内容,后端也要做xss防范过滤吧?
🤔@sunsonliu 你怎么看呢?
🤔@sunsonliu 你怎么看呢?
额。。支持呗,也不是很难。我差不多实现了。等下测试下没问题就提交
new Cherry({
engine: {
syntax: {
htmlBlock: {
/**
* 是否过滤html标签中的style属性
* true:过滤style属性
* false:不过滤style属性
*/
filterStyle: true,
}
}
}
})
这样就可以过滤html标签里的style属性了哈
new Cherry({ engine: { syntax: { htmlBlock: { /** * 是否过滤html标签中的style属性 * true:过滤style属性 * false:不过滤style属性 */ filterStyle: true, } } } })这样就可以过滤html标签里的style属性了哈
直接实现过滤器岂不是更好?
直接实现过滤器岂不是更好?
额,只想着简单实现,就没怎么考虑扩展性,目前这方面的反馈还是比较少的,就打算简单实现好了。