更改QuillDeltaToHtmlConverter的选项将delta转换为html

问题描述

我正在尝试获取没有ql-align-center类名称的干净HTML代码。首先想到的是将classprefix选项(认值为'ql')设置为空”。

我想知道如何以quillDeltaToHtmlConverter接受选项的方式对“ cfg”值进行编码,因为现在它基本上什么都不做。我在onEdit()方法中使用它。

谢谢!

cfg: {
        classprefix: ''
     } 


constructor(injector: Injector,protected cdRef: ChangeDetectorRef) {
        super(injector);
    }

ngOnInit(): void {
        // Filter Helper
        this.editorForm = new FormGroup({
            'editor': new FormControl('ahoj')
        });
        // If filter is not supported,listofMeters is required
        this.getContract();
    }


onEdit = () => {
        this.loading(true);

        if (this.contract == null) {
            // @ts-ignore
            this.contract = {};
        }
        this.contract.content = this.editorForm.controls['editor'].value;

        const deltaOps = this.editor.quillEditor.getContents().ops;

        console.log('deltaOps before convert: ',deltaOps);
        const converter = new quillDeltaToHtmlConverter(deltaOps,this.cfg);
        let a = converter.convert();

        this.backendService.ISmartFlat_buildingSetContract(<ISmartFlat_BuildingContractDeal>{
            id: this.building.id,contract_content: JSON.stringify(this.contract)
        })
            .then((result: ISmartFlat_Building) => {
                this.building = result;
                this.loading(false);
            })
            .catch((reason: IError) => {
                this.loading(false);
            });
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)