Category : draftjs

I am trying this: import React from ‘react’; import Editor from ‘draft-js-plugins-editor’; import createToolbarPlugin from ‘draft-js-static-toolbar-plugin’; import { EditorState } from ‘draft-js’; import ‘draft-js-static-toolbar-plugin/lib/plugin.css’; export default function MyEditor() { const [editorState, setEditorState] = React.useState(() => EditorState.createEmpty()); const toolbarPlugin = createToolbarPlugin(); const { Toolbar } = toolbarPlugin; const plugins = [toolbarPlugin]; this.editor = React.useRef(null); return ( ..

Read more

I’m currently building a document like editor using Draft.js and React where the editor has custom blocks generated from previous processing steps and default blocks provided by Draft.js. I’ve encountered some strange behavior when I ‘Drag-and-Drop’ custom blocks onto the editor. Specifically, if there are default text-like blocks on the editor and you drop a ..

Read more

Is is possible to render an input (for adding caption to images) inside the draft js and can get the data which is typed by user? I am familiar with "custom block rendering" concept and follow the instruction which is provided by https://draftjs.org/docs/advanced-topics-custom-block-render-map/ . But, when I want to write something in the input, I ..

Read more

I am implementing React’s "draft js" with mention plugin. https://www.draft-js-plugins.com/ So far i am able to create the editor and creating the mention tags. I can save the mentions in my database using rest API. Here is what i do on saving content to db: const contentState = this.state.MyInput.getCurrentContent(); const raw = convertToRaw(contentState); const data ..

Read more

I’m using Draft-Js and while trying to use the handleKeyCommand of RichUtils the application stop and I’m getting the error : "this.props.editorState.isInCompositionMode is not a function error" Can somebody help? Thanks. const MyEditor = () => { const [editorState, setEditorState] = useState(()=>EditorState.createEmpty()) const editor = useRef(null) useEffect(() => {focus()}, []) const onChange = (editorState) => ..

Read more

When I create a new contentState from Immutable OrderedMap to Array I get block.getKey is not a function from Draftjs even though the key is provided… I found a thread on draftjs github suggesting this could be a bug however it’s from 2016, wondering if anyone has a solution or workaround they could suggest… Here ..

Read more