mirror of
https://github.com/heyman/heynote.git
synced 2024-11-21 23:43:22 +01:00
Make the insertNewBlockAtCursor use the same block language/auto setting as the block that is being split
This commit is contained in:
parent
9987c01207
commit
ed13baf4e4
@ -15,8 +15,14 @@ export { moveLineDown, moveLineUp }
|
||||
export const insertNewBlockAtCursor = ({ state, dispatch }) => {
|
||||
if (state.readOnly)
|
||||
return false
|
||||
|
||||
const delimText = "\n∞∞∞text-a\n"
|
||||
|
||||
const currentBlock = getActiveNoteBlock(state)
|
||||
let delimText;
|
||||
if (currentBlock) {
|
||||
delimText = `\n∞∞∞${currentBlock.language.name}${currentBlock.language.auto ? "-a" : ""}\n`
|
||||
} else {
|
||||
delimText = "\n∞∞∞text-a\n"
|
||||
}
|
||||
dispatch(state.replaceSelection(delimText),
|
||||
{
|
||||
scrollIntoView: true,
|
||||
|
Loading…
Reference in New Issue
Block a user