Fixes issue where selecting an editor for a note on one platform doesn't update the live session on another platform
This commit is contained in:
@@ -89,6 +89,25 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Observe editor changes to see if the current note should update its editor
|
||||||
|
|
||||||
|
modelManager.addItemSyncObserver("component-manager", "SN|Component", (allItems, validItems, deletedItems, source) => {
|
||||||
|
if(!this.note) { return; }
|
||||||
|
|
||||||
|
var editors = allItems.filter(function(item) {
|
||||||
|
return item.isEditor();
|
||||||
|
});
|
||||||
|
|
||||||
|
// If no editors have changed
|
||||||
|
if(editors.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Look through editors again and find the most proper one
|
||||||
|
var editor = this.editorForNote(this.note);
|
||||||
|
this.selectedEditor = editor;
|
||||||
|
});
|
||||||
|
|
||||||
this.editorForNote = function(note) {
|
this.editorForNote = function(note) {
|
||||||
let editors = componentManager.componentsForArea("editor-editor");
|
let editors = componentManager.componentsForArea("editor-editor");
|
||||||
for(var editor of editors) {
|
for(var editor of editors) {
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class ModelManager {
|
|||||||
/* Note that this function is public, and can also be called manually (desktopManager uses it) */
|
/* Note that this function is public, and can also be called manually (desktopManager uses it) */
|
||||||
notifySyncObserversOfModels(models, source) {
|
notifySyncObserversOfModels(models, source) {
|
||||||
for(var observer of this.itemSyncObservers) {
|
for(var observer of this.itemSyncObservers) {
|
||||||
var allRelevantItems = models.filter(function(item){return item.content_type == observer.type || observer.type == "*"});
|
var allRelevantItems = observer.type == "*" ? models : models.filter(function(item){return item.content_type == observer.type});
|
||||||
var validItems = [], deletedItems = [];
|
var validItems = [], deletedItems = [];
|
||||||
for(var item of allRelevantItems) {
|
for(var item of allRelevantItems) {
|
||||||
if(item.deleted) {
|
if(item.deleted) {
|
||||||
|
|||||||
Reference in New Issue
Block a user