Open Lieblein opened 3 years ago
Function getBlockStyle give incorrect counter value. For example:
I have for this case in md:
But I would see this:
Original code of getBlockStyle:
const getBlockStyle = (currentStyle, appliedBlockStyles) => { if (currentStyle === 'ordered-list-item') { const counter = appliedBlockStyles.reduce((prev, style) => { if (style === 'ordered-list-item') { return prev + 1; } return prev; }, 1); return `${counter}. `; } return blockStyleDict[currentStyle] || ''; };
My version:
const getBlockStyle = (currentStyle, appliedBlockStyles) => { if (currentStyle === 'ordered-list-item') { let count = 0; for (let i = appliedBlockStyles.length - 1; i >= 0; i--) { if (appliedBlockStyles[i] !== 'ordered-list-item') { break; } else { count++; } } return `${count + 1}. `; } return blockStyleDict[currentStyle] || ''; };
Function getBlockStyle give incorrect counter value. For example:
I have for this case in md:
But I would see this:
Original code of getBlockStyle:
My version: