* code for task#904.
This commit is contained in:
+1
-1
@@ -204,7 +204,7 @@ j=k.div,n=b('[name="address"]',j),o=b('[name="searchBtn"]',j),r=b('[name="insert
|
||||
KindEditor.plugin("clearhtml",function(b){var c=this;c.clickToolbar("clearhtml",function(){c.focus();var g=c.html(),g=g.replace(/(<script[^>]*>)([\s\S]*?)(<\/script>)/ig,""),g=g.replace(/(<style[^>]*>)([\s\S]*?)(<\/style>)/ig,""),g=b.formatHtml(g,{a:["href","target"],embed:["src","width","height","type","loop","autostart","quality",".width",".height","align","allowscriptaccess"],img:["src","width","height","border","alt","title",".width",".height"],table:["border"],"td,th":["rowspan","colspan"],"div,hr,br,tbody,tr,p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6":[]});
|
||||
c.html(g);c.cmd.selection(!0);c.addBookmark()})});
|
||||
KindEditor.plugin("code",function(b){var c=this;c.clickToolbar("code",function(){c.lang("code.");var g=c.createDialog({name:"code",width:450,title:c.lang("code"),body:'<div style="padding:10px 20px;"><div class="ke-dialog-row"><select class="ke-code-type"><option value="js">JavaScript</option><option value="html">HTML</option><option value="css">CSS</option><option value="php">PHP</option><option value="pl">Perl</option><option value="py">Python</option><option value="rb">Ruby</option><option value="java">Java</option><option value="vb">ASP/VB</option><option value="cpp">C/C++</option><option value="cs">C#</option><option value="xml">XML</option><option value="bsh">Shell</option><option value="">Other</option></select></div><textarea class="ke-textarea" style="width:408px;height:260px;"></textarea></div>',yesBtn:{name:c.lang("yes"),
|
||||
click:function(){var f=b(".ke-code-type",g.div).val(),i=l.val(),f='<pre class="prettyprint'+(f===""?"":" lang-"+f)+'">\n'+b.escape(i)+"</pre> ";c.insertHtml(f).hideDialog().focus()}}}),l=b("textarea",g.div);l[0].focus()})});
|
||||
click:function(){var f=b(".ke-code-type",g.div).val(),i=l.val(),f='<pre class="brush:'+(f===""?"":""+f)+'">\n'+b.escape(i)+"</pre> ";c.insertHtml(f).hideDialog().focus()}}}),l=b("textarea",g.div);l[0].focus()})});
|
||||
KindEditor.plugin("emoticons",function(b){var c=this,g=c.emoticonsPath||c.pluginsPath+"emoticons/images/",l=c.allowPreviewEmoticons===void 0?!0:c.allowPreviewEmoticons,f=1;c.clickToolbar("emoticons",function(){function i(f,j,i){z?f.mouseover(function(){j>C?(z.css("left",0),z.css("right","")):(z.css("left",""),z.css("right",0));F.attr("src",g+i+".gif");b(this).addClass("ke-on")}):f.mouseover(function(){b(this).addClass("ke-on")});f.mouseout(function(){b(this).removeClass("ke-on")});f.click(function(b){c.insertHtml('<img src="'+
|
||||
g+i+'.gif" border="0" alt="" />').hideMenu().focus();b.stop()})}function k(c,f){var j=document.createElement("table");f.append(j);z&&(b(j).mouseover(function(){z.show("block")}),b(j).mouseout(function(){z.hide()}),A.push(b(j)));j.className="ke-table";j.cellPadding=0;j.cellSpacing=0;j.border=0;for(var n=(c-1)*u+p,o=0;o<r;o++)for(var k=j.insertRow(o),l=0;l<s;l++){var q=b(k.insertCell(l));q.addClass("ke-cell");i(q,l,n);var t=b('<span class="ke-img"></span>').css("background-position","-"+24*n+"px 0px").css("background-image",
|
||||
"url("+g+"static.gif)");q.append(t);A.push(q);n++}return j}function j(){b.each(A,function(){this.unbind()})}function n(b,c){b.click(function(b){j();t.parentNode.removeChild(t);D.remove();t=k(c,q);o(c);f=c;b.stop()})}function o(c){D=b('<div class="ke-page"></div>');q.append(D);for(var f=1;f<=w;f++){if(c!==f){var g=b('<a href="javascript:;">['+f+"]</a>");n(g,f);D.append(g);A.push(g)}else D.append(b("@["+f+"]"));D.append(b("@ "))}}var r=5,s=9,p=0,u=r*s,w=Math.ceil(135/u),C=Math.floor(s/2),q=b('<div class="ke-plugin-emoticons"></div>'),
|
||||
|
||||
+2
-2
@@ -45,8 +45,8 @@ KindEditor.plugin('code', function(K) {
|
||||
click : function(e) {
|
||||
var type = K('.ke-code-type', dialog.div).val(),
|
||||
code = textarea.val(),
|
||||
cls = type === '' ? '' : ' lang-' + type,
|
||||
html = '<pre class="prettyprint' + cls + '">\n' + K.escape(code) + '</pre> ';
|
||||
cls = type === '' ? '' : type,
|
||||
html = '<pre class="prettyprint brush:' + cls + '">\n' + K.escape(code) + '</pre><p></p>';
|
||||
self.insertHtml(html).hideDialog().focus();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user