Reputation: 2445
I am trying to add the Quill text editor to my Angular 8 project, but it is not rendering correctly on the browser.
There are no errors appearing in the console, and this is what is displayed in the browser:
I followed the installation steps as outlined here.
Also, the following is mentioned in my angular.json:
"styles": [
"src/styles.css",
"./node_modules/quill/dist/quill.core.css",
"./node_modules/quill/dist/quill.snow.css"
],
"scripts": ["./node_modules/quill/dist/quill.js"]
Here are the imports in my NgModule:
imports: [
BrowserModule,
AppRoutingModule,
QuillModule.forRoot()
],
And here is my HTML:
<div id="quill">
<p>Content *</p>
<quill-editor [styles]="editorStyle" placeholder="Enter Text" [modules]="config" formControlName="yourCtrlname"
required>
</quill-editor>
</div>
Can someone please tell me why the editor isn't rendering correctly>
Upvotes: 5
Views: 9668
Reputation: 41
You need to add the imports
@import '~ quill / dist / quill.core.css';
@import '~ quill / dist / quill.snow.css';
in /webapp/content/scss/global.scss
and not directly in the scss file of your module
Upvotes: 1
Reputation: 1
Make sure that you have included the following in styles.css
@import '~quill/dist/quill.core.css';
@import '~quill/dist/quill.snow.css';
and also make sure they are applying while serving if not, import styles.css
into index.html
.
Upvotes: 0
Reputation: 11
better late than never
u need to add "@import '~quill/dist/quill.snow.css';" to your styles.less worked for me after i did this.
Hope this still helps some1
Upvotes: 1
Reputation: 109
Add inside index.html, it should now display it
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<link href="https://cdn.quilljs.com/1.3.6/quill.bubble.css" rel="stylesheet">
Upvotes: 6
Reputation: 71
As per the source: "do not forget to include quill + theme css in your buildprocess, module or index.html!".
However, I was seeing the same behavior when I included style "./node_modules/quill/dist/quill.snow.css" in angular.json. Changing it to style.css resolves the issue. Add the following at the start of your style.css:
@import '~quill/dist/quill.core.css';
@import '~quill/dist/quill.bubble.css';
@import '~quill/dist/quill.snow.css';
Upvotes: 3
Reputation: 650
I'm using quill in my angular project and I'm not sure why you have those hard-coded paths in your angular json - also there is a package that wraps quill in an angular module, I think that's what you're expecting to be defined by QuillModule, but I think you're just referencing the quill-source, not specific to angular. I think if you remove those imports from angular.json and just run :
npm install --save quill
npm install --save ngx-quill
And then make sure you in your module your quillModule is importing from the ngx-quill
import { QuillModule } from 'ngx-quill';
I don't recall encountering any difficulties getting it up and running, but it looks like you have the quill library, but not the angular module - which seems to be the syntax you're using/expecting, so think you just need to install dependencies properly.
Upvotes: 1