markdown-editor
markdown-editor copied to clipboard
fix(wysiwyg): fix serialization of yfm-cut and yfm-note
The problem was when creating a slice inside YFM-Note's or YFM-Cut's content. If includeParents=true is passed, doc.slice() will capture parent note or cut. If you then serialize the slice's content, it will be serialized incorrectly.
// `from` and `to` are inside content of yfm-cut or yfm-note
// includeParents=true
const slice = doc.slice(from, to, true);
// `markup` will contain a closing tag for yfm-cut and/or yfm-note,
// but will be missing an opening tab
const markup = serializer.serialize(slice.content);
console.log(markup); // -->
//
// <content>
//
// {% endcut %}
This PR fixes this issue.
Preview is ready.
Visual Tests Report is ready.