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