I have a use-case where the ProseMirror editor is not editable at first (readonly mode). Once the user double-clicks the editor, the editor becomes editable.
/**
* The schema is defined to have paragraphs within a document.
*/
const state = EditorState.create({
schema,
doc: schema.nodeFromJSON(emptyDoc),
});
const view = new EditorView(document.getElementById('editor'), {
state,
editable: () => false,
});
/**
* Once the user double clicks the editor, we enable it to be editable.
*/
view.setProps({
editable: () => true,
});
This all works fine. The issue here is that the caret is not visible immediately when it turns editable. Of course, I can click on the text and it becomes visible.
But, I want it to be shown immediately at the position where it was double clicked. Is this possible?