gpt4 book ai didi

angular - Quill.register 未被识别为函数

转载 作者:行者123 更新时间:2023-12-04 04:18:45 29 4
gpt4 key购买 nike

我有这个使用 ngx-quill 的 Angular 项目我想添加第三方模块,quill-blot-formatter给它。

我已经安装了@types/quill作为开发依赖项来摆脱 TS linter 错误并配置 tsconfig.json包括"esModuleInterop": true"allowSyntheticDefaultImports": true .

我还添加了quill.jsangular.json如下:

"scripts": [
"./node_modules/quill/dist/quill.min.js"
]

我正在尝试在 app.module.ts 中注册模块但我在浏览器控制台上收到以下错误。
quill.js:1122 Uncaught TypeError: Cannot read property 'register' of undefined
这是我的模块注册码:
import Quill from 'quill';
import { BlotFormatter } from 'quill-blot-formatter';

Quill.register('modules/blotFormatter', BlotFormatter);

我试过导入 Quill以各种方式( * as Quill* as QuillNamespace ),但没有任何效果。

任何帮助,将不胜感激。

最佳答案

我通过改变这个解决了这个问题:
import { BlotFormatter } from 'quill-blot-formatter';
对此:
import BlotFormatter from 'quill-blot-formatter';
显然我没有正确阅读文档:)

关于angular - Quill.register 未被识别为函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59981328/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com