jpuri / react-draft-wysiwyg

A Wysiwyg editor build on top of ReactJS and DraftJS. https://jpuri.github.io/react-draft-wysiwyg
MIT License
6.38k stars 1.16k forks source link

How to make a particular block non editable in the editor ? #1407

Open JacobJohn88 opened 7 months ago

JacobJohn88 commented 7 months ago

I am facing difficulties in making a particular block non editable in the editor. I tried with the following function but its not working

const makeBlockContenteditableFalse = (blockKey: string) => { const block = editorState .getCurrentContent() .getBlockMap() .get(blockKey) .merge({ data: { contenteditable: false, }, }); const updatedEditorState = EditorState.push(editorState, block); setEditorState(updatedEditorState); };