Javascript 自定义嵌入Blot无法重新实例化已存在的对象
QuillJS定制内嵌式污渍 我试图在编辑器中插入一个自定义的blot(使用blots/embed),该部分的工作方式如游乐场所示。但是,如果我尝试重新实例化提交的内容,它会将参数givens处的undefined返回给类 我已经创建了一个显示此行为的。其内容如下所示 HTMLJavascript 自定义嵌入Blot无法重新实例化已存在的对象,javascript,quill,Javascript,Quill,QuillJS定制内嵌式污渍 我试图在编辑器中插入一个自定义的blot(使用blots/embed),该部分的工作方式如游乐场所示。但是,如果我尝试重新实例化提交的内容,它会将参数givens处的undefined返回给类 我已经创建了一个显示此行为的。其内容如下所示 HTML <div id="editor-container"><br/><span class="proc-link" style="text-de
<div id="editor-container"><br/><span class="proc-link" style="text-decoration: underline;background-color : lightgreen;" data-proc="value"><span contenteditable="false">Test</span></span></div>
JS
#editor-container {
height: 375px;
}
var Embed = Quill.import('blots/embed');
class ProcLink extends Embed {
static create(value) {
let node = super.create(value);
// give it some margin
node.setAttribute('style', "text-decoration: underline;background-color : lightgreen;");
node.setAttribute('data-proc', value.value);
node.innerHTML = value.text;
return node;
}
}
ProcLink.blotName = 'proc-link';
ProcLink.className = 'proc-link';
ProcLink.tagName = 'span';
Quill.register({
'formats/proc-link': ProcLink
});
var quill = new Quill('#editor-container', {
modules: {
toolbar: [
[{ header: [1, 2, false] }],
['bold', 'italic', 'underline']
]
},
placeholder: 'Compose an epic...',
theme: 'snow' // or 'bubble'
});
var index = quill.getSelection(true).index;//quill is the reference to my instantiated quill obj
var cObj = {text : 'Test', value : 'value'};
quill.insertEmbed(0,"proc-link",cObj)