From e5ca273b70c2c41f953ad2a534afabdb313f3e99 Mon Sep 17 00:00:00 2001 From: bob Date: Mon, 9 Dec 2019 10:16:55 -0500 Subject: changed styles to allow multi-character names using %. switched default "styles" of todo, ignore, etc to use % style notation --- src/client/views/nodes/FormattedTextBox.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/client/views') diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx index 3302d2e54..11fececd7 100644 --- a/src/client/views/nodes/FormattedTextBox.tsx +++ b/src/client/views/nodes/FormattedTextBox.tsx @@ -351,7 +351,7 @@ export class FormattedTextBox extends DocAnnotatableComponent<(FieldViewProps & addStyleSheetRule(FormattedTextBox._userStyleSheet, "userTag-" + "disagree", { "text-decoration": "line-through" }); } if (FormattedTextBox._highlights.indexOf("Ignore Items") !== -1) { - addStyleSheetRule(FormattedTextBox._userStyleSheet, "userTag-" + "ignore", { "font-size": "0" }); + addStyleSheetRule(FormattedTextBox._userStyleSheet, "userTag-" + "ignore", { "font-size": "1" }); } if (FormattedTextBox._highlights.indexOf("By Recent Minute") !== -1) { addStyleSheetRule(FormattedTextBox._userStyleSheet, "userMark-" + Doc.CurrentUserEmail.replace(".", "").replace("@", ""), { opacity: "0.1" }); @@ -1040,7 +1040,18 @@ export class FormattedTextBox extends DocAnnotatableComponent<(FieldViewProps & } this.doLinkOnDeselect(); } + onKeyPress = (e: React.KeyboardEvent) => { + if (!this._editorView!.state.selection.empty && e.key === "%") { + (this._editorView!.state as any).EnteringStyle = true; + e.preventDefault(); + e.stopPropagation(); + return; + } + + if (this._editorView!.state.selection.empty || !(this._editorView!.state as any).EnteringStyle) { + (this._editorView!.state as any).EnteringStyle = false; + } if (e.key === "Escape") { SelectionManager.DeselectAll(); } -- cgit v1.2.3-70-g09d2