I just realised that Transform.replaceWith used in the linter example:
function fixPunc(replacement) {
return function({state, dispatch}) {
dispatch(state.tr.replaceWith(this.from, this.to,
state.schema.text(replacement)))
}
}
split marks.
Initial dom structure (with punctuation problem):
<p>
and, double-click them to
<strong>
automaticall fix
<div class="lint-icon ProseMirror-widget" title="Suspicious spacing around punctuation" contenteditable="false">
</div>
<span class="problem"> . </span>
it
</strong>
(if supported).
</p>
Result after fixPunct
did it’s thing:
<p>
and, double-click them to
<strong>automaticall fix</strong>
.
<strong>it</strong>
(if supported).
</p>
Is there a way to do a replace text and keep the surrounding mark intact?