epic-editor-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ /**
2
+ * EpicEditor - An Embeddable JavaScript Markdown Editor (https://github.com/OscarGodson/EpicEditor)
3
+ * Copyright (c) 2011-2012, Oscar Godson. (MIT Licensed)
4
+ */(function(e,t){function n(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function r(e,t){for(var n in t)t.hasOwnProperty(n)&&(e.style[n]=t[n])}function i(t,n){var r=t,i=null;return e.getComputedStyle?i=document.defaultView.getComputedStyle(r,null).getPropertyValue(n):r.currentStyle&&(i=r.currentStyle[n]),i}function s(e,t,n){var s={},o;if(t==="save"){for(o in n)n.hasOwnProperty(o)&&(s[o]=i(e,o));r(e,n)}else t==="apply"&&r(e,n);return s}function o(e){var t=parseInt(i(e,"border-left-width"),10)+parseInt(i(e,"border-right-width"),10),n=parseInt(i(e,"padding-left"),10)+parseInt(i(e,"padding-right"),10),r=e.offsetWidth,s;return isNaN(t)&&(t=0),s=t+n+r,s}function u(e){var t=parseInt(i(e,"border-top-width"),10)+parseInt(i(e,"border-bottom-width"),10),n=parseInt(i(e,"padding-top"),10)+parseInt(i(e,"padding-bottom"),10),r=e.offsetHeight,s;return isNaN(t)&&(t=0),s=t+n+r,s}function a(e,t,r){r=r||"";var i=t.getElementsByTagName("head")[0],s=t.createElement("link");n(s,{type:"text/css",id:r,rel:"stylesheet",href:e,name:e,media:"screen"}),i.appendChild(s)}function f(e,t,n){e.className=e.className.replace(t,n)}function l(e){return e.contentDocument||e.contentWindow.document}function c(e){var t;return typeof document.body.innerText=="string"?t=e.innerText:(t=e.innerHTML.replace(/<br>/gi,"\n"),t=t.replace(/<(?:.|\n)*?>/gm,""),t=t.replace(/&lt;/gi,"<"),t=t.replace(/&gt;/gi,">")),t}function h(e,t){return typeof document.body.innerText=="string"?(t=t.replace(/ /g," "),e.innerText=t):(t=t.replace(/</g,"&lt;"),t=t.replace(/>/g,"&gt;"),t=t.replace(/\n/g,"<br>"),t=t.replace(/\s\s/g," &nbsp;"),e.innerHTML=t),!0}function p(){var e=-1,t=navigator.userAgent,n;return navigator.appName=="Microsoft Internet Explorer"&&(n=/MSIE ([0-9]{1,}[\.0-9]{0,})/,n.exec(t)!=null&&(e=parseFloat(RegExp.$1,10))),e}function d(){var t=e.navigator;return t.userAgent.indexOf("Safari")>-1&&t.userAgent.indexOf("Chrome")==-1}function v(e){var t={};return e&&t.toString.call(e)==="[object Function]"}function m(){var e=arguments[0]||{},n=1,r=arguments.length,i=!1,s,o,u,a;typeof e=="boolean"&&(i=e,e=arguments[1]||{},n=2),typeof e!="object"&&!v(e)&&(e={}),r===n&&(e=this,--n);for(;n<r;n++)if((s=arguments[n])!=null)for(o in s)if(s.hasOwnProperty(o)){u=e[o],a=s[o];if(e===a)continue;i&&a&&typeof a=="object"&&!a.nodeType?e[o]=m(i,u||(a.length!=null?[]:{}),a):a!==t&&(e[o]=a)}return e}function g(e){var n=this,r=e||{},i,s,o={container:"epiceditor",basePath:"epiceditor",clientSideStorage:!0,localStorageName:"epiceditor",useNativeFullscreen:!0,file:{name:null,defaultContent:"",autoSave:100},theme:{base:"/themes/base/epiceditor.css",preview:"/themes/preview/github.css",editor:"/themes/editor/epic-dark.css"},focusOnLoad:!1,shortcut:{modifier:18,fullscreen:70,preview:80},parser:typeof marked=="function"?marked:null},u;n.settings=m(!0,o,r);if(typeof n.settings.parser!="function"||typeof n.settings.parser("TEST")!="string")n.settings.parser=function(e){return e};return typeof n.settings.container=="string"?n.element=document.getElementById(n.settings.container):typeof n.settings.container=="object"&&(n.element=n.settings.container),n.settings.file.name||(typeof n.settings.container=="string"?n.settings.file.name=n.settings.container:typeof n.settings.container=="object"&&(n.element.id?n.settings.file.name=n.element.id:(g._data.unnamedEditors||(g._data.unnamedEditors=[]),g._data.unnamedEditors.push(n),n.settings.file.name="__epiceditor-untitled-"+g._data.unnamedEditors.length))),n._instanceId="epiceditor-"+Math.round(Math.random()*1e5),n._storage={},n._canSave=!0,n._defaultFileSchema=function(){return{content:n.settings.file.defaultContent,created:new Date,modified:new Date}},localStorage&&n.settings.clientSideStorage&&(this._storage=localStorage,this._storage[n.settings.localStorageName]&&n.getFiles(n.settings.file.name)===t&&(s=n.getFiles(n.settings.file.name),s=n._defaultFileSchema(),s.content=n.settings.file.defaultContent)),this._storage[n.settings.localStorageName]||(u={},u[n.settings.file.name]=n._defaultFileSchema(),u=JSON.stringify(u),this._storage[n.settings.localStorageName]=u),n._eeState={fullscreen:!1,preview:!1,edit:!1,loaded:!1,unloaded:!1},n.events||(n.events={}),this}g.prototype.load=function(t){function C(t){if(Math.abs(g.y-t.pageY)>=5||Math.abs(g.x-t.pageX)>=5)h.style.display="block",v&&clearTimeout(v),v=e.setTimeout(function(){h.style.display="none"},1e3);g={y:t.pageY,x:t.pageX}}function k(e){e.keyCode==n.settings.shortcut.modifier&&(S=!0),e.keyCode==17&&(x=!0),S===!0&&e.keyCode==n.settings.shortcut.preview&&!n.is("fullscreen")&&(e.preventDefault(),n.is("edit")?n.preview():n.edit()),S===!0&&e.keyCode==n.settings.shortcut.fullscreen&&(e.preventDefault(),n._goFullscreen(E)),S===!0&&e.keyCode!==n.settings.shortcut.modifier&&(S=!1),e.keyCode==27&&n.is("fullscreen")&&n._exitFullscreen(E),x===!0&&e.keyCode==83&&(n.save(),e.preventDefault(),x=!1),e.metaKey&&e.keyCode==83&&(n.save(),e.preventDefault())}function L(e){e.keyCode==n.settings.shortcut.modifier&&(S=!1),e.keyCode==17&&(x=!1)}if(this.is("loaded"))return this;var n=this,o,u,f,c,h,v,m,g={y:-1,x:-1},y,b,w=!1,E,S=!1,x=!1,T,N;n.settings.useNativeFullscreen&&(w=document.body.webkitRequestFullScreen?!0:!1),d()&&(w=!1),!n.is("edit")&&!n.is("preview")&&(n._eeState.edit=!0),t=t||function(){},o={chrome:'<div id="epiceditor-wrapper" class="epiceditor-edit-mode"><iframe frameborder="0" id="epiceditor-editor-frame"></iframe><iframe frameborder="0" id="epiceditor-previewer-frame"></iframe><div id="epiceditor-utilbar"><img width="30" src="'+this.settings.basePath+'/images/preview.png" title="Toggle Preview Mode" class="epiceditor-toggle-btn epiceditor-toggle-preview-btn"> '+'<img width="30" src="'+this.settings.basePath+'/images/edit.png" title="Toggle Edit Mode" class="epiceditor-toggle-btn epiceditor-toggle-edit-btn"> '+'<img width="30" src="'+this.settings.basePath+'/images/fullscreen.png" title="Enter Fullscreen" class="epiceditor-fullscreen-btn">'+"</div>"+"</div>",previewer:'<div id="epiceditor-preview"></div>'},n.element.innerHTML='<iframe scrolling="no" frameborder="0" id= "'+n._instanceId+'"></iframe>',n.element.style.height=n.element.offsetHeight+"px",u=document.getElementById(n._instanceId),n.iframeElement=u,n.iframe=l(u),n.iframe.open(),n.iframe.write(o.chrome),n.editorIframe=n.iframe.getElementById("epiceditor-editor-frame"),n.previewerIframe=n.iframe.getElementById("epiceditor-previewer-frame"),n.editorIframeDocument=l(n.editorIframe),n.editorIframeDocument.open(),n.editorIframeDocument.write(""),n.editorIframeDocument.close(),n.previewerIframeDocument=l(n.previewerIframe),n.previewerIframeDocument.open(),n.previewerIframeDocument.write(o.previewer),f=n.previewerIframeDocument.createElement("base"),f.target="_blank",n.previewerIframeDocument.getElementsByTagName("head")[0].appendChild(f),n.previewerIframeDocument.close(),n.reflow(),a(n.settings.basePath+n.settings.theme.base,n.iframe,"theme"),a(n.settings.basePath+n.settings.theme.editor,n.editorIframeDocument,"theme"),a(n.settings.basePath+n.settings.theme.preview,n.previewerIframeDocument,"theme"),n.iframe.getElementById("epiceditor-wrapper").style.position="relative",n.editor=n.editorIframeDocument.body,n.previewer=n.previewerIframeDocument.getElementById("epiceditor-preview"),n.editor.contentEditable=!0,n.iframe.body.style.height=this.element.offsetHeight+"px",this.previewerIframe.style.display="none",p()>-1&&(this.previewer.style.height=parseInt(i(this.previewer,"height"),10)+2),this.open(n.settings.file.name),n.settings.focusOnLoad&&n.iframe.addEventListener("readystatechange",function(){n.iframe.readyState=="complete"&&n.editorIframeDocument.body.focus()}),c=n.iframe.getElementById("epiceditor-utilbar"),y={},n._goFullscreen=function(t){if(n.is("fullscreen")){n._exitFullscreen(t);return}w&&t.webkitRequestFullScreen(),b=n.is("edit"),n._eeState.fullscreen=!0,n._eeState.edit=!0,n._eeState.preview=!0;var r=e.innerWidth,o=e.innerHeight,u=e.outerWidth,a=e.outerHeight;w||(a=e.innerHeight),y.editorIframe=s(n.editorIframe,"save",{width:u/2+"px",height:a+"px","float":"left",cssFloat:"left",styleFloat:"left",display:"block"}),y.previewerIframe=s(n.previewerIframe,"save",{width:u/2+"px",height:a+"px","float":"right",cssFloat:"right",styleFloat:"right",display:"block"}),y.element=s(n.element,"save",{position:"fixed",top:"0",left:"0",width:"100%","z-index":"9999",zIndex:"9999",border:"none",margin:"0",background:i(n.editor,"background-color"),height:o+"px"}),y.iframeElement=s(n.iframeElement,"save",{width:u+"px",height:o+"px"}),c.style.visibility="hidden",w||(document.body.style.overflow="hidden"),n.preview(),n.editorIframeDocument.body.focus(),n.emit("fullscreenenter")},n._exitFullscreen=function(e){s(n.element,"apply",y.element),s(n.iframeElement,"apply",y.iframeElement),s(n.editorIframe,"apply",y.editorIframe),s(n.previewerIframe,"apply",y.previewerIframe),n.element.style.width=n._eeState.reflowWidth?n._eeState.reflowWidth:"",n.element.style.height=n._eeState.reflowHeight?n._eeState.reflowHeight:"",c.style.visibility="visible",w?document.webkitCancelFullScreen():document.body.style.overflow="auto",n._eeState.fullscreen=!1,b?n.edit():n.preview(),n.reflow(),n.emit("fullscreenexit")},n.editor.addEventListener("keyup",function(){m&&e.clearTimeout(m),m=e.setTimeout(function(){n.is("fullscreen")&&n.preview()},250)}),E=n.iframeElement,c.addEventListener("click",function(e){var t=e.target.className;t.indexOf("epiceditor-toggle-preview-btn")>-1?n.preview():t.indexOf("epiceditor-toggle-edit-btn")>-1?n.edit():t.indexOf("epiceditor-fullscreen-btn")>-1&&n._goFullscreen(E)}),document.body.webkitRequestFullScreen&&E.addEventListener("webkitfullscreenchange",function(){document.webkitIsFullScreen||n._exitFullscreen(E)},!1),h=n.iframe.getElementById("epiceditor-utilbar"),h.style.display="none",h.addEventListener("mouseover",function(){v&&clearTimeout(v)}),T=[n.previewerIframeDocument,n.editorIframeDocument];for(N=0;N<T.length;N++)T[N].addEventListener("mousemove",function(e){C(e)}),T[N].addEventListener("scroll",function(e){C(e)}),T[N].addEventListener("keyup",function(e){L(e)}),T[N].addEventListener("keydown",function(e){k(e)});return n.settings.file.autoSave&&(n.saveInterval=e.setInterval(function(){if(!n._canSave)return;n.save()},n.settings.file.autoSave)),e.addEventListener("resize",function(){!n.iframe.webkitRequestFullScreen&&n.is("fullscreen")?(r(n.iframeElement,{width:e.outerWidth+"px",height:e.innerHeight+"px"}),r(n.element,{height:e.innerHeight+"px"}),r(n.previewerIframe,{width:e.outerWidth/2+"px",height:e.innerHeight+"px"}),r(n.editorIframe,{width:e.outerWidth/2+"px",height:e.innerHeight+"px"})):n.is("fullscreen")||n.reflow()}),n._eeState.loaded=!0,n._eeState.unloaded=!1,n.is("preview")?n.preview():n.edit(),n.iframe.close(),t.call(this),this.emit("load"),this},g.prototype.unload=function(t){if(this.is("unloaded"))throw new Error("Editor isn't loaded");var n=this,r=e.parent.document.getElementById(n._instanceId);return r.parentNode.removeChild(r),n._eeState.loaded=!1,n._eeState.unloaded=!0,t=t||function(){},n.saveInterval&&e.clearInterval(n.saveInterval),t.call(this),n.emit("unload"),n},g.prototype.reflow=function(e){var t=this,n=o(t.element)-t.element.offsetWidth,r=u(t.element)-t.element.offsetHeight,i=[t.iframeElement,t.editorIframe,t.previewerIframe],s,a;for(var f=0;f<i.length;f++){if(!e||e=="width")s=t.element.offsetWidth-n+"px",i[f].style.width=s,t._eeState.reflowWidth=s;if(!e||e=="height")a=t.element.offsetHeight-r+"px",i[f].style.height=a,t._eeState.reflowHeight=a}return t},g.prototype.preview=function(t){var n=this,r,i;t=t||n.settings.basePath+n.settings.theme.preview,f(n.getElement("wrapper"),"epiceditor-edit-mode","epiceditor-preview-mode"),n.previewerIframeDocument.getElementById("theme")?n.previewerIframeDocument.getElementById("theme").name!==t&&(n.previewerIframeDocument.getElementById("theme").href=t):a(t,n.previewerIframeDocument,"theme"),n.previewer.innerHTML=n.exportFile(null,"html"),i=n.previewer.getElementsByTagName("a");for(r in i)i[r].hash&&i[r].hostname==e.location.hostname&&(i[r].target="_self");return n.is("fullscreen")||(n.editorIframe.style.display="none",n.previewerIframe.style.display="block",n._eeState.preview=!0,n._eeState.edit=!1,n.previewerIframe.focus()),n.emit("preview"),n},g.prototype.enterFullscreen=function(){return this.is("fullscreen")?this:(this._goFullscreen(this.iframeElement),this)},g.prototype.exitFullscreen=function(){return this.is("fullscreen")?(this._exitFullscreen(this.iframeElement),this):this},g.prototype.edit=function(){var e=this;return f(e.getElement("wrapper"),"epiceditor-preview-mode","epiceditor-edit-mode"),e._eeState.preview=!1,e._eeState.edit=!0,e.editorIframe.style.display="block",e.previewerIframe.style.display="none",e.editorIframe.focus(),e.emit("edit"),this},g.prototype.getElement=function(e){var t={container:this.element,wrapper:this.iframe.getElementById("epiceditor-wrapper"),wrapperIframe:this.iframeElement,editor:this.editorIframeDocument,editorIframe:this.editorIframe,previewer:this.previewerIframeDocument,previewerIframe:this.previewerIframe};return!t[e]||this.is("unloaded")?null:t[e]},g.prototype.is=function(e){var t=this;switch(e){case"loaded":return t._eeState.loaded;case"unloaded":return t._eeState.unloaded;case"preview":return t._eeState.preview;case"edit":return t._eeState.edit;case"fullscreen":return t._eeState.fullscreen;default:return!1}},g.prototype.open=function(e){var n=this,r=n.settings.file.defaultContent,i;return e=e||n.settings.file.name,n.settings.file.name=e,this._storage[n.settings.localStorageName]&&(i=n.getFiles(),i[e]!==t?(h(n.editor,i[e].content),n.emit("read")):(h(n.editor,r),n.save(),n.emit("create")),n.previewer.innerHTML=n.exportFile(null,"html"),n.emit("open")),this},g.prototype.save=function(){var e=this,n,r=!1,i=e.settings.file.name,s=c(this.editor);return this._canSave=!0,n=JSON.parse(this._storage[e.settings.localStorageName]),n[i]===t?n[i]=e._defaultFileSchema():s!==n[i].content&&(n[i].modified=new Date,r=!0),n[i].content=s,this._storage[e.settings.localStorageName]=JSON.stringify(n),r&&e.emit("update"),this.emit("save"),this},g.prototype.remove=function(e){var t=this,n;return e=e||t.settings.file.name,e==t.settings.file.name&&(t._canSave=!1),n=JSON.parse(this._storage[t.settings.localStorageName]),delete n[e],this._storage[t.settings.localStorageName]=JSON.stringify(n),this.emit("remove"),this},g.prototype.rename=function(e,t){var n=this,r=JSON.parse(this._storage[n.settings.localStorageName]);return r[t]=r[e],delete r[e],this._storage[n.settings.localStorageName]=JSON.stringify(r),n.open(t),this},g.prototype.importFile=function(e,n,r,i){var s=this,o=!1;return e=e||s.settings.file.name,n=n||"",r=r||"md",i=i||{},JSON.parse(this._storage[s.settings.localStorageName])[e]===t&&(o=!0),s.settings.file.name=e,h(s.editor,n),o&&s.emit("create"),s.save(),s.is("fullscreen")&&s.preview(),this},g.prototype.exportFile=function(e,n){var r=this,i,s;e=e||r.settings.file.name,n=n||"text",i=r.getFiles(e);if(i===t)return;s=i.content;switch(n){case"html":return s=s.replace(/\u00a0/g," ").replace(/&nbsp;/g," "),r.settings.parser(s);case"text":return s=s.replace(/\u00a0/g," ").replace(/&nbsp;/g," "),s;default:return s}},g.prototype.getFiles=function(e){var t=JSON.parse(this._storage[this.settings.localStorageName]);return e?t[e]:t},g.prototype.on=function(e,t){var n=this;return this.events[e]||(this.events[e]=[]),this.events[e].push(t),n},g.prototype.emit=function(e,t){function i(e){e.call(n,t)}var n=this,r;t=t||n.getFiles(n.settings.file.name);if(!this.events[e])return;for(r=0;r<n.events[e].length;r++)i(n.events[e][r]);return n},g.prototype.removeListener=function(e,t){var n=this;return t?this.events[e]?(this.events[e].splice(this.events[e].indexOf(t),1),n):n:(this.events[e]=[],n)},g.version="0.2.0",g._data={},e.EpicEditor=g})(window),function(){function n(e,n){return e[0][0]!=="!"?'<a href="'+f(n.href)+'"'+(n.title?' title="'+f(n.title)+'"':"")+">"+t.lexer(e[1])+"</a>":'<img src="'+f(n.href)+'" alt="'+f(e[1])+'"'+(n.title?' title="'+f(n.title)+'"':"")+">"}function s(){return i=r.pop()}function o(){switch(i.type){case"space":return"";case"hr":return"<hr>\n";case"heading":return"<h"+i.depth+">"+t.lexer(i.text)+"</h"+i.depth+">\n";case"code":return v.highlight&&(i.code=v.highlight(i.text,i.lang),i.code!=null&&i.code!==i.text&&(i.escaped=!0,i.text=i.code)),i.escaped||(i.text=f(i.text,!0)),"<pre><code"+(i.lang?' class="lang-'+i.lang+'"':"")+">"+i.text+"</code></pre>\n";case"blockquote_start":var e="";while(s().type!=="blockquote_end")e+=o();return"<blockquote>\n"+e+"</blockquote>\n";case"list_start":var n=i.ordered?"ol":"ul",e="";while(s().type!=="list_end")e+=o();return"<"+n+">\n"+e+"</"+n+">\n";case"list_item_start":var e="";while(s().type!=="list_item_end")e+=i.type==="text"?u():o();return"<li>"+e+"</li>\n";case"loose_item_start":var e="";while(s().type!=="list_item_end")e+=o();return"<li>"+e+"</li>\n";case"html":return v.sanitize?t.lexer(i.text):!i.pre&&!v.pedantic?t.lexer(i.text):i.text;case"paragraph":return"<p>"+t.lexer(i.text)+"</p>\n";case"text":return"<p>"+u()+"</p>\n"}}function u(){var e=i.text,n;while((n=r[r.length-1])&&n.type==="text")e+="\n"+s().text;return t.lexer(e)}function a(e){r=e.reverse();var t="";while(s())t+=o();return r=null,i=null,t}function f(e,t){return e.replace(t?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function l(e){var t="",n=e.length,r=0,i;for(;r<n;r++)i=e.charCodeAt(r),Math.random()>.5&&(i="x"+i.toString(16)),t+="&#"+i+";";return t}function c(){var e="(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+";return e}function h(e,t){return e=e.source,t=t||"",function n(r,i){return r?(e=e.replace(r,i.source||i),n):new RegExp(e,t)}}function p(){}function d(t,n){return g(n),a(e.lexer(t))}function g(n){n||(n=m);if(v===n)return;v=n,v.gfm?(e.fences=e.gfm.fences,e.paragraph=e.gfm.paragraph,t.text=t.gfm.text,t.url=t.gfm.url):(e.fences=e.normal.fences,e.paragraph=e.normal.paragraph,t.text=t.normal.text,t.url=t.normal.url),v.pedantic?(t.em=t.pedantic.em,t.strong=t.pedantic.strong):(t.em=t.normal.em,t.strong=t.normal.strong)}var e={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:p,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,lheading:/^([^\n]+)\n *(=|-){3,} *\n*/,blockquote:/^( *>[^\n]+(\n[^\n]+)*\n*)+/,list:/^( *)(bull) [^\0]+?(?:hr|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *([^\s]+)(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,paragraph:/^([^\n]+\n?(?!body))+\n*/,text:/^[^\n]+/};e.bullet=/(?:[*+-]|\d+\.)/,e.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,e.item=h(e.item,"gm")(/bull/g,e.bullet)(),e.list=h(e.list)(/bull/g,e.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)(),e.html=h(e.html)("comment",/<!--[^\0]*?-->/)("closed",/<(tag)[^\0]+?<\/\1>/)("closing",/<tag(?!:\/|@)\b(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,c())(),e.paragraph=function(){var t=e.paragraph.source,n=[];return function r(t){return t=e[t]?e[t].source:t,n.push(t.replace(/(^|[^\[])\^/g,"$1")),r}("hr")("heading")("lheading")("blockquote")("<"+c())("def"),new RegExp(t.replace("body",n.join("|")))}(),e.normal={fences:e.fences,paragraph:e.paragraph},e.gfm={fences:/^ *``` *(\w+)? *\n([^\0]+?)\s*``` *(?:\n+|$)/,paragraph:/^/},e.gfm.paragraph=h(e.paragraph)("(?!","(?!"+e.gfm.fences.source.replace(/(^|[^\[])\^/g,"$1")+"|")(),e.lexer=function(t){var n=[];return n.links={},t=t.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),e.token(t,n,!0)},e.token=function(t,n,r){var t=t.replace(/^ +$/gm,""),i,s,o,u,a,f,l;while(t){if(o=e.newline.exec(t))t=t.substring(o[0].length),o[0].length>1&&n.push({type:"space"});if(o=e.code.exec(t)){t=t.substring(o[0].length),o=o[0].replace(/^ {4}/gm,""),n.push({type:"code",text:v.pedantic?o:o.replace(/\n+$/,"")});continue}if(o=e.fences.exec(t)){t=t.substring(o[0].length),n.push({type:"code",lang:o[1],text:o[2]});continue}if(o=e.heading.exec(t)){t=t.substring(o[0].length),n.push({type:"heading",depth:o[1].length,text:o[2]});continue}if(o=e.lheading.exec(t)){t=t.substring(o[0].length),n.push({type:"heading",depth:o[2]==="="?1:2,text:o[1]});continue}if(o=e.hr.exec(t)){t=t.substring(o[0].length),n.push({type:"hr"});continue}if(o=e.blockquote.exec(t)){t=t.substring(o[0].length),n.push({type:"blockquote_start"}),o=o[0].replace(/^ *> ?/gm,""),e.token(o,n,r),n.push({type:"blockquote_end"});continue}if(o=e.list.exec(t)){t=t.substring(o[0].length),n.push({type:"list_start",ordered:isFinite(o[2])}),o=o[0].match(e.item),i=!1,l=o.length,f=0;for(;f<l;f++)u=o[f],a=u.length,u=u.replace(/^ *([*+-]|\d+\.) +/,""),~u.indexOf("\n ")&&(a-=u.length,u=v.pedantic?u.replace(/^ {1,4}/gm,""):u.replace(new RegExp("^ {1,"+a+"}","gm"),"")),s=i||/\n\n(?!\s*$)/.test(u),f!==l-1&&(i=u[u.length-1]==="\n",s||(s=i)),n.push({type:s?"loose_item_start":"list_item_start"}),e.token(u,n),n.push({type:"list_item_end"});n.push({type:"list_end"});continue}if(o=e.html.exec(t)){t=t.substring(o[0].length),n.push({type:"html",pre:o[1]==="pre",text:o[0]});continue}if(r&&(o=e.def.exec(t))){t=t.substring(o[0].length),n.links[o[1].toLowerCase()]={href:o[2],title:o[3]};continue}if(r&&(o=e.paragraph.exec(t))){t=t.substring(o[0].length),n.push({type:"paragraph",text:o[0]});continue}if(o=e.text.exec(t)){t=t.substring(o[0].length),n.push({type:"text",text:o[0]});continue}}return n};var t={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:p,tag:/^<!--[^\0]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([^\0]+?)__(?!_)|^\*\*([^\0]+?)\*\*(?!\*)/,em:/^\b_((?:__|[^\0])+?)_\b|^\*((?:\*\*|[^\0])+?)\*(?!\*)/,code:/^(`+)([^\0]*?[^`])\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,text:/^[^\0]+?(?=[\\<!\[_*`]| {2,}\n|$)/};t._linkInside=/(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/,t._linkHref=/\s*<?([^\s]*?)>?(?:\s+['"]([^\0]*?)['"])?\s*/,t.link=h(t.link)("inside",t._linkInside)("href",t._linkHref)(),t.reflink=h(t.reflink)("inside",t._linkInside)(),t.normal={url:t.url,strong:t.strong,em:t.em,text:t.text},t.pedantic={strong:/^__(?=\S)([^\0]*?\S)__(?!_)|^\*\*(?=\S)([^\0]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([^\0]*?\S)_(?!_)|^\*(?=\S)([^\0]*?\S)\*(?!\*)/},t.gfm={url:/^(https?:\/\/[^\s]+[^.,:;"')\]\s])/,text:/^[^\0]+?(?=[\\<!\[_*`]|https?:\/\/| {2,}\n|$)/},t.lexer=function(e){var i="",s=r.links,o,u,a,c;while(e){if(c=t.escape.exec(e)){e=e.substring(c[0].length),i+=c[1];continue}if(c=t.autolink.exec(e)){e=e.substring(c[0].length),c[2]==="@"?(u=c[1][6]===":"?l(c[1].substring(7)):l(c[1]),a=l("mailto:")+u):(u=f(c[1]),a=u),i+='<a href="'+a+'">'+u+"</a>";continue}if(c=t.url.exec(e)){e=e.substring(c[0].length),u=f(c[1]),a=u,i+='<a href="'+a+'">'+u+"</a>";continue}if(c=t.tag.exec(e)){e=e.substring(c[0].length),i+=v.sanitize?f(c[0]):c[0];continue}if(c=t.link.exec(e)){e=e.substring(c[0].length),i+=n(c,{href:c[2],title:c[3]});continue}if((c=t.reflink.exec(e))||(c=t.nolink.exec(e))){e=e.substring(c[0].length),o=(c[2]||c[1]).replace(/\s+/g," "),o=s[o.toLowerCase()];if(!o||!o.href){i+=c[0][0],e=c[0].substring(1)+e;continue}i+=n(c,o);continue}if(c=t.strong.exec(e)){e=e.substring(c[0].length),i+="<strong>"+t.lexer(c[2]||c[1])+"</strong>";continue}if(c=t.em.exec(e)){e=e.substring(c[0].length),i+="<em>"+t.lexer(c[2]||c[1])+"</em>";continue}if(c=t.code.exec(e)){e=e.substring(c[0].length),i+="<code>"+f(c[2],!0)+"</code>";continue}if(c=t.br.exec(e)){e=e.substring(c[0].length),i+="<br>";continue}if(c=t.text.exec(e)){e=e.substring(c[0].length),i+=f(c[0]);continue}}return i};var r,i;p.exec=p;var v,m;d.options=d.setOptions=function(e){return m=e,g(e),d},d.setOptions({gfm:!0,pedantic:!1,sanitize:!1,highlight:null}),d.parser=function(e,t){return g(t),a(e)},d.lexer=function(t,n){return g(n),e.lexer(t)},d.parse=d,typeof module!="undefined"?module.exports=d:this.marked=d}.call(function(){return this||(typeof window!="undefined"?window:global)}());
@@ -0,0 +1,31 @@
1
+ html, body, iframe, div { margin:0; padding:0; }
2
+
3
+ #epiceditor-utilbar {
4
+ position:fixed;
5
+ bottom:10px;
6
+ right:10px;
7
+ padding:5px;
8
+ }
9
+
10
+ #epiceditor-utilbar img {
11
+ display:block;
12
+ float:left;
13
+ width: 30px;
14
+ height: 30px;
15
+ }
16
+
17
+ #epiceditor-utilbar img:last-child {
18
+ margin-left: 15px;
19
+ }
20
+
21
+ #epiceditor-utilbar img:hover {
22
+ cursor:pointer;
23
+ }
24
+
25
+ .epiceditor-edit-mode #epiceditor-utilbar img.epiceditor-toggle-edit-btn {
26
+ display: none;
27
+ }
28
+
29
+ .epiceditor-preview-mode #epiceditor-utilbar img.epiceditor-toggle-preview-btn {
30
+ display: none;
31
+ }
@@ -0,0 +1,13 @@
1
+ html { padding:10px; }
2
+
3
+ body {
4
+ border:0;
5
+ background:rgb(41,41,41);
6
+ font-family:monospace;
7
+ font-size:14px;
8
+ padding:10px;
9
+ color:#ddd;
10
+ line-height:1.35em;
11
+ margin:0;
12
+ padding:0;
13
+ }
@@ -0,0 +1,12 @@
1
+ html { padding:10px; }
2
+
3
+ body {
4
+ border:0;
5
+ background:#fcfcfc;
6
+ font-family:monospace;
7
+ font-size:14px;
8
+ padding:10px;
9
+ line-height:1.35em;
10
+ margin:0;
11
+ padding:0;
12
+ }
@@ -0,0 +1,167 @@
1
+ body {
2
+ font-family: Georgia, "Times New Roman", Times, serif;
3
+ line-height: 1.5;
4
+ font-size: 87.5%;
5
+ word-wrap: break-word;
6
+ margin: 2em;
7
+ padding: 0;
8
+ border: 0;
9
+ outline: 0;
10
+ background: #fff;
11
+ }
12
+
13
+ h1,
14
+ h2,
15
+ h3,
16
+ h4,
17
+ h5,
18
+ h6 {
19
+ margin: 1.0em 0 0.5em;
20
+ font-weight: inherit;
21
+ }
22
+
23
+ h1 {
24
+ font-size: 1.357em;
25
+ color: #000;
26
+ }
27
+
28
+ h2 {
29
+ font-size: 1.143em;
30
+ }
31
+
32
+ p {
33
+ margin: 0 0 1.2em;
34
+ }
35
+
36
+ del {
37
+ text-decoration: line-through;
38
+ }
39
+
40
+ tr:nth-child(odd) {
41
+ background-color: #dddddd;
42
+ }
43
+
44
+ img {
45
+ outline: 0;
46
+ }
47
+
48
+ code {
49
+ background-color: #f2f2f2;
50
+ background-color: rgba(40, 40, 0, 0.06);
51
+ }
52
+
53
+ pre {
54
+ background-color: #f2f2f2;
55
+ background-color: rgba(40, 40, 0, 0.06);
56
+ margin: 10px 0;
57
+ overflow: hidden;
58
+ padding: 15px;
59
+ white-space: pre-wrap;
60
+ }
61
+
62
+ pre code {
63
+ font-size: 100%;
64
+ background-color: transparent;
65
+ }
66
+
67
+ blockquote {
68
+ background: #f7f7f7;
69
+ border-left: 1px solid #bbb;
70
+ font-style: italic;
71
+ margin: 1.5em 10px;
72
+ padding: 0.5em 10px;
73
+ }
74
+
75
+ blockquote:before {
76
+ color: #bbb;
77
+ content: "\201C";
78
+ font-size: 3em;
79
+ line-height: 0.1em;
80
+ margin-right: 0.2em;
81
+ vertical-align: -.4em;
82
+ }
83
+
84
+ blockquote:after {
85
+ color: #bbb;
86
+ content: "\201D";
87
+ font-size: 3em;
88
+ line-height: 0.1em;
89
+ vertical-align: -.45em;
90
+ }
91
+
92
+ blockquote > p:first-child {
93
+ display: inline;
94
+ }
95
+
96
+ table {
97
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
98
+ border: 0;
99
+ border-spacing: 0;
100
+ font-size: 0.857em;
101
+ margin: 10px 0;
102
+ width: 100%;
103
+ }
104
+
105
+ table table {
106
+ font-size: 1em;
107
+ }
108
+
109
+ table tr th {
110
+ background: #757575;
111
+ background: rgba(0, 0, 0, 0.51);
112
+ border-bottom-style: none;
113
+ }
114
+
115
+ table tr th,
116
+ table tr th a,
117
+ table tr th a:hover {
118
+ color: #FFF;
119
+ font-weight: bold;
120
+ }
121
+
122
+ table tbody tr th {
123
+ vertical-align: top;
124
+ }
125
+
126
+ tr td,
127
+ tr th {
128
+ padding: 4px 9px;
129
+ border: 1px solid #fff;
130
+ text-align: left; /* LTR */
131
+ }
132
+
133
+ tr:nth-child(odd) {
134
+ background: #e4e4e4;
135
+ background: rgba(0, 0, 0, 0.105);
136
+ }
137
+
138
+ tr,
139
+ tr:nth-child(even) {
140
+ background: #efefef;
141
+ background: rgba(0, 0, 0, 0.063);
142
+ }
143
+
144
+ a {
145
+ color: #0071B3;
146
+ }
147
+
148
+ a:hover,
149
+ a:focus {
150
+ color: #018fe2;
151
+ }
152
+
153
+ a:active {
154
+ color: #23aeff;
155
+ }
156
+
157
+ a:link,
158
+ a:visited {
159
+ text-decoration: none;
160
+ }
161
+
162
+ a:hover,
163
+ a:active,
164
+ a:focus {
165
+ text-decoration: underline;
166
+ }
167
+
@@ -0,0 +1,368 @@
1
+ html { padding:0 10px; }
2
+
3
+ body {
4
+ margin:0;
5
+ padding:0;
6
+ background:#fff;
7
+ }
8
+
9
+ #epiceditor-wrapper{
10
+ background:white;
11
+ }
12
+
13
+ #epiceditor-preview{
14
+ padding-top:10px;
15
+ padding-bottom:10px;
16
+ font-family: Helvetica,arial,freesans,clean,sans-serif;
17
+ font-size:13px;
18
+ line-height:1.6;
19
+ }
20
+
21
+ #epiceditor-preview>*:first-child{
22
+ margin-top:0!important;
23
+ }
24
+
25
+ #epiceditor-preview>*:last-child{
26
+ margin-bottom:0!important;
27
+ }
28
+
29
+ #epiceditor-preview a{
30
+ color:#4183C4;
31
+ text-decoration:none;
32
+ }
33
+
34
+ #epiceditor-preview a:hover{
35
+ text-decoration:underline;
36
+ }
37
+
38
+ #epiceditor-preview h1,
39
+ #epiceditor-preview h2,
40
+ #epiceditor-preview h3,
41
+ #epiceditor-preview h4,
42
+ #epiceditor-preview h5,
43
+ #epiceditor-preview h6{
44
+ margin:20px 0 10px;
45
+ padding:0;
46
+ font-weight:bold;
47
+ -webkit-font-smoothing:antialiased;
48
+ }
49
+
50
+ #epiceditor-preview h1 tt,
51
+ #epiceditor-preview h1 code,
52
+ #epiceditor-preview h2 tt,
53
+ #epiceditor-preview h2 code,
54
+ #epiceditor-preview h3 tt,
55
+ #epiceditor-preview h3 code,
56
+ #epiceditor-preview h4 tt,
57
+ #epiceditor-preview h4 code,
58
+ #epiceditor-preview h5 tt,
59
+ #epiceditor-preview h5 code,
60
+ #epiceditor-preview h6 tt,
61
+ #epiceditor-preview h6 code{
62
+ font-size:inherit;
63
+ }
64
+
65
+ #epiceditor-preview h1{
66
+ font-size:28px;
67
+ color:#000;
68
+ }
69
+
70
+ #epiceditor-preview h2{
71
+ font-size:24px;
72
+ border-bottom:1px solid #ccc;
73
+ color:#000;
74
+ }
75
+
76
+ #epiceditor-preview h3{
77
+ font-size:18px;
78
+ }
79
+
80
+ #epiceditor-preview h4{
81
+ font-size:16px;
82
+ }
83
+
84
+ #epiceditor-preview h5{
85
+ font-size:14px;
86
+ }
87
+
88
+ #epiceditor-preview h6{
89
+ color:#777;
90
+ font-size:14px;
91
+ }
92
+
93
+ #epiceditor-preview p,
94
+ #epiceditor-preview blockquote,
95
+ #epiceditor-preview ul,
96
+ #epiceditor-preview ol,
97
+ #epiceditor-preview dl,
98
+ #epiceditor-preview li,
99
+ #epiceditor-preview table,
100
+ #epiceditor-preview pre{
101
+ margin:15px 0;
102
+ }
103
+
104
+ #epiceditor-preview hr{
105
+ background:transparent url('../../images/modules/pulls/dirty-shade.png') repeat-x 0 0;
106
+ border:0 none;
107
+ color:#ccc;
108
+ height:4px;
109
+ padding:0;
110
+ }
111
+
112
+ #epiceditor-preview>h2:first-child,
113
+ #epiceditor-preview>h1:first-child,
114
+ #epiceditor-preview>h1:first-child+h2,
115
+ #epiceditor-preview>h3:first-child,
116
+ #epiceditor-preview>h4:first-child,
117
+ #epiceditor-preview>h5:first-child,
118
+ #epiceditor-preview>h6:first-child{
119
+ margin-top:0;
120
+ padding-top:0;
121
+ }
122
+
123
+ #epiceditor-preview h1+p,
124
+ #epiceditor-preview h2+p,
125
+ #epiceditor-preview h3+p,
126
+ #epiceditor-preview h4+p,
127
+ #epiceditor-preview h5+p,
128
+ #epiceditor-preview h6+p{
129
+ margin-top:0;
130
+ }
131
+
132
+ #epiceditor-preview li p.first{
133
+ display:inline-block;
134
+ }
135
+
136
+ #epiceditor-preview ul,
137
+ #epiceditor-preview ol{
138
+ padding-left:30px;
139
+ }
140
+
141
+ #epiceditor-preview ul li>:first-child,
142
+ #epiceditor-preview ol li>:first-child{
143
+ margin-top:0;
144
+ }
145
+
146
+ #epiceditor-preview ul li>:last-child,
147
+ #epiceditor-preview ol li>:last-child{
148
+ margin-bottom:0;
149
+ }
150
+
151
+ #epiceditor-preview dl{
152
+ padding:0;
153
+ }
154
+
155
+ #epiceditor-preview dl dt{
156
+ font-size:14px;
157
+ font-weight:bold;
158
+ font-style:italic;
159
+ padding:0;
160
+ margin:15px 0 5px;
161
+ }
162
+
163
+ #epiceditor-preview dl dt:first-child{
164
+ padding:0;
165
+ }
166
+
167
+ #epiceditor-preview dl dt>:first-child{
168
+ margin-top:0;
169
+ }
170
+
171
+ #epiceditor-preview dl dt>:last-child{
172
+ margin-bottom:0;
173
+ }
174
+
175
+ #epiceditor-preview dl dd{
176
+ margin:0 0 15px;
177
+ padding:0 15px;
178
+ }
179
+
180
+ #epiceditor-preview dl dd>:first-child{
181
+ margin-top:0;
182
+ }
183
+
184
+ #epiceditor-preview dl dd>:last-child{
185
+ margin-bottom:0;
186
+ }
187
+
188
+ #epiceditor-preview blockquote{
189
+ border-left:4px solid #DDD;
190
+ padding:0 15px;
191
+ color:#777;
192
+ }
193
+
194
+ #epiceditor-preview blockquote>:first-child{
195
+ margin-top:0;
196
+ }
197
+
198
+ #epiceditor-preview blockquote>:last-child{
199
+ margin-bottom:0;
200
+ }
201
+
202
+ #epiceditor-preview table{
203
+ padding:0;
204
+ border-collapse: collapse;
205
+ border-spacing: 0;
206
+ font-size: 100%;
207
+ font: inherit;
208
+ }
209
+
210
+ #epiceditor-preview table tr{
211
+ border-top:1px solid #ccc;
212
+ background-color:#fff;
213
+ margin:0;
214
+ padding:0;
215
+ }
216
+
217
+ #epiceditor-preview table tr:nth-child(2n){
218
+ background-color:#f8f8f8;
219
+ }
220
+
221
+ #epiceditor-preview table tr th{
222
+ font-weight:bold;
223
+ }
224
+
225
+ #epiceditor-preview table tr th,
226
+ #epiceditor-preview table tr td{
227
+ border:1px solid #ccc;
228
+ text-align:left;
229
+ margin:0;
230
+ padding:6px 13px;
231
+ }
232
+
233
+ #epiceditor-preview table tr th>:first-child,
234
+ #epiceditor-preview table tr td>:first-child{
235
+ margin-top:0;
236
+ }
237
+
238
+ #epiceditor-preview table tr th>:last-child,
239
+ #epiceditor-preview table tr td>:last-child{
240
+ margin-bottom:0;
241
+ }
242
+
243
+ #epiceditor-preview img{
244
+ max-width:100%;
245
+ }
246
+
247
+ #epiceditor-preview span.frame{
248
+ display:block;
249
+ overflow:hidden;
250
+ }
251
+
252
+ #epiceditor-preview span.frame>span{
253
+ border:1px solid #ddd;
254
+ display:block;
255
+ float:left;
256
+ overflow:hidden;
257
+ margin:13px 0 0;
258
+ padding:7px;
259
+ width:auto;
260
+ }
261
+
262
+ #epiceditor-preview span.frame span img{
263
+ display:block;
264
+ float:left;
265
+ }
266
+
267
+ #epiceditor-preview span.frame span span{
268
+ clear:both;
269
+ color:#333;
270
+ display:block;
271
+ padding:5px 0 0;
272
+ }
273
+
274
+ #epiceditor-preview span.align-center{
275
+ display:block;
276
+ overflow:hidden;
277
+ clear:both;
278
+ }
279
+
280
+ #epiceditor-preview span.align-center>span{
281
+ display:block;
282
+ overflow:hidden;
283
+ margin:13px auto 0;
284
+ text-align:center;
285
+ }
286
+
287
+ #epiceditor-preview span.align-center span img{
288
+ margin:0 auto;
289
+ text-align:center;
290
+ }
291
+
292
+ #epiceditor-preview span.align-right{
293
+ display:block;
294
+ overflow:hidden;
295
+ clear:both;
296
+ }
297
+
298
+ #epiceditor-preview span.align-right>span{
299
+ display:block;
300
+ overflow:hidden;
301
+ margin:13px 0 0;
302
+ text-align:right;
303
+ }
304
+
305
+ #epiceditor-preview span.align-right span img{
306
+ margin:0;
307
+ text-align:right;
308
+ }
309
+
310
+ #epiceditor-preview span.float-left{
311
+ display:block;
312
+ margin-right:13px;
313
+ overflow:hidden;
314
+ float:left;
315
+ }
316
+
317
+ #epiceditor-preview span.float-left span{
318
+ margin:13px 0 0;
319
+ }
320
+
321
+ #epiceditor-preview span.float-right{
322
+ display:block;
323
+ margin-left:13px;
324
+ overflow:hidden;
325
+ float:right;
326
+ }
327
+
328
+ #epiceditor-preview span.float-right>span{
329
+ display:block;
330
+ overflow:hidden;
331
+ margin:13px auto 0;
332
+ text-align:right;
333
+ }
334
+
335
+ #epiceditor-preview code,
336
+ #epiceditor-preview tt{
337
+ margin:0 2px;
338
+ padding:0 5px;
339
+ white-space:nowrap;
340
+ border:1px solid #eaeaea;
341
+ background-color:#f8f8f8;
342
+ border-radius:3px;
343
+ }
344
+
345
+ #epiceditor-preview pre>code{
346
+ margin:0;
347
+ padding:0;
348
+ white-space:pre;
349
+ border:none;
350
+ background:transparent;
351
+ }
352
+
353
+ #epiceditor-preview .highlight pre,
354
+ #epiceditor-preview pre{
355
+ background-color:#f8f8f8;
356
+ border:1px solid #ccc;
357
+ font-size:13px;
358
+ line-height:19px;
359
+ overflow:auto;
360
+ padding:6px 10px;
361
+ border-radius:3px;
362
+ }
363
+
364
+ #epiceditor-preview pre code,
365
+ #epiceditor-preview pre tt{
366
+ background-color:transparent;
367
+ border:none;
368
+ }