diff options
Diffstat (limited to 'src/fields')
-rw-r--r-- | src/fields/Doc.ts | 6 | ||||
-rw-r--r-- | src/fields/List.ts | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index af2ea73d5..c2b491454 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -915,6 +915,10 @@ export namespace Doc { brushManager.SearchMatchDoc.has(Doc.GetProto(doc)) ? brushManager.SearchMatchDoc.get(Doc.GetProto(doc)) : undefined; })(doc); } + export function IsSearchMatchUnmemoized(doc: Doc) { + return brushManager.SearchMatchDoc.has(doc) ? brushManager.SearchMatchDoc.get(doc) : + brushManager.SearchMatchDoc.has(Doc.GetProto(doc)) ? brushManager.SearchMatchDoc.get(Doc.GetProto(doc)) : undefined; + } export function SetSearchMatch(doc: Doc, results: { searchMatch: number }) { if (!doc || GetEffectiveAcl(doc) === AclPrivate || GetEffectiveAcl(Doc.GetProto(doc)) === AclPrivate) return doc; brushManager.SearchMatchDoc.set(doc, results); @@ -1276,7 +1280,7 @@ Scripting.addGlobal(function copyDragFactory(dragFactory: Doc) { Doc.SetInPlace(ndoc, "title", ndoc.title + " " + NumCast(dragFactory["dragFactory-count"]).toString(), true); } return ndoc; -}) +}); Scripting.addGlobal(function copyField(field: any) { return field instanceof ObjectField ? ObjectField.MakeCopy(field) : field; }); Scripting.addGlobal(function docList(field: any) { return DocListCast(field); }); Scripting.addGlobal(function setInPlace(doc: any, field: any, value: any) { return Doc.SetInPlace(doc, field, value, false); }); diff --git a/src/fields/List.ts b/src/fields/List.ts index 1c2b89b01..3601f282b 100644 --- a/src/fields/List.ts +++ b/src/fields/List.ts @@ -334,5 +334,5 @@ Scripting.addGlobal("List", List); Scripting.addGlobal(function compareLists(l1: any, l2: any) { const L1 = Cast(l1, listSpec("string"), []); const L2 = Cast(l2, listSpec("string"), []); - return L1 && L2 && L1.length === L2.length && L2.reduce((p, v) => p && L1.includes(v), true); + return !L1 && !L2 ? true : L1 && L2 && L1.length === L2.length && L2.reduce((p, v) => p && L1.includes(v), true); }, "compare two lists");
\ No newline at end of file |