diff options
| author | Bob Zeleznik <zzzman@gmail.com> | 2019-12-15 21:47:34 -0500 |
|---|---|---|
| committer | Bob Zeleznik <zzzman@gmail.com> | 2019-12-15 21:47:34 -0500 |
| commit | 15333069562d265a8bc8e5d1d3ec1bfc564d8796 (patch) | |
| tree | 3275e01f539a594fe822c00bc1981bbffc4aed38 /src | |
| parent | 7eb932ee4598ac12ba0b854325f51d4a1d052b7f (diff) | |
fixed auto show seleted function
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/views/nodes/DocumentBox.tsx | 2 | ||||
| -rw-r--r-- | src/new_fields/Doc.ts | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/src/client/views/nodes/DocumentBox.tsx b/src/client/views/nodes/DocumentBox.tsx index 2f2cba485..b9a97b42d 100644 --- a/src/client/views/nodes/DocumentBox.tsx +++ b/src/client/views/nodes/DocumentBox.tsx @@ -22,7 +22,7 @@ export class DocumentBox extends DocComponent<FieldViewProps, DocBoxSchema>(DocB specificContextMenu = (e: React.MouseEvent): void => { const funcs: ContextMenuProps[] = []; - funcs.push({ description: "Auto Show Selected", event: () => Doc.GetProto(this.props.Document).data = ComputedField.MakeFunction("selectedDocs(this,true,_last_)?.[0]"), icon: "expand-arrows-alt" }); + funcs.push({ description: "Auto Show Selected", event: () => Doc.GetProto(this.props.Document).data = ComputedField.MakeFunction("selectedDocs(this,true,[_last_])?.[0]"), icon: "expand-arrows-alt" }); ContextMenu.Instance.addItem({ description: "DocumentBox Funcs...", subitems: funcs, icon: "asterisk" }); } diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts index 171f3fd2d..c3a6a1658 100644 --- a/src/new_fields/Doc.ts +++ b/src/new_fields/Doc.ts @@ -756,6 +756,5 @@ Scripting.addGlobal(function undo() { return UndoManager.Undo(); }); Scripting.addGlobal(function redo() { return UndoManager.Redo(); }); Scripting.addGlobal(function selectedDocs(container: Doc, excludeCollections: boolean, prevValue: any) { let docs = DocListCast(Doc.UserDoc().SelectedDocs).filter(d => (!excludeCollections || !Cast(d.data, listSpec(Doc), null)) && d.type !== DocumentType.KVP && !Doc.AreProtosEqual(d, container)); - if (!docs.length) return prevValue; - return new List(docs); + return docs.length ? new List(docs) : prevValue; });
\ No newline at end of file |
