src/pyams_skin/resources/js/ext/ace/ext-spellcheck.min.js
changeset 565 318533413200
parent 564 a1c75f3e0bc7
child 566 a1707c607eec
equal deleted inserted replaced
564:a1c75f3e0bc7 565:318533413200
     1 ace.define("ace/ext/spellcheck",["require","exports","module","ace/lib/event","ace/editor","ace/config"],function(e,t,n){"use strict";var l=e("../lib/event");t.contextMenuHandler=function(e){var n=e.target,o=n.textInput.getElement();if(n.selection.isEmpty()){var t=n.getCursorPosition(),i=n.session.getWordRange(t.row,t.column),s=n.session.getTextRange(i);if(n.session.tokenRe.lastIndex=0,n.session.tokenRe.test(s)){var c=s+" ";o.value=c,o.setSelectionRange(s.length,s.length+1),o.setSelectionRange(0,0),o.setSelectionRange(0,s.length);var r=!1;l.addListener(o,"keydown",function e(){l.removeListener(o,"keydown",e),r=!0}),n.textInput.setInputHandler(function(e){if(console.log(e,c,o.selectionStart,o.selectionEnd),e==c)return"";if(0===e.lastIndexOf(c,0))return e.slice(c.length);if(e.substr(o.selectionEnd)==c)return e.slice(0,-c.length);if(""==e.slice(-2)){var t=e.slice(0,-2);if(" "==t.slice(-1))return r?t.substring(0,o.selectionEnd):(t=t.slice(0,-1),n.session.replace(i,t),"")}return e})}}};var o=e("../editor").Editor;e("../config").defineOptions(o.prototype,"editor",{spellcheck:{set:function(e){this.textInput.getElement().spellcheck=!!e,e?this.on("nativecontextmenu",t.contextMenuHandler):this.removeListener("nativecontextmenu",t.contextMenuHandler)},value:!0}})}),ace.require(["ace/ext/spellcheck"],function(e){"object"==typeof module&&"object"==typeof exports&&module&&(module.exports=e)});