Skip to content

Commit

Permalink
Fix insertCodeBlock working with CRLF (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanzhong authored Nov 24, 2024
1 parent e08e18b commit 52222a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CoreEditor/src/modules/input/insertCodeBlock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default function insertCodeBlock(editor: EditorView) {

// Insert an empty code block and move the cursor to the empty line
return {
range: EditorSelection.cursor(from + prefix.length),
range: EditorSelection.cursor(from + mark.length + 1), // Don't use prefix.length, it doesn't work for CRLF
changes: {
from, to, insert: prefix + `${state.lineBreak}${mark}${mark}${mark}`,
},
Expand Down

0 comments on commit 52222a3

Please sign in to comment.