diff --git a/masks/write.html b/masks/write.html index 58e0dee..5f1ff4b 100755 --- a/masks/write.html +++ b/masks/write.html @@ -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'); }; diff --git a/scripts/mythoughts.js b/scripts/mythoughts.js index 1ef4d30..c942d54 100755 --- a/scripts/mythoughts.js +++ b/scripts/mythoughts.js @@ -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() {