Skip to content

Commit

Permalink
fix code bug
Browse files Browse the repository at this point in the history
  • Loading branch information
shuntian committed Jul 25, 2024
1 parent 5c95dc4 commit b887a2b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/slate-convert/md-to-slate/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,30 @@ const applyMarkForInlineItem = (result, item, textNode = {}) => {
// https://symbl.cc/en/200B/
const formatValue = (value && value !== '​') ? value : '';
textNode['text'] = formatValue;
result.push(textNode);
result.push({ ...textNode });

// reset testNode
textNode = {};
return;
}

if (type === 'inlineCode') {
textNode['code'] = true;
textNode['text'] = value || '';
result.push(textNode);
result.push({ ...textNode });

// reset testNode
textNode = {};
return;
}

const attr_key = INLINE_KEY_MAP[type];
if (!Array.isArray(children) || children.length === 0 || !attr_key) {
textNode['text'] = value || '';
result.push(textNode);
result.push({ ...textNode });

// reset testNode
textNode = {};
return;
}

Expand Down

0 comments on commit b887a2b

Please sign in to comment.