参见「ttypic」评论:
这是我的代码:
const Block = Quill.import('blots/block');
class MyBlock extends Block {
static create() {
const node = super.create();
// Next, customize other functions
node.setAttribute('style', 'margin: 0;');
return node;
}
}
Angular 14 与 Primeng 这对我来说非常有用。
import * as QuillNamespace from 'quill';
const Block = this.Quill.import('blots/block');
class DivBlock extends Block {}
DivBlock.tagName = 'DIV';
// true means we overwrite
this.Quill.register('blots/block', DivBlock, true);