moved isNewNoteCreated into note_editor

This commit is contained in:
azivner
2017-11-23 19:40:47 -05:00
parent 0ec6d4baa8
commit f6aae68063
2 changed files with 16 additions and 41 deletions

View File

@@ -127,11 +127,17 @@ const noteEditor = (function() {
noteTree.setCurrentNoteTreeBasedOnProtectedStatus();
}
let isNewNoteCreated = false;
function newNoteCreated() {
isNewNoteCreated = true;
}
async function loadNoteToEditor(noteId) {
currentNote = await $.get(baseApiUrl + 'notes/' + noteId);
if (noteTree.isNewNoteCreated()) {
noteTree.switchOffNewNoteCreated();
if (isNewNoteCreated) {
isNewNoteCreated = false;
noteTitleEl.focus().select();
}
@@ -165,9 +171,7 @@ const noteEditor = (function() {
}
async function loadNote(noteId) {
const note = await $.get(baseApiUrl + 'notes/' + noteId);
return note;
return await $.get(baseApiUrl + 'notes/' + noteId);
}
$(document).ready(() => {
@@ -199,6 +203,7 @@ const noteEditor = (function() {
loadNote,
getCurrentNote,
getCurrentNoteId,
getCurrentNoteLoadTime
getCurrentNoteLoadTime,
newNoteCreated
};
})();