我现在面临的问题是,我在Bulletin.js中使用的从编辑器中检索html内容的方法似乎落后了一步(例如,我需要执行一些操作,如单击任意位置或检索编辑器中的最后一个操作)。 我想让它的变化是即时的,而不是落后一步,这样当用户做的事情,如改变字体颜色等,它将反映到预览部分立即。 Bulletin.js const getContent = (htm...
axios.get(`http://localhost:5555/api/get_blog_detail?id=${id}`, {}).then((resp) => {const contentBlock =htmlToDraft(resp.data.content); const contentState=ContentState.createFromBlockArray(contentBlock.contentBlocks); const editorState=EditorState.createWithContent(contentState); console.log...
importdraftToMarkdownfrom'draftjs-to-markdown'; importhtmlToDraftfrom'html-to-draftjs'; import'../../../node_modules/react-draft-wysiwyg/dist/react-draft-wysiwyg.css'; const content = { "entityMap": {}, "blocks": [{ "key": "637gr", "text": "", "type": "unstyled", "depth"...
const temp = EditorState.push(editorState, contentState, 'insert-characters') let html = draftToHtml(convertToRaw(temp.getCurrentContent())) html = html.replace(/</g, '<').replace(/>/g, '>') setEditorState(formatEditorState(html)) //提交给后端的是html字符串 onChange({ isChan...
desc: draftToHtml(convertToRaw(editorState.getCurrentContent())),},});7.富⽂本回显 const descInit = response.data.brandDesc if (descInit && descInit !== 'null') { const contentBlock = htmlToDraft(descInit);const contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks)...
//setFieldsValue是将富文本的内容传给content this.props.form.setFieldsValue({content:draftToHtml(convertToRaw(editorState.getCurrentContent()))}); } render() { const { editorState } = this.state; return ( <div> <Editor editorState={editorState} ...
问在react-draft-wysiwyg上使用formikEN当你想同时查看多个文件(尤其是日志文件)的活动时,multitail ...
//创建一个空得富文本isShowHtml:false,//是否显示获取得html内容模态框isShowJson:false,//是否显示获取得json内容模态框isShowText:false,//是否显示获取得text内容模态框}//编辑器发上内容发生变化时onEditorStateChange=(editorState)=>{// console.log(convertToRaw(editorState.getCurrentContent()))th...
props.changeBody(editorState, draftToHtml(convertToRaw(editorState.getCurrentContent())); } render() { const { editorState } = this.state; return ( <Editor editorState={editorState} onEditorStateChange={this.onEditorStateChange} toolbar={{ options: ['blockType'], blockType: { inDropdown...
return draftToHtml(convertToRaw(this.state.editorState.getCurrentContent())) } uploadImageCallBack = (file) => { return new Promise( (resolve, reject) => { const xhr = new XMLHttpRequest() xhr.open('POST', '/manage/img/upload') ...