修改富文本禁止粘贴
This commit is contained in:
+16
@@ -234,6 +234,10 @@
|
|||||||
placeholder: '',
|
placeholder: '',
|
||||||
theme: 'snow', // or 'bubble'
|
theme: 'snow', // or 'bubble'
|
||||||
modules: {
|
modules: {
|
||||||
|
clipboard: {
|
||||||
|
// 粘贴版,处理粘贴时候带图片
|
||||||
|
matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]]
|
||||||
|
},
|
||||||
toolbar: {
|
toolbar: {
|
||||||
container: toolbarOptions, // 工具栏
|
container: toolbarOptions, // 工具栏
|
||||||
handlers: {
|
handlers: {
|
||||||
@@ -338,6 +342,18 @@
|
|||||||
quilleditorBlur() {
|
quilleditorBlur() {
|
||||||
this.$refs.ruleForm.validateField('content')
|
this.$refs.ruleForm.validateField('content')
|
||||||
},
|
},
|
||||||
|
handleCustomMatcher(node, Delta) {
|
||||||
|
let ops = []
|
||||||
|
Delta.ops.forEach(op => {
|
||||||
|
if (op.insert && typeof op.insert === 'string') {// 如果粘贴了图片,这里会是一个对象,如果是字符串则可以添加
|
||||||
|
ops.push({
|
||||||
|
insert: op.insert
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
Delta.ops = ops
|
||||||
|
return Delta
|
||||||
|
},
|
||||||
getBase() {
|
getBase() {
|
||||||
getAction('/problemKnowledgeBase/problemKnowledgeBaseClassifyEO/list', {}).then((res) => {
|
getAction('/problemKnowledgeBase/problemKnowledgeBaseClassifyEO/list', {}).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user