epiceditor-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(a,b){function c(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])}function d(a,b){for(var c in b)b.hasOwnProperty(c)&&(a.style[c]=b[c])}function e(b,c){var d=b,e=null;return a.getComputedStyle?e=document.defaultView.getComputedStyle(d,null).getPropertyValue(c):d.currentStyle&&(e=d.currentStyle[c]),e}function f(a,b,c){var f={},g;if(b==="save"){for(g in c)c.hasOwnProperty(g)&&(f[g]=e(a,g));d(a,c)}else b==="apply"&&d(a,c);return f}function g(a){var b=parseInt(e(a,"border-left-width"),10)+parseInt(e(a,"border-right-width"),10),c=parseInt(e(a,"padding-left"),10)+parseInt(e(a,"padding-right"),10),d=a.offsetWidth,f;return isNaN(b)&&(b=0),f=b+c+d,f}function h(a){var b=parseInt(e(a,"border-top-width"),10)+parseInt(e(a,"border-bottom-width"),10),c=parseInt(e(a,"padding-top"),10)+parseInt(e(a,"padding-bottom"),10),d=a.offsetHeight,f;return isNaN(b)&&(b=0),f=b+c+d,f}function i(a,b,d){d=d||"";var e=b.getElementsByTagName("head")[0],f=b.createElement("link");c(f,{type:"text/css",id:d,rel:"stylesheet",href:a,name:a,media:"screen"}),e.appendChild(f)}function j(a,b,c){a.className=a.className.replace(b,c)}function k(a){return a.contentDocument||a.contentWindow.document}function l(a){var b;return document.body.innerText?b=a.innerText:(b=a.innerHTML.replace(/<br>/gi,"\n"),b=b.replace(/<(?:.|\n)*?>/gm,""),b=b.replace(/&lt;/gi,"<"),b=b.replace(/&gt;/gi,">")),b}function m(a,b){return document.body.innerText?a.innerText=b:a.innerHTML=b.replace(/\n/g,"<br>"),!0}function n(){var a=-1,b=navigator.userAgent,c;return navigator.appName=="Microsoft Internet Explorer"&&(c=/MSIE ([0-9]{1,}[\.0-9]{0,})/,c.exec(b)!=null&&(a=parseFloat(RegExp.$1,10))),a}function o(a){var b={};return a&&b.toString.call(a)==="[object Function]"}function p(){var a=arguments[0]||{},c=1,d=arguments.length,e=!1,f,g,h,i;typeof a=="boolean"&&(e=a,a=arguments[1]||{},c=2),typeof a!="object"&&!o(a)&&(a={}),d===c&&(a=this,--c);for(;c<d;c++)if((f=arguments[c])!=null)for(g in f)if(f.hasOwnProperty(g)){h=a[g],i=f[g];if(a===i)continue;e&&i&&typeof i=="object"&&!i.nodeType?a[g]=p(e,h||(i.length!=null?[]:{}),i):i!==b&&(a[g]=i)}return a}function q(a){var c=this,d=a||{},e,f,g={container:"epiceditor",basePath:"epiceditor",localStorageName:"epiceditor",file:{name:d.container||"epiceditor",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,edit:79},parser:typeof marked=="function"?marked:null},h;c.settings=p(!0,g,d);if(typeof c.settings.parser!="function"||typeof c.settings.parser("TEST")!="string")c.settings.parser=function(a){return a};return c.instanceId="epiceditor-"+Math.round(Math.random()*1e5),c._canSave=!0,c._defaultFileSchema=function(){return{content:c.settings.file.defaultContent,created:new Date,modified:new Date}},localStorage&&(localStorage[c.settings.localStorageName]?JSON.parse(localStorage[c.settings.localStorageName])[c.settings.file.name]===b?(f=JSON.parse(localStorage[c.settings.localStorageName])[c.settings.file.name],f=c._defaultFileSchema(),f.content=c.settings.file.defaultContent):c.content=c.settings.file.defaultContent:(h={},h[c.settings.file.name]=c._defaultFileSchema(),h=JSON.stringify(h),localStorage[c.settings.localStorageName]=h)),c.events||(c.events={}),typeof c.settings.container=="string"?c.element=document.getElementById(c.settings.container):typeof c.settings.container=="object"&&(c.element=c.settings.container),this}q.prototype.load=function(b){function G(a){for(var b=0;b<a.length;b++)a[b].style.width=c.element.offsetWidth-o+"px",a[b].style.height=c.element.offsetHeight-p+"px"}function H(a){o=g(c.element)-c.element.offsetWidth;for(var b=0;b<a.length;b++)a[b].style.width=c.element.offsetWidth-o+"px"}function I(b){if(Math.abs(u.y-b.pageY)>=5||Math.abs(u.x-b.pageX)>=5)r.style.display="block",s&&clearTimeout(s),s=a.setTimeout(function(){r.style.display="none"},1e3);u={y:b.pageY,x:b.pageX}}function J(a){a.keyCode==c.settings.shortcut.modifier&&(C=!0),a.keyCode==17&&(D=!0),C===!0&&a.keyCode==c.settings.shortcut.preview&&!c.eeState.fullscreen&&(a.preventDefault(),c.preview(),c.previewerIframe.focus()),C===!0&&a.keyCode==c.settings.shortcut.edit&&(a.preventDefault(),c.eeState.fullscreen||(c.edit(),c.editorIframe.focus())),C===!0&&a.keyCode==c.settings.shortcut.fullscreen&&(a.preventDefault(),y(B)),a.keyCode==27&&c.eeState.fullscreen&&(document.body.webkitRequestFullScreen||z(B)),D===!0&&a.keyCode==83&&(c.save(),a.preventDefault()),a.metaKey&&a.keyCode==83&&(c.save(),a.preventDefault())}function K(a){a.keyCode==c.settings.shortcut.modifier&&(C=!1),a.keyCode==17&&(D=!1)}var c=this,j,l,m,o,p,q,r,s,t,u={y:-1,x:-1},v,w,x=document.body.webkitRequestFullScreen?!0:!1,y,z,A,B,C=!1,D=!1,E,F;b=b||function(){},c.eeState={fullscreen:!1,preview:!1,edit:!0,loaded:!1,unloaded:!1},j={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>'},c.element.innerHTML='<iframe scrolling="no" frameborder="0" id= "'+c.instanceId+'"></iframe>',l=document.getElementById(c.instanceId),c.iframeElement=l,c.iframe=k(l),c.iframe.open(),c.iframe.write(j.chrome),c.editorIframe=c.iframe.getElementById("epiceditor-editor-frame"),c.previewerIframe=c.iframe.getElementById("epiceditor-previewer-frame"),c.editorIframeDocument=k(c.editorIframe),c.editorIframeDocument.open(),c.editorIframeDocument.write(""),c.editorIframeDocument.close(),c.previewerIframeDocument=k(c.previewerIframe),c.previewerIframeDocument.open(),c.previewerIframeDocument.write(j.previewer),m=c.previewerIframeDocument.createElement("base"),m.target="_blank",c.previewerIframeDocument.getElementsByTagName("head")[0].appendChild(m),c.previewerIframeDocument.close(),o=g(c.element)-c.element.offsetWidth,p=h(c.element)-c.element.offsetHeight,A=[c.iframeElement,c.editorIframe,c.previewerIframe],G(A),i(c.settings.basePath+c.settings.theme.base,c.iframe),i(c.settings.basePath+c.settings.theme.editor,c.editorIframeDocument),i(c.settings.basePath+c.settings.theme.preview,c.previewerIframeDocument),c.iframe.getElementById("epiceditor-wrapper").style.position="relative",c.editor=c.editorIframeDocument.body,c.previewer=c.previewerIframeDocument.getElementById("epiceditor-preview"),c.editor.contentEditable=!0,c.iframe.body.style.height=this.element.offsetHeight+"px",this.previewerIframe.style.display="none",n()>-1&&(this.previewer.style.height=parseInt(e(this.previewer,"height"),10)+2),i(c.settings.basePath+c.settings.theme.preview,c.previewerIframeDocument,"theme"),this.open(c.settings.file.name),c.settings.focusOnLoad&&c.iframe.addEventListener("readystatechange",function(){c.iframe.readyState=="complete"&&c.editorIframeDocument.body.focus()}),q=c.iframe.getElementById("epiceditor-utilbar"),v={},y=function(b){if(c.eeState.fullscreen){z(b);return}x&&b.webkitRequestFullScreen(),w=c.eeState.edit,c.eeState.fullscreen=!0,c.eeState.edit=!0,c.eeState.preview=!0;var d=a.innerWidth,g=a.innerHeight,h=a.outerWidth,i=a.outerHeight;x||(i=a.innerHeight),v.editorIframe=f(c.editorIframe,"save",{width:h/2+"px",height:i+"px","float":"left",cssFloat:"left",styleFloat:"left",display:"block"}),v.previewerIframe=f(c.previewerIframe,"save",{width:h/2+"px",height:i+"px","float":"right",cssFloat:"right",styleFloat:"right",display:"block"}),v.element=f(c.element,"save",{position:"fixed",top:"0",left:"0",width:"100%","z-index":"9999",zIndex:"9999",border:"none",margin:"0",background:e(c.editor,"background-color"),height:g+"px"}),v.iframeElement=f(c.iframeElement,"save",{width:h+"px",height:g+"px"}),q.style.visibility="hidden",x||(document.body.style.overflow="hidden"),c.preview(),c.editorIframeDocument.body.focus()},z=function(a){f(c.element,"apply",v.element),f(c.iframeElement,"apply",v.iframeElement),f(c.editorIframe,"apply",v.editorIframe),f(c.previewerIframe,"apply",v.previewerIframe),c.element.style.width="",c.element.style.height="",q.style.visibility="visible",x?document.webkitCancelFullScreen():document.body.style.overflow="auto",c.eeState.fullscreen=!1,w?c.edit():c.preview(),H(A)},c.editor.addEventListener("keyup",function(){t&&a.clearTimeout(t),t=a.setTimeout(function(){c.eeState.fullscreen&&c.preview()},250)}),B=c.iframeElement,q.addEventListener("click",function(a){var b=a.target.className;b.indexOf("epiceditor-toggle-preview-btn")>-1?c.preview():b.indexOf("epiceditor-toggle-edit-btn")>-1?c.edit():b.indexOf("epiceditor-fullscreen-btn")>-1&&y(B)}),document.body.webkitRequestFullScreen&&B.addEventListener("webkitfullscreenchange",function(){document.webkitIsFullScreen||z(B)},!1),r=c.iframe.getElementById("epiceditor-utilbar"),r.style.display="none",r.addEventListener("mouseover",function(){s&&clearTimeout(s)}),E=[c.previewerIframeDocument,c.editorIframeDocument];for(F=0;F<E.length;F++)E[F].addEventListener("mousemove",function(a){I(a)}),E[F].addEventListener("scroll",function(a){I(a)}),E[F].addEventListener("keyup",function(a){K(a)}),E[F].addEventListener("keydown",function(a){J(a)});return c.settings.file.autoSave&&(c.saveInterval=a.setInterval(function(){if(!c._canSave)return;c.save()},c.settings.file.autoSave)),a.addEventListener("resize",function(){!c.iframe.webkitRequestFullScreen&&c.eeState.fullscreen?(d(c.iframeElement,{width:a.outerWidth+"px",height:a.innerHeight+"px"}),d(c.element,{height:a.innerHeight+"px"}),d(c.previewerIframe,{width:a.outerWidth/2+"px",height:a.innerHeight+"px"}),d(c.editorIframe,{width:a.outerWidth/2+"px",height:a.innerHeight+"px"})):c.eeState.fullscreen||H(A)}),c.iframe.close(),c.eeState.loaded=!0,c.eeState.unloaded=!1,b.call(this),this.emit("load"),this},q.prototype.unload=function(b){if(this.eeState.unloaded)throw new Error("Editor isn't loaded");var c=this,d=a.parent.document.getElementById(c.instanceId);return d.parentNode.removeChild(d),c.eeState.loaded=!1,c.eeState.unloaded=!0,b=b||function(){},c.saveInterval&&a.clearInterval(c.saveInterval),b.call(this),c.emit("unload"),c},q.prototype.preview=function(a){var b=this;return a=a||b.settings.basePath+b.settings.theme.preview,j(b.getElement("wrapper"),"epiceditor-edit-mode","epiceditor-preview-mode"),b.previewerIframeDocument.getElementById("theme")?b.previewerIframeDocument.getElementById("theme").name!==a&&(b.previewerIframeDocument.getElementById("theme").href=a):i(a,b.previewerIframeDocument,"theme"),b.previewer.innerHTML=b.exportFile(null,"html"),b.eeState.fullscreen||(b.editorIframe.style.display="none",b.previewerIframe.style.display="block",b.eeState.preview=!0,b.eeState.edit=!1),b.emit("preview"),b},q.prototype.edit=function(){var a=this;return j(a.getElement("wrapper"),"epiceditor-preview-mode","epiceditor-edit-mode"),a.eeState.preview=!1,a.eeState.edit=!0,a.editorIframe.style.display="block",a.previewerIframe.style.display="none",a.emit("edit"),this},q.prototype.getElement=function(a){var b={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!b[a]||this.eeState.unloaded?null:b[a]},q.prototype.open=function(a){var c=this,d=c.settings.file.defaultContent,e;return a=a||c.settings.file.name,c.settings.file.name=a,localStorage&&localStorage[c.settings.localStorageName]&&(e=JSON.parse(localStorage[c.settings.localStorageName]),e[a]!==b?(m(c.editor,e[a].content),c.emit("read")):(m(c.editor,d),c.save(),c.emit("create")),c.previewer.innerHTML=c.exportFile(null,"html"),c.emit("open")),this},q.prototype.save=function(){var a=this,c,d=a.settings.file.name,e=l(this.editor);return this._canSave=!0,c=JSON.parse(localStorage[a.settings.localStorageName]),c[d]===b?c[d]=a._defaultFileSchema():e!==c[d].content&&(c[d].modified=new Date,a.emit("update")),c[d].content=e,localStorage[a.settings.localStorageName]=JSON.stringify(c),this.emit("save"),this},q.prototype.remove=function(a){var b=this,c;return a=a||b.settings.file.name,a==b.settings.file.name&&(b._canSave=!1),c=JSON.parse(localStorage[b.settings.localStorageName]),delete c[a],localStorage[b.settings.localStorageName]=JSON.stringify(c),this.emit("remove"),this},q.prototype.rename=function(a,b){var c=this,d=JSON.parse(localStorage[c.settings.localStorageName]);return d[b]=d[a],delete d[a],localStorage[c.settings.localStorageName]=JSON.stringify(d),c.open(b),this},q.prototype.importFile=function(a,c,d,e){var f=this,g=!1;return a=a||f.settings.file.name,c=c||"",d=d||"md",e=e||{},JSON.parse(localStorage[f.settings.localStorageName])[a]===b&&(g=!0),f.settings.file.name=a,m(f.editor,c),g&&f.emit("create"),f.save(),f.eeState.fullscreen&&f.preview(),this},q.prototype.exportFile=function(a,c){var d=this,e,f;a=a||d.settings.file.name,c=c||"text",e=JSON.parse(localStorage[d.settings.localStorageName])[a];if(e===b)return;f=e.content;switch(c){case"html":return f=f.replace(/\u00a0/g," ").replace(/&nbsp;/g," "),d.settings.parser(f);case"text":return f;default:return f}},q.prototype.on=function(a,b){var c=this;return this.events[a]||(this.events[a]=[]),this.events[a].push(b),c},q.prototype.emit=function(a,b){function e(a){a.call(c,b)}var c=this,d;b=b||JSON.parse(localStorage[c.settings.localStorageName])[c.settings.file.name];if(!this.events[a])return;for(d=0;d<c.events[a].length;d++)e(c.events[a][d]);return c},q.prototype.removeListener=function(a,b){var c=this;return b?this.events[a]?(this.events[a].splice(this.events[a].indexOf(b),1),c):c:(this.events[a]=[],c)},q.version="0.1.0",a.EpicEditor=q})(window),function(){function c(a,c){return a[0][0]!=="!"?'<a href="'+j(c.href)+'"'+(c.title?' title="'+j(c.title)+'"':"")+">"+b.lexer(a[1])+"</a>":'<img src="'+j(c.href)+'" alt="'+j(a[1])+'"'+(c.title?' title="'+j(c.title)+'"':"")+">"}function f(){return e=d.pop()}function g(){switch(e.type){case"space":return"";case"hr":return"<hr>\n";case"heading":return"<h"+e.depth+">"+b.lexer(e.text)+"</h"+e.depth+">\n";case"code":return p.highlight&&(e.code=p.highlight(e.text,e.lang),e.code!=null&&e.code!==e.text&&(e.escaped=!0,e.text=e.code)),e.escaped||(e.text=j(e.text,!0)),"<pre><code"+(e.lang?' class="lang-'+e.lang+'"':"")+">"+e.text+"</code></pre>\n";case"blockquote_start":var a="";while(f().type!=="blockquote_end")a+=g();return"<blockquote>\n"+a+"</blockquote>\n";case"list_start":var c=e.ordered?"ol":"ul",a="";while(f().type!=="list_end")a+=g();return"<"+c+">\n"+a+"</"+c+">\n";case"list_item_start":var a="";while(f().type!=="list_item_end")a+=e.type==="text"?h():g();return"<li>"+a+"</li>\n";case"loose_item_start":var a="";while(f().type!=="list_item_end")a+=g();return"<li>"+a+"</li>\n";case"html":return p.sanitize?b.lexer(e.text):!e.pre&&!p.pedantic?b.lexer(e.text):e.text;case"paragraph":return"<p>"+b.lexer(e.text)+"</p>\n";case"text":return"<p>"+h()+"</p>\n"}}function h(){var a=e.text,c;while((c=d[d.length-1])&&c.type==="text")a+="\n"+f().text;return b.lexer(a)}function i(a){d=a.reverse();var b="";while(f())b+=g();return d=null,e=null,b}function j(a,b){return a.replace(b?/&/g:/&(?!#?\w+;)/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function k(a){var b="",c=a.length,d=0,e;for(;d<c;d++)e=a.charCodeAt(d),Math.random()>.5&&(e="x"+e.toString(16)),b+="&#"+e+";";return b}function l(){var a="(?!(?: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 a}function m(a,b){return a=a.source,b=b||"",function c(d,e){return d?(a=a.replace(d,e.source||e),c):new RegExp(a,b)}}function n(){}function o(b,c){return r(c),i(a.lexer(b))}function r(c){c||(c=q);if(p===c)return;p=c,p.gfm?(a.fences=a.gfm.fences,a.paragraph=a.gfm.paragraph,b.text=b.gfm.text,b.url=b.gfm.url):(a.fences=a.normal.fences,a.paragraph=a.normal.paragraph,b.text=b.normal.text,b.url=b.normal.url),p.pedantic?(b.em=b.pedantic.em,b.strong=b.pedantic.strong):(b.em=b.normal.em,b.strong=b.normal.strong)}var a={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:n,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]+/};a.bullet=/(?:[*+-]|\d+\.)/,a.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/,a.item=m(a.item,"gm")(/bull/g,a.bullet)(),a.list=m(a.list)(/bull/g,a.bullet)("hr",/\n+(?=(?: *[-*_]){3,} *(?:\n+|$))/)(),a.html=m(a.html)("comment",/<!--[^\0]*?-->/)("closed",/<(tag)[^\0]+?<\/\1>/)("closing",/<tag(?!:\/|@)\b(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,l())(),a.paragraph=function(){var b=a.paragraph.source,c=[];return function d(b){return b=a[b]?a[b].source:b,c.push(b.replace(/(^|[^\[])\^/g,"$1")),d}("hr")("heading")("lheading")("blockquote")("<"+l())("def"),new RegExp(b.replace("body",c.join("|")))}(),a.normal={fences:a.fences,paragraph:a.paragraph},a.gfm={fences:/^ *``` *(\w+)? *\n([^\0]+?)\s*``` *(?:\n+|$)/,paragraph:/^/},a.gfm.paragraph=m(a.paragraph)("(?!","(?!"+a.gfm.fences.source.replace(/(^|[^\[])\^/g,"$1")+"|")(),a.lexer=function(b){var c=[];return c.links={},b=b.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),a.token(b,c,!0)},a.token=function(b,c,d){var b=b.replace(/^ +$/gm,""),e,f,g,h,i,j,k;while(b){if(g=a.newline.exec(b))b=b.substring(g[0].length),g[0].length>1&&c.push({type:"space"});if(g=a.code.exec(b)){b=b.substring(g[0].length),g=g[0].replace(/^ {4}/gm,""),c.push({type:"code",text:p.pedantic?g:g.replace(/\n+$/,"")});continue}if(g=a.fences.exec(b)){b=b.substring(g[0].length),c.push({type:"code",lang:g[1],text:g[2]});continue}if(g=a.heading.exec(b)){b=b.substring(g[0].length),c.push({type:"heading",depth:g[1].length,text:g[2]});continue}if(g=a.lheading.exec(b)){b=b.substring(g[0].length),c.push({type:"heading",depth:g[2]==="="?1:2,text:g[1]});continue}if(g=a.hr.exec(b)){b=b.substring(g[0].length),c.push({type:"hr"});continue}if(g=a.blockquote.exec(b)){b=b.substring(g[0].length),c.push({type:"blockquote_start"}),g=g[0].replace(/^ *> ?/gm,""),a.token(g,c,d),c.push({type:"blockquote_end"});continue}if(g=a.list.exec(b)){b=b.substring(g[0].length),c.push({type:"list_start",ordered:isFinite(g[2])}),g=g[0].match(a.item),e=!1,k=g.length,j=0;for(;j<k;j++)h=g[j],i=h.length,h=h.replace(/^ *([*+-]|\d+\.) +/,""),~h.indexOf("\n ")&&(i-=h.length,h=p.pedantic?h.replace(/^ {1,4}/gm,""):h.replace(new RegExp("^ {1,"+i+"}","gm"),"")),f=e||/\n\n(?!\s*$)/.test(h),j!==k-1&&(e=h[h.length-1]==="\n",f||(f=e)),c.push({type:f?"loose_item_start":"list_item_start"}),a.token(h,c),c.push({type:"list_item_end"});c.push({type:"list_end"});continue}if(g=a.html.exec(b)){b=b.substring(g[0].length),c.push({type:"html",pre:g[1]==="pre",text:g[0]});continue}if(d&&(g=a.def.exec(b))){b=b.substring(g[0].length),c.links[g[1].toLowerCase()]={href:g[2],title:g[3]};continue}if(d&&(g=a.paragraph.exec(b))){b=b.substring(g[0].length),c.push({type:"paragraph",text:g[0]});continue}if(g=a.text.exec(b)){b=b.substring(g[0].length),c.push({type:"text",text:g[0]});continue}}return c};var b={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:n,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|$)/};b._linkInside=/(?:\[[^\]]*\]|[^\]]|\](?=[^\[]*\]))*/,b._linkHref=/\s*<?([^\s]*?)>?(?:\s+['"]([^\0]*?)['"])?\s*/,b.link=m(b.link)("inside",b._linkInside)("href",b._linkHref)(),b.reflink=m(b.reflink)("inside",b._linkInside)(),b.normal={url:b.url,strong:b.strong,em:b.em,text:b.text},b.pedantic={strong:/^__(?=\S)([^\0]*?\S)__(?!_)|^\*\*(?=\S)([^\0]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([^\0]*?\S)_(?!_)|^\*(?=\S)([^\0]*?\S)\*(?!\*)/},b.gfm={url:/^(https?:\/\/[^\s]+[^.,:;"')\]\s])/,text:/^[^\0]+?(?=[\\<!\[_*`]|https?:\/\/| {2,}\n|$)/},b.lexer=function(a){var e="",f=d.links,g,h,i,l;while(a){if(l=b.escape.exec(a)){a=a.substring(l[0].length),e+=l[1];continue}if(l=b.autolink.exec(a)){a=a.substring(l[0].length),l[2]==="@"?(h=l[1][6]===":"?k(l[1].substring(7)):k(l[1]),i=k("mailto:")+h):(h=j(l[1]),i=h),e+='<a href="'+i+'">'+h+"</a>";continue}if(l=b.url.exec(a)){a=a.substring(l[0].length),h=j(l[1]),i=h,e+='<a href="'+i+'">'+h+"</a>";continue}if(l=b.tag.exec(a)){a=a.substring(l[0].length),e+=p.sanitize?j(l[0]):l[0];continue}if(l=b.link.exec(a)){a=a.substring(l[0].length),e+=c(l,{href:l[2],title:l[3]});continue}if((l=b.reflink.exec(a))||(l=b.nolink.exec(a))){a=a.substring(l[0].length),g=(l[2]||l[1]).replace(/\s+/g," "),g=f[g.toLowerCase()];if(!g||!g.href){e+=l[0][0],a=l[0].substring(1)+a;continue}e+=c(l,g);continue}if(l=b.strong.exec(a)){a=a.substring(l[0].length),e+="<strong>"+b.lexer(l[2]||l[1])+"</strong>";continue}if(l=b.em.exec(a)){a=a.substring(l[0].length),e+="<em>"+b.lexer(l[2]||l[1])+"</em>";continue}if(l=b.code.exec(a)){a=a.substring(l[0].length),e+="<code>"+j(l[2],!0)+"</code>";continue}if(l=b.br.exec(a)){a=a.substring(l[0].length),e+="<br>";continue}if(l=b.text.exec(a)){a=a.substring(l[0].length),e+=j(l[0]);continue}}return e};var d,e;n.exec=n;var p,q;o.options=o.setOptions=function(a){return q=a,r(a),o},o.setOptions({gfm:!0,pedantic:!1,sanitize:!1,highlight:null}),o.parser=function(a,b){return r(b),i(a)},o.lexer=function(b,c){return r(c),a.lexer(b)},o.parse=o,typeof module!="undefined"?module.exports=o:this.marked=o}.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,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
+ }
@@ -0,0 +1,121 @@
1
+ html { padding:0 10px; }
2
+
3
+ body {
4
+ margin:0;
5
+ padding:10px 0;
6
+ background:#000;
7
+ }
8
+
9
+ #epiceditor-preview h1,
10
+ #epiceditor-preview h2,
11
+ #epiceditor-preview h3,
12
+ #epiceditor-preview h4,
13
+ #epiceditor-preview h5,
14
+ #epiceditor-preview h6,
15
+ #epiceditor-preview p,
16
+ #epiceditor-preview blockquote {
17
+ margin: 0;
18
+ padding: 0;
19
+ }
20
+ #epiceditor-preview {
21
+ background:#000;
22
+ font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", Arial, sans-serif;
23
+ font-size: 13px;
24
+ line-height: 18px;
25
+ color: #ccc;
26
+ }
27
+ #epiceditor-preview a {
28
+ color: #fff;
29
+ }
30
+ #epiceditor-preview a:hover {
31
+ color: #00ff00;
32
+ text-decoration: none;
33
+ }
34
+ #epiceditor-preview a img {
35
+ border: none;
36
+ }
37
+ #epiceditor-preview p {
38
+ margin-bottom: 9px;
39
+ }
40
+ #epiceditor-preview h1,
41
+ #epiceditor-preview h2,
42
+ #epiceditor-preview h3,
43
+ #epiceditor-preview h4,
44
+ #epiceditor-preview h5,
45
+ #epiceditor-preview h6 {
46
+ color: #cdcdcd;
47
+ line-height: 36px;
48
+ }
49
+ #epiceditor-preview h1 {
50
+ margin-bottom: 18px;
51
+ font-size: 30px;
52
+ }
53
+ #epiceditor-preview h2 {
54
+ font-size: 24px;
55
+ }
56
+ #epiceditor-preview h3 {
57
+ font-size: 18px;
58
+ }
59
+ #epiceditor-preview h4 {
60
+ font-size: 16px;
61
+ }
62
+ #epiceditor-preview h5 {
63
+ font-size: 14px;
64
+ }
65
+ #epiceditor-preview h6 {
66
+ font-size: 13px;
67
+ }
68
+ #epiceditor-preview hr {
69
+ margin: 0 0 19px;
70
+ border: 0;
71
+ border-bottom: 1px solid #ccc;
72
+ }
73
+ #epiceditor-preview blockquote {
74
+ padding: 13px 13px 21px 15px;
75
+ margin-bottom: 18px;
76
+ font-family:georgia,serif;
77
+ font-style: italic;
78
+ }
79
+ #epiceditor-preview blockquote:before {
80
+ content:"\201C";
81
+ font-size:40px;
82
+ margin-left:-10px;
83
+ font-family:georgia,serif;
84
+ color:#eee;
85
+ }
86
+ #epiceditor-preview blockquote p {
87
+ font-size: 14px;
88
+ font-weight: 300;
89
+ line-height: 18px;
90
+ margin-bottom: 0;
91
+ font-style: italic;
92
+ }
93
+ #epiceditor-preview code, #epiceditor-preview pre {
94
+ font-family: Monaco, Andale Mono, Courier New, monospace;
95
+ }
96
+ #epiceditor-preview code {
97
+ background-color: #000;
98
+ color: #f92672;
99
+ padding: 1px 3px;
100
+ font-size: 12px;
101
+ -webkit-border-radius: 3px;
102
+ -moz-border-radius: 3px;
103
+ border-radius: 3px;
104
+ }
105
+ #epiceditor-preview pre {
106
+ display: block;
107
+ padding: 14px;
108
+ color:#66d9ef;
109
+ margin: 0 0 18px;
110
+ line-height: 16px;
111
+ font-size: 11px;
112
+ border: 1px solid #d9d9d9;
113
+ white-space: pre-wrap;
114
+ word-wrap: break-word;
115
+ }
116
+ #epiceditor-preview pre code {
117
+ background-color: #000;
118
+ color:#ccc;
119
+ font-size: 11px;
120
+ padding: 0;
121
+ }