同一页面上的多个 laravel-ckeditor 抛出错误
Multiple laravel-ckeditor on the same page throws error
在我的 HTML 中,我有两个文本区域,一个用于正文,一个用于正文,另一个用于摘录,它们都被分配了 id article-ckeditor
。当我在浏览器中加载页面时,我只能看到正文文本区域变成了 ckeditor,但摘录没有。在我的控制台中,我看到以下错误:
The editor instance "article-ckeditor" is already attached to the
provided element.
如何在同一页面上附加多个 ckeditor?
在你的HTML中:
...
<textarea id="body-editor" name="body"></textarea>
<textarea id="excerpt-editor" name="excerpt"></textarea>
...
在你的Javascript中:
CKEDITOR.replace("body-editor");
CKEDITOR.replace("excerpt-editor");
在我的 HTML 中,我有两个文本区域,一个用于正文,一个用于正文,另一个用于摘录,它们都被分配了 id article-ckeditor
。当我在浏览器中加载页面时,我只能看到正文文本区域变成了 ckeditor,但摘录没有。在我的控制台中,我看到以下错误:
The editor instance "article-ckeditor" is already attached to the provided element.
如何在同一页面上附加多个 ckeditor?
在你的HTML中:
...
<textarea id="body-editor" name="body"></textarea>
<textarea id="excerpt-editor" name="excerpt"></textarea>
...
在你的Javascript中:
CKEDITOR.replace("body-editor");
CKEDITOR.replace("excerpt-editor");