save on ctrl+s
This commit is contained in:
@@ -10,7 +10,13 @@
|
|||||||
self.tmp('saving', false);
|
self.tmp('saving', false);
|
||||||
|
|
||||||
oEditor = new Editor('#edi_write');
|
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');
|
oEditor.moveToPage('last');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ class Editor {
|
|||||||
this.$PrevBtn = $('.prev');
|
this.$PrevBtn = $('.prev');
|
||||||
this.$NextBtn = $('.next');
|
this.$NextBtn = $('.next');
|
||||||
|
|
||||||
this.onKeyStroke = function(){};
|
this.onKeyStroke = function(e){};
|
||||||
|
|
||||||
//Date format
|
//Date format
|
||||||
ThoughtDate.blotName = 'thought_date';
|
ThoughtDate.blotName = 'thought_date';
|
||||||
@@ -336,6 +336,7 @@ class Editor {
|
|||||||
if($.inArray(e.which, [13, 37, 38, 39, 40]) != -1) this._onChange('', '', 'user', e);
|
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==33) this.$PrevBtn.click();
|
||||||
else if(e.which==34) this.$NextBtn.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);});
|
this.oQuill.on('text-change', (delta, oldDelta, sSource) => {this._onChange(delta, oldDelta, sSource);});
|
||||||
@@ -502,8 +503,7 @@ class Editor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_incKeyStrokes() {
|
_incKeyStrokes() {
|
||||||
this.keystrokes += + 1;
|
this.keystrokes += 1;
|
||||||
this.onKeyStroke();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getContent() {
|
getContent() {
|
||||||
|
|||||||
Reference in New Issue
Block a user