From d4cb98bb9431e548c00f97db2541a8472ef01146 Mon Sep 17 00:00:00 2001 From: t510599 Date: Sun, 4 Nov 2018 19:34:43 +0800 Subject: [PATCH] uploads --- editormd.js | 53 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 20 deletions(-) diff --git a/editormd.js b/editormd.js index ffd7e8b..264da53 100644 --- a/editormd.js +++ b/editormd.js @@ -496,6 +496,8 @@ var _this = this; var settings = this.settings; var loadPath = settings.path; + + var cdnjs = "https://cdnjs.cloudflare.com/ajax/libs"; var loadFlowChartOrSequenceDiagram = function() { @@ -508,19 +510,19 @@ if (settings.flowChart || settings.sequenceDiagram) { - editormd.loadScript(loadPath + "raphael.min", function() { + editormd.loadScript(cdnjs + "/raphael/2.2.7/raphael.min", function() { - editormd.loadScript(loadPath + "underscore.min", function() { + editormd.loadScript(cdnjs + "/underscore.js/1.9.1/underscore-min", function() { if (!settings.flowChart && settings.sequenceDiagram) { - editormd.loadScript(loadPath + "sequence-diagram.min", function() { + editormd.loadScript(cdnjs + "/js-sequence-diagrams/1.0.6/sequence-diagram-min", function() { _this.loadedDisplay(); }); } else if (settings.flowChart && !settings.sequenceDiagram) { - editormd.loadScript(loadPath + "flowchart.min", function() { + editormd.loadScript(cdnjs + "/flowchart/1.11.3/flowchart.min", function() { editormd.loadScript(loadPath + "jquery.flowchart.min", function() { _this.loadedDisplay(); }); @@ -528,9 +530,9 @@ } else if (settings.flowChart && settings.sequenceDiagram) { - editormd.loadScript(loadPath + "flowchart.min", function() { + editormd.loadScript(cdnjs + "/flowchart/1.11.3/flowchart.min", function() { editormd.loadScript(loadPath + "jquery.flowchart.min", function() { - editormd.loadScript(loadPath + "sequence-diagram.min", function() { + editormd.loadScript(cdnjs + "/js-sequence-diagrams/1.0.6/sequence-diagram-min", function() { _this.loadedDisplay(); }); }); @@ -577,13 +579,13 @@ _this.setToolbar(); - editormd.loadScript(loadPath + "marked.min", function() { + editormd.loadScript(cdnjs + "/marked/0.5.1/marked.min", function() { editormd.$marked = marked; if (settings.previewCodeHighlight) { - editormd.loadScript(loadPath + "prettify.min", function() { + editormd.loadScript(cdnjs + "/prettify/r298/prettify.min", function() { loadFlowChartOrSequenceDiagram(); }); } @@ -714,6 +716,7 @@ styleSelectedText : settings.styleSelectedText, autoCloseBrackets : settings.autoCloseBrackets, showTrailingSpace : settings.showTrailingSpace, + inputStyle : 'textarea', highlightSelectionMatches : ( (!settings.matchWordHighlight) ? false : { showToken: (settings.matchWordHighlight === "onselected") ? false : /\w/ } ) }; @@ -1247,7 +1250,8 @@ var toolbarIcons = this.toolbarIcons = toolbar.find("." + classPrefix + "menu > li > a"); var toolbarIconHandlers = this.getToolbarHandles(); - toolbarIcons.bind(editormd.mouseOrTouch("click", "touchend"), function(event) { + //-- toolbarIcons.bind(editormd.mouseOrTouch("click", "touchend"), function(event) { + toolbarIcons.on(editormd.mouseOrTouch("click", "touchend"), function(event) { var icon = $(this).children(".fa"); var name = icon.attr("name"); @@ -1766,7 +1770,7 @@ if (!settings.syncScrolling) { return this; } - + cm.on("change", function(_cm, changeObj) { if (settings.watch) @@ -2030,8 +2034,9 @@ { this.htmlTextarea.text(newMarkdownDoc); } - - if(settings.watch || (!settings.watch && state.preview)) + + //-- if(settings.watch || (!settings.watch && state.preview)) + if(settings.watch || (!settings.watch || state.preview)) { previewContainer.html(newMarkdownDoc); @@ -3364,13 +3369,15 @@ // Emoji graphics files url path editormd.emoji = { - path : "http://www.emoji-cheat-sheet.com/graphics/emojis/", + //-- path : "http://www.emoji-cheat-sheet.com/graphics/emojis/", + path : "https://www.webfx.com/tools/emoji-cheat-sheet/graphics/emojis/", ext : ".png" }; // Twitter Emoji (Twemoji) graphics files url path editormd.twemoji = { - path : "http://twemoji.maxcdn.com/36x36/", + //-- path : "http://twemoji.maxcdn.com/36x36/", + path : "https://twemoji.maxcdn.com/36x36/", ext : ".png" }; @@ -3464,6 +3471,10 @@ return "\"twemoji-""; } } + else if (name === "thinking") // cavern emoji + { + return "\":thinking:\""; + } else { var src = (name === "+1") ? "plus1" : name; @@ -3521,7 +3532,7 @@ } } - var out = ""; - headingHTML += ""; + headingHTML += ""; headingHTML += ""; headingHTML += (hasLinkReg) ? this.atLink(this.emoji(linkText)) : this.atLink(this.emoji(text)); headingHTML += ""; @@ -3809,7 +3820,7 @@ editormd.filterHTMLTags = function(html, filters) { if (typeof html !== "string") { - html = new String(html); + html = new String(html).valueOf(); } if (typeof filters !== "string") { @@ -3956,7 +3967,7 @@ smartypants : true }; - markdownDoc = new String(markdownDoc); + markdownDoc = new String(markdownDoc).valueOf(); var markdownParsed = marked(markdownDoc, markedOptions); @@ -4178,8 +4189,10 @@ // 使用国外的CDN,加载速度有时会很慢,或者自定义URL // You can custom KaTeX load url. editormd.katexURL = { - css : "//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min", - js : "//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min" + //-- css : "//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min", + //-- js : "//cdnjs.cloudflare.com/ajax/libs/KaTeX/0.3.0/katex.min" + css : "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0/katex.min", + js : "https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.9.0/katex.min" }; editormd.kaTeXLoaded = false;