aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FormattedTextBox.tsx
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-12-09 10:16:55 -0500
committerbob <bcz@cs.brown.edu>2019-12-09 10:16:55 -0500
commite5ca273b70c2c41f953ad2a534afabdb313f3e99 (patch)
tree05a92122a5bac7dabe8cf8171a64b94fae0bbf8d /src/client/views/nodes/FormattedTextBox.tsx
parentfef12d4ca96d35c230a3a5e7c053b9b90eb38243 (diff)
changed styles to allow multi-character names using %. switched default "styles" of todo, ignore, etc to use % style notation
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx13
1 files changed, 12 insertions, 1 deletions
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();
}