editor change fixes
This commit is contained in:
@@ -35,9 +35,11 @@ angular.module('app.frontend')
|
|||||||
|
|
||||||
if(this.note.uuid === id) {
|
if(this.note.uuid === id) {
|
||||||
this.note.text = text;
|
this.note.text = text;
|
||||||
var changesMade = this.customEditor.setData(id, data);
|
if(data) {
|
||||||
if(changesMade) {
|
var changesMade = this.customEditor.setData(id, data);
|
||||||
this.customEditor.setDirty(true);
|
if(changesMade) {
|
||||||
|
this.customEditor.setDirty(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.changesMade();
|
this.changesMade();
|
||||||
}
|
}
|
||||||
@@ -45,15 +47,28 @@ angular.module('app.frontend')
|
|||||||
}.bind(this), false);
|
}.bind(this), false);
|
||||||
|
|
||||||
this.setNote = function(note, oldNote) {
|
this.setNote = function(note, oldNote) {
|
||||||
|
var currentEditor = this.customEditor;
|
||||||
|
this.customEditor = null;
|
||||||
this.showExtensions = false;
|
this.showExtensions = false;
|
||||||
this.showMenu = false;
|
this.showMenu = false;
|
||||||
this.loadTagsString();
|
this.loadTagsString();
|
||||||
|
|
||||||
var editor = this.editorForNote(note);
|
var setEditor = function(editor) {
|
||||||
|
|
||||||
if(editor) {
|
|
||||||
this.customEditor = editor;
|
this.customEditor = editor;
|
||||||
this.postNoteToExternalEditor();
|
this.postNoteToExternalEditor();
|
||||||
|
}.bind(this)
|
||||||
|
|
||||||
|
var editor = this.editorForNote(note);
|
||||||
|
if(editor) {
|
||||||
|
if(currentEditor !== editor) {
|
||||||
|
// switch after timeout, so that note data isnt posted to current editor
|
||||||
|
$timeout(function(){
|
||||||
|
setEditor(editor);
|
||||||
|
}.bind(this));
|
||||||
|
} else {
|
||||||
|
// switch immediately
|
||||||
|
setEditor(editor);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.customEditor = null;
|
this.customEditor = null;
|
||||||
}
|
}
|
||||||
@@ -73,11 +88,13 @@ angular.module('app.frontend')
|
|||||||
|
|
||||||
this.selectedEditor = function(editor) {
|
this.selectedEditor = function(editor) {
|
||||||
this.showEditorMenu = false;
|
this.showEditorMenu = false;
|
||||||
|
|
||||||
|
if(this.customEditor && editor !== this.customEditor) {
|
||||||
|
this.customEditor.removeItemAsRelationship(this.note);
|
||||||
|
this.customEditor.setDirty(true);
|
||||||
|
}
|
||||||
|
|
||||||
if(editor.default) {
|
if(editor.default) {
|
||||||
if(this.customEditor) {
|
|
||||||
this.customEditor.removeItemAsRelationship(this.note);
|
|
||||||
this.customEditor.setDirty(true);
|
|
||||||
}
|
|
||||||
this.customEditor = null;
|
this.customEditor = null;
|
||||||
} else {
|
} else {
|
||||||
this.customEditor = editor;
|
this.customEditor = editor;
|
||||||
|
|||||||
Reference in New Issue
Block a user