refac
This commit is contained in:
1 parent
d81886e315
commit
bf7a18a0f8
1 file changed
+7
@@ -301,6 +301,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.key === 'Enter') {
|
if (event.key === 'Enter') {
|
||||||
|
if (event.shiftKey) {
|
||||||
|
editor.commands.setHardBreak(); // Insert a hard break
|
||||||
|
view.dispatch(view.state.tr.scrollIntoView()); // Move viewport to the cursor
|
||||||
|
event.preventDefault();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
// Check if the current selection is inside a structured block (like codeBlock or list)
|
// Check if the current selection is inside a structured block (like codeBlock or list)
|
||||||
const { state } = view;
|
const { state } = view;
|
||||||
const { $head } = state.selection;
|
const { $head } = state.selection;
|
||||||
@@ -327,6 +333,7 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Handle shift + Enter for a line break
|
// Handle shift + Enter for a line break
|
||||||
if (shiftEnter) {
|
if (shiftEnter) {
|
||||||
|
|||||||
Reference in new issue
Block a user