aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2020-10-08 21:57:50 -0400
committerbobzel <zzzman@gmail.com>2020-10-08 21:57:50 -0400
commit93c50b6ea3b24994d836ad24c8476c9f9012a089 (patch)
tree47ec50b65fe723c1183b5cb81b7992d0ed165c78
parent24e31df47a0d38de8073da69cc4ea78a2e5be6cd (diff)
added direct typing of notes into stacking columns in text box sidebar.
-rw-r--r--src/client/views/EditableView.tsx7
-rw-r--r--src/client/views/collections/CollectionStackingViewFieldColumn.tsx6
2 files changed, 13 insertions, 0 deletions
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx
index d35271ffd..8b1b12365 100644
--- a/src/client/views/EditableView.tsx
+++ b/src/client/views/EditableView.tsx
@@ -47,6 +47,7 @@ export interface EditableProps {
onClick?: (e: React.MouseEvent) => boolean;
isEditingCallback?: (isEditing: boolean) => void;
menuCallback?: (x: number, y: number) => void;
+ textCallback?: (char: string) => boolean;
showMenuOnLoad?: boolean;
HeadingObject?: SchemaHeaderField | undefined;
toggle?: () => void;
@@ -119,6 +120,12 @@ export class EditableView extends React.Component<EditableProps> {
case ":":
this.props.menuCallback?.(e.currentTarget.getBoundingClientRect().x, e.currentTarget.getBoundingClientRect().y);
break;
+ case "Shift": case "Alt": case "Meta": case "Control": break;
+ default:
+ if (this.props.textCallback?.(e.key)) {
+ this._editing = false;
+ this.props.isEditingCallback?.(false,);
+ }
}
}
diff --git a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
index 1bc989e83..74ea824cd 100644
--- a/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
+++ b/src/client/views/collections/CollectionStackingViewFieldColumn.tsx
@@ -131,6 +131,11 @@ export class CollectionStackingViewFieldColumn extends React.Component<CSVFieldC
}
@action
+ textCallback = (char: string) => {
+ return this.addDocument(char, false);
+ }
+
+ @action
addDocument = (value: string, shiftDown?: boolean) => {
if (!value) return false;
const key = StrCast(this.props.parent.props.Document._pivotField);
@@ -300,6 +305,7 @@ export class CollectionStackingViewFieldColumn extends React.Component<CSVFieldC
const newEditableViewProps = {
GetValue: () => "",
SetValue: this.addDocument,
+ textCallback: this.textCallback,
contents: "+ NEW",
HeadingObject: this.props.headingObject,
toggle: this.toggleVisibility,