如何为ckeditor5设置初始数据?

发布于 2025-01-23 03:12:10 字数 368 浏览 3 评论 0原文

我找不到有关如何在CKEditor 5中设置初始数据的简单示例。

在某些问题中,据说我们应该使用setData api。但是这些示例是基于AJAX的。

在CKEditor 4中,我将简单地设置textareavalue,仅此而已。

在CKEditor 5中,HTML不是textarea,而是简单的< div>

我试图将内容放入< div>中,但它不起作用。

我也找不到文档中的示例。

那么,如何在CKeditor 5中设置初始数据?

I can't find a simple example on how to set initial data in CKEditor 5.

In some SO questions, it's said that we should use setData API. But those examples are AJAX based.

In CKEditor 4, I would simply set the value of the textarea and that was it.

In CKEditor 5, the HTML is not textarea but a simple <div>.

I tried to put the content inside the <div> and it did not work.

I also can't find an example in the docs.

So, how can I set initial data in CKEditor 5?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感性不性感 2025-01-30 03:12:10

您可以在初始化期间在配置对象中提供initiaData字段。

You can provide the initialData field in your config object during initialization. Doc reference

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文