widgets can now listen to sync data changes

This commit is contained in:
zadam
2019-08-06 22:39:27 +02:00
parent fcd87b3e2d
commit bfbc124e78
8 changed files with 60 additions and 9 deletions

View File

@@ -357,13 +357,14 @@ function fireDetailLoaded() {
detailLoadedListeners = [];
}
messagingService.subscribeToSyncMessages(syncData => {
messagingService.subscribeToOutsideSyncMessages(syncData => {
const noteIdsToRefresh = new Set();
syncData
.filter(sync => sync.entityName === 'notes')
.forEach(sync => noteIdsToRefresh.add(sync.entityId));
// we need to reload because of promoted attributes
syncData
.filter(sync => sync.entityName === 'attributes')
.forEach(sync => noteIdsToRefresh.add(sync.noteId));
@@ -373,6 +374,12 @@ messagingService.subscribeToSyncMessages(syncData => {
}
});
messagingService.subscribeToAllSyncMessages(syncData => {
for (const tc of tabContexts) {
tc.syncDataReceived(syncData);
}
});
$tabContentsContainer.on("dragover", e => e.preventDefault());
$tabContentsContainer.on("dragleave", e => e.preventDefault());