【发布时间】:2020-05-24 22:26:46
【问题描述】:
对不起,我对 Angular 中的包装工作原理的理解太糟糕了!!我想在我的Angular6 应用程序中使用WYSIWYG 编辑器。我已经归零到quill.js。 https://quilljs.com/docs/quickstart/
但我很困惑如何将它包含在我的项目中。我已将其作为依赖项添加到我的 package.json 中。
"dependencies": {
...
"quill": "1.3.6"
}
然后我尝试使用以下textarea
<textarea id="question-description" type="text" class="form-control" formControlName="questionDescription" [ngClass]="validateField('questionDescription')" rows="4"></textarea>
并初始化Quill,就像在ngAfterViewInit中一样
var quill = new Quill('#question-description', {
theme: 'snow'
});
但我得到错误
ReferenceError: Quill is not defined
at NewPracticeQuestionComponent.push../s
我还在组件的.ts 文件顶部添加了declare var Quill:any;
我可以在node_modules 中看到有一个quill 文件夹,它有dist/quill.js 我想Quill 对象必须在其中定义和导出(虽然还没有检查过)。
我做错了什么?
【问题讨论】: