在module的粘贴板里添加一个匹配器
modules: {
toolbar: false,
clipboard: {
// 粘贴过滤
matchers: [[Node.ELEMENT_NODE, this.HandleCustomMatcher]]
// ['img', this.HandleCustomMatcher2]
},
},
let ops = []
Delta.ops.forEach(op => {
if (op.insert && typeof op.insert === 'string') {
ops.push({
insert: op.insert,
})
} else {
// this.$message({
// message: '不允许粘贴图片',
// type: 'warning'
// })
}
})
Delta.ops = ops
return Delta
本文介绍了如何在模块的粘贴板功能中添加一个节点匹配器,如ELEMENT_NODE,以及如何处理插入操作,如字符串文本,同时阻止非文本内容(如图片)的粘贴,确保内容符合特定规则。
6079

被折叠的 条评论
为什么被折叠?



