use splitBlockKeepMarks by default, disable weird selectAll
This commit is contained in:
@@ -1,9 +1,51 @@
|
|||||||
import { baseKeymap } from 'prosemirror-commands'
|
import {
|
||||||
|
chainCommands,
|
||||||
|
newlineInCode,
|
||||||
|
createParagraphNear,
|
||||||
|
liftEmptyBlock,
|
||||||
|
splitBlockKeepMarks,
|
||||||
|
exitCode,
|
||||||
|
deleteSelection,
|
||||||
|
joinForward,
|
||||||
|
joinBackward,
|
||||||
|
selectNodeForward,
|
||||||
|
selectNodeBackward,
|
||||||
|
} from 'prosemirror-commands'
|
||||||
|
import { undoInputRule } from 'prosemirror-inputrules'
|
||||||
import { createExtension } from '../Extension'
|
import { createExtension } from '../Extension'
|
||||||
|
|
||||||
export const BaseKeymap = createExtension({
|
export const BaseKeymap = createExtension({
|
||||||
addKeyboardShortcuts() {
|
addKeyboardShortcuts() {
|
||||||
return baseKeymap
|
const enter = chainCommands(
|
||||||
|
newlineInCode,
|
||||||
|
createParagraphNear,
|
||||||
|
liftEmptyBlock,
|
||||||
|
splitBlockKeepMarks,
|
||||||
|
)
|
||||||
|
|
||||||
|
const backspace = chainCommands(
|
||||||
|
undoInputRule,
|
||||||
|
deleteSelection,
|
||||||
|
joinBackward,
|
||||||
|
selectNodeBackward,
|
||||||
|
)
|
||||||
|
|
||||||
|
const del = chainCommands(
|
||||||
|
deleteSelection,
|
||||||
|
joinForward,
|
||||||
|
selectNodeForward,
|
||||||
|
)
|
||||||
|
|
||||||
|
return {
|
||||||
|
Enter: enter,
|
||||||
|
'Mod-Enter': exitCode,
|
||||||
|
Backspace: backspace,
|
||||||
|
'Mod-Backspace': backspace,
|
||||||
|
Delete: del,
|
||||||
|
'Mod-Delete': del,
|
||||||
|
// we don’t need a custom `selectAll` for now
|
||||||
|
// 'Mod-a': () => this.editor.selectAll(),
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ export { DeleteSelection } from './deleteSelection'
|
|||||||
export { Editable } from './editable'
|
export { Editable } from './editable'
|
||||||
export { Focus } from './focus'
|
export { Focus } from './focus'
|
||||||
export { FocusEvents } from './focusEvents'
|
export { FocusEvents } from './focusEvents'
|
||||||
export { InputRules } from './inputRules'
|
|
||||||
export { InsertHTML } from './insertHTML'
|
export { InsertHTML } from './insertHTML'
|
||||||
export { InsertText } from './insertText'
|
export { InsertText } from './insertText'
|
||||||
export { BaseKeymap } from './baseKeymap'
|
export { BaseKeymap } from './baseKeymap'
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
import { undoInputRule } from 'prosemirror-inputrules'
|
|
||||||
import { createExtension } from '../Extension'
|
|
||||||
|
|
||||||
export const InputRules = createExtension({
|
|
||||||
addKeyboardShortcuts() {
|
|
||||||
return {
|
|
||||||
Backspace: undoInputRule,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
declare module '../Editor' {
|
|
||||||
interface AllExtensions {
|
|
||||||
InputRules: typeof InputRules,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user