I am running a simple setup for ProseMirror and have got a serious issue which I do not know how to approach best. Basically whenever in the document model there is a link (a text node with a link mark) within a paragraph, if I toggle the mark of a selection starting at the beginning of the paragraph (for example to make it bold), and then remove the mark, the link is duplicated. For example, if the original paragraph is:
Hellow my name is Bob and I work here.
Making the Hellow
part bold (using toggleMark()
command) will (correctly) result in:
Hellow my name is Bob and I work here.
Now using toggleMark()
one more time will update the state to:
This will not happen if the range upon which toggleMark()
is applied does not include the first character of the paragraph, so basically:
Hellow my name is Bob and I work here.
Works perfectly fine.
I am running ProseMirror within Angular (6.0.8), which might have an effect on the issue. Additionally, if I manually reconstruct the DOM representation of the document, the duplicate link will disappear:
this.view.dom.innerHTML = '';
const fragment = DOMSerializer.fromSchema(this.schema).serializeFragment(this.view.state.doc.content);
this.view.dom.appendChild(fragment);
Would cause the duplicate link to go away, which means the duplicate links seems like a residual element that ProseMirror’s view somehow did not clear up, and not present in the actual document model.
Any ideas?