aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Doc.ts
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-12-15 12:44:20 -0500
committerBob Zeleznik <zzzman@gmail.com>2019-12-15 12:44:20 -0500
commit6683517a69f4806d026e7af85069f18b1f0a9d1f (patch)
treecfe8beeb58abae2479fc387a4636deae55f2a8cb /src/new_fields/Doc.ts
parent877a6f481a06e2454ff9d8eabe43acb0e58a2676 (diff)
added _last_ for computedScripts to access last value of script
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r--src/new_fields/Doc.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index a22b289bb..171f3fd2d 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -754,9 +754,8 @@ Scripting.addGlobal(function docList(field: any) { return DocListCast(field); })
Scripting.addGlobal(function sameDocs(doc1: any, doc2: any) { return Doc.AreProtosEqual(doc1, doc2); });
Scripting.addGlobal(function undo() { return UndoManager.Undo(); });
Scripting.addGlobal(function redo() { return UndoManager.Redo(); });
-Scripting.addGlobal(function selectedDocs(container: Doc, excludeCollections: boolean) {
+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) untracked(() => container && (container.cachedSelection = new List(docs)));
- else docs = untracked(() => DocListCast(container.cachedSelection));
+ if (!docs.length) return prevValue;
return new List(docs);
}); \ No newline at end of file