|
|
|
!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){e.defineOption("showTrailingSpace",!1,function(t,n,o){o==e.Init&&(o=!1),o&&!n?t.removeOverlay("trailingspace"):!o&&n&&t.addOverlay({token:function(e){for(var t=e.string.length,n=t;n&&/\s/.test(e.string.charAt(n-1));--n);return n>e.pos?(e.pos=n,null):(e.pos=t,"trailingspace")},name:"trailingspace"})})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n){var o,r=e.getWrapperElement();return o=r.appendChild(document.createElement("div")),o.className=n?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?o.innerHTML=t:o.appendChild(t),o}function n(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(o,r,i){function a(e){if("string"==typeof e)u.value=e;else{if(f)return;f=!0,s.parentNode.removeChild(s),c.focus(),i.onClose&&i.onClose(s)}}i||(i={}),n(this,null);var l,s=t(this,o,i.bottom),f=!1,c=this,u=s.getElementsByTagName("input")[0];return u?(i.value&&(u.value=i.value,u.select()),i.onInput&&e.on(u,"input",function(e){i.onInput(e,u.value,a)}),i.onKeyUp&&e.on(u,"keyup",function(e){i.onKeyUp(e,u.value,a)}),e.on(u,"keydown",function(t){i&&i.onKeyDown&&i.onKeyDown(t,u.value,a)||((27==t.keyCode||i.closeOnEnter!==!1&&13==t.keyCode)&&(u.blur(),e.e_stop(t),a()),13==t.keyCode&&r(u.value,t))}),i.closeOnBlur!==!1&&e.on(u,"blur",a),u.focus()):(l=s.getElementsByTagName("button")[0])&&(e.on(l,"click",function(){a(),c.focus()}),i.closeOnBlur!==!1&&e.on(l,"blur",a),l.focus()),a}),e.defineExtension("openConfirm",function(o,r,i){function a(){f||(f=!0,l.parentNode.removeChild(l),c.focus())}n(this,null);var l=t(this,o,i&&i.bottom),s=l.getElementsByTagName("button"),f=!1,c=this,u=1;s[0].focus();for(var d=0;d<s.length;++d){var h=s[d];!function(t){e.on(h,"click",function(n){e.e_preventDefault(n),a(),t&&t(c)})}(r[d]),e.on(h,"blur",function(){--u,setTimeout(function(){0>=u&&a()},200)}),e.on(h,"focus",function(){++u})}}),e.defineExtension("openNotification",function(o,r){function i(){s||(s=!0,clearTimeout(a),l.parentNode.removeChild(l))}n(this,i);var a,l=t(this,o,r&&r.bottom),s=!1,f=r&&"undefined"!=typeof r.duration?r.duration:5e3;return e.on(l,"click",function(t){e.e_preventDefault(t),i()}),f&&(a=setTimeout(i,f)),i})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,i){if(this.atOccurrence=!1,this.doc=e,null==i&&"string"==typeof t&&(i=!1),r=r?e.clipPos(r):o(0,0),this.pos={from:r,to:r},"string"!=typeof t)t.global||(t=new RegExp(t.source,t.ignoreCase?"ig":"g")),this.matches=function(n,r){if(n){t.lastIndex=0;for(var i,a,l=e.getLine(r.line).slice(0,r.ch),s=0;;){t.lastIndex=s;var f=t.exec(l);if(!f)break;if(i=f,a=i.index,s=i.index+(i[0].length||1),s==l.length)break}var c=i&&i[0].length||0;c||(0==a&&0==l.length?i=void 0:a!=e.getLine(r.line).length&&c++)}else{t.lastIndex=r.ch;var l=e.getLine(r.line),i=t.exec(l),c=i&&i[0].length||0,a=i&&i.index;a+c==l.length||c||(c=1)}return i&&c?{from:o(r.line,a),to:o(r.line,a+c),match:i}:void 0};else{var a=t;i&&(t=t.toLowerCase());var l=i?function(e){return e.toLowerCase()}:function(e){return e},s=t.split("\n");if(1==s.length)this.matches=t.length?function(r,i){if(r){var s=e.getLine(i.line).slice(0,i.ch),f=l(s),c=f.lastIndexOf(t);if(c>-1)return c=n(s,f,c),{from:o(i.line,c),to:o(i.line,c+a.length)}}else{var s=e.getLine(i.line).slice(i.ch),f=l(s),c=f.indexOf(t);if(c>-1)return c=n(s,f,c)+i.ch,{from:o(i.line,c),to:o(i.line,c+a.length)}}}:function(){};else{var f=a.split("\n");this.matches=function(t,n){var r=s.length-1;if(t){if(n.line-(s.length-1)<e.fi
|
|
|
|
})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){var n=e.getRange(s(t.line,t.ch-1),s(t.line,t.ch+1));return 2==n.length?n:null}function n(t,n,o){var r=t.getLine(n.line),i=t.getTokenAt(n);if(/\bstring2?\b/.test(i.type))return!1;var a=new e.StringStream(r.slice(0,n.ch)+o+r.slice(n.ch),4);for(a.pos=a.start=i.start;;){var l=t.getMode().token(a,i.state);if(a.pos>=n.ch+1)return/\bstring2?\b/.test(l);a.start=a.pos}}function o(o){for(var r={name:"autoCloseBrackets",Backspace:function(n){if(n.getOption("disableInput"))return e.Pass;for(var r=n.listSelections(),i=0;i<r.length;i++){if(!r[i].empty())return e.Pass;var a=t(n,r[i].head);if(!a||o.indexOf(a)%2!=0)return e.Pass}for(var i=r.length-1;i>=0;i--){var l=r[i].head;n.replaceRange("",s(l.line,l.ch-1),s(l.line,l.ch+1))}}},i="",a=0;a<o.length;a+=2)(function(t,o){i+=o,r["'"+t+"'"]=function(r){if(r.getOption("disableInput"))return e.Pass;for(var a,f,c=r.listSelections(),u=0;u<c.length;u++){var d,h=c[u],p=h.head,f=r.getRange(p,s(p.line,p.ch+1));if(h.empty())if(t==o&&f==o)d=r.getRange(p,s(p.line,p.ch+3))==t+t+t?"skipThree":"skip";else if(t==o&&p.ch>1&&r.getRange(s(p.line,p.ch-2),p)==t+t&&(p.ch<=2||r.getRange(s(p.line,p.ch-3),s(p.line,p.ch-2))!=t))d="addFour";else if('"'==t||"'"==t){if(e.isWordChar(f)||!n(r,p,t))return e.Pass;d="both"}else{if(!(r.getLine(p.line).length==p.ch||i.indexOf(f)>=0||l.test(f)))return e.Pass;d="both"}else d="surround";if(a){if(a!=d)return e.Pass}else a=d}r.operation(function(){if("skip"==a)r.execCommand("goCharRight");else if("skipThree"==a)for(var e=0;3>e;e++)r.execCommand("goCharRight");else if("surround"==a){for(var n=r.getSelections(),e=0;e<n.length;e++)n[e]=t+n[e]+o;r.replaceSelections(n,"around")}else"both"==a?(r.replaceSelection(t+o,null),r.execCommand("goCharLeft")):"addFour"==a&&(r.replaceSelection(t+t+t+t,"before"),r.execCommand("goCharRight"))})},t!=o&&(r["'"+o+"'"]=function(t){for(var n=t.listSelections(),r=0;r<n.length;r++){var i=n[r];if(!i.empty()||t.getRange(i.head,s(i.head.line,i.head.ch+1))!=o)return e.Pass}t.execCommand("goCharRight")})})(o.charAt(a),o.charAt(a+1));return r}function r(n){return function(o){if(o.getOption("disableInput"))return e.Pass;for(var r=o.listSelections(),i=0;i<r.length;i++){if(!r[i].empty())return e.Pass;var a=t(o,r[i].head);if(!a||n.indexOf(a)%2!=0)return e.Pass}o.operation(function(){o.replaceSelection("\n\n",null),o.execCommand("goCharLeft"),r=o.listSelections();for(var e=0;e<r.length;e++){var t=r[e].head.line;o.indentLine(t,null,!0),o.indentLine(t+1,null,!0)}})}}var i="()[]{}''\"\"",a="[]{}",l=/\s/,s=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,n,l){if(l!=e.Init&&l&&t.removeKeyMap("autoCloseBrackets"),n){var s=i,f=a;"string"==typeof n?s=n:"object"==typeof n&&(null!=n.pairs&&(s=n.pairs),null!=n.explode&&(f=n.explode));var c=o(s);f&&(c.Enter=r(f)),t.addKeyMap(c)}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.getWrapperElement();e.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",e.refresh()}function n(e){var t=e.getWrapperElement();t.className=t.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var n=e.state.fullScreenRestore;t.style.width=n.width,t.style.height=n.height,window.scrollTo(n.scrollLeft,n.scrollTop),e.refresh()}e.defineOption("fullScreen",!1,function(o,r,i){i==e.Init&&(i=!1),!i!=!r&&(r?t(o):n(o))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use s
|