I have trouble integrating a quilljs editor in my angular 15 web project.
I firstly installed the dependencies with the following commands, which worked fine:
npm install ngx-quill@latest
npm install quill --save
I tried importing it in my component with the name BeitragCreateComponent.
import { QuillModule } from 'ngx-quill';
@Component({
standalone: true,
imports: [SbbInputModule, QuillModule.forRoot()],
selector: 'app-beitrag-create',
templateUrl: './beitrag-create.component.html',
styleUrls: ['./beitrag-create.component.scss'],
})
export class BeitragCreateComponent {
public quillconfig = {
toolbar: {
container: [
['bold', 'italic', 'underline', 'strike', 'image', 'video'],
[{'size': ['xsmall', 'small', 'medium', 'large', 'xlarge']}],
[{'align': []}],
['clean'],
['link']
]
}
};
}
but I only get error messages like:
ERROR
node_modules/ngx-quill/lib/quill-editor.component.d.ts:2:21 - error TS2614: Module '"quill"' has no exported member 'Delta'. Did you mean to use 'import Delta from "quill"' instead? 2 import QuillType, { Delta } from 'quill';
I then tried importing and integrating also 'Delta' it still did not work.
After that I tried only writing QuillModule instead of QuillModule.forRoot() in the imports. I also tried the same things in my main.ts file.
But when I use it like this, it works:
But I want have it imported in my component and not having to use this url.
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet">
<!-- Create the editor container -->
<div id="editor">
<p>Hello World!</p>
<p>Some initial <strong>bold</strong> text</p>
<p><br></p>
</div>
<!-- Include the Quill library -->
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script>
<!-- Initialize Quill editor -->
<script>
var quill = new Quill('#editor', {
theme: 'snow'
});
</script>
I checked out the quilljs documentation and some example projects and I still am not able to find the right solution.