aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/FormattedTextBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-12-12 19:22:46 -0500
committerbobzel <zzzman@gmail.com>2020-12-12 19:22:46 -0500
commit7f93d584dbd356f61c39cfe6c95647e4df003948 (patch)
treee3a9d15d9ccb1a51f2dbbb9c20bdae3c290476db /src/client/views/nodes/formattedText/FormattedTextBox.tsx
parent0aa855ab36ead1e4669f25e2a3604e8941cf2075 (diff)
fixed hitting Esc in text to turn off text options in menu
Diffstat (limited to 'src/client/views/nodes/formattedText/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/formattedText/FormattedTextBox.tsx25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
index 4be49ca47..0beea2bcd 100644
--- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx
+++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx
@@ -1530,24 +1530,25 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp
if (state.selection.empty || !this._rules!.EnteringStyle) {
this._rules!.EnteringStyle = false;
}
+ e.stopPropagation();
if (e.key === "Escape") {
this._editorView!.dispatch(state.tr.setSelection(TextSelection.create(state.doc, state.selection.from, state.selection.from)));
(document.activeElement as any).blur?.();
SelectionManager.DeselectAll();
- }
- e.stopPropagation();
- if (e.key === "Tab" || e.key === "Enter") {
- if (e.key === "Enter" && this.layoutDoc._timeStampOnEnter) {
- this.insertTime();
+ RichTextMenu.Instance.updateMenu(undefined, undefined, undefined);
+ } else {
+ if (e.key === "Tab" || e.key === "Enter") {
+ if (e.key === "Enter" && this.layoutDoc._timeStampOnEnter) {
+ this.insertTime();
+ }
+ e.preventDefault();
}
- e.preventDefault();
- }
- if (e.key === " " || this._lastTimedMark?.attrs.userid !== Doc.CurrentUserEmail) {
- const mark = schema.marks.user_mark.create({ userid: Doc.CurrentUserEmail, modified: Math.floor(Date.now() / 1000) });
- this._editorView!.dispatch(this._editorView!.state.tr.removeStoredMark(schema.marks.user_mark.create({})).addStoredMark(mark));
+ if (e.key === " " || this._lastTimedMark?.attrs.userid !== Doc.CurrentUserEmail) {
+ const mark = schema.marks.user_mark.create({ userid: Doc.CurrentUserEmail, modified: Math.floor(Date.now() / 1000) });
+ this._editorView!.dispatch(this._editorView!.state.tr.removeStoredMark(schema.marks.user_mark.create({})).addStoredMark(mark));
+ }
+ this.startUndoTypingBatch();
}
-
- this.startUndoTypingBatch();
}
ondrop = (eve: React.DragEvent) => {