2017-05-27 1 views
1

Ich versuche, ein benutzerdefiniertes Klassenattribut in QuillJS zu erstellen. Ich habe so weit gekommen:Erstellen eines benutzerdefinierten Klassenattributors in QuillJS

let config = { 
    scope: Parchment.Scope.BLOCK, 
}; 

let MClass = new Parchment.Attributor.Class('mark', 'dom-mark', config); 
Quill.register(MClass,true) 

Aber bei dem Versuch:

this.quillEditor.format('mark', 'MarkThisHere'); 

ich:

ERROR Typeerror: BlotClass.create keine Funktion

Was ist bin ich falsch machen?

Antwort

3

Funktioniert für mich in diesem example.

Parchment = Quill.import('parchment'); 

let config = { 
    scope: Parchment.Scope.BLOCK, 
}; 

let MClass = new Parchment.Attributor.Class('mark', 'dom-mark', config); 
Quill.register(MClass,true) 

var quill = new Quill('#editor-container', { 
    modules: { 
    toolbar: [ 
     [{ header: [1, 2, false] }], 
     ['bold', 'italic', 'underline'], 
     ['image', 'code-block'] 
    ] 
    }, 
    placeholder: 'Compose an epic...', 
    theme: 'snow' // or 'bubble' 
}); 

quill.format('mark', 'MarkThisHere'); 
Verwandte Themen