diff options
author | bobzel <zzzman@gmail.com> | 2023-03-08 12:33:16 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2023-03-08 12:33:16 -0500 |
commit | 071aa191d37f2805bd717c1d1caf8b2a57c394bc (patch) | |
tree | 82b13306be383397735f8b1fd92c56c4336d533c /src/fields/Doc.ts | |
parent | 871925ecc9f15377339afc907a2000fecfe3240d (diff) |
added progressive disclosure for collections.
Diffstat (limited to 'src/fields/Doc.ts')
-rw-r--r-- | src/fields/Doc.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/fields/Doc.ts b/src/fields/Doc.ts index ed5eaa756..7713d884e 100644 --- a/src/fields/Doc.ts +++ b/src/fields/Doc.ts @@ -1304,6 +1304,7 @@ export namespace Doc { } export function linkFollowUnhighlight() { + clearTimeout(UnhighlightTimer); UnhighlightWatchers.forEach(watcher => watcher()); UnhighlightWatchers.length = 0; highlightedDocs.forEach(doc => Doc.UnHighlightDoc(doc)); @@ -1345,12 +1346,15 @@ export namespace Doc { } }); } - export function UnHighlightDoc(doc: Doc) { + /// if doc is defined, then it is unhighlighted, otherwise all highlighted docs are unhighlighted + export function UnHighlightDoc(doc?: Doc) { runInAction(() => { - highlightedDocs.delete(doc); - highlightedDocs.delete(Doc.GetProto(doc)); - doc[HighlightSym] = Doc.GetProto(doc)[HighlightSym] = false; - doc[AnimationSym] = undefined; + (doc ? [doc] : Array.from(highlightedDocs)).forEach(doc => { + highlightedDocs.delete(doc); + highlightedDocs.delete(Doc.GetProto(doc)); + doc[HighlightSym] = Doc.GetProto(doc)[HighlightSym] = false; + doc[AnimationSym] = undefined; + }); }); } export function UnBrushAllDocs() { |