emdash rendering

This commit is contained in:
TC
2026-06-05 10:53:51 +10:00
parent dc38afb23c
commit 19049cfc04

View File

@@ -681,6 +681,21 @@ export function MarkdownEditor(): JSX.Element {
{ key: 'Mod-Shift-s', run: (view) => wrapOrUnwrap(view, '~~') },
{ key: 'Mod-e', run: (view) => wrapOrUnwrap(view, '`') },
{ key: 'Mod-k', run: insertLink },
{
key: '-',
run: (view) => {
const { state } = view
const { from } = state.selection.main
if (from >= 1 && state.sliceDoc(from - 1, from) === '-') {
view.dispatch(state.update({
changes: { from: from - 1, to: from, insert: '—' },
userEvent: 'input'
}))
return true
}
return false
}
},
{ key: 'Mod-Shift-.', run: (view) => toggleLinePrefix(view, '> ') },
{ key: 'Mod-1', run: (view) => setHeading(view, 1) },
{ key: 'Mod-2', run: (view) => setHeading(view, 2) },