Fixes dummy note auto creation issue
This commit is contained in:
@@ -35,9 +35,7 @@ angular.module('app')
|
||||
syncManager.addEventHandler((syncEvent, data) => {
|
||||
if(syncEvent == "local-data-loaded") {
|
||||
this.localDataLoaded = true;
|
||||
if(this.tag && this.notes.length == 0) {
|
||||
this.createNewNote();
|
||||
}
|
||||
this.handledDataLoad = false;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -45,6 +43,13 @@ angular.module('app')
|
||||
// reload our notes
|
||||
this.reloadNotes();
|
||||
|
||||
if(!this.handledDataLoad) {
|
||||
this.handledDataLoad = true;
|
||||
if(this.tag && this.notes.length == 0) {
|
||||
this.createNewNote();
|
||||
}
|
||||
}
|
||||
|
||||
// Note has changed values, reset its flags
|
||||
let notes = allItems.filter((item) => item.content_type == "Note");
|
||||
for(let note of notes) {
|
||||
@@ -55,7 +60,10 @@ angular.module('app')
|
||||
|
||||
// select first note if none is selected
|
||||
if(!this.selectedNote) {
|
||||
this.selectFirstNote();
|
||||
$timeout(() => {
|
||||
// required to be in timeout since selecting notes depends on rendered notes
|
||||
this.selectFirstNote();
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
@@ -71,7 +79,18 @@ angular.module('app')
|
||||
}
|
||||
|
||||
this.reloadNotes = function() {
|
||||
this.setNotes(this.tag.notes);
|
||||
let notes = this.tag.notes;
|
||||
|
||||
if(notes.length > 0 && this.selectedNote && this.selectedNote.dummy) {
|
||||
// remove dummy
|
||||
modelManager.removeItemLocally(this.selectedNote);
|
||||
notes = _.pull(notes, this.selectedNote);
|
||||
$timeout(() => {
|
||||
this.selectFirstNote();
|
||||
})
|
||||
}
|
||||
|
||||
this.setNotes(notes);
|
||||
}
|
||||
|
||||
this.reorderNotes = function() {
|
||||
|
||||
12
package-lock.json
generated
12
package-lock.json
generated
@@ -4750,9 +4750,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"sn-models": {
|
||||
"version": "0.1.13",
|
||||
"resolved": "https://registry.npmjs.org/sn-models/-/sn-models-0.1.13.tgz",
|
||||
"integrity": "sha512-I7vKVXrpYOVVthDD37us9cWcbrhQ/9mTQ2uGXITUonaNIP06xfGgNaPDs9MRKj5F0+4PtiCLuVYkh9ibbtGtig==",
|
||||
"version": "0.1.14",
|
||||
"resolved": "https://registry.npmjs.org/sn-models/-/sn-models-0.1.14.tgz",
|
||||
"integrity": "sha512-p5Tp18sKP68saA4EkdAeYo+X3dNdmGwgqPKL0Bi0Y6lv2SO0LiHPbcBxKcsQjrikE8ePUviJVeckRfMgR5QbYA==",
|
||||
"dev": true
|
||||
},
|
||||
"sn-stylekit": {
|
||||
@@ -4830,9 +4830,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"standard-file-js": {
|
||||
"version": "0.3.44",
|
||||
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.44.tgz",
|
||||
"integrity": "sha512-9g/XQxL/j1ugOiX6eV5hTashi79JEOrA/IuifTcBPE09Lc0SEYtJM+33pVvoATQrYaa6NEHMTSPCpKl+2ZjTsA==",
|
||||
"version": "0.3.46",
|
||||
"resolved": "https://registry.npmjs.org/standard-file-js/-/standard-file-js-0.3.46.tgz",
|
||||
"integrity": "sha512-fGym9hkkWr+Fi+FTsNWJXPXUNUkkVf3A/T2Jc1YqqLSK5/ze0Txo3Ij9pVIfWD7EQcTN6arI7vw1ErpoXWfMaw==",
|
||||
"dev": true
|
||||
},
|
||||
"statuses": {
|
||||
|
||||
@@ -36,9 +36,9 @@
|
||||
"grunt-ng-annotate": "^3.0.0",
|
||||
"mocha": "^5.2.0",
|
||||
"serve-static": "^1.13.2",
|
||||
"sn-models": "0.1.13",
|
||||
"sn-models": "0.1.14",
|
||||
"sn-stylekit": "2.0.13",
|
||||
"standard-file-js": "0.3.44",
|
||||
"standard-file-js": "0.3.46",
|
||||
"grunt-shell": "^2.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user