在Wagtail上向Draftail编辑器添加HTML查看

在Wagtail上向Draftail编辑器添加HTML查看,第1张

概述当我们在Wagtail上使用Hallo.js时,我能够在编辑器添加一个按钮,以便您可以查看富文本字段的原始 HTML. 我的问题:Draftail还有可能吗? 我查看了文档 – 并成功为Draftail编写了自己的自定义函数,但它似乎只接受自定义按钮的HTML标记. 我看到Draftail将内容存储为JSON而不是HTML,因此可能会限制此功能. 关于此主题有一个(已关闭)问题: https:/ 当我们在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 07001 or 07002.

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

总结

以上是内存溢出为你收集整理的在Wagtail上向Draftail编辑器添加HTML查看全部内容,希望文章能够帮你解决在Wagtail上向Draftail编辑器添加HTML查看所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1071266.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存