save on ctrl+s

This commit is contained in:
2018-11-30 20:34:57 +01:00
parent 3f6a801c30
commit 389fd02f08
2 changed files with 10 additions and 4 deletions

View File

@@ -10,7 +10,13 @@
self.tmp('saving', false);
oEditor = new Editor('#edi_write');
oEditor.onKeyStroke = save;
oEditor.onKeyStroke = (e) => {
if(e.which == 83 && e.ctrlKey) {
e.preventDefault();
save(true);
}
else save();
}
oEditor.moveToPage('last');
};

View File

@@ -315,7 +315,7 @@ class Editor {
this.$PrevBtn = $('.prev');
this.$NextBtn = $('.next');
this.onKeyStroke = function(){};
this.onKeyStroke = function(e){};
//Date format
ThoughtDate.blotName = 'thought_date';
@@ -336,6 +336,7 @@ class Editor {
if($.inArray(e.which, [13, 37, 38, 39, 40]) != -1) this._onChange('', '', 'user', e);
else if(e.which==33) this.$PrevBtn.click();
else if(e.which==34) this.$NextBtn.click();
else this.onKeyStroke(e);
});
this.oQuill.on('text-change', (delta, oldDelta, sSource) => {this._onChange(delta, oldDelta, sSource);});
@@ -502,8 +503,7 @@ class Editor {
}
_incKeyStrokes() {
this.keystrokes += + 1;
this.onKeyStroke();
this.keystrokes += 1;
}
getContent() {