initial commit

This commit is contained in:
Philipp Kühn
2018-08-20 23:02:21 +02:00
parent b37be519d8
commit d111afe7ac
64 changed files with 11545 additions and 0 deletions

33
src/nodes/HardBreak.js Normal file
View File

@@ -0,0 +1,33 @@
import { Node } from 'vue-mirror/utils'
import { chainCommands, exitCode } from 'vue-mirror/helpers'
export default class HardBreakNode extends Node {
get name() {
return 'hard_break'
}
get schema() {
return {
inline: true,
group: 'inline',
selectable: false,
parseDOM: [
{ tag: 'br' },
],
toDOM: () => ['br'],
}
}
keys({ type }) {
const command = chainCommands(exitCode, (state, dispatch) => {
dispatch(state.tr.replaceSelectionWith(type.create()).scrollIntoView())
return true
})
return {
'Mod-Enter': command,
'Shift-Enter': command,
}
}
}