当我从某处复制粘贴一些文本到 Summernote 文本编辑器时,它也会复制样式。我需要的只是纯文本。但我得到的是带有许多 html 标签的文本。
当我复制时
Lorem Ipsum is simply dummy text of the printing and typesetting industry
我得到的是
<strong style="font-family: Arial, Helvetica, sans; font-size: 11px; line-height: 14px; text-align: justify;">Lorem Ipsum</strong><span style="font-family: Arial, Helvetica, sans; font-size: 11px; font-weight: normal; line-height: 14px; text-align: justify;"> is simply dummy text of the printing and typesetting industry.</span>
我使用的代码是
$('.summernote').summernote({
focus : true,
height: 250,
toolbar: []
});
summernote 中是否有任何选项可以禁用这种行为?
最佳答案
Summernote有一个onPaste事件,可以像这样实现:
$('.summernote').summernote({
focus : true,
height: 250,
toolbar: [],
onPaste: function(e) {
})
});
您可以在此处查看某人如何使用它来去除格式的实现:https://github.com/summernote/summernote/issues/303#issuecomment-53713694
关于html - 如何将 HTML 复制为纯文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30994260/