我正在开发一个博客应用程序。目前,在发布博客文章时,您可以上传纯文本,每篇文章最多只能上传一张图片。
我想添加富文本 (WYSIWYG) 编辑器。如何在 Firebase 数据库中保存和检索富文本格式(样式、字体、颜色等)?
另外,如何添加存储任意数量图像的容量?
最佳答案
从文档来看,他们有以下方法来获取内容并渲染
render(); //Render the editor. This method must be called to render the editor.
render(String html); //Render the editor with HTML as parameter.
render(EditorState state); //Render the editor with the state as a parameter
getContent(); //returns the content in the editor as EditorState
getContentAsSerialized(); //returns the content as serialized form of EditorState
getContentAsSerialized(EditorState state); //returns the provided parameter as serialized.
getContentAsHTML(); //returns the editor content in HTML format.
因此您可以根据您的要求使用getContent()
并直接存储内容并在显示时使用render方法。
您可以搜索如何在 Firebase 中存储序列化对象来存储 EditorState
对象或直接将 HTML 文本存储为 String
。
关于android - 如何存储富文本数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49167176/