From e25be4e4124c1da9d7f7c8b3f9ffd48e36efeabc Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Tue, 25 Feb 2020 22:30:38 -0500 Subject: fixed schema column selection from key press. add 'b' for creating backgrounds. added unlock for isBackground documents. --- .../views/collections/CollectionSchemaHeaders.tsx | 14 ++++++-------- .../collections/collectionFreeForm/MarqueeView.tsx | 19 +++++++++++++++---- src/client/views/nodes/DocumentView.scss | 17 +++++++++++++++++ src/client/views/nodes/DocumentView.tsx | 6 ++++-- 4 files changed, 42 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionSchemaHeaders.tsx b/src/client/views/collections/CollectionSchemaHeaders.tsx index c585506b3..507ee89e4 100644 --- a/src/client/views/collections/CollectionSchemaHeaders.tsx +++ b/src/client/views/collections/CollectionSchemaHeaders.tsx @@ -291,13 +291,11 @@ class KeysDropdown extends React.Component { onKeyDown = (e: React.KeyboardEvent): void => { if (e.key === "Enter") { const keyOptions = this._searchTerm === "" ? this.props.possibleKeys : this.props.possibleKeys.filter(key => key.toUpperCase().indexOf(this._searchTerm.toUpperCase()) > -1); - const exactFound = keyOptions.findIndex(key => key.toUpperCase() === this._searchTerm.toUpperCase()) > -1 || - this.props.existingKeys.findIndex(key => key.toUpperCase() === this._searchTerm.toUpperCase()) > -1; - - if (!exactFound && this._searchTerm !== "" && this.props.canAddNew) { + if (keyOptions.length) { + this.onSelect(keyOptions[0]); + } else if (this._searchTerm !== "" && this.props.canAddNew) { + this.setSearchTerm(this._searchTerm || this._key); this.onSelect(this._searchTerm); - } else { - this.setSearchTerm(this._key); } } } @@ -338,7 +336,7 @@ class KeysDropdown extends React.Component { this.props.existingKeys.findIndex(key => key.toUpperCase() === this._searchTerm.toUpperCase()) > -1; const options = keyOptions.map(key => { - return
{ this.onSelect(key); this.setSearchTerm(""); }}>{key}
; + return
e.stopPropagation()} onClick={() => { this.onSelect(key); this.setSearchTerm(""); }}>{key}
; }); // if search term does not already exist as a group type, give option to create new group type @@ -356,7 +354,7 @@ class KeysDropdown extends React.Component {
this.onChange(e.target.value)} onFocus={this.onFocus} onBlur={this.onBlur}> -
+
{this.renderOptions()}
diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx index 3cfefc25e..b1cca027d 100644 --- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx +++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx @@ -302,7 +302,7 @@ export class MarqueeView extends React.Component { + getCollection = (selected: Doc[], asTemplate: boolean, isBackground: boolean = false) => { const bounds = this.Bounds; // const inkData = this.ink ? this.ink.inkData : undefined; const creator = asTemplate ? Docs.Create.StackingDocument : Docs.Create.FreeformDocument; @@ -311,7 +311,8 @@ export class MarqueeView extends React.Component { + const newCollection = this.getCollection([], false, true); + this.props.addDocument(newCollection); + MarqueeOptionsMenu.Instance.fadeOut(true); + this.hideMarquee(); + setTimeout(() => this.props.selectDocuments([newCollection], []), 0); + } @undoBatch @action @@ -380,7 +389,7 @@ export class MarqueeView extends React.Component(Docu
); const captionView = (!showCaption ? (null) :
- @@ -935,6 +936,7 @@ export class DocumentView extends DocComponent(Docu height: "100%", opacity: this.Document.opacity }}> + {this.Document.isBackground ?
: (null)} {this.onClickHandler && this.props.ContainingCollectionView?.props.Document._viewType === CollectionViewType.Time ? <> {this.innards}
-- cgit v1.2.3-70-g09d2