use Word line spacing units and join adjacent lists

This commit is contained in:
Alex Turchyn authored and Pete Matsyburka committed 2026-10-03 14:05:38 +03:00
1 parent f77a716658
commit 1e43fe8969
2 files changed
+13 -4

No files matched your search

@@ -1018,8 +1018,17 @@ const Formatting = Extension.create({
}
if (dispatch) {
selectedTextblocks(state).forEach(({ node, pos, numbering }) => {
tr.setNodeMarkup(pos, null, { ...node.attrs, htmlAttrs: withNumberingClass(node.attrs.htmlAttrs, `doc-list-${listStyle}-${numbering?.level || 0}`) })
const blocks = selectedTextblocks(state)
const $before = state.doc.resolve(blocks[0].pos)
const $after = state.doc.resolve(blocks.at(-1).pos + blocks.at(-1).node.nodeSize)
const adjacent = [[$before.nodeBefore, $before.pos - $before.nodeBefore?.nodeSize], [$after.nodeAfter, $after.pos]]
.map(([node, pos]) => node && findNumbering(node) && numberingListStyle(view, pos) === listStyle && findNumbering(node).prefix)
.find(Boolean)
blocks.forEach(({ node, pos, numbering }) => {
const className = numbering ? `doc-list-${listStyle}-${numbering.level}` : `${adjacent || `doc-list-${listStyle}`}-0`
tr.setNodeMarkup(pos, null, { ...node.attrs, htmlAttrs: withNumberingClass(node.attrs.htmlAttrs, className) })
})
}
@@ -125,7 +125,7 @@
:key="value"
class="block w-full text-left px-2 py-1 rounded-md hover:bg-neutral-100"
:class="{ 'bg-neutral-200': value === lineHeight }"
@click="setBlockStyle('line-height', value)"
@click="setBlockStyle('line-height', `calc(${value} * 1.15)`)"
>
{{ value }}
</button>
@@ -665,7 +665,7 @@ export default {
const align = blockStyle.textAlign.replace('start', 'left').replace('end', 'right')
this.textAlign = this.alignIcons[align] ? align : 'left'
this.lineHeight = String(Math.round(parseFloat(blockStyle.lineHeight) / parseFloat(blockStyle.fontSize) * 100) / 100)
this.lineHeight = String(Math.round(parseFloat(blockStyle.lineHeight) / parseFloat(blockStyle.fontSize) / 1.15 * 100) / 100)
}
this.listStyle = findNumbering($from.parent) ? numberingListStyle(view, $from.before()) : null