【发布时间】:2018-04-25 16:25:57
【问题描述】:
我在使用 Quill Editor 时遇到问题。我想在另一个 HTML 标记中显示 Quill 编辑器的插入内容。
我尝试使用以下代码:
configureQuill() {
const toolbarOptions = [
['bold', 'italic', 'underline', 'strike'],
[{ 'align': [] }],
[{ 'size': ['small', false, 'large', 'huge'] }],
[{ 'list': 'ordered'}, { 'list': 'bullet' }],
[{ 'color': [] }, { 'background': [] }],
['image', 'formula']
];
const options = {
modules: {
toolbar: toolbarOptions,
formula : true,
imageResize: {}
},
placeholder: 'Hier goes the content...',
theme: 'snow'
};
this.q = new Quill('#editor2', options);
this.q.on('editor-change', (eventName, ...args) => {
if (eventName === 'text-change') {
this.contentHtml = this.q.root.innerHTML;
}
});
}
我正在使用 contentHTML 变量将 HTML 内容放入 div 容器中:
<div [innerHTML]="contentHtml">
显示了内容,但我认为 div 容器中的内容没有使用 css 样式:
除了公式、文本对齐和文本大小之外,一切都很好。
【问题讨论】: