I’m new to prosemirror, thanks for the awesome editor framework.
I’m using prosemirror in an angular2 environment. In my case, the document can change from outside the editor. I’m pushing this.data (a markdown doc) successfully into the editor:
.... this.props.state.doc = defaultMarkdownParser.parse(this.data); this.instance.update(this.props);
The problem arises, when the cursor is at the end of a document, and I push a shorter document into the editor. I’ll get a “Invalid Position XX” exception.
I’m a little bit lost how I could resolve the nearest valid position compared to the old (invalid) position - or at least reset the cursor to the end of the document.
Any help would be greatly appreciated!