File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { LINEAGE_VIEW_TYPE , LineageView } from 'src/view/view' ;
2+
3+ export const refreshActiveViewOfDocument = ( view : LineageView ) => {
4+ const views : [ string , string ] [ ] = view . plugin . app . workspace
5+ . getLeavesOfType ( LINEAGE_VIEW_TYPE )
6+ . map ( ( leaf ) =>
7+ leaf . view instanceof LineageView &&
8+ leaf . view !== view &&
9+ leaf . view . file
10+ ? [ leaf . view . id , leaf . view . file . path ]
11+ : null ,
12+ )
13+ . filter ( ( x ) => x ) as [ string , string ] [ ] ;
14+
15+ view . plugin . store . dispatch ( {
16+ type : 'plugin/documents/refresh-active-view-of-document' ,
17+ payload : { views } ,
18+ } ) ;
19+ } ;
Original file line number Diff line number Diff line change 11import Lineage from 'src/main' ;
2- import { LINEAGE_VIEW_TYPE , LineageView } from 'src/view/view' ;
2+ import { LineageView } from 'src/view/view' ;
33import { removeStaleDocuments } from 'src/stores/plugin/subscriptions/effects/remove-stale-documents/remove-stale-documents' ;
4- import { MarkdownView } from 'obsidian' ;
54
65export const onWorkspaceEvent = ( plugin : Lineage ) => {
76 const onActiveLeafChangeRef = plugin . app . workspace . on (
@@ -16,19 +15,6 @@ export const onWorkspaceEvent = (plugin: Lineage) => {
1615 viewId : view . id ,
1716 } ,
1817 } ) ;
19- } else if ( view instanceof MarkdownView ) {
20- const views : [ string , string ] [ ] = plugin . app . workspace
21- . getLeavesOfType ( LINEAGE_VIEW_TYPE )
22- . map ( ( leaf ) =>
23- leaf . view instanceof LineageView && leaf . view . file
24- ? [ leaf . view . id , leaf . view . file . path ]
25- : null ,
26- )
27- . filter ( ( x ) => x ) as [ string , string ] [ ] ;
28- plugin . store . dispatch ( {
29- type : 'plugin/documents/refresh-active-view-of-document' ,
30- payload : { views } ,
31- } ) ;
3218 }
3319 plugin . store . dispatch ( {
3420 type : 'plugin/echo/workspace/active-leaf-change' ,
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ import { lang } from 'src/lang/lang';
4949import { DebouncedMinimapEffects } from 'src/stores/minimap/subscriptions/effects/debounced-minimap-effects' ;
5050import { updateFrontmatter } from 'src/stores/view/subscriptions/actions/document/update-frontmatter' ;
5151import { loadFullDocument } from 'src/stores/view/subscriptions/actions/document/load-full-document' ;
52+ import { refreshActiveViewOfDocument } from 'src/stores/plugin/actions/refresh-active-view-of-document' ;
5253
5354export const LINEAGE_VIEW_TYPE = 'lineage' ;
5455
@@ -138,6 +139,7 @@ export class LineageView extends TextFileView {
138139 for ( const s of this . onDestroyCallbacks ) {
139140 s ( ) ;
140141 }
142+ refreshActiveViewOfDocument ( this ) ;
141143 }
142144
143145 clear ( ) : void {
You can’t perform that action at this time.
0 commit comments