src/pyams_skin/resources/js/ext/ace/ext-static_highlight.min.js
changeset 501 2f0eb9a77324
child 504 fb5a531cddbe
equal deleted inserted replaced
500:f08f5a2ffaa6 501:2f0eb9a77324
       
     1 ace.define("ace/ext/static_highlight",["require","exports","module","ace/edit_session","ace/layer/text","ace/config","ace/lib/dom","ace/lib/lang"],function(e,t,n){"use strict";function i(e){this.type=e,this.style={},this.textContent=""}var o=e("../edit_session").EditSession,r=e("../layer/text").Text,a=e("../config"),s=e("../lib/dom"),c=e("../lib/lang").escapeHTML;i.prototype.cloneNode=function(){return this},i.prototype.appendChild=function(e){this.textContent+=e.toString()},i.prototype.toString=function(){var e=[];if("fragment"!=this.type){e.push("<",this.type),this.className&&e.push(" class='",this.className,"'");var t=[];for(var n in this.style)t.push(n,":",this.style[n]);t.length&&e.push(" style='",t.join(""),"'"),e.push(">")}return this.textContent&&e.push(this.textContent),"fragment"!=this.type&&e.push("</",this.type,">"),e.join("")};var l={createTextNode:function(e,t){return c(e)},createElement:function(e){return new i(e)},createFragment:function(){return new i("fragment")}},h=function(){this.config={},this.dom=l};h.prototype=r.prototype;var g=function(e,t,n){var i=e.className.match(/lang-(\w+)/),o=t.mode||i&&"ace/mode/"+i[1];if(!o)return!1;var r=t.theme||"ace/theme/textmate",a="",c=[];if(e.firstElementChild)for(var l=0,h=0;h<e.childNodes.length;h++){var u=e.childNodes[h];3==u.nodeType?(l+=u.data.length,a+=u.data):c.push(l,u)}else a=e.textContent,t.trim&&(a=a.trim());g.render(a,o,r,t.firstLineNumber,!t.showGutter,function(t){s.importCssString(t.css,"ace_highlight"),e.innerHTML=t.html;for(var i=e.firstChild.firstChild,o=0;o<c.length;o+=2){var r=t.session.doc.indexToPosition(c[o]),a=c[o+1],l=i.children[r.row];l&&l.appendChild(a)}n&&n()})};g.render=function(e,t,n,i,r,s){function c(){var o=g.renderSync(e,t,n,i,r);return s?s(o):o}var l=1,h=o.prototype.$modes;"string"==typeof n&&(l++,a.loadModule(["theme",n],function(e){n=e,--l||c()}));var u;return t&&"object"==typeof t&&!t.getTokenizer&&(u=t,t=u.path),"string"==typeof t&&(l++,a.loadModule(["mode",t],function(e){h[t]&&!u||(h[t]=new e.Mode(u)),t=h[t],--l||c()})),--l||c()},g.renderSync=function(e,t,n,i,r){i=parseInt(i||1,10);var a=new o("");a.setUseWorker(!1),a.setMode(t);var s=new h;s.setSession(a),Object.keys(s.$tabStrings).forEach(function(e){if("string"==typeof s.$tabStrings[e]){var t=l.createFragment();t.textContent=s.$tabStrings[e],s.$tabStrings[e]=t}}),a.setValue(e);var c=a.getLength(),g=l.createElement("div");g.className=n.cssClass;var u=l.createElement("div");u.className="ace_static_highlight"+(r?"":" ace_show_gutter"),u.style["counter-reset"]="ace_line "+(i-1);for(var p=0;p<c;p++){var d=l.createElement("div");if(d.className="ace_line",!r){var f=l.createElement("span");f.className="ace_gutter ace_gutter-cell",f.textContent="",d.appendChild(f)}s.$renderLine(d,p,!1),d.textContent+="\n",u.appendChild(d)}return g.appendChild(u),{css:".ace_static_highlight {font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;font-size: 12px;white-space: pre-wrap}.ace_static_highlight .ace_gutter {width: 2em;text-align: right;padding: 0 3px 0 0;margin-right: 3px;contain: none;}.ace_static_highlight.ace_show_gutter .ace_line {padding-left: 2.6em;}.ace_static_highlight .ace_line { position: relative; }.ace_static_highlight .ace_gutter-cell {-moz-user-select: -moz-none;-khtml-user-select: none;-webkit-user-select: none;user-select: none;top: 0;bottom: 0;left: 0;position: absolute;}.ace_static_highlight .ace_gutter-cell:before {content: counter(ace_line, decimal);counter-increment: ace_line;}.ace_static_highlight {counter-reset: ace_line;}"+n.cssText,html:g.toString(),session:a}},n.exports=g,n.exports.highlight=g}),ace.require(["ace/ext/static_highlight"],function(e){"object"==typeof module&&"object"==typeof exports&&module&&(module.exports=e)});