diff options
author | Sam Wilkins <abdullah_ahmed@brown.edu> | 2019-04-13 19:06:18 -0400 |
---|---|---|
committer | Sam Wilkins <abdullah_ahmed@brown.edu> | 2019-04-13 19:06:18 -0400 |
commit | 8c58ff299e371c70147aa8123ed9fb0ae1a9e880 (patch) | |
tree | 1592b23dc2da31e7c200cd1c4c8f01181c8bbf60 /src/client/views/nodes/FormattedTextBox.tsx | |
parent | 79a0d8d66204868158849afda6518f6c641c826b (diff) | |
parent | 74411165f21b6c616fa98e0676c6f4568c2d4564 (diff) |
added typesheet for full prosemirror keymap
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
-rw-r--r-- | src/client/views/nodes/FormattedTextBox.tsx | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index ec766e069..e872ea48b 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -16,6 +16,8 @@ import { Main } from "../Main"; import { FieldView, FieldViewProps } from "./FieldView"; import "./FormattedTextBox.scss"; import React = require("react"); +import { undoItem } from "prosemirror-menu"; +import buildKeymap from "../../util/ProsemirrorKeymap"; const { buildMenuItems } = require("prosemirror-example-setup"); const { menuBar } = require("prosemirror-menu"); @@ -64,12 +66,6 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { } } - undo = <S extends Schema = any>(state: EditorState<S>, dispatch?: (tr: Transaction<S>) => void): boolean => { - console.log(state); - console.log(dispatch); - return true; - } - get FieldDoc() { return this.props.fieldKey === KeyStore.Archives ? Main.Instance._textDoc! : this.props.Document; } get FieldKey() { return this.props.fieldKey === KeyStore.Archives ? KeyStore.Data : this.props.fieldKey; } @@ -79,7 +75,7 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { inpRules, //these currently don't do anything, but could eventually be helpful plugins: [ history(), - keymap({ "Mod-z": this.undo, "Mod-y": redo }), + keymap(buildKeymap(schema)), keymap(baseKeymap), this.tooltipMenuPlugin() ] @@ -213,7 +209,8 @@ export class FormattedTextBox extends React.Component<FieldViewProps> { }); } onKeyPress(e: React.KeyboardEvent) { - e.stopPropagation(); + console.log(e.keyCode) + // e.stopPropagation(); // stop propagation doesn't seem to stop propagation of native keyboard events. // so we set a flag on the native event that marks that the event's been handled. // (e.nativeEvent as any).DASHFormattedTextBoxHandled = true; |