mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-08-30 20:42:44 -06:00
Rebuild project
This commit is contained in:
parent
a93f7a2570
commit
d13b3d51cd
14
dist/simplemde.min.js
vendored
14
dist/simplemde.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1534,6 +1534,10 @@
|
||||
}
|
||||
},
|
||||
|
||||
readOnlyChanged: function(val) {
|
||||
if (!val) this.reset();
|
||||
},
|
||||
|
||||
setUneditable: nothing,
|
||||
|
||||
needsContentAttribute: false
|
||||
@ -1552,7 +1556,6 @@
|
||||
init: function(display) {
|
||||
var input = this, cm = input.cm;
|
||||
var div = input.div = display.lineDiv;
|
||||
div.contentEditable = "true";
|
||||
disableBrowserMagic(div);
|
||||
|
||||
on(div, "paste", function(e) { handlePaste(e, cm); })
|
||||
@ -1593,7 +1596,7 @@
|
||||
|
||||
on(div, "input", function() {
|
||||
if (input.composing) return;
|
||||
if (!input.pollContent())
|
||||
if (isReadOnly(cm) || !input.pollContent())
|
||||
runInOp(input.cm, function() {regChange(cm);});
|
||||
});
|
||||
|
||||
@ -1818,17 +1821,24 @@
|
||||
this.div.focus();
|
||||
},
|
||||
applyComposition: function(composing) {
|
||||
if (composing.data && composing.data != composing.startData)
|
||||
if (isReadOnly(this.cm))
|
||||
operation(this.cm, regChange)(this.cm)
|
||||
else if (composing.data && composing.data != composing.startData)
|
||||
operation(this.cm, applyTextInput)(this.cm, composing.data, 0, composing.sel);
|
||||
},
|
||||
|
||||
setUneditable: function(node) {
|
||||
node.setAttribute("contenteditable", "false");
|
||||
node.contentEditable = "false"
|
||||
},
|
||||
|
||||
onKeyPress: function(e) {
|
||||
e.preventDefault();
|
||||
operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);
|
||||
if (!isReadOnly(this.cm))
|
||||
operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);
|
||||
},
|
||||
|
||||
readOnlyChanged: function(val) {
|
||||
this.div.contentEditable = String(val != "nocursor")
|
||||
},
|
||||
|
||||
onContextMenu: nothing,
|
||||
@ -5389,8 +5399,8 @@
|
||||
cm.display.disabled = true;
|
||||
} else {
|
||||
cm.display.disabled = false;
|
||||
if (!val) cm.display.input.reset();
|
||||
}
|
||||
cm.display.input.readOnlyChanged(val)
|
||||
});
|
||||
option("disableInput", false, function(cm, val) {if (!val) cm.display.input.reset();}, true);
|
||||
option("dragDrop", true, dragDropChanged);
|
||||
@ -8093,24 +8103,30 @@
|
||||
}
|
||||
};
|
||||
|
||||
var noHandlers = []
|
||||
function getHandlers(emitter, type, copy) {
|
||||
var arr = emitter._handlers && emitter._handlers[type]
|
||||
if (copy) return arr && arr.length > 0 ? arr.slice() : noHandlers
|
||||
else return arr || noHandlers
|
||||
}
|
||||
|
||||
var off = CodeMirror.off = function(emitter, type, f) {
|
||||
if (emitter.removeEventListener)
|
||||
emitter.removeEventListener(type, f, false);
|
||||
else if (emitter.detachEvent)
|
||||
emitter.detachEvent("on" + type, f);
|
||||
else {
|
||||
var arr = emitter._handlers && emitter._handlers[type];
|
||||
if (!arr) return;
|
||||
for (var i = 0; i < arr.length; ++i)
|
||||
if (arr[i] == f) { arr.splice(i, 1); break; }
|
||||
var handlers = getHandlers(emitter, type, false)
|
||||
for (var i = 0; i < handlers.length; ++i)
|
||||
if (handlers[i] == f) { handlers.splice(i, 1); break; }
|
||||
}
|
||||
};
|
||||
|
||||
var signal = CodeMirror.signal = function(emitter, type /*, values...*/) {
|
||||
var arr = emitter._handlers && emitter._handlers[type];
|
||||
if (!arr) return;
|
||||
var handlers = getHandlers(emitter, type, true)
|
||||
if (!handlers.length) return;
|
||||
var args = Array.prototype.slice.call(arguments, 2);
|
||||
for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args);
|
||||
for (var i = 0; i < handlers.length; ++i) handlers[i].apply(null, args);
|
||||
};
|
||||
|
||||
var orphanDelayedCallbacks = null;
|
||||
@ -8123,8 +8139,8 @@
|
||||
// them to be executed when the last operation ends, or, if no
|
||||
// operation is active, when a timeout fires.
|
||||
function signalLater(emitter, type /*, values...*/) {
|
||||
var arr = emitter._handlers && emitter._handlers[type];
|
||||
if (!arr) return;
|
||||
var arr = getHandlers(emitter, type, false)
|
||||
if (!arr.length) return;
|
||||
var args = Array.prototype.slice.call(arguments, 2), list;
|
||||
if (operationGroup) {
|
||||
list = operationGroup.delayedCallbacks;
|
||||
@ -8164,8 +8180,7 @@
|
||||
}
|
||||
|
||||
function hasHandler(emitter, type) {
|
||||
var arr = emitter._handlers && emitter._handlers[type];
|
||||
return arr && arr.length > 0;
|
||||
return getHandlers(emitter, type).length > 0
|
||||
}
|
||||
|
||||
// Add on and off methods to a constructor's prototype, to make
|
||||
@ -8819,7 +8834,7 @@
|
||||
|
||||
// THE END
|
||||
|
||||
CodeMirror.version = "5.6.1";
|
||||
CodeMirror.version = "5.7.1";
|
||||
|
||||
return CodeMirror;
|
||||
});
|
||||
|
@ -39,7 +39,7 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
|
||||
|
||||
// Hack to prevent formatting override inside code blocks (block and inline)
|
||||
if (state.codeBlock) {
|
||||
if (stream.match(/^```/)) {
|
||||
if (stream.match(/^```+/)) {
|
||||
state.codeBlock = false;
|
||||
return null;
|
||||
}
|
||||
@ -49,7 +49,7 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
|
||||
if (stream.sol()) {
|
||||
state.code = false;
|
||||
}
|
||||
if (stream.sol() && stream.match(/^```/)) {
|
||||
if (stream.sol() && stream.match(/^```+/)) {
|
||||
stream.skipToEnd();
|
||||
state.codeBlock = true;
|
||||
return null;
|
||||
@ -115,7 +115,7 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
|
||||
var markdownConfig = {
|
||||
underscoresBreakWords: false,
|
||||
taskLists: true,
|
||||
fencedCodeBlocks: true,
|
||||
fencedCodeBlocks: '```',
|
||||
strikethrough: true
|
||||
};
|
||||
for (var attr in modeConfig) {
|
||||
|
@ -39,8 +39,10 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
if (modeCfg.underscoresBreakWords === undefined)
|
||||
modeCfg.underscoresBreakWords = true;
|
||||
|
||||
// Turn on fenced code blocks? ("```" to start/end)
|
||||
if (modeCfg.fencedCodeBlocks === undefined) modeCfg.fencedCodeBlocks = false;
|
||||
// Use `fencedCodeBlocks` to configure fenced code blocks. false to
|
||||
// disable, string to specify a precise regexp that the fence should
|
||||
// match, and true to allow three or more backticks or tildes (as
|
||||
// per CommonMark).
|
||||
|
||||
// Turn on task lists? ("- [ ] " and "- [x] ")
|
||||
if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
|
||||
@ -74,7 +76,9 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
, taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE
|
||||
, atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
|
||||
, setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/
|
||||
, textRE = /^[^#!\[\]*_\\<>` "'(~]+/;
|
||||
, textRE = /^[^#!\[\]*_\\<>` "'(~]+/
|
||||
, fencedCodeRE = new RegExp("^(" + (modeCfg.fencedCodeBlocks === true ? "~~~+|```+" : modeCfg.fencedCodeBlocks) +
|
||||
")[ \\t]*([\\w+#]*)");
|
||||
|
||||
function switchInline(stream, state, f) {
|
||||
state.f = state.inline = f;
|
||||
@ -86,6 +90,9 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
return f(stream, state);
|
||||
}
|
||||
|
||||
function lineIsEmpty(line) {
|
||||
return !line || !/\S/.test(line.string)
|
||||
}
|
||||
|
||||
// Blocks
|
||||
|
||||
@ -110,7 +117,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
state.trailingSpace = 0;
|
||||
state.trailingSpaceNewLine = false;
|
||||
// Mark this line as blank
|
||||
state.thisLineHasContent = false;
|
||||
state.prevLine = state.thisLine
|
||||
state.thisLine = null
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -141,7 +149,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
var match = null;
|
||||
if (state.indentationDiff >= 4) {
|
||||
stream.skipToEnd();
|
||||
if (prevLineIsIndentedCode || !state.prevLineHasContent) {
|
||||
if (prevLineIsIndentedCode || lineIsEmpty(state.prevLine)) {
|
||||
state.indentation -= 4;
|
||||
state.indentedCode = true;
|
||||
return code;
|
||||
@ -155,7 +163,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
if (modeCfg.highlightFormatting) state.formatting = "header";
|
||||
state.f = state.inline;
|
||||
return getType(state);
|
||||
} else if (state.prevLineHasContent && !state.quote && !prevLineIsList && !prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) {
|
||||
} else if (!lineIsEmpty(state.prevLine) && !state.quote && !prevLineIsList &&
|
||||
!prevLineIsIndentedCode && (match = stream.match(setextHeaderRE))) {
|
||||
state.header = match[0].charAt(0) == '=' ? 1 : 2;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "header";
|
||||
state.f = state.inline;
|
||||
@ -170,7 +179,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
} else if (stream.match(hrRE, true)) {
|
||||
state.hr = true;
|
||||
return hr;
|
||||
} else if ((!state.prevLineHasContent || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) {
|
||||
} else if ((lineIsEmpty(state.prevLine) || prevLineIsList) && (stream.match(ulRE, false) || stream.match(olRE, false))) {
|
||||
var listType = null;
|
||||
if (stream.match(ulRE, true)) {
|
||||
listType = 'ul';
|
||||
@ -187,9 +196,10 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
state.f = state.inline;
|
||||
if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
|
||||
return getType(state);
|
||||
} else if (modeCfg.fencedCodeBlocks && stream.match(/^```[ \t]*([\w+#]*)/, true)) {
|
||||
} else if (modeCfg.fencedCodeBlocks && (match = stream.match(fencedCodeRE, true))) {
|
||||
state.fencedChars = match[1]
|
||||
// try switching mode
|
||||
state.localMode = getMode(RegExp.$1);
|
||||
state.localMode = getMode(match[2]);
|
||||
if (state.localMode) state.localState = state.localMode.startState();
|
||||
state.f = state.block = local;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "code-block";
|
||||
@ -213,7 +223,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
}
|
||||
|
||||
function local(stream, state) {
|
||||
if (stream.sol() && stream.match("```", false)) {
|
||||
if (stream.sol() && state.fencedChars && stream.match(state.fencedChars, false)) {
|
||||
state.localMode = state.localState = null;
|
||||
state.f = state.block = leavingLocal;
|
||||
return null;
|
||||
@ -226,9 +236,10 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
}
|
||||
|
||||
function leavingLocal(stream, state) {
|
||||
stream.match("```");
|
||||
stream.match(state.fencedChars);
|
||||
state.block = blockNormal;
|
||||
state.f = inlineNormal;
|
||||
state.fencedChars = null;
|
||||
if (modeCfg.highlightFormatting) state.formatting = "code-block";
|
||||
state.code = true;
|
||||
var returnType = getType(state);
|
||||
@ -656,8 +667,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
return {
|
||||
f: blockNormal,
|
||||
|
||||
prevLineHasContent: false,
|
||||
thisLineHasContent: false,
|
||||
prevLine: null,
|
||||
thisLine: null,
|
||||
|
||||
block: blockNormal,
|
||||
htmlState: null,
|
||||
@ -680,7 +691,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
quote: 0,
|
||||
trailingSpace: 0,
|
||||
trailingSpaceNewLine: false,
|
||||
strikethrough: false
|
||||
strikethrough: false,
|
||||
fencedChars: null
|
||||
};
|
||||
},
|
||||
|
||||
@ -688,8 +700,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
return {
|
||||
f: s.f,
|
||||
|
||||
prevLineHasContent: s.prevLineHasContent,
|
||||
thisLineHasContent: s.thisLineHasContent,
|
||||
prevLine: s.prevLine,
|
||||
thisLine: s.this,
|
||||
|
||||
block: s.block,
|
||||
htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
|
||||
@ -715,7 +727,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
indentedCode: s.indentedCode,
|
||||
trailingSpace: s.trailingSpace,
|
||||
trailingSpaceNewLine: s.trailingSpaceNewLine,
|
||||
md_inside: s.md_inside
|
||||
md_inside: s.md_inside,
|
||||
fencedChars: s.fencedChars
|
||||
};
|
||||
},
|
||||
|
||||
@ -724,22 +737,22 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
|
||||
// Reset state.formatting
|
||||
state.formatting = false;
|
||||
|
||||
if (stream.sol()) {
|
||||
var forceBlankLine = !!state.header || state.hr;
|
||||
if (stream != state.thisLine) {
|
||||
var forceBlankLine = state.header || state.hr;
|
||||
|
||||
// Reset state.header and state.hr
|
||||
state.header = 0;
|
||||
state.hr = false;
|
||||
|
||||
if (stream.match(/^\s*$/, true) || forceBlankLine) {
|
||||
state.prevLineHasContent = false;
|
||||
blankLine(state);
|
||||
return forceBlankLine ? this.token(stream, state) : null;
|
||||
} else {
|
||||
state.prevLineHasContent = state.thisLineHasContent;
|
||||
state.thisLineHasContent = true;
|
||||
if (!forceBlankLine) return null
|
||||
state.prevLine = null
|
||||
}
|
||||
|
||||
state.prevLine = state.thisLine
|
||||
state.thisLine = stream
|
||||
|
||||
// Reset state.taskList
|
||||
state.taskList = false;
|
||||
|
||||
|
@ -739,28 +739,28 @@ function SimpleMDE(options) {
|
||||
|
||||
// Used later to refer to it's parent
|
||||
options.parent = this;
|
||||
|
||||
|
||||
|
||||
|
||||
// Check if Font Awesome needs to be auto downloaded
|
||||
var autoDownloadFA = true;
|
||||
|
||||
if(options.autoDownloadFontAwesome === false){
|
||||
if(options.autoDownloadFontAwesome === false) {
|
||||
autoDownloadFA = false;
|
||||
}
|
||||
|
||||
if(options.autoDownloadFontAwesome !== true){
|
||||
|
||||
if(options.autoDownloadFontAwesome !== true) {
|
||||
var styleSheets = document.styleSheets;
|
||||
for(var i = 0; i < styleSheets.length; i++) {
|
||||
if(!styleSheets[i].href)
|
||||
continue;
|
||||
|
||||
if(styleSheets[i].href.indexOf("//maxcdn.bootstrapcdn.com/font-awesome/") > -1){
|
||||
|
||||
if(styleSheets[i].href.indexOf("//maxcdn.bootstrapcdn.com/font-awesome/") > -1) {
|
||||
autoDownloadFA = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(autoDownloadFA){
|
||||
|
||||
if(autoDownloadFA) {
|
||||
var link = document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
link.href = "https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css";
|
||||
@ -899,7 +899,8 @@ SimpleMDE.prototype.render = function(el) {
|
||||
lineNumbers: false,
|
||||
autofocus: (options.autofocus === true) ? true : false,
|
||||
extraKeys: keyMaps,
|
||||
lineWrapping: (options.lineWrapping === false) ? false : true
|
||||
lineWrapping: (options.lineWrapping === false) ? false : true,
|
||||
allowDroppedFileTypes: ["text/plain"]
|
||||
});
|
||||
|
||||
if(options.toolbar !== false) {
|
||||
@ -1033,7 +1034,7 @@ SimpleMDE.prototype.createToolbar = function(items) {
|
||||
for(var i = 0; i < items.length; i++) {
|
||||
if(items[i].name == "guide" && self.options.toolbarGuideIcon === false)
|
||||
continue;
|
||||
|
||||
|
||||
if(self.options.hideIcons.indexOf(items[i].name) != -1)
|
||||
continue;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user