gpt4 book ai didi

wagtail - 将 HTML 查看添加到 Wagtail 上的 Draftail 编辑器

转载 作者:行者123 更新时间:2023-12-04 18:56:52 27 4
gpt4 key购买 nike

当我们在 Wagtail 上使用 Hallo.js 时,我能够向编辑器添加一个按钮,以便您可以查看富文本字段的原始 HTML。

我的问题:这在 Draftail 中还有可能吗?

我已经浏览了文档 - 并成功地为 Draftail 编写了我自己的自定义函数,但它似乎只接受自定义按钮的 HTML 标签。

我看到 Draftail 将内容存储为 JSON 而不是 HTML,所以也许这限制了这个功能。

最佳答案

关于此主题有一个(已关闭)问题:https://github.com/springload/draftail/issues/156

Unfortunately there is no such thing possible in this editor, since it doesn’t store its content as HTML. Having such a feature would also go the opposite way to the editor’s general direction – trying to enforce that end users can't alter the content in unforeseen ways.

It would technically be possible to write a toolbar extension that takes the editor’s content, converts it to HTML, allows you to edit that, then inserts whatever was entered back into the editor – but again that completely defeats the purpose of using this editor to start with.

If you need such a feature, you'll probably be better off using an editor like https://www.tinymce.com/ or https://ckeditor.com/.


我想补充一点,使用 StreamFields 可以更好地处理任何“复杂”的 html 结构。 .

关于wagtail - 将 HTML 查看添加到 Wagtail 上的 Draftail 编辑器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50590958/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com