markdown-editor icon indicating copy to clipboard operation
markdown-editor copied to clipboard

fix(wysiwyg): fix serialization of yfm-cut and yfm-note

Open d3m1d0v opened this issue 4 months ago • 2 comments

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.

d3m1d0v avatar Oct 13 '25 13:10 d3m1d0v

Preview is ready.

gravity-ui-bot avatar Oct 13 '25 13:10 gravity-ui-bot

Visual Tests Report is ready.

gravity-ui-bot avatar Oct 13 '25 13:10 gravity-ui-bot