All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.jquery.ace.min.js Maven / Gradle / Ivy

(function(b){var a={init:function(d){var c=b.extend({mode:"html",tabSize:4,softTabs:true,highlightActiveLine:true,idPostfix:"__ace",toolbarCallback:null,wrapperClass:"jquery-ace-wrapper",readOnly:false,showGutter:true,theme:"eclipse",options:{}},d);return this.each(function(){var g=b(this).data("ace");if(!g){var n=b(this);if(b(this).attr("id")){var e=n.attr("id")+c.idPostfix}var k=n.height();var o=n.width();n.hide();var j=b("
").insertAfter(n).height(k).width(o).addClass(c.wrapperClass);var f=b("
").appendTo(j).attr("id",e).height(k).width(o);var l=ace.edit(e);if(typeof c.toolbarCallback=="function"){var i=b("
").prependTo(j).width(o);c.toolbarCallback(i,l);if(i.height()>0){f.height(k-i.height());l.resize()}}g={wrapperDiv:j,editorDiv:f,editor:l};l.setTheme("ace/theme/"+c.theme);l.setOptions(c.options);var m=l.getSession();m.setMode("ace/mode/"+c.mode);m.setTabSize(c.tabSize);m.setUseSoftTabs(c.softTabs);l.setReadOnly(c.readOnly);l.renderer.setShowGutter(c.showGutter);n.data("ace",g);n.ace("val",n.val());l.setHighlightActiveLine(c.highlightActiveLine);l.clearSelection();m.on("change",function(h){n.val(l.getSession().getValue())})}})},get:function(){if(this.first().data("ace")){return this.first().data("ace").editor}},val:function(c){if(typeof c=="undefined"){return this.first().data("ace").editor.getValue()}else{this.each(function(){var d=b(this).data("ace");if(d){d.editor.setValue(c,-1)}})}return this},check:function(){return typeof this.first().data("ace")!="undefined"}};b.fn.ace=function(c){if(a[c]){return a[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return a.init.apply(this,arguments)}else{b.error("Method "+c+" does not exist on jQuery.ace")}}}})(jQuery);




© 2015 - 2024 Weber Informatics LLC | Privacy Policy