diff options
author | redmatrix <git@macgirvin.com> | 2016-06-27 04:00:10 -0700 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-06-27 04:00:10 -0700 |
commit | 85d2ad4aea106417dc3d8ce2429d13dd858c5201 (patch) | |
tree | 72e03b3fe379829a4e2f9c521366fb14e1eaa970 /library/ace/ext-spellcheck.js | |
parent | d5d5d78e3aded9a3238ccb7e93b4c6fd4b873331 (diff) | |
parent | 8d298d5a068845856c9827c0d2ea3f02f1399d72 (diff) | |
download | volse-hubzilla-85d2ad4aea106417dc3d8ce2429d13dd858c5201.tar.gz volse-hubzilla-85d2ad4aea106417dc3d8ce2429d13dd858c5201.tar.bz2 volse-hubzilla-85d2ad4aea106417dc3d8ce2429d13dd858c5201.zip |
Merge branch 'dev' into perms
Diffstat (limited to 'library/ace/ext-spellcheck.js')
-rw-r--r-- | library/ace/ext-spellcheck.js | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/library/ace/ext-spellcheck.js b/library/ace/ext-spellcheck.js new file mode 100644 index 000000000..15c0f86f1 --- /dev/null +++ b/library/ace/ext-spellcheck.js @@ -0,0 +1,5 @@ +ace.define("ace/ext/spellcheck",["require","exports","module","ace/lib/event","ace/editor","ace/config"],function(e,t,n){"use strict";var r=e("../lib/event");t.contextMenuHandler=function(e){var t=e.target,n=t.textInput.getElement();if(!t.selection.isEmpty())return;var i=t.getCursorPosition(),s=t.session.getWordRange(i.row,i.column),o=t.session.getTextRange(s);t.session.tokenRe.lastIndex=0;if(!t.session.tokenRe.test(o))return;var u="",a=o+" "+u;n.value=a,n.setSelectionRange(o.length,o.length+1),n.setSelectionRange(0,0),n.setSelectionRange(0,o.length);var f=!1;r.addListener(n,"keydown",function l(){r.removeListener(n,"keydown",l),f=!0}),t.textInput.setInputHandler(function(e){console.log(e,a,n.selectionStart,n.selectionEnd);if(e==a)return"";if(e.lastIndexOf(a,0)===0)return e.slice(a.length);if(e.substr(n.selectionEnd)==a)return e.slice(0,-a.length);if(e.slice(-2)==u){var r=e.slice(0,-2);if(r.slice(-1)==" ")return f?r.substring(0,n.selectionEnd):(r=r.slice(0,-1),t.session.replace(s,r),"")}return e})};var i=e("../editor").Editor;e("../config").defineOptions(i.prototype,"editor",{spellcheck:{set:function(e){var n=this.textInput.getElement();n.spellcheck=!!e,e?this.on("nativecontextmenu",t.contextMenuHandler):this.removeListener("nativecontextmenu",t.contextMenuHandler)},value:!0}})}); + (function() { + ace.require(["ace/ext/spellcheck"], function() {}); + })(); +
\ No newline at end of file |