no new note on launch
This commit is contained in:
@@ -18,8 +18,6 @@ angular.module('app.frontend')
|
|||||||
scope.$watch('ctrl.note', function(note, oldNote){
|
scope.$watch('ctrl.note', function(note, oldNote){
|
||||||
if(note) {
|
if(note) {
|
||||||
ctrl.setNote(note, oldNote);
|
ctrl.setNote(note, oldNote);
|
||||||
} else {
|
|
||||||
ctrl.note = {};
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -28,7 +26,6 @@ angular.module('app.frontend')
|
|||||||
.controller('EditorCtrl', function ($sce, $timeout, authManager, $rootScope, extensionManager, syncManager, modelManager) {
|
.controller('EditorCtrl', function ($sce, $timeout, authManager, $rootScope, extensionManager, syncManager, modelManager) {
|
||||||
|
|
||||||
window.addEventListener("message", function(event){
|
window.addEventListener("message", function(event){
|
||||||
// console.log("App received message:", event);
|
|
||||||
if(event.data.status) {
|
if(event.data.status) {
|
||||||
this.postNoteToExternalEditor();
|
this.postNoteToExternalEditor();
|
||||||
} else {
|
} else {
|
||||||
@@ -92,7 +89,6 @@ angular.module('app.frontend')
|
|||||||
this.editorForNote = function(note) {
|
this.editorForNote = function(note) {
|
||||||
var editors = modelManager.itemsForContentType("SN|Editor");
|
var editors = modelManager.itemsForContentType("SN|Editor");
|
||||||
for(var editor of editors) {
|
for(var editor of editors) {
|
||||||
// console.log(editor.notes, editor.references);
|
|
||||||
if(_.includes(editor.notes, note)) {
|
if(_.includes(editor.notes, note)) {
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ angular.module('app.frontend')
|
|||||||
}
|
}
|
||||||
|
|
||||||
syncManager.loadLocalItems(function(items) {
|
syncManager.loadLocalItems(function(items) {
|
||||||
|
$scope.allTag.didLoad = true;
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
|
|
||||||
syncManager.sync(null);
|
syncManager.sync(null);
|
||||||
@@ -35,10 +36,11 @@ angular.module('app.frontend')
|
|||||||
});
|
});
|
||||||
|
|
||||||
var allTag = new Tag({all: true});
|
var allTag = new Tag({all: true});
|
||||||
allTag.title = "All";
|
allTag.needsLoad = true;
|
||||||
$scope.tags = modelManager.tags;
|
|
||||||
allTag.notes = modelManager.notes;
|
|
||||||
$scope.allTag = allTag;
|
$scope.allTag = allTag;
|
||||||
|
$scope.allTag.title = "All";
|
||||||
|
$scope.tags = modelManager.tags;
|
||||||
|
$scope.allTag.notes = modelManager.notes;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Editor Callbacks
|
Editor Callbacks
|
||||||
|
|||||||
@@ -18,7 +18,16 @@ angular.module('app.frontend')
|
|||||||
link:function(scope, elem, attrs, ctrl) {
|
link:function(scope, elem, attrs, ctrl) {
|
||||||
scope.$watch('ctrl.tag', function(tag, oldTag){
|
scope.$watch('ctrl.tag', function(tag, oldTag){
|
||||||
if(tag) {
|
if(tag) {
|
||||||
ctrl.tagDidChange(tag, oldTag);
|
if(tag.needsLoad) {
|
||||||
|
scope.$watch('ctrl.tag.didLoad', function(didLoad){
|
||||||
|
if(didLoad) {
|
||||||
|
tag.needsLoad = false;
|
||||||
|
ctrl.tagDidChange(tag, oldTag);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
ctrl.tagDidChange(tag, oldTag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -45,12 +54,15 @@ angular.module('app.frontend')
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.noteFilter.text = "";
|
this.noteFilter.text = "";
|
||||||
|
this.setNotes(tag.notes);
|
||||||
|
}
|
||||||
|
|
||||||
tag.notes.forEach(function(note){
|
this.setNotes = function(notes) {
|
||||||
|
notes.forEach(function(note){
|
||||||
note.visible = true;
|
note.visible = true;
|
||||||
})
|
})
|
||||||
|
|
||||||
var createNew = tag.notes.length == 0;
|
var createNew = notes.length == 0;
|
||||||
this.selectFirstNote(createNew);
|
this.selectFirstNote(createNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
.section.editor{"ng-class" => "{'fullscreen' : ctrl.fullscreen}"}
|
.section.editor{"ng-class" => "{'fullscreen' : ctrl.fullscreen}"}
|
||||||
.section-title-bar.editor-heading{"ng-class" => "{'fullscreen' : ctrl.fullscreen }"}
|
.section-title-bar.editor-heading{"ng-if" => "ctrl.note", "ng-class" => "{'fullscreen' : ctrl.fullscreen }"}
|
||||||
.title
|
.title
|
||||||
%input.input#note-title-editor{"ng-model" => "ctrl.note.title", "ng-keyup" => "$event.keyCode == 13 && ctrl.saveTitle($event)",
|
%input.input#note-title-editor{"ng-model" => "ctrl.note.title", "ng-keyup" => "$event.keyCode == 13 && ctrl.saveTitle($event)",
|
||||||
"ng-change" => "ctrl.nameChanged()", "ng-focus" => "ctrl.onNameFocus()",
|
"ng-change" => "ctrl.nameChanged()", "ng-focus" => "ctrl.onNameFocus()",
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
.tags
|
.tags
|
||||||
%input.tags-input{"type" => "text", "ng-keyup" => "$event.keyCode == 13 && $event.target.blur();",
|
%input.tags-input{"type" => "text", "ng-keyup" => "$event.keyCode == 13 && $event.target.blur();",
|
||||||
"ng-model" => "ctrl.tagsString", "placeholder" => "#tags", "ng-blur" => "ctrl.updateTagsFromTagsString($event, ctrl.tagsString)"}
|
"ng-model" => "ctrl.tagsString", "placeholder" => "#tags", "ng-blur" => "ctrl.updateTagsFromTagsString($event, ctrl.tagsString)"}
|
||||||
.section-menu
|
.section-menu{"ng-if" => "ctrl.note"}
|
||||||
%ul.nav
|
%ul.nav
|
||||||
%li.dropdown.pull-left.mr-10{"click-outside" => "ctrl.showMenu = false;", "is-open" => "ctrl.showMenu"}
|
%li.dropdown.pull-left.mr-10{"click-outside" => "ctrl.showMenu = false;", "is-open" => "ctrl.showMenu"}
|
||||||
%a.dropdown-toggle{"ng-click" => "ctrl.showMenu = !ctrl.showMenu; ctrl.showExtensions = false;"}
|
%a.dropdown-toggle{"ng-click" => "ctrl.showMenu = !ctrl.showMenu; ctrl.showExtensions = false;"}
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
%li{"ng-click" => "ctrl.selectedMenuItem(); ctrl.toggleFullScreen()"}
|
%li{"ng-click" => "ctrl.selectedMenuItem(); ctrl.toggleFullScreen()"}
|
||||||
.text Toggle Fullscreen
|
.text Toggle Fullscreen
|
||||||
%li{"ng-click" => "ctrl.deleteNote()"}
|
%li{"ng-click" => "ctrl.deleteNote()"}
|
||||||
.text Delete
|
.text Delete Note
|
||||||
|
|
||||||
%li.sep
|
%li.sep
|
||||||
%li.dropdown.pull-left.mr-10{"click-outside" => "ctrl.showEditorMenu = false;", "is-open" => "ctrl.showEditorMenu"}
|
%li.dropdown.pull-left.mr-10{"click-outside" => "ctrl.showEditorMenu = false;", "is-open" => "ctrl.showEditorMenu"}
|
||||||
|
|||||||
@@ -6,6 +6,6 @@
|
|||||||
%notes-section{"remove-tag" => "notesRemoveTag", "add-new" => "notesAddNew", "selection-made" => "notesSelectionMade",
|
%notes-section{"remove-tag" => "notesRemoveTag", "add-new" => "notesAddNew", "selection-made" => "notesSelectionMade",
|
||||||
"tag" => "selectedTag", "remove" => "deleteNote"}
|
"tag" => "selectedTag", "remove" => "deleteNote"}
|
||||||
|
|
||||||
%editor-section{"ng-if" => "selectedNote", "note" => "selectedNote", "remove" => "deleteNote", "save" => "saveNote", "update-tags" => "updateTagsForNote"}
|
%editor-section{"note" => "selectedNote", "remove" => "deleteNote", "save" => "saveNote", "update-tags" => "updateTagsForNote"}
|
||||||
|
|
||||||
%header
|
%header
|
||||||
|
|||||||
@@ -15,8 +15,6 @@
|
|||||||
%span.sr-only
|
%span.sr-only
|
||||||
|
|
||||||
%ul.dropdown-menu.dropdown-menu-left.nt-dropdown-menu.dark{"ng-if" => "ctrl.showMenu"}
|
%ul.dropdown-menu.dropdown-menu-left.nt-dropdown-menu.dark{"ng-if" => "ctrl.showMenu"}
|
||||||
%li
|
|
||||||
%a.text{"ng-click" => "ctrl.selectedMenuItem(); ctrl.selectedTagDelete()"} Delete Tag
|
|
||||||
%li
|
%li
|
||||||
%a.text{"ng-click" => "ctrl.selectedMenuItem(); ctrl.selectedSortByCreated()"}
|
%a.text{"ng-click" => "ctrl.selectedMenuItem(); ctrl.selectedSortByCreated()"}
|
||||||
%span.top.mt-5.mr-5{"ng-if" => "ctrl.sortBy == 'created_at'"} ✓
|
%span.top.mt-5.mr-5{"ng-if" => "ctrl.sortBy == 'created_at'"} ✓
|
||||||
@@ -25,6 +23,8 @@
|
|||||||
%a.text{"ng-click" => "ctrl.selectedMenuItem(); ctrl.selectedSortByUpdated()"}
|
%a.text{"ng-click" => "ctrl.selectedMenuItem(); ctrl.selectedSortByUpdated()"}
|
||||||
%span.top.mt-5.mr-5{"ng-if" => "ctrl.sortBy == 'updated_at'"} ✓
|
%span.top.mt-5.mr-5{"ng-if" => "ctrl.sortBy == 'updated_at'"} ✓
|
||||||
Sort by date updated
|
Sort by date updated
|
||||||
|
%li
|
||||||
|
%a.text{"ng-click" => "ctrl.selectedMenuItem(); ctrl.selectedTagDelete()"} Delete Tag
|
||||||
|
|
||||||
.scrollable
|
.scrollable
|
||||||
.infinite-scroll{"infinite-scroll" => "ctrl.paginate()", "can-load" => "true", "threshold" => "200"}
|
.infinite-scroll{"infinite-scroll" => "ctrl.paginate()", "can-load" => "true", "threshold" => "200"}
|
||||||
|
|||||||
Reference in New Issue
Block a user