From d49a40979c2b5fb0fa58c8b6a0d1875dbf4da6ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ionic=C4=83=20Biz=C4=83u?= Date: Thu, 9 Apr 2015 15:43:01 +0300 Subject: [PATCH] Updated minified code --- src/custom-html.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/custom-html.min.js b/src/custom-html.min.js index 18df878..ffdba90 100644 --- a/src/custom-html.min.js +++ b/src/custom-html.min.js @@ -1 +1 @@ -function CustomHtml(options){this.button=document.createElement("button");this.button.className="medium-editor-action";if(this.button.innerText){this.button.innerText=options.buttonText||""}else{this.button.textContent=options.buttonText||""}this.button.onclick=this.onClick.bind(this);this.options=options;this.insertHtmlAtCaret=function(html){var sel,range;if(window.getSelection){sel=window.getSelection();if(sel.getRangeAt&&sel.rangeCount){range=sel.getRangeAt(0);range.deleteContents();var el=document.createElement("div");el.innerHTML=html;var frag=document.createDocumentFragment(),node,lastNode;while(node=el.firstChild){lastNode=frag.appendChild(node)}range.insertNode(frag);if(lastNode){range=range.cloneRange();range.setStartAfter(lastNode);range.collapse(true);sel.removeAllRanges();sel.addRange(range)}}}else if(document.selection&&document.selection.type!="Control"){document.selection.createRange().pasteHTML(html)}}}CustomHtml.prototype.onClick=function(){this.insertHtmlAtCaret(this.options.htmlToInsert)};CustomHtml.prototype.getButton=function(){return this.button}; \ No newline at end of file +(function(){function a(a){this.button=document.createElement("button"),this.button.className="medium-editor-action",this.button.innerText?this.button.innerText=a.buttonText||"":this.button.textContent=a.buttonText||"",this.button.onclick=this.onClick.bind(this),this.options=a}a.insertHtmlAtCaret=function(a){var b,c;if(window.getSelection){b=window.getSelection();if(b.getRangeAt&&b.rangeCount){c=b.getRangeAt(0),c.deleteContents();var d=document.createElement("div");d.innerHTML=a;var e=document.createDocumentFragment(),f,g;while(f=d.firstChild)g=e.appendChild(f);c.insertNode(e),g&&(c=c.cloneRange(),c.setStartAfter(g),c.collapse(!0),b.removeAllRanges(),b.addRange(c))}}else document.selection&&document.selection.type!="Control"&&document.selection.createRange().pasteHTML(a)},a.prototype.onClick=function(){a.insertHtmlAtCaret(this.options.htmlToInsert)},a.prototype.getButton=function(){return this.button},window.CustomHtml=a})(); \ No newline at end of file