我正在使用羽毛笔编辑器,它的工作良好,但问题是,当粘贴的文本,其中包括图像,它也粘贴在文本区域,我不想要。我怎么能让它失效?我尝试了在下面的链接上提供的格式选项,但没有用。https://github.com/quilljs/quill/issues/1108下面是html
<quill-editor #textArea [placeholder]="attribute.name"
[formControl]="specsForm.controls[attribute.id].controls.value" [required]="attribute.isRequired"
[readOnly]="isProductAttributeDefected || attribute.isReadOnly " [disableControl]="isProductAttributeDefected || attribute.isReadOnly"
[maxLength]="attribute.maxLength" [modules]="editorConfig" (onEditorCreated)="editorInit($event, attribute.id, specsForm, false)">这是我的配置
public editorConfig: {
modules: {
toolbar: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline'],
['code-block']
]
},
placeholder: 'Compose an epic...',
theme: 'snow', // or 'bubble'
formats: [
'background',
'bold',
'color',
'font',
'code',
'italic',
'link',
'size',
'strike',
'script',
'underline',
'blockquote',
'header',
'indent',
'list',
'align',
'direction',
'code-block',
'formula'
// 'image'
// 'video'
]
};我尝试了5.2.0和6.2.0两种版本
知道吗?注意:在给定的链接中提到了一个黑客,但我希望有一个适当的解决方案。
发布于 2020-12-22 11:31:07
对于这个延迟的回答,很抱歉,但是为了避免将图像粘贴到quill编辑器中,您可以添加一个不改变编辑器的图像处理程序。但是要在图像粘贴上调用处理程序,则需要quill-image-drop-and-paste模块。
import * as QuillNamespace from 'quill';
let Quill: any = QuillNamespace;
import QuillImageDropAndPaste from 'quill-image-drop-and-paste'
Quill.register('modules/imageDropAndPaste', QuillImageDropAndPaste);现在,在编辑器配置中,添加处理程序引用。
editor_modules = {
.....
imageDropAndPaste: {
handler: this.imageHandler1
}
............
}现在在处理程序中
imageHandler1 = (imageDataUrl, type, imageData)=> {
console.log('Eating your pasted image.')
}https://stackoverflow.com/questions/63632511
复制相似问题