From a43c3c014c3e7bbdfbee8bf234a5812d1601b945 Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 3 Nov 2020 17:28:37 -0500 Subject: fixed masonry view to not create empty documents --- src/client/views/collections/CollectionMasonryViewFieldRow.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/views/collections/CollectionMasonryViewFieldRow.tsx b/src/client/views/collections/CollectionMasonryViewFieldRow.tsx index 7014966c7..b35644c6b 100644 --- a/src/client/views/collections/CollectionMasonryViewFieldRow.tsx +++ b/src/client/views/collections/CollectionMasonryViewFieldRow.tsx @@ -138,7 +138,8 @@ export class CollectionMasonryViewFieldRow extends React.Component { + addDocument = (value: string, shiftDown?: boolean, forceEmptyNote?: boolean) => { + if (!value && !forceEmptyNote) return false; this._createAliasSelected = false; const key = StrCast(this.props.parent.props.Document._pivotField); const newDoc = Docs.Create.TextDocument(value, { _autoHeight: true, _width: 200, title: value }); @@ -239,6 +240,10 @@ export class CollectionMasonryViewFieldRow extends React.Component ); } + @action + textCallback = (char: string) => { + return this.addDocument("", false); + } @computed get contentLayout() { const rows = Math.max(1, Math.min(this.props.docList.length, Math.floor((this.props.parent.props.PanelWidth() - 2 * this.props.parent.xMargin) / (this.props.parent.columnWidth + this.props.parent.gridGap)))); @@ -247,6 +252,7 @@ export class CollectionMasonryViewFieldRow extends React.Component "", SetValue: this.addDocument, + textCallback: this.textCallback, contents: "+ NEW", HeadingObject: this.props.headingObject, toggle: this.toggleVisibility, -- cgit v1.2.3-70-g09d2