Editor debouncer
This commit is contained in:
@@ -323,7 +323,8 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.contentChanged = function() {
|
this.contentChanged = function() {
|
||||||
this.changesMade();
|
// content changes should bypass manual debouncer as we use the built in ng-model-options debouncer
|
||||||
|
this.changesMade(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.nameChanged = function() {
|
this.nameChanged = function() {
|
||||||
|
|||||||
@@ -174,11 +174,12 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.setNotes = function(notes) {
|
this.setNotes = function(notes) {
|
||||||
|
|
||||||
notes.forEach(function(note){
|
notes.forEach(function(note){
|
||||||
note.visible = true;
|
note.visible = true;
|
||||||
})
|
})
|
||||||
|
|
||||||
var createNew = notes.length == 0;
|
var createNew = this.visibleNotes().length == 0;
|
||||||
this.selectFirstNote(createNew);
|
this.selectFirstNote(createNew);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,7 +219,7 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.createNewNote = function() {
|
this.createNewNote = function() {
|
||||||
var title = "New Note" + (this.tag.notes ? (" " + (this.tag.notes.length + 1)) : "");
|
var title = "New Note" + (this.tag.notes ? (" " + (this.visibleNotes().length + 1)) : "");
|
||||||
let newNote = modelManager.createItem({content_type: "Note", content: {text: "", title: title}});
|
let newNote = modelManager.createItem({content_type: "Note", content: {text: "", title: title}});
|
||||||
newNote.dummy = true;
|
newNote.dummy = true;
|
||||||
this.newNote = newNote;
|
this.newNote = newNote;
|
||||||
@@ -253,10 +254,6 @@ angular.module('app')
|
|||||||
note.visible = matchesTitle || matchesBody;
|
note.visible = matchesTitle || matchesBody;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(this.tag.archiveTag) {
|
|
||||||
// note.visible = note.visible && note.archived;
|
|
||||||
// }
|
|
||||||
|
|
||||||
return note.visible;
|
return note.visible;
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,9 @@ angular.module('app')
|
|||||||
}
|
}
|
||||||
|
|
||||||
items = items || [];
|
items = items || [];
|
||||||
return items.sort(function(a, b){
|
var result = items.sort(function(a, b){
|
||||||
return sortValueFn(a, b);
|
return sortValueFn(a, b);
|
||||||
})
|
})
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
%textarea.editable#note-text-editor{"ng-if" => "!ctrl.selectedEditor", "ng-model" => "ctrl.note.text", "ng-readonly" => "ctrl.note.locked",
|
%textarea.editable#note-text-editor{"ng-if" => "!ctrl.selectedEditor", "ng-model" => "ctrl.note.text", "ng-readonly" => "ctrl.note.locked",
|
||||||
"ng-change" => "ctrl.contentChanged()", "ng-trim" => "false", "ng-click" => "ctrl.clickedTextArea()",
|
"ng-change" => "ctrl.contentChanged()", "ng-trim" => "false", "ng-click" => "ctrl.clickedTextArea()",
|
||||||
"ng-focus" => "ctrl.onContentFocus()", "dir" => "auto", "ng-attr-spellcheck" => "{{ctrl.spellcheck}}"}
|
"ng-focus" => "ctrl.onContentFocus()", "dir" => "auto", "ng-attr-spellcheck" => "{{ctrl.spellcheck}}", "ng-model-options"=>"{ debounce: 200 }"}
|
||||||
{{ctrl.onSystemEditorLoad()}}
|
{{ctrl.onSystemEditorLoad()}}
|
||||||
|
|
||||||
%panel-resizer{"panel-id" => "'editor-content'", "on-resize-finish" => "ctrl.onPanelResizeFinish","control" => "ctrl.resizeControl", "min-width" => 300, "hoverable" => "true", "property" => "'right'"}
|
%panel-resizer{"panel-id" => "'editor-content'", "on-resize-finish" => "ctrl.onPanelResizeFinish","control" => "ctrl.resizeControl", "min-width" => 300, "hoverable" => "true", "property" => "'right'"}
|
||||||
|
|||||||
Reference in New Issue
Block a user