问题描述
我在我的一个项目中使用了 react Draftjs。但是,当我尝试通过 url 图像添加图像时,会显示图像,但是当我保存它并将信息发送到服务器然后再获取它时,我没有得到任何图像。它只是空的图形标签。
我的状态:
const [editorState,setEditorState] = useState(() =>
EditorState.createEmpty()
);
const [convertedContent,setConvertedContent] = useState(null);
const handleEditorChange = (state) => {
setEditorState(state);
convertContentToHTML();
};
const convertContentToHTML = () => {
let currentContentAsHTML = convertToHTML(editorState.getCurrentContent());
setConvertedContent(currentContentAsHTML);
};
我的编辑器组合:
<Editor
editorState={editorState}
onEditorStateChange={handleEditorChange}
wrapperClassName="wrapper-class"
editorClassName="editor-class"
toolbarClassName="toolbar-class"
placeholder="Type something here..."
toolbar={{
inline: { inDropdown: false },list: { inDropdown: true },textAlign: { inDropdown: false },link: { inDropdown: true },history: { inDropdown: false },}}
/>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)