如何在Angular中安装Quill.js
对不起,我对如何在Angular中安装Quill.js,angular,angular6,quill,Angular,Angular6,Quill,对不起,我对Angular包装工作原理的理解太糟糕了!!我想在我的Angular6应用程序中使用WYSIWYG编辑器。我已经把注意力集中到quill.js 但是我很困惑如何将它包括在我的项目中。我已将其作为依赖项添加到我的package.json中 "dependencies": { ... "quill": "1.3.6" } 然后我尝试使用以下textarea <textarea id="question-description" type="text" class=
Angular
包装工作原理的理解太糟糕了!!我想在我的Angular6
应用程序中使用WYSIWYG
编辑器。我已经把注意力集中到quill.js
但是我很困惑如何将它包括在我的项目中。我已将其作为依赖项添加到我的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>
但我有一个错误
ReferenceError: Quill is not defined
at NewPracticeQuestionComponent.push../s
我还添加了declarevarquill:any组件的.ts
文件顶部的code>
我可以在node\u modules
中看到有一个quill
文件夹,它有dist/quill.js
,我想在那里必须定义并导出quill
对象(但没有选中它)
我做错了什么?尝试使用包装器。此链接有助于()。我不得不添加以下几行,但是我不太理解它是如何工作的,以及这些步骤意味着什么
import * as Quill from 'Quill';
let quill = new Quill('#editor');
按照这些简单步骤在Angular应用程序中安装quilljs
安装以下软件包
npm安装套筒
npm安装ngx纬管
npm安装@types/quill
在angular.json
文件中添加css文件下方的
"styles": ["./node_modules/quill/dist/quill.core.css",
"./node_modules/quill/dist/quill.bubble.css",
"./node_modules/quill/dist/quill.snow.css",
"src/styles.css",
]
在下面的app.module.ts
文件中添加模块下方的
`QuillModule.forRoot({
customOptions: [{
import: 'formats/font',
whitelist: ['mirza', 'roboto', 'aref', 'serif', 'sansserif', 'monospace']
}]
})`
在app.component.html
<quill-editor [styles]="{height: '200px'}"></quill-editor>
我已经在这里创建了演示。我将尝试一下ngx羽毛笔。我需要验证功能表单
,因为我的一些所见即所得
编辑器是表单的一部分。但是我无法使用羽毛笔。我可能会寻求你的帮助,因为我肯定会被卡住的!:)我试图使用ngx羽毛笔,但出现了错误。你能看一下这里的解释吗-
<quill-editor [styles]="{height: '200px'}"></quill-editor>