* markdown v2, 修复笔记内容覆盖
This commit is contained in:
1 parent
92576e9239
commit
90bd07cdcc
3 files changed
+19
-7
No files matched your search
Vendored
+1
-1
@@ -4,4 +4,4 @@ var requirejs,require,define;!function(ba){function G(e){return"[object Function
|
||||
if("("===u)++c;else if("\\"===u.charAt(0)){var d=+u.substring(1);d&&(c>=d?s[d]=-1:n[l]=t(d))}}for(var l=1;l<s.length;++l)-1===s[l]&&(s[l]=++i);for(var l=0,c=0;a>l;++l){var u=n[l];if("("===u)++c,s[c]||(n[l]="(?:");else if("\\"===u.charAt(0)){var d=+u.substring(1);d&&c>=d&&(n[l]="\\"+s[d])}}for(var l=0;a>l;++l)"^"===n[l]&&"^"!==n[l+1]&&(n[l]="");if(e.ignoreCase&&o)for(var l=0;a>l;++l){var u=n[l],p=u.charAt(0);u.length>=2&&"["===p?n[l]=r(u):"\\"!==p&&(n[l]=u.replace(/[a-zA-Z]/g,function(e){var n=e.charCodeAt(0);return"["+String.fromCharCode(-33&n,32|n)+"]"}))}return n.join("")}for(var i=0,o=!1,s=!1,l=0,c=e.length;c>l;++l){var u=e[l];if(u.ignoreCase)s=!0;else if(/[a-z]/i.test(u.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){o=!0,s=!1;break}}for(var d={b:8,t:9,n:10,v:11,f:12,r:13},p=[],l=0,c=e.length;c>l;++l){var u=e[l];if(u.global||u.multiline)throw new Error(""+u);p.push("(?:"+a(u)+")")}return new RegExp(p.join("|"),s?"gi":"g")}function n(e,n){function t(e){var l=e.nodeType;if(1==l){if(r.test(e.className))return;for(var c=e.firstChild;c;c=c.nextSibling)t(c);var u=e.nodeName.toLowerCase();("br"===u||"li"===u)&&(a[s]="\n",o[s<<1]=i++,o[s++<<1|1]=e)}else if(3==l||4==l){var d=e.nodeValue;d.length&&(d=n?d.replace(/\r\n?/g,"\n"):d.replace(/[ \t\r\n]+/g," "),a[s]=d,o[s<<1]=i,i+=d.length,o[s++<<1|1]=e)}}var r=/(?:^|\s)nocode(?:\s|$)/,a=[],i=0,o=[],s=0;return t(e),{sourceCode:a.join("").replace(/\n$/,""),spans:o}}function t(e,n,t,r){if(n){var a={sourceCode:n,basePos:e};t(a),r.push.apply(r,a.decorations)}}function r(e){for(var n=void 0,t=e.firstChild;t;t=t.nextSibling){var r=t.nodeType;n=1===r?n?e:t:3===r&&U.test(t.nodeValue)?e:n}return n===e?void 0:n}function a(n,r){var a,i={};!function(){for(var t=n.concat(r),o=[],s={},l=0,c=t.length;c>l;++l){var u=t[l],d=u[3];if(d)for(var p=d.length;--p>=0;)i[d.charAt(p)]=u;var f=u[1],m=""+f;s.hasOwnProperty(m)||(o.push(f),s[m]=null)}o.push(/[\0-\uffff]/),a=e(o)}();var o=r.length,s=function(e){for(var n=e.sourceCode,l=e.basePos,u=[l,P],d=0,p=n.match(a)||[],f={},m=0,g=p.length;g>m;++m){var h,v=p[m],b=f[v],w=void 0;if("string"==typeof b)h=!1;else{var x=i[v.charAt(0)];if(x)w=v.match(x[1]),b=x[0];else{for(var y=0;o>y;++y)if(x=r[y],w=v.match(x[1])){b=x[0];break}w||(b=P)}h=b.length>=5&&"lang-"===b.substring(0,5),!h||w&&"string"==typeof w[1]||(h=!1,b=O),h||(f[v]=b)}var C=d;if(d+=v.length,h){var k=w[1],S=v.indexOf(k),_=S+k.length;w[2]&&(_=v.length-w[2].length,S=_-k.length);var E=b.substring(5);t(l+C,v.substring(0,S),s,u),t(l+C+S,k,c(E,k),u),t(l+C+_,v.substring(_),s,u)}else u.push(l+C,b)}e.decorations=u};return s}function i(e){var n=[],t=[];n.push(e.tripleQuotedStrings?[M,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""]:e.multiLineStrings?[M,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"]:[M,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"]),e.verbatimStrings&&t.push([M,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null]);var r=e.hashComments;r&&(e.cStyleComments?(n.push(r>1?[L,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"]:[L,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"]),t.push([M,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])):n.push([L,/^#[^\r\n]*/,null,"#"])),e.cStyleComments&&(t.push([L,/^\/\/[^\r\n]*/,null]),t.push([L,/^\/\*[\s\S]*?(?:\*\/|$)/,null]));var i=e.regexLiterals;if(i){var o=i>1?"":"\n\r",s=o?".":"[\\S\\s]",l="/(?=[^/*"+o+"])(?:[^/\\x5B\\x5C"+o+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+o+"]|\\x5C"+s+")*(?:\\x5D|$))+/";t.push(["lang-regex",RegExp("^"+q+"("+l+")")])}var c=e.types;c&&t.push([A,c]);var u=(""+e.keywords).replace(/^ | $/g,"");u.length&&t.push([$,new RegExp("^(?:"+u.replace(/[\s,]+/g,"|")+")\\b"),null]),n.push([P,/^\s+/,null," \r\n "]);var d="^.[^\\s\\w.$@'\"`/\\\\]*";return e.regexLiterals&&(d+="(?!s*/)"),t.push([R,/^@[a-z_$][a-z_$@0-9]*/i,null],[A,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[P,/^[a-z_$][a-z_$@0-9]*/i,null],[R,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[P,/^\\[\s\S]?/,null],[N,new RegExp(d),null]),a(n,t)}function o(e,n,t){function r(e){var n=e.nodeType;if(1!=n||i.test(e.className)){if((3==n||4==n)&&t){var l=e.nodeValue,c=l.match(o);if(c){var u=l.substring(0,c.index);e.nodeValue=u;var d=l.substring(c.index+c[0].length);if(d){var p=e.parentNode;p.insertBefore(s.createTextNode(d),e.nextSibling)}a(e),u||e.parentNode.removeChild(e)}}}else if("br"===e.nodeName)a(e),e.parentNode&&e.parentNode.removeChild(e);else for(var f=e.firstChild;f;f=f.nextSibling)r(f)}function a(e){function n(e,t){var r=t?e.cloneNode(!1):e,a=e.parentNode;if(a){var i=n(a,1),o=e.nextSibling;i.appendChild(r);for(var s=o;s;s=o)o=s.nextSibling,i.appendChild(Line truncated
|
||||
var l=function(e){return o.strings[e]||g[e]};t=t||"";var c=this.hooks=new Markdown.HookCollection;c.addNoop("onPreviewRefresh"),c.addNoop("postBlockquoteCreation"),c.addFalse("insertImageDialog"),c.addFalse("insertLinkDialog"),this.getConverter=function(){return e};var u,d,p=this;this.run=function(s,f){if(!u){u=new n(t,s);var m,g=new i(c,l),v=new r(e,u,function(){c.onPreviewRefresh()},f),b=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase(),w="mac"==b,x=function(e){var n=h[e][w?"mac":"win"],t=n.indexOf("|");return n.substring(0,t>0?t:n.length)};m=new a(t,u,d,v,g,o.helpButton,l,x),m.setUndoRedoButtonStates();var y=p.refreshPreview=function(){v.refresh(!0)};y(),p.uiManager=m}}},e.prototype.findTags=function(e,n){var t,r=this;e&&(t=s.extendRegExp(e,"","$"),this.before=this.before.replace(t,function(e){return r.startTag=r.startTag+e,""}),t=s.extendRegExp(e,"^",""),this.selection=this.selection.replace(t,function(e){return r.startTag=r.startTag+e,""})),n&&(t=s.extendRegExp(n,"","$"),this.selection=this.selection.replace(t,function(e){return r.endTag=e+r.endTag,""}),t=s.extendRegExp(n,"^",""),this.after=this.after.replace(t,function(e){return r.endTag=e+r.endTag,""}))},e.prototype.trimWhitespace=function(e){var n,t,r=this;e?n=t="":(n=function(e){return r.before+=e,""},t=function(e){return r.after=e+r.after,""}),this.selection=this.selection.replace(/^(\s*)/,n).replace(/(\s*)$/,t)},e.prototype.skipLines=function(e,n,t){void 0===e&&(e=1),void 0===n&&(n=1),e++,n++;var r,a;if(navigator.userAgent.match(/Chrome/)&&"X".match(/()./),this.selection=this.selection.replace(/(^\n*)/,""),this.startTag=this.startTag+d.$1,this.selection=this.selection.replace(/(\n*$)/,""),this.endTag=this.endTag+d.$1,this.startTag=this.startTag.replace(/(^\n*)/,""),this.before=this.before+d.$1,this.endTag=this.endTag.replace(/(\n*$)/,""),this.after=this.after+d.$1,this.before){for(r=a="";e--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.before=this.before.replace(new d(r+"$",""),a)}if(this.after){for(r=a="";n--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.after=this.after.replace(new d(r,""),a)}},s.isVisible=function(e){return window.getComputedStyle?"none"!==window.getComputedStyle(e,null).getPropertyValue("display"):e.currentStyle?"none"!==e.currentStyle.display:void 0},s.addEvent=function(e,n,t){e.attachEvent?e.attachEvent("on"+n,t):e.addEventListener(n,t,!1)},s.removeEvent=function(e,n,t){e.detachEvent?e.detachEvent("on"+n,t):e.removeEventListener(n,t,!1)},s.fixEolChars=function(e){return e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n")},s.extendRegExp=function(e,n,t){(null===n||void 0===n)&&(n=""),(null===t||void 0===t)&&(t="");var r,a=e.toString();return a=a.replace(/\/([gim]*)$/,function(e,n){return r=n,""}),a=a.replace(/(^\/|\/$)/g,""),a=n+a+t,new d(a,r)},l.getTop=function(e,n){var t=e.offsetTop;if(!n)for(;e=e.offsetParent;)t+=e.offsetTop;return t},l.getHeight=function(e){return e.offsetHeight||e.scrollHeight},l.getWidth=function(e){return e.offsetWidth||e.scrollWidth},l.getPageSize=function(){var e,n,t,r;self.innerHeight&&self.scrollMaxY?(e=u.body.scrollWidth,n=self.innerHeight+self.scrollMaxY):u.body.scrollHeight>u.body.offsetHeight?(e=u.body.scrollWidth,n=u.body.scrollHeight):(e=u.body.offsetWidth,n=u.body.offsetHeight),self.innerHeight?(t=self.innerWidth,r=self.innerHeight):u.documentElement&&u.documentElement.clientHeight?(t=u.documentElement.clientWidth,r=u.documentElement.clientHeight):u.body&&(t=u.body.clientWidth,r=u.body.clientHeight);var a=Math.max(e,t),i=Math.max(n,r);return[a,i,t,r]},c.createBackground=function(){var e=u.createElement("div"),n=e.style;e.className="wmd-prompt-background",n.position="absolute",n.top="0",n.zIndex="1000",m.isIE?n.filter="alpha(opacity=50)":n.opacity="0.5";var t=l.getPageSize();return n.height=t[1]+"px",m.isIE?(n.left=u.documentElement.scrollLeft,n.width=u.documentElement.clientWidth):(n.left="0",n.width="100%"),u.body.appendChild(e),e},c.prompt=function(e,n,t){var r,a;void 0===n&&(n="");var i=function(e){var n=e.charCode||e.keyCode;27===n&&o(!0)},o=function(e){s.removeEvent(u.body,"keydown",i);var n=a.value;return e?n=null:(n=n.replace(/^http:\/\/(https?|ftp):\/\//,"$1://"),/^(?:https?|ftp):\/\//.test(n)||(n="http://"+n)),r.parentNode.removeChild(r),t(n),!1},c=function(){r=u.createElement("div"),r.className="wmd-prompt-dialog",r.style.padding="10px;",r.style.position="fixed",r.style.width="400px",r.style.zIndex="1001";var t=u.createElement("div");t.innerHTML=e,t.style.padding="5px",r.appendChild(t);var c=u.createElement("form"),d=c.style;c.onsubmit=function(){return o(!1)},d.padding="0",d.margin="0",d.cssFloat="left",d.width="100%",d.textAlign="center",d.position="relative",r.appendChild(c),a=u.createElement("input"),a.type="text",a.value=n,d=a.style,d.display="block",d.width="80%",d.marginLeft=d.marginRight="auto",c.appendChild(a);var p=u.createElement("input");p.type="button",p.onclick=function(){return o(!1)},p.value="OK",d=p.style,d.margin="10px",d.display="inline",d.width="7em";varLine truncated
|
||||
return"fenced_code_gfm"==e})&&(i="^```.*\\n[\\s\\S]*?\\n```|"+i),t.enabled&&(i="^[ \\t]*\\n\\$\\$[\\s\\S]*?\\$\\$|"+i,i="^[ \\t]*\\n\\\\\\\\[[\\s\\S]*?\\\\\\\\]|"+i,i="^[ \\t]*\\n\\\\?\\\\begin\\{[a-z]*\\*?\\}[\\s\\S]*?\\\\end\\{[a-z]*\\*?\\}|"+i),i=new RegExp(i,"gm");var o=r.getConverter();o.hooks.chain("preConversion",function(n){function t(e,n){var t=r.substring(s,n);o.push({text:t,textWithDelimiter:'\n<div class="se-section-delimiter"></div>\n\n'+t+"\n"})}a.previewStartTime=new Date;var r=n+"\n\n",o=[],s=0;return r.replace(i,function(e,n){t(s,n),s=n}),t(s,n.length),a.onSectionsCreated(o),e.reduce(o,function(e,n){return e+n.textWithDelimiter},"")})},i}),define("extensions/partialRendering",["underscore","crel","extensions/markdownExtra","classes/Extension"],function(e,n,t,r){function a(n,t){if(g=[],m=[],u=void 0,h===!0||c!=t)return h=!1,c=t,m=f,f=n,void(g=n);var r=f.length;e.some(f,function(e,t){return t>=n.length||e.text!=n[t].text?(r=t,!0):void 0});var a=-f.length;e.some(f.slice().reverse(),function(e,t){return t>=n.length||e.text!=n[n.length-t-1].text?(a=-t,!0):void 0}),r-a>f.length&&(a=r-f.length);var i=f.slice(0,r);g=n.slice(r,n.length+a);var o=f.slice(f.length+a,f.length);u=e.first(o),m=f.slice(r,f.length+a),f=i.concat(g).concat(o)}function i(e){var n=e.id.substring(3);y[n]=e}function o(){function t(t){for(var r=n("div",{id:"wmd-preview-section-"+t.id,"class":"wmd-preview-section preview-content"}),o=!1;a;){var s=a.nextSibling;if(o===!0&&"DIV"==a.tagName&&"se-section-delimiter"==a.className)break;o=!0,"DIV"==a.tagName&&"footnotes"==a.className?e.each(a.querySelectorAll("ol > li"),i):r.appendChild(a),a=s}return r}e.each(m,function(e){var n=document.getElementById("wmd-preview-section-"+e.id);x.removeChild(n)});var r=document.getElementById("wmd-preview"),a=r.firstChild,o=document.createDocumentFragment();e.each(g,function(e){o.appendChild(t(e))}),r.innerHTML="";var s=w;void 0!==u&&(s=document.getElementById("wmd-preview-section-"+u.id)),x.insertBefore(o,s),w.innerHTML="";var l=[];if(b===!0){var c=n("ol");e.each(x.querySelectorAll("a.footnote"),function(e,n){e.textContent=n+1;var t=e.id.substring(6);l.push(t),c.appendChild(y[t].cloneNode(!0))}),l.length>0&&w.appendChild(n("div",{"class":"footnotes"},n("hr"),c)),y=e.pick(y,l)}}function s(n){l=n.getConverter(),l.hooks.chain("preConversion",function(){var n=e.map(g,function(e){return e.text});return n.push(c+"\n\n"),n.join("")}),n.hooks.chain("onPreviewRefresh",function(){o()})}var l,c,u,d=new r("partialRendering","Partial Rendering",!0),p=0,f=[],m=[],g=[],h=!1,v=!1,b=!1;d.onSectionsCreated=function(n){var t=[],r="\n";b=!1,e.each(n,function(e){var n=e.textWithDelimiter+"\n";v&&(n=n.replace(/^```.*\n[\s\S]*?\n```|\n[ ]{0,3}\[\^(.+?)\]\:[ \t]*\n?([\s\S]*?)\n{1,2}((?=\n[ ]{0,3}\S)|$)/gm,function(e,n){return n?(b=!0,r+=e.replace(/^\s*\n/gm,"")+"\n",""):e})),n=n.replace(/^```.*\n[\s\S]*?\n```|^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?(?=\s|$)[ \t]*\n?[ \t]*((\n*)["(](.+?)[")][ \t]*)?(?:\n+)/gm,function(e,n){return n?(r+=e.replace(/^\s*\n/gm,"")+"\n",""):e}),t.push({id:++p,text:n+"\n"})}),a(t,r)};var w,x,y={};return d.onPagedownConfigure=s,d.onToggleMode=s,d.onInit=function(){t.enabled&&e.some(t.config.extensions,function(e){return"footnotes"==e})&&(v=!0)},d.onReady=function(){w=n("div",{id:"wmd-preview-section-footnotes","class":"preview-content"}),x=document.getElementById("preview-contents"),x.appendChild(w)},d.onFileSelected=function(){h=!0},d}),define("extensions/umlDiagrams",["require","underscore","utils","classes/Extension","crel"],function(e,n,t,r,a){function i(){var t=c.querySelectorAll(".prettyprint > .language-flow");t&&0!=t.length&&e(["flow-chart"],function(e){n.each(t,function(n){try{var t=e.parse(n.textContent),r=n.parentNode,i=a("div",{"class":"flow-chart"});r.parentNode.replaceChild(i,r),t.drawSVG(i,JSON.parse(l.config.flowchartOptions))}catch(o){console.error(o)}})})}function o(){var t=c.querySelectorAll(".prettyprint > .language-sequence");t&&0!=t.length&&e(["Diagram"],function(e){n.each(t,function(n){try{var t=e.parse(n.textContent),r=n.parentNode,i=a("div",{"class":"sequence-diagram"});r.parentNode.replaceChild(i,r),t.drawSVG(i,{theme:"simple"})}catch(o){console.error(o)}})})}function i(){var t=c.querySelectorAll(".prettyprint > .language-flow");t&&0!=t.length&&e(["flow-chart"],function(e){n.each(t,function(n){try{var t=e.parse(n.textContent),r=n.parentNode,i=a("div",{"class":"flow-chart"});r.parentNode.replaceChild(i,r),t.drawSVG(i,JSON.parse(l.config.flowchartOptions))}catch(o){console.error(o)}})})}function s(e){e.hooks.chain("onPreviewRefresh",function(){o(),i()})}var l=new r("umlDiagrams","UML Diagrams",!0);l.defaultConfig={flowchartOptions:["{",' "line-width": 2,',' "font-family": "sans-serif",',' "font-weight": "normal"',"}"].join("\n")};var c=document.getElementById("preview-contents");return l.onPagedownConfigure=s,l.onToggleMode=s,l}),define("extensions/toc",["underscore","utils","classes/Extension"],function(e,n,t){funcLine truncated
|
||||
void 0===e&&(e=1),void 0===n&&(n=1),e++,n++;var r,a;if(navigator.userAgent.match(/Chrome/)&&"X".match(/()./),this.selection=this.selection.replace(/(^\n*)/,""),this.startTag=this.startTag+p.$1,this.selection=this.selection.replace(/(\n*$)/,""),this.endTag=this.endTag+p.$1,this.startTag=this.startTag.replace(/(^\n*)/,""),this.before=this.before+p.$1,this.endTag=this.endTag.replace(/(\n*$)/,""),this.after=this.after+p.$1,this.before){for(r=a="";e--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.before=this.before.replace(new p(r+"$",""),a)}if(this.after){for(r=a="";n--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.after=this.after.replace(new p(r,""),a)}},l.isVisible=function(e){return window.getComputedStyle?"none"!==window.getComputedStyle(e,null).getPropertyValue("display"):e.currentStyle?"none"!==e.currentStyle.display:void 0},l.addEvent=function(e,n,t){e.attachEvent?e.attachEvent("on"+n,t):e.addEventListener(n,t,!1)},l.removeEvent=function(e,n,t){e.detachEvent?e.detachEvent("on"+n,t):e.removeEventListener(n,t,!1)},l.fixEolChars=function(e){return e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n")},l.extendRegExp=function(e,n,t){(null===n||void 0===n)&&(n=""),(null===t||void 0===t)&&(t="");var r,a=e.toString();return a=a.replace(/\/([gim]*)$/,function(e,n){return r=n,""}),a=a.replace(/(^\/|\/$)/g,""),a=n+a+t,new p(a,r)},c.getTop=function(e,n){var t=e.offsetTop;if(!n)for(;e=e.offsetParent;)t+=e.offsetTop;return t},c.getHeight=function(e){return e.offsetHeight||e.scrollHeight},c.getWidth=function(e){return e.offsetWidth||e.scrollWidth},c.getPageSize=function(){var e,n,t,r;self.innerHeight&&self.scrollMaxY?(e=d.body.scrollWidth,n=self.innerHeight+self.scrollMaxY):d.body.scrollHeight>d.body.offsetHeight?(e=d.body.scrollWidth,n=d.body.scrollHeight):(e=d.body.offsetWidth,n=d.body.offsetHeight),self.innerHeight?(t=self.innerWidth,r=self.innerHeight):d.documentElement&&d.documentElement.clientHeight?(t=d.documentElement.clientWidth,r=d.documentElement.clientHeight):d.body&&(t=d.body.clientWidth,r=d.body.clientHeight);var a=Math.max(e,t),i=Math.max(n,r);return[a,i,t,r]},u.createBackground=function(){var e=d.createElement("div"),n=e.style;e.className="wmd-prompt-background",n.position="absolute",n.top="0",n.zIndex="1000",g.isIE?n.filter="alpha(opacity=50)":n.opacity="0.5";var t=c.getPageSize();return n.height=t[1]+"px",g.isIE?(n.left=d.documentElement.scrollLeft,n.width=d.documentElement.clientWidth):(n.left="0",n.width="100%"),d.body.appendChild(e),e},u.prompt=function(e,n,t){var r,a;void 0===n&&(n="");var i=function(e){var n=e.charCode||e.keyCode;27===n&&o(!0)},o=function(e){l.removeEvent(d.body,"keydown",i);var n=a.value;return e?n=null:(n=n.replace(/^http:\/\/(https?|ftp):\/\//,"$1://"),/^(?:https?|ftp):\/\//.test(n)||(n="http://"+n)),r.parentNode.removeChild(r),t(n),!1},s=function(){r=d.createElement("div"),r.className="wmd-prompt-dialog",r.style.padding="10px;",r.style.position="fixed",r.style.width="400px",r.style.zIndex="1001";var t=d.createElement("div");t.innerHTML=e,t.style.padding="5px",r.appendChild(t);var s=d.createElement("form"),u=s.style;s.onsubmit=function(){return o(!1)},u.padding="0",u.margin="0",u.cssFloat="left",u.width="100%",u.textAlign="center",u.position="relative",r.appendChild(s),a=d.createElement("input"),a.type="text",a.value=n,u=a.style,u.display="block",u.width="80%",u.marginLeft=u.marginRight="auto",s.appendChild(a);var p=d.createElement("input");p.type="button",p.onclick=function(){return o(!1)},p.value="OK",u=p.style,u.margin="10px",u.display="inline",u.width="7em";var f=d.createElement("input");f.type="button",f.onclick=function(){return o(!0)},f.value="Cancel",u=f.style,u.margin="10px",u.display="inline",u.width="7em",s.appendChild(p),s.appendChild(f),l.addEvent(d.body,"keydown",i),r.style.top="50%",r.style.left="50%",r.style.display="block",g.isIE_5or6&&(r.style.position="absolute",r.style.top=d.documentElement.scrollTop+200+"px",r.style.left="50%"),d.body.appendChild(r),r.style.marginTop=-(c.getHeight(r)/2)+"px",r.style.marginLeft=-(c.getWidth(r)/2)+"px"};setTimeout(function(){s();var e=n.length;if(void 0!==a.selectionStart)a.selectionStart=0,a.selectionEnd=e;else if(a.createTextRange){var t=a.createTextRange();t.collapse(!1),t.moveStart("character",-e),t.moveEnd("character",e),t.select()}a.focus()},0)};var w=o.prototype;w.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)",w.unwrap=function(e){var n=new p("([^\\n])\\n(?!(\\n|"+this.prefixes+"))","g");e.selection=e.selection.replace(n,"$1 $2")},w.wrap=function(e,n){this.unwrap(e);var t=new p("(.{1,"+n+"})( +|$\\n?)","gm"),r=this;e.selection=e.selection.replace(t,function(e,n){return new p("^"+r.prefixes,"").test(e)?e:n+"\n"}),e.selection=e.selection.replace(/\s+$/,"")},w.doBold=function(e,n){return this.doBorI(e,n,2,this.getString("boldexample"))},w.doItalic=function(e,n){return this.doBorI(e,n,1,this.getString("italicexample"))},w.doBorI=function(e,n,t,r){e.trimWhitespace(),e.selection=e.selection.replace(/\nLine truncated
|
||||
void 0===e&&(e=1),void 0===n&&(n=1),e++,n++;var r,a;if(navigator.userAgent.match(/Chrome/)&&"X".match(/()./),this.selection=this.selection.replace(/(^\n*)/,""),this.startTag=this.startTag+p.$1,this.selection=this.selection.replace(/(\n*$)/,""),this.endTag=this.endTag+p.$1,this.startTag=this.startTag.replace(/(^\n*)/,""),this.before=this.before+p.$1,this.endTag=this.endTag.replace(/(\n*$)/,""),this.after=this.after+p.$1,this.before){for(r=a="";e--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.before=this.before.replace(new p(r+"$",""),a)}if(this.after){for(r=a="";n--;)r+="\\n?",a+="\n";t&&(r="\\n*"),this.after=this.after.replace(new p(r,""),a)}},l.isVisible=function(e){return window.getComputedStyle?"none"!==window.getComputedStyle(e,null).getPropertyValue("display"):e.currentStyle?"none"!==e.currentStyle.display:void 0},l.addEvent=function(e,n,t){e.attachEvent?e.attachEvent("on"+n,t):e.addEventListener(n,t,!1)},l.removeEvent=function(e,n,t){e.detachEvent?e.detachEvent("on"+n,t):e.removeEventListener(n,t,!1)},l.fixEolChars=function(e){return e=e.replace(/\r\n/g,"\n"),e=e.replace(/\r/g,"\n")},l.extendRegExp=function(e,n,t){(null===n||void 0===n)&&(n=""),(null===t||void 0===t)&&(t="");var r,a=e.toString();return a=a.replace(/\/([gim]*)$/,function(e,n){return r=n,""}),a=a.replace(/(^\/|\/$)/g,""),a=n+a+t,new p(a,r)},c.getTop=function(e,n){var t=e.offsetTop;if(!n)for(;e=e.offsetParent;)t+=e.offsetTop;return t},c.getHeight=function(e){return e.offsetHeight||e.scrollHeight},c.getWidth=function(e){return e.offsetWidth||e.scrollWidth},c.getPageSize=function(){var e,n,t,r;self.innerHeight&&self.scrollMaxY?(e=d.body.scrollWidth,n=self.innerHeight+self.scrollMaxY):d.body.scrollHeight>d.body.offsetHeight?(e=d.body.scrollWidth,n=d.body.scrollHeight):(e=d.body.offsetWidth,n=d.body.offsetHeight),self.innerHeight?(t=self.innerWidth,r=self.innerHeight):d.documentElement&&d.documentElement.clientHeight?(t=d.documentElement.clientWidth,r=d.documentElement.clientHeight):d.body&&(t=d.body.clientWidth,r=d.body.clientHeight);var a=Math.max(e,t),i=Math.max(n,r);return[a,i,t,r]},u.createBackground=function(){var e=d.createElement("div"),n=e.style;e.className="wmd-prompt-background",n.position="absolute",n.top="0",n.zIndex="1000",g.isIE?n.filter="alpha(opacity=50)":n.opacity="0.5";var t=c.getPageSize();return n.height=t[1]+"px",g.isIE?(n.left=d.documentElement.scrollLeft,n.width=d.documentElement.clientWidth):(n.left="0",n.width="100%"),d.body.appendChild(e),e},u.prompt=function(e,n,t){var r,a;void 0===n&&(n="");var i=function(e){var n=e.charCode||e.keyCode;27===n&&o(!0)},o=function(e){l.removeEvent(d.body,"keydown",i);var n=a.value;return e?n=null:(n=n.replace(/^http:\/\/(https?|ftp):\/\//,"$1://"),/^(?:https?|ftp):\/\//.test(n)||(n="http://"+n)),r.parentNode.removeChild(r),t(n),!1},s=function(){r=d.createElement("div"),r.className="wmd-prompt-dialog",r.style.padding="10px;",r.style.position="fixed",r.style.width="400px",r.style.zIndex="1001";var t=d.createElement("div");t.innerHTML=e,t.style.padding="5px",r.appendChild(t);var s=d.createElement("form"),u=s.style;s.onsubmit=function(){return o(!1)},u.padding="0",u.margin="0",u.cssFloat="left",u.width="100%",u.textAlign="center",u.position="relative",r.appendChild(s),a=d.createElement("input"),a.type="text",a.value=n,u=a.style,u.display="block",u.width="80%",u.marginLeft=u.marginRight="auto",s.appendChild(a);var p=d.createElement("input");p.type="button",p.onclick=function(){return o(!1)},p.value="OK",u=p.style,u.margin="10px",u.display="inline",u.width="7em";var f=d.createElement("input");f.type="button",f.onclick=function(){return o(!0)},f.value="Cancel",u=f.style,u.margin="10px",u.display="inline",u.width="7em",s.appendChild(p),s.appendChild(f),l.addEvent(d.body,"keydown",i),r.style.top="50%",r.style.left="50%",r.style.display="block",g.isIE_5or6&&(r.style.position="absolute",r.style.top=d.documentElement.scrollTop+200+"px",r.style.left="50%"),d.body.appendChild(r),r.style.marginTop=-(c.getHeight(r)/2)+"px",r.style.marginLeft=-(c.getWidth(r)/2)+"px"};setTimeout(function(){s();var e=n.length;if(void 0!==a.selectionStart)a.selectionStart=0,a.selectionEnd=e;else if(a.createTextRange){var t=a.createTextRange();t.collapse(!1),t.moveStart("character",-e),t.moveEnd("character",e),t.select()}a.focus()},0)};var w=o.prototype;w.prefixes="(?:\\s{4,}|\\s*>|\\s*-\\s+|\\s*\\d+\\.|=|\\+|-|_|\\*|#|\\s*\\[[^\n]]+\\]:)",w.unwrap=function(e){var n=new p("([^\\n])\\n(?!(\\n|"+this.prefixes+"))","g");e.selection=e.selection.replace(n,"$1 $2")},w.wrap=function(e,n){this.unwrap(e);var t=new p("(.{1,"+n+"})( +|$\\n?)","gm"),r=this;e.selection=e.selection.replace(t,function(e,n){return new p("^"+r.prefixes,"").test(e)?e:n+"\n"}),e.selection=e.selection.replace(/\s+$/,"")},w.doBold=function(e,n){return this.doBorI(e,n,2,this.getString("boldexample"))},w.doItalic=function(e,n){return this.doBorI(e,n,1,this.getString("italicexample"))},w.doBorI=function(e,n,t,r){e.trimWhitespace(),e.selection=e.selection.replace(/\nLine truncated
|
||||
+17
-5
@@ -16576,8 +16576,17 @@ define('core',[
|
||||
if (window.lightMode) {
|
||||
return;
|
||||
}
|
||||
var scrollTop = aceEditor.renderer.getScrollTop();
|
||||
var pos = aceEditor.getCursorPosition();
|
||||
|
||||
var scrollTop;
|
||||
var pos;
|
||||
if (aceEditor) {
|
||||
scrollTop = aceEditor.renderer.getScrollTop();
|
||||
pos = aceEditor.getCursorPosition();
|
||||
}
|
||||
else {
|
||||
scrollTop = 0;
|
||||
pos = 0;
|
||||
}
|
||||
var content = MD.getContent();
|
||||
|
||||
core._resetToolBar();
|
||||
@@ -16604,6 +16613,7 @@ define('core',[
|
||||
$editorElt.val(content);
|
||||
|
||||
window.lightMode = true;
|
||||
aceEditor = null;
|
||||
MD.clearUndo();
|
||||
eventMgr.onToggleMode(editor);
|
||||
core._moveCursorTo(pos.row, pos.column);
|
||||
@@ -16695,7 +16705,7 @@ define('core',[
|
||||
documentContent = undefined;
|
||||
var initDocumentContent = fileDesc.content;
|
||||
|
||||
if(aceEditor !== undefined) {
|
||||
if(!window.lightMode) {
|
||||
aceEditor.setValue(initDocumentContent, -1);
|
||||
// 重新设置undo manage
|
||||
// aceEditor.getSession().setUndoManager(new ace.UndoManager());
|
||||
@@ -16706,7 +16716,9 @@ define('core',[
|
||||
|
||||
// If the editor is already created
|
||||
if(editor !== undefined) {
|
||||
aceEditor && fileDesc.editorSelectRange && aceEditor.selection.setSelectionRange(fileDesc.editorSelectRange);
|
||||
if(!window.lightMode) {
|
||||
aceEditor && fileDesc.editorSelectRange && aceEditor.selection.setSelectionRange(fileDesc.editorSelectRange);
|
||||
}
|
||||
// aceEditor ? aceEditor.focus() : $editorElt.focus();
|
||||
editor.refreshPreview();
|
||||
|
||||
@@ -16782,7 +16794,7 @@ define('core',[
|
||||
|
||||
function checkDocumentChanges() {
|
||||
var newDocumentContent = $editorElt.val();
|
||||
if(aceEditor !== undefined) {
|
||||
if(!window.lightMode && aceEditor) {
|
||||
newDocumentContent = aceEditor.getValue();
|
||||
}
|
||||
if(documentContent !== undefined && documentContent != newDocumentContent) {
|
||||
|
||||
Vendored
+1
-1
@@ -3,4 +3,4 @@
|
||||
var M;!I&&(M=r(t))&&C.test(M.tagName)&&(I=M.className.match(b)),I&&(I=I[1])}var $;if(y.test(t.tagName))$=1;else{var L=t.currentStyle,A=s.defaultView,R=L?L.whiteSpace:A&&A.getComputedStyle?A.getComputedStyle(t,null).getPropertyValue("white-space"):0;$=R&&"pre"===R.substring(0,3)}var N=i.linenums;(N="true"===N||+N)||(N=m.match(/\blinenums\b(?::(\d+))?/),N=N?N[1]&&N[1].length?+N[1]:!0:!1),N&&o(t,N,$),h={langExtension:I,sourceNode:t,numberLines:N,pre:$},u(h)}}}v<c.length?setTimeout(a,250):"function"==typeof e&&e()}for(var i=n||document.body,s=i.ownerDocument||document,l=[t("pre"),t("code"),t("xmp")],c=[],d=0;d<l.length;++d)for(var p=0,m=l[d].length;m>p;++p)c.push(l[d][p]);l=null;var g=Date;g.now||(g={now:function(){return+new Date}});var h,v=0,b=/\blang(?:uage)?-([\w.]+)(?!\S)/,w=/\bprettyprint\b/,x=/\bprettyprinted\b/,y=/pre|xmp/i,C=/^code$/i,k=/^(?:pre|code|xmp)$/i,S={};a()}var f=window,m=["break,continue,do,else,for,if,return,while"],g=[m,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],h=[g,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],v=[h,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],b=[h,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],w=[b,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],x="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",y=[h,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],C="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",k=[m,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],S=[m,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],_=[m,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],E=[m,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],T=[v,w,y,C,k,S,E],I=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,M="str",$="kwd",L="com",A="typ",R="lit",N="pun",P="pln",B="tag",D="dec",O="src",H="atn",F="atv",j="nocode",q="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*",U=/\S/,K=i({keywords:T,hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),z={};l(K,["default-code"]),l(a([],[[P,/^[^<?]+/],[D,/^<!\w[^>]*(?:>|$)/],[L,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[N,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]),l(a([[P,/^[\s]+/,null," \r\n"],[F,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[B,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[H,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[N,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]),l(a([],[[F,/^[\s\S]+/]]),["uq.val"]),l(i({keywords:v,hashComments:!0,cStyleComments:!0,types:I}),["c","cc","cpp","cxx","cyc","m"]),l(i({keywords:"null,true,false"}),["json"]),l(i({keywords:w,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:I}),["cs"]),l(i({keywords:b,cStyleComments:!0}),["java"]),l(i({keywords:E,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]),l(i({keywords:k,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]),l(i({keywords:C,hashComments:!0,multiLineStrings:!0,Line truncated
|
||||
},w.insertLink=function(e,n,t,r,a){e.trimWhitespace(),e.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\[.*?\])?/);var i;if(!(e.endTag.length>1&&e.startTag.length>0)){if(e.selection=e.startTag+e.selection+e.endTag,e.startTag=e.endTag="",/\n\n/.test(e.selection))return void this.addLinkDef(e,null);var s=function(t){i.parentNode.removeChild(i),null!==t&&(e.selection=(" "+e.selection).replace(/([^\\](?:\\\\)*)(?=[[\]])/g,"$1\\").substr(1),e.startTag=a?"+")",e.selection=r),n()};return i=c.createBackground(),s(t),!0}e.startTag=e.startTag.replace(/!?\[/,""),e.endTag="",this.addLinkDef(e,null)},w.doLinkOrImage=function(e,n,t){e.trimWhitespace(),e.findTags(/\s*!?\[/,/\][ ]?(?:\n[ ]*)?(\(.*?\))?/);var r;if(!(e.endTag.length>1&&e.startTag.length>0)){if(e.selection=e.startTag+e.selection+e.endTag,e.startTag=e.endTag="",/\n\n/.test(e.selection))return void this.addLinkDef(e,null);var a=this,i=function(i,s){if(r.parentNode.removeChild(r),null!==i&&(e.selection=(" "+e.selection).replace(/([^\\](?:\\\\)*)(?=[[\]])/g,"$1\\").substr(1),e.startTag=t?"+")",!e.selection)){var l="";l=s?s:a.getString(t?"imagedescription":"linkdescription"),e.selection=l}n()};return r=c.createBackground(),t?this.hooks.insertImageDialog(i)||c.prompt(this.getString("imagedialog"),v,i):this.hooks.insertLinkDialog(i)||c.prompt(this.getString("linkdialog"),b,i),!0}e.startTag=e.startTag.replace(/!?\[/,""),e.endTag="",this.addLinkDef(e,null)},w.doAutoindent=function(e){var n=this,t=!1;e.before=e.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ \t]+\n$/,"\n\n"),e.selection||/^[ \t]*(?:\n|$)/.test(e.after)||(e.after=e.after.replace(/^[^\n]*/,function(n){return e.selection=n,""}),t=!0),/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]+.*\n$/.test(e.before)&&n.doList&&n.doList(e),/(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(e.before)&&n.doBlockquote&&n.doBlockquote(e),/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&n.doCode&&n.doCode(e),t&&(e.after=e.selection+e.after,e.selection="")},w.doBlockquote=function(e){e.selection=e.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,function(n,t,r,a){return e.before+=t,e.after=a+e.after,r}),e.before=e.before.replace(/(>[ \t]*)$/,function(n,t){return e.selection=t+e.selection,""}),e.selection=e.selection.replace(/^(\s|>)+$/,""),e.selection=e.selection||this.getString("quoteexample");var n,t="",r="";if(e.before){for(var a=e.before.replace(/\n$/,"").split("\n"),i=!1,o=0;o<a.length;o++){var s=!1;n=a[o],i=i&&n.length>0,/^>/.test(n)?(s=!0,!i&&n.length>1&&(i=!0)):s=/^[ \t]*$/.test(n)?!0:i,s?t+=n+"\n":(r+=t+n,t="\n")}/(^|\n)>/.test(t)||(r+=t,t="")}e.startTag=t,e.before=r;var l=function(n){var t=n?"> ":"";e.startTag&&(e.startTag=e.startTag.replace(/\n((>|\s)*)\n$/,function(e,n){return"\n"+n.replace(/^[ ]{0,3}>?[ \t]*$/gm,t)+"\n"})),e.endTag&&(e.endTag=e.endTag.replace(/^\n((>|\s)*)\n/,function(e,n){return"\n"+n.replace(/^[ ]{0,3}>?[ \t]*$/gm,t)+"\n"}))};/^(?![ ]{0,3}>)/m.test(e.selection)?(this.wrap(e,f.lineLength-2),e.selection=e.selection.replace(/^/gm,"> "),l(!0),e.skipLines()):(e.selection=e.selection.replace(/^[ ]{0,3}> ?/gm,""),this.unwrap(e),l(!1),!/^(\n|^)[ ]{0,3}>/.test(e.selection)&&e.startTag&&(e.startTag=e.startTag.replace(/\n{0,2}$/,"\n\n")),!/(\n|^)[ ]{0,3}>.*$/.test(e.selection)&&e.endTag&&(e.endTag=e.endTag.replace(/^\n{0,2}/,"\n\n"))),e.selection=this.hooks.postBlockquoteCreation(e.selection),/\n/.test(e.selection)||(e.selection=e.selection.replace(/^(> *)/,function(n,t){return e.startTag+=t,""}))},w.doCode=function(e){var n=/\S[ ]*$/.test(e.before),t=/^[ ]*\S/.test(e.after);if(!t&&!n||/\n/.test(e.selection)){e.before=e.before.replace(/[ ]{4}$/,function(n){return e.selection=n+e.selection,""});var r=1,a=1;/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&(r=0),/^\n(\t|[ ]{4,})/.test(e.after)&&(a=0),e.skipLines(r,a),e.selection?/^[ ]{0,3}\S/m.test(e.selection)?/\n/.test(e.selection)?e.selection=e.selection.replace(/^/gm," "):e.before+=" ":e.selection=e.selection.replace(/^(?:[ ]{4}|[ ]{0,3}\t)/gm,""):(e.startTag=" ",e.selection=this.getString("codeexample"))}else e.trimWhitespace(),e.findTags(/`/,/`/),e.startTag||e.endTag?e.endTag&&!e.startTag?(e.before+=e.endTag,e.endTag=""):e.startTag=e.endTag="":(e.startTag=e.endTag="`",e.selection||(e.selection=this.getString("codeexample")))},w.doList=function(e,n,t){var r=/(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/,a=/^\n*(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/,i="-",o=1,s=function(){var e;return t?(e=" "+o+". ",o++):e=" "+i+" ",e},l=function(e){return void 0===t&&(t=/^\s*\d/.test(e)),e=e.replace(/^[ ]{0,3}([*+-]|\d+[.])\s/gm,function(){return s()})};if(e.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/,null),!e.before||/\n$/.test(e.before)||/^\n/.test(e.startTag)||(e.before+=e.startTag,e.startTag=""),e.startTag){var c=/\d+[.]/.test(e.startTag);if(e.stLine truncated
|
||||
t!==i.length-1?0===r.length&&(r=void 0):/\n$/.test(r)&&(r+="\n"),n(r)});var h=e.last(p).endOffset,v=s[0].scrollHeight,b=v/h;p=e.map(p,function(e){return{startOffset:e.startOffset*b,endOffset:e.endOffset*b,height:e.height*b}})}else e.each(i,function(e){t+=e.text.length+m,m=0;var n=r.session.doc.indexToPosition(t),i=r.session.documentToScreenPosition(n.row,n.column),o=i.row*r.renderer.lineHeight,s=o-a;p.push({startOffset:a,endOffset:o,height:s}),a=o});f=[];var w,y=c.scrollTop();c.find(".preview-content > .se-section-delimiter").each(function(){if(void 0===w)return void(w=0);var e=$(this),n=e.position().top+y;f.push({startOffset:w,endOffset:n,height:n-w}),w=n});var C=c.prop("scrollHeight");f.push({startOffset:w,endOffset:C,height:C-w}),u=-10,d=-10,x()},500),g=!1,h=!1,v=!1,b=!1,w=$("<div>"),x=e.throttle(function(){if(0===p.length||p.length!==f.length)return void x();var n=window.lightMode?s.scrollTop():r.renderer.getScrollTop();0>n&&(n=0);var a,i=c.scrollTop();if(g===!0){if(Math.abs(n-u)<=9)return;if(g=!1,u=n,a=t(n,p,f),a=e.min([a,c.prop("scrollHeight")-c.outerHeight()]),Math.abs(a-i)<=9)return void(d=i);w.stop("scrollLinkFx",!0).css("value",0).animate({value:a-i},{easing:"linear",duration:200,queue:"scrollLinkFx",step:function(e){b=!0,d=i+e,c.scrollTop(d)},done:function(){e.defer(function(){b=!1})}}).dequeue("scrollLinkFx")}else if(h===!0){if(Math.abs(i-d)<=9)return;if(h=!1,d=i,a=t(i,f,p),window.lightMode?a=e.min([a,s.prop("scrollHeight")-s.outerHeight()]):(a=e.min([a,r.session.getScreenLength()*r.renderer.lineHeight+r.renderer.scrollMargin.bottom-r.renderer.$size.scrollerHeight]),0>a&&(a=0)),Math.abs(a-n)<=9)return void(u=n);w.stop("scrollLinkFx",!0).css("value",0).animate({value:a-n},{easing:"linear",duration:200,queue:"scrollLinkFx",step:function(e){v=!0,u=n+e,window.lightMode||r.session.setScrollTop(u),window.lightMode&&s.scrollTop(u)},done:function(){e.defer(function(){v=!1})}}).dequeue("scrollLinkFx")}},100);a.onLayoutResize=function(){g=!0,m()},a.onFileClosed=function(){p=[]};var y=function(e){c=$(".preview-container"),s=$("#wmd-input"),l=$(".textarea-helper"),c.scroll(function(){b===!1&&C===!1&&(h=!0,g=!1,x()),C=!1});var n=function(){v===!1&&(g=!0,h=!1,x())},t=e?500:0;setTimeout(function(){window.lightMode?s.scroll(n):r.session.on("changeScrollTop",n)},t)};a.onToggleMode=function(){c=$(".preview-container"),s=$("#wmd-input"),l=$(".textarea-helper"),m(),y(!0)};var C=!1;a.onReady=function(){c=$(".preview-container"),s=$("#wmd-input"),l=$(".textarea-helper"),y(),$(".extension-preview-buttons .table-of-contents, #preview-contents").on("click","a",function(e){var n=this.hash;if(n){e.preventDefault();var a=$("#preview-contents "+n);if(a.length){var i=a[0].getBoundingClientRect().top-c.get(0).getBoundingClientRect().top+c.scrollTop(),o=t(i,f,p);c.scrollTop(i),window.lightMode||r.session.setScrollTop(o),window.lightMode&&s.scrollTop(o)}}})};var k;return a.onPagedownConfigure=function(e){k=$("#preview-contents"),e.getConverter().hooks.chain("postConversion",function(e){return k.height(k.height()),e})},a.onPreviewFinished=function(){var e=k.height();k.height("auto");var n=k.height();g=!0,e>n&&(C=!0),m()},a}),function(e){var n="waitForImages";e.waitForImages={hasImageProperties:["backgroundImage","listStyleImage","borderImage","borderCornerImage"]},e.expr[":"].uncached=function(n){if(!e(n).is('img[src!=""]'))return!1;var t=new Image;return t.src=n.src,!t.complete},e.fn.waitForImages=function(t,r,a){var i=0,o=0;if(e.isPlainObject(arguments[0])&&(a=arguments[0].waitForAll,r=arguments[0].each,t=arguments[0].finished),t=t||e.noop,r=r||e.noop,a=!!a,!e.isFunction(t)||!e.isFunction(r))throw new TypeError("An invalid callback was supplied.");return this.each(function(){var s=e(this),l=[],c=e.waitForImages.hasImageProperties||[],u=/url\(\s*(['"]?)(.*?)\1\s*\)/g;a?s.find("*").andSelf().each(function(){var n=e(this);n.is("img:uncached")&&l.push({src:n.attr("src"),element:n[0]}),e.each(c,function(e,t){var r,a=n.css(t);if(!a)return!0;for(;r=u.exec(a);)l.push({src:r[2],element:n[0]})})}):s.find("img:uncached").each(function(){l.push({src:this.src,element:this})}),i=l.length,o=0,0===i&&t.call(s[0]),e.each(l,function(a,l){var c=new Image;e(c).bind("load."+n+" error."+n,function(e){return o++,r.call(l.element,o,i,"load"==e.type),o==i?(t.call(s[0]),!1):void 0}),c.src=l.src})})}}(jQuery),define("jquery-waitforimages",function(){}),define("eventMgr",["underscore","crel","utils","classes/Extension","settings","extensions/markdownSectionParser","extensions/partialRendering","extensions/umlDiagrams","extensions/markdownExtra","extensions/toc","extensions/mathJax","extensions/emailConverter","extensions/scrollLink","jquery-waitforimages"],function(e,n,t,r,a){function i(n){return e.chain(c).map(function(e){return e.enabled&&e[n]}).compact().value()}function o(n){return d[n]=i(n),function(){var t=arguments;e.each(d[n],function(n){try{n.apply(null,t)}catch(r){console.error(e.isObject(r)?r.stack:r)}})}}function s(e){l[e]=o(e)}var l={},c=e.Line truncated
|
||||
e.before=e.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ \t]+\n$/,"\n\n"),e.selection||/^[ \t]*(?:\n|$)/.test(e.after)||(e.after=e.after.replace(/^[^\n]*/,function(n){return e.selection=n,""}),t=!0),/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]+.*\n$/.test(e.before)&&n.doList&&n.doList(e),/(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(e.before)&&n.doBlockquote&&n.doBlockquote(e),/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&n.doCode&&n.doCode(e),t&&(e.after=e.selection+e.after,e.selection="")},w.doBlockquote=function(e){e.selection=e.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,function(n,t,r,a){return e.before+=t,e.after=a+e.after,r}),e.before=e.before.replace(/(>[ \t]*)$/,function(n,t){return e.selection=t+e.selection,""}),e.selection=e.selection.replace(/^(\s|>)+$/,""),e.selection=e.selection||this.getString("quoteexample");var n,t="",r="";if(e.before){for(var a=e.before.replace(/\n$/,"").split("\n"),i=!1,o=0;o<a.length;o++){var s=!1;n=a[o],i=i&&n.length>0,/^>/.test(n)?(s=!0,!i&&n.length>1&&(i=!0)):s=/^[ \t]*$/.test(n)?!0:i,s?t+=n+"\n":(r+=t+n,t="\n")}/(^|\n)>/.test(t)||(r+=t,t="")}e.startTag=t,e.before=r,e.after&&(e.after=e.after.replace(/^\n?/,"\n")),e.after=e.after.replace(/^(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*)/,function(n){return e.endTag=n,""});var l=function(n){var t=n?"> ":"";e.startTag&&(e.startTag=e.startTag.replace(/\n((>|\s)*)\n$/,function(e,n){return"\n"+n.replace(/^[ ]{0,3}>?[ \t]*$/gm,t)+"\n"})),e.endTag&&(e.endTag=e.endTag.replace(/^\n((>|\s)*)\n/,function(e,n){return"\n"+n.replace(/^[ ]{0,3}>?[ \t]*$/gm,t)+"\n"}))};/^(?![ ]{0,3}>)/m.test(e.selection)?(this.wrap(e,m.lineLength-2),e.selection=e.selection.replace(/^/gm,"> "),l(!0),e.skipLines()):(e.selection=e.selection.replace(/^[ ]{0,3}> ?/gm,""),this.unwrap(e),l(!1),!/^(\n|^)[ ]{0,3}>/.test(e.selection)&&e.startTag&&(e.startTag=e.startTag.replace(/\n{0,2}$/,"\n\n")),!/(\n|^)[ ]{0,3}>.*$/.test(e.selection)&&e.endTag&&(e.endTag=e.endTag.replace(/^\n{0,2}/,"\n\n"))),e.selection=this.hooks.postBlockquoteCreation(e.selection),/\n/.test(e.selection)||(e.selection=e.selection.replace(/^(> *)/,function(n,t){return e.startTag+=t,""}))},w.doCode=function(e){var n=/\S[ ]*$/.test(e.before),t=/^[ ]*\S/.test(e.after);if(!t&&!n||/\n/.test(e.selection)){e.before=e.before.replace(/[ ]{4}$/,function(n){return e.selection=n+e.selection,""});var r=1,a=1;/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&(r=0),/^\n(\t|[ ]{4,})/.test(e.after)&&(a=0),e.skipLines(r,a),e.selection?/^[ ]{0,3}\S/m.test(e.selection)?/\n/.test(e.selection)?e.selection=e.selection.replace(/^/gm," "):e.before+=" ":e.selection=e.selection.replace(/^(?:[ ]{4}|[ ]{0,3}\t)/gm,""):(e.startTag=" ",e.selection=this.getString("codeexample"))}else e.trimWhitespace(),e.findTags(/`/,/`/),e.startTag||e.endTag?e.endTag&&!e.startTag?(e.before+=e.endTag,e.endTag=""):e.startTag=e.endTag="":(e.startTag=e.endTag="`",e.selection||(e.selection=this.getString("codeexample")))},w.doList=function(e,n,t){var r=/(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/,a=/^\n*(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/,i="-",o=1,s=function(){var e;return t?(e=" "+o+". ",o++):e=" "+i+" ",e},l=function(e){return void 0===t&&(t=/^\s*\d/.test(e)),e=e.replace(/^[ ]{0,3}([*+-]|\d+[.])\s/gm,function(){return s()})};if(e.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/,null),!e.before||/\n$/.test(e.before)||/^\n/.test(e.startTag)||(e.before+=e.startTag,e.startTag=""),e.startTag){var c=/\d+[.]/.test(e.startTag);if(e.startTag="",e.selection=e.selection.replace(/\n[ ]{4}/g,"\n"),this.unwrap(e),e.skipLines(),c&&(e.after=e.after.replace(a,l)),t==c)return}var u=1;e.before=e.before.replace(r,function(e){return/^\s*([*+-])/.test(e)&&(i=p.$1),u=/[^\n]\n\n[^\n]/.test(e)?1:0,l(e)}),e.selection||(e.selection=this.getString("litem"));var d=s(),f=1;e.after=e.after.replace(a,function(e){return f=/[^\n]\n\n[^\n]/.test(e)?1:0,l(e)}),e.trimWhitespace(!0),e.skipLines(u,f,!0),e.startTag=d;var g=d.replace(/./g," ");this.wrap(e,m.lineLength-g.length),e.selection=e.selection.replace(/\n/g,"\n"+g)},w.doHeading=function(e){if(e.selection=e.selection.replace(/\s+/g," "),e.selection=e.selection.replace(/(^\s+|\s+$)/g,""),!e.selection)return e.before&&"\n"!=e.before[e.before.length-1]&&e.skipLines(1,1),e.startTag="# ",e.selection=this.getString("headingexample"),void(e.endTag="");e.findTags(/#+[ ]*/,/[ ]*#+/),e.before&&"\n"!=e.before[e.before.length-1]&&e.skipLines(1,1);var n=0,t=e.startTag;/^#+[ ]*$/.test(t)&&(t=t.replace(/ /g,""),n=t.length);var r=0;if(n>=0&&3>=n&&(r=n+1),n>=4&&(r=0,e.startTag=""),r>0){for(var a="";r--;)a+="#";a+=" ",e.startTag=a}},w.doHorizontalRule=function(e){e.startTag="----------\n",e.selection="",e.skipLines(1,1,!0)}}(),define("pagedown-light",function(){}),define("core",["underscore","crel","constants","utils","eventMgr","shortcutMgr","pagedown-Line truncated
|
||||
e.before=e.before.replace(/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ ]{0,3}>[ \t]*\n$/,"\n\n"),e.before=e.before.replace(/(\n|^)[ \t]+\n$/,"\n\n"),e.selection||/^[ \t]*(?:\n|$)/.test(e.after)||(e.after=e.after.replace(/^[^\n]*/,function(n){return e.selection=n,""}),t=!0),/(\n|^)[ ]{0,3}([*+-]|\d+[.])[ \t]+.*\n$/.test(e.before)&&n.doList&&n.doList(e),/(\n|^)[ ]{0,3}>[ \t]+.*\n$/.test(e.before)&&n.doBlockquote&&n.doBlockquote(e),/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&n.doCode&&n.doCode(e),t&&(e.after=e.selection+e.after,e.selection="")},w.doBlockquote=function(e){e.selection=e.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,function(n,t,r,a){return e.before+=t,e.after=a+e.after,r}),e.before=e.before.replace(/(>[ \t]*)$/,function(n,t){return e.selection=t+e.selection,""}),e.selection=e.selection.replace(/^(\s|>)+$/,""),e.selection=e.selection||this.getString("quoteexample");var n,t="",r="";if(e.before){for(var a=e.before.replace(/\n$/,"").split("\n"),i=!1,o=0;o<a.length;o++){var s=!1;n=a[o],i=i&&n.length>0,/^>/.test(n)?(s=!0,!i&&n.length>1&&(i=!0)):s=/^[ \t]*$/.test(n)?!0:i,s?t+=n+"\n":(r+=t+n,t="\n")}/(^|\n)>/.test(t)||(r+=t,t="")}e.startTag=t,e.before=r,e.after&&(e.after=e.after.replace(/^\n?/,"\n")),e.after=e.after.replace(/^(((\n|^)(\n[ \t]*)*>(.+\n)*.*)+(\n[ \t]*)*)/,function(n){return e.endTag=n,""});var l=function(n){var t=n?"> ":"";e.startTag&&(e.startTag=e.startTag.replace(/\n((>|\s)*)\n$/,function(e,n){return"\n"+n.replace(/^[ ]{0,3}>?[ \t]*$/gm,t)+"\n"})),e.endTag&&(e.endTag=e.endTag.replace(/^\n((>|\s)*)\n/,function(e,n){return"\n"+n.replace(/^[ ]{0,3}>?[ \t]*$/gm,t)+"\n"}))};/^(?![ ]{0,3}>)/m.test(e.selection)?(this.wrap(e,m.lineLength-2),e.selection=e.selection.replace(/^/gm,"> "),l(!0),e.skipLines()):(e.selection=e.selection.replace(/^[ ]{0,3}> ?/gm,""),this.unwrap(e),l(!1),!/^(\n|^)[ ]{0,3}>/.test(e.selection)&&e.startTag&&(e.startTag=e.startTag.replace(/\n{0,2}$/,"\n\n")),!/(\n|^)[ ]{0,3}>.*$/.test(e.selection)&&e.endTag&&(e.endTag=e.endTag.replace(/^\n{0,2}/,"\n\n"))),e.selection=this.hooks.postBlockquoteCreation(e.selection),/\n/.test(e.selection)||(e.selection=e.selection.replace(/^(> *)/,function(n,t){return e.startTag+=t,""}))},w.doCode=function(e){var n=/\S[ ]*$/.test(e.before),t=/^[ ]*\S/.test(e.after);if(!t&&!n||/\n/.test(e.selection)){e.before=e.before.replace(/[ ]{4}$/,function(n){return e.selection=n+e.selection,""});var r=1,a=1;/(\n|^)(\t|[ ]{4,}).*\n$/.test(e.before)&&(r=0),/^\n(\t|[ ]{4,})/.test(e.after)&&(a=0),e.skipLines(r,a),e.selection?/^[ ]{0,3}\S/m.test(e.selection)?/\n/.test(e.selection)?e.selection=e.selection.replace(/^/gm," "):e.before+=" ":e.selection=e.selection.replace(/^(?:[ ]{4}|[ ]{0,3}\t)/gm,""):(e.startTag=" ",e.selection=this.getString("codeexample"))}else e.trimWhitespace(),e.findTags(/`/,/`/),e.startTag||e.endTag?e.endTag&&!e.startTag?(e.before+=e.endTag,e.endTag=""):e.startTag=e.endTag="":(e.startTag=e.endTag="`",e.selection||(e.selection=this.getString("codeexample")))},w.doList=function(e,n,t){var r=/(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/,a=/^\n*(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*/,i="-",o=1,s=function(){var e;return t?(e=" "+o+". ",o++):e=" "+i+" ",e},l=function(e){return void 0===t&&(t=/^\s*\d/.test(e)),e=e.replace(/^[ ]{0,3}([*+-]|\d+[.])\s/gm,function(){return s()})};if(e.findTags(/(\n|^)*[ ]{0,3}([*+-]|\d+[.])\s+/,null),!e.before||/\n$/.test(e.before)||/^\n/.test(e.startTag)||(e.before+=e.startTag,e.startTag=""),e.startTag){var c=/\d+[.]/.test(e.startTag);if(e.startTag="",e.selection=e.selection.replace(/\n[ ]{4}/g,"\n"),this.unwrap(e),e.skipLines(),c&&(e.after=e.after.replace(a,l)),t==c)return}var u=1;e.before=e.before.replace(r,function(e){return/^\s*([*+-])/.test(e)&&(i=p.$1),u=/[^\n]\n\n[^\n]/.test(e)?1:0,l(e)}),e.selection||(e.selection=this.getString("litem"));var d=s(),f=1;e.after=e.after.replace(a,function(e){return f=/[^\n]\n\n[^\n]/.test(e)?1:0,l(e)}),e.trimWhitespace(!0),e.skipLines(u,f,!0),e.startTag=d;var g=d.replace(/./g," ");this.wrap(e,m.lineLength-g.length),e.selection=e.selection.replace(/\n/g,"\n"+g)},w.doHeading=function(e){if(e.selection=e.selection.replace(/\s+/g," "),e.selection=e.selection.replace(/(^\s+|\s+$)/g,""),!e.selection)return e.before&&"\n"!=e.before[e.before.length-1]&&e.skipLines(1,1),e.startTag="# ",e.selection=this.getString("headingexample"),void(e.endTag="");e.findTags(/#+[ ]*/,/[ ]*#+/),e.before&&"\n"!=e.before[e.before.length-1]&&e.skipLines(1,1);var n=0,t=e.startTag;/^#+[ ]*$/.test(t)&&(t=t.replace(/ /g,""),n=t.length);var r=0;if(n>=0&&3>=n&&(r=n+1),n>=4&&(r=0,e.startTag=""),r>0){for(var a="";r--;)a+="#";a+=" ",e.startTag=a}},w.doHorizontalRule=function(e){e.startTag="----------\n",e.selection="",e.skipLines(1,1,!0)}}(),define("pagedown-light",function(){}),define("core",["underscore","crel","constants","utils","eventMgr","shortcutMgr","pagedown-Line truncated
|
||||
Reference in new issue
Block a user