Merge branch 'master' of github.com:standardnotes/web into sfv3
This commit is contained in:
@@ -40,6 +40,33 @@ angular.module('app')
|
||||
this.loadTagsString();
|
||||
}.bind(this));
|
||||
|
||||
modelManager.addItemSyncObserver("component-manager", "Note", (allItems, validItems, deletedItems, source) => {
|
||||
if(!this.note) { return; }
|
||||
|
||||
// Before checking if isMappingSourceRetrieved, we check if this item was deleted via a local source,
|
||||
// such as alternating uuids during sign in. Otherwise, we only want to make interface updates if it's a
|
||||
// remote retrieved source.
|
||||
if(this.note.deleted) {
|
||||
$rootScope.notifyDelete();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!ModelManager.isMappingSourceRetrieved(source)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var matchingNote = allItems.find((item) => {
|
||||
return item.uuid == this.note.uuid;
|
||||
});
|
||||
|
||||
if(!matchingNote) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Update tags
|
||||
this.loadTagsString();
|
||||
});
|
||||
|
||||
this.noteDidChange = function(note, oldNote) {
|
||||
this.setNote(note, oldNote);
|
||||
this.reloadComponentContext();
|
||||
|
||||
@@ -145,11 +145,11 @@ angular.module('app')
|
||||
}
|
||||
|
||||
$scope.tagsSelectionMade = function(tag) {
|
||||
$scope.selectedTag = tag;
|
||||
|
||||
if($scope.selectedNote && $scope.selectedNote.dummy) {
|
||||
modelManager.removeItemLocally($scope.selectedNote);
|
||||
}
|
||||
|
||||
$scope.selectedTag = tag;
|
||||
}
|
||||
|
||||
$scope.tagsAddNew = function(tag) {
|
||||
@@ -227,7 +227,7 @@ angular.module('app')
|
||||
this.$apply(fn);
|
||||
};
|
||||
|
||||
$scope.notifyDelete = function() {
|
||||
$rootScope.notifyDelete = function() {
|
||||
$timeout(function() {
|
||||
$rootScope.$broadcast("noteDeleted");
|
||||
}.bind(this), 0);
|
||||
@@ -243,7 +243,7 @@ angular.module('app')
|
||||
|
||||
if(note.dummy) {
|
||||
modelManager.removeItemLocally(note);
|
||||
$scope.notifyDelete();
|
||||
$rootScope.notifyDelete();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -251,11 +251,11 @@ angular.module('app')
|
||||
if(authManager.offline()) {
|
||||
// when deleting items while ofline, we need to explictly tell angular to refresh UI
|
||||
setTimeout(function () {
|
||||
$scope.notifyDelete();
|
||||
$rootScope.notifyDelete();
|
||||
$scope.safeApply();
|
||||
}, 50);
|
||||
} else {
|
||||
$scope.notifyDelete();
|
||||
$rootScope.notifyDelete();
|
||||
}
|
||||
}, null, "deleteNote");
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ angular.module('app')
|
||||
this.onNoteRemoval = function() {
|
||||
let visibleNotes = this.visibleNotes();
|
||||
if(this.selectedIndex < visibleNotes.length) {
|
||||
this.selectNote(visibleNotes[this.selectedIndex]);
|
||||
this.selectNote(visibleNotes[Math.max(this.selectedIndex, 0)]);
|
||||
} else {
|
||||
this.selectNote(visibleNotes[visibleNotes.length - 1]);
|
||||
}
|
||||
@@ -190,11 +190,14 @@ angular.module('app')
|
||||
}
|
||||
|
||||
this.selectNote = function(note, viaClick = false) {
|
||||
if(!note) { return; }
|
||||
if(!note) {
|
||||
this.createNewNote();
|
||||
return;
|
||||
}
|
||||
this.selectedNote = note;
|
||||
note.conflict_of = null; // clear conflict
|
||||
this.selectionMade()(note);
|
||||
this.selectedIndex = this.visibleNotes().indexOf(note);
|
||||
this.selectedIndex = Math.max(this.visibleNotes().indexOf(note), 0);
|
||||
|
||||
if(viaClick && this.isFiltering()) {
|
||||
desktopManager.searchText(this.noteFilter.text);
|
||||
|
||||
@@ -129,10 +129,12 @@ angular.module('app')
|
||||
return;
|
||||
}
|
||||
|
||||
this.save()(tag, function(savedTag){
|
||||
this.selectTag(tag);
|
||||
this.newTag = null;
|
||||
}.bind(this));
|
||||
this.save()(tag, (savedTag) => {
|
||||
$timeout(() => {
|
||||
this.selectTag(tag);
|
||||
this.newTag = null;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function inputElementForTag(tag) {
|
||||
|
||||
Reference in New Issue
Block a user