fix: Enter keeps an empty line inside the columns section
The base Enter chain's liftEmptyBlock lifted an empty block out of the section (and split the fragment mid-run), so the caret left column 1 for the page below instead of moving on to column 2. Inside a section Enter now only splits the block; a list keeps its own escape. Claude-Session: https://claude.ai/code/session_01Gpw1ctsR8FrdNMrpqePtik
This commit is contained in:
1 parent
e70c1e9c6c
commit
5c0ac978f4
2 files changed
+15
-1
No files matched your search
@@ -223,6 +223,20 @@ export const Columns = Node.create({
|
||||
}), 0];
|
||||
},
|
||||
|
||||
// Enter in an empty block: the base chain lifts it out of the section, or splits
|
||||
// the fragment mid-run — a section must read as flowing text, so it only ever
|
||||
// splits the block. Core keymaps come later, so this binding is reached first.
|
||||
addKeyboardShortcuts() {
|
||||
return {
|
||||
Enter: ({ editor }) => {
|
||||
const { $cursor } = editor.state.selection as TextSelection;
|
||||
if (!$cursor || $cursor.parent.content.size) return false;
|
||||
if ($cursor.node(-1)?.type.name !== 'columns') return false;
|
||||
return editor.commands.splitBlock();
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
addCommands() {
|
||||
return {
|
||||
// Inside a section: 1 unwraps the whole chain, 2/3 update its count. Outside:
|
||||
|
||||
Reference in new issue
Block a user