pull/391/merge
Andrey Torsunov 8 years ago committed by GitHub
commit 781c09da29

@ -192,6 +192,7 @@ Name | Action | Tooltip<br>Class
bold | toggleBold | Bold<br>fa fa-bold
italic | toggleItalic | Italic<br>fa fa-italic
strikethrough | toggleStrikethrough | Strikethrough<br>fa fa-strikethrough
underline | toggleUnderline | Underline<br>fa fa-underline
heading | toggleHeadingSmaller | Heading<br>fa fa-header
heading-smaller | toggleHeadingSmaller | Smaller Heading<br>fa fa-header
heading-bigger | toggleHeadingBigger | Bigger Heading<br>fa fa-lg fa-header
@ -250,6 +251,7 @@ Shortcut | Action
:------- | :-----
*Cmd-'* | "toggleBlockquote"
*Cmd-B* | "toggleBold"
*Cmd-U* | "toggleUnderline"
*Cmd-E* | "cleanBlock"
*Cmd-H* | "toggleHeadingSmaller"
*Cmd-I* | "toggleItalic"

@ -94,8 +94,14 @@
.cm-tab { display: inline-block; text-decoration: inherit; }
.CodeMirror-rulers {
position: absolute;
left: 0; right: 0; top: -50px; bottom: -20px;
overflow: hidden;
}
.CodeMirror-ruler {
border-left: 1px solid #ccc;
top: 0; bottom: 0;
position: absolute;
}
@ -297,7 +303,10 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
visibility: hidden;
}
.CodeMirror-cursor { position: absolute; }
.CodeMirror-cursor {
position: absolute;
pointer-events: none;
}
.CodeMirror-measure pre { position: static; }
div.CodeMirror-cursors {
@ -345,7 +354,6 @@ span.CodeMirror-selectedtext { background: none; }
.CodeMirror {
height: auto;
min-height: 300px;
border: 1px solid #ddd;
border-bottom-left-radius: 4px;
border-bottom-right-radius: 4px;
@ -354,10 +362,6 @@ span.CodeMirror-selectedtext { background: none; }
z-index: 1;
}
.CodeMirror-scroll {
min-height: 300px
}
.CodeMirror-fullscreen {
background: #fff;
position: fixed !important;
@ -367,6 +371,8 @@ span.CodeMirror-selectedtext { background: none; }
bottom: 0;
height: auto;
z-index: 9;
border-right: none !important;
border-bottom-right-radius: 0 !important;
}
.CodeMirror-sided {

File diff suppressed because one or more lines are too long

@ -173,7 +173,7 @@ exports.kMaxLength = kMaxLength()
function typedArraySupport () {
try {
var arr = new Uint8Array(1)
arr.foo = function () { return 42 }
arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
return arr.foo() === 42 && // typed array instances can be augmented
typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
@ -317,7 +317,7 @@ function allocUnsafe (that, size) {
assertSize(size)
that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
if (!Buffer.TYPED_ARRAY_SUPPORT) {
for (var i = 0; i < size; i++) {
for (var i = 0; i < size; ++i) {
that[i] = 0
}
}
@ -373,7 +373,9 @@ function fromArrayBuffer (that, array, byteOffset, length) {
throw new RangeError('\'length\' is out of bounds')
}
if (length === undefined) {
if (byteOffset === undefined && length === undefined) {
array = new Uint8Array(array)
} else if (length === undefined) {
array = new Uint8Array(array, byteOffset)
} else {
array = new Uint8Array(array, byteOffset, length)
@ -495,14 +497,14 @@ Buffer.concat = function concat (list, length) {
var i
if (length === undefined) {
length = 0
for (i = 0; i < list.length; i++) {
for (i = 0; i < list.length; ++i) {
length += list[i].length
}
}
var buffer = Buffer.allocUnsafe(length)
var pos = 0
for (i = 0; i < list.length; i++) {
for (i = 0; i < list.length; ++i) {
var buf = list[i]
if (!Buffer.isBuffer(buf)) {
throw new TypeError('"list" argument must be an Array of Buffers')
@ -534,7 +536,6 @@ function byteLength (string, encoding) {
switch (encoding) {
case 'ascii':
case 'binary':
// Deprecated
case 'raw':
case 'raws':
return len
@ -772,15 +773,16 @@ function arrayIndexOf (arr, val, byteOffset, encoding) {
}
var foundIndex = -1
for (var i = 0; byteOffset + i < arrLength; i++) {
if (read(arr, byteOffset + i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
for (var i = byteOffset; i < arrLength; ++i) {
if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
if (foundIndex === -1) foundIndex = i
if (i - foundIndex + 1 === valLength) return (byteOffset + foundIndex) * indexSize
if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
} else {
if (foundIndex !== -1) i -= i - foundIndex
foundIndex = -1
}
}
return -1
}
@ -845,7 +847,7 @@ function hexWrite (buf, string, offset, length) {
if (length > strLen / 2) {
length = strLen / 2
}
for (var i = 0; i < length; i++) {
for (var i = 0; i < length; ++i) {
var parsed = parseInt(string.substr(i * 2, 2), 16)
if (isNaN(parsed)) return i
buf[offset + i] = parsed
@ -1059,7 +1061,7 @@ function asciiSlice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; i++) {
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i] & 0x7F)
}
return ret
@ -1069,7 +1071,7 @@ function binarySlice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
for (var i = start; i < end; i++) {
for (var i = start; i < end; ++i) {
ret += String.fromCharCode(buf[i])
}
return ret
@ -1082,7 +1084,7 @@ function hexSlice (buf, start, end) {
if (!end || end < 0 || end > len) end = len
var out = ''
for (var i = start; i < end; i++) {
for (var i = start; i < end; ++i) {
out += toHex(buf[i])
}
return out
@ -1125,7 +1127,7 @@ Buffer.prototype.slice = function slice (start, end) {
} else {
var sliceLen = end - start
newBuf = new Buffer(sliceLen, undefined)
for (var i = 0; i < sliceLen; i++) {
for (var i = 0; i < sliceLen; ++i) {
newBuf[i] = this[i + start]
}
}
@ -1352,7 +1354,7 @@ Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
function objectWriteUInt16 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffff + value + 1
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; i++) {
for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
(littleEndian ? i : 1 - i) * 8
}
@ -1386,7 +1388,7 @@ Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert
function objectWriteUInt32 (buf, value, offset, littleEndian) {
if (value < 0) value = 0xffffffff + value + 1
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; i++) {
for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
}
}
@ -1601,12 +1603,12 @@ Buffer.prototype.copy = function copy (target, targetStart, start, end) {
if (this === target && start < targetStart && targetStart < end) {
// descending copy from end
for (i = len - 1; i >= 0; i--) {
for (i = len - 1; i >= 0; --i) {
target[i + targetStart] = this[i + start]
}
} else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
// ascending copy from start
for (i = 0; i < len; i++) {
for (i = 0; i < len; ++i) {
target[i + targetStart] = this[i + start]
}
} else {
@ -1667,7 +1669,7 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
var i
if (typeof val === 'number') {
for (i = start; i < end; i++) {
for (i = start; i < end; ++i) {
this[i] = val
}
} else {
@ -1675,7 +1677,7 @@ Buffer.prototype.fill = function fill (val, start, end, encoding) {
? val
: utf8ToBytes(new Buffer(val, encoding).toString())
var len = bytes.length
for (i = 0; i < end - start; i++) {
for (i = 0; i < end - start; ++i) {
this[i + start] = bytes[i % len]
}
}
@ -1717,7 +1719,7 @@ function utf8ToBytes (string, units) {
var leadSurrogate = null
var bytes = []
for (var i = 0; i < length; i++) {
for (var i = 0; i < length; ++i) {
codePoint = string.charCodeAt(i)
// is surrogate component
@ -1792,7 +1794,7 @@ function utf8ToBytes (string, units) {
function asciiToBytes (str) {
var byteArray = []
for (var i = 0; i < str.length; i++) {
for (var i = 0; i < str.length; ++i) {
// Node's code seems to be doing this and not & 0x7F..
byteArray.push(str.charCodeAt(i) & 0xFF)
}
@ -1802,7 +1804,7 @@ function asciiToBytes (str) {
function utf16leToBytes (str, units) {
var c, hi, lo
var byteArray = []
for (var i = 0; i < str.length; i++) {
for (var i = 0; i < str.length; ++i) {
if ((units -= 2) < 0) break
c = str.charCodeAt(i)
@ -1820,7 +1822,7 @@ function base64ToBytes (str) {
}
function blitBuffer (src, dst, offset, length) {
for (var i = 0; i < length; i++) {
for (var i = 0; i < length; ++i) {
if ((i + offset >= dst.length) || (i >= src.length)) break
dst[i + offset] = src[i]
}
@ -1832,7 +1834,14 @@ function isnan (val) {
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"base64-js":1,"ieee754":15,"isarray":16}],4:[function(require,module,exports){
},{"base64-js":1,"ieee754":16,"isarray":4}],4:[function(require,module,exports){
var toString = {}.toString;
module.exports = Array.isArray || function (arr) {
return toString.call(arr) == '[object Array]';
};
},{}],5:[function(require,module,exports){
// Use strict mode (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode)
"use strict";
@ -1952,7 +1961,7 @@ CodeMirrorSpellChecker.typo;
// Export
module.exports = CodeMirrorSpellChecker;
},{"typo-js":18}],5:[function(require,module,exports){
},{"typo-js":18}],6:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
@ -1995,7 +2004,7 @@ module.exports = CodeMirrorSpellChecker;
}
});
},{"../../lib/codemirror":10}],6:[function(require,module,exports){
},{"../../lib/codemirror":11}],7:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
@ -2059,7 +2068,7 @@ module.exports = CodeMirrorSpellChecker;
}
});
},{"../../lib/codemirror":10}],7:[function(require,module,exports){
},{"../../lib/codemirror":11}],8:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
@ -2112,7 +2121,7 @@ module.exports = CodeMirrorSpellChecker;
};
});
},{"../../lib/codemirror":10}],8:[function(require,module,exports){
},{"../../lib/codemirror":11}],9:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
@ -2199,7 +2208,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
});
},{"../../lib/codemirror":10}],9:[function(require,module,exports){
},{"../../lib/codemirror":11}],10:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
@ -2319,7 +2328,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
}
});
},{"../../lib/codemirror":10}],10:[function(require,module,exports){
},{"../../lib/codemirror":11}],11:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
@ -3543,7 +3552,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
};
function hiddenTextarea() {
var te = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none");
var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
// The textarea is kept positioned near the cursor to prevent the
// fact that it'll be scrolled into view on input from scrolling
@ -5010,6 +5019,16 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd};
}
function getUsefulRect(rects, bias) {
var rect = nullRect
if (bias == "left") for (var i = 0; i < rects.length; i++) {
if ((rect = rects[i]).left != rect.right) break
} else for (var i = rects.length - 1; i >= 0; i--) {
if ((rect = rects[i]).left != rect.right) break
}
return rect
}
function measureCharInner(cm, prepared, ch, bias) {
var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
@ -5019,17 +5038,10 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
for (var i = 0; i < 4; i++) { // Retry a maximum of 4 times when nonsense rectangles are returned
while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) --start;
while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) ++end;
if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) {
if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
rect = node.parentNode.getBoundingClientRect();
} else if (ie && cm.options.lineWrapping) {
var rects = range(node, start, end).getClientRects();
if (rects.length)
rect = rects[bias == "right" ? rects.length - 1 : 0];
else
rect = nullRect;
} else {
rect = range(node, start, end).getBoundingClientRect() || nullRect;
}
else
rect = getUsefulRect(range(node, start, end).getClientRects(), bias)
if (rect.left || rect.right || start == 0) break;
end = start;
start = start - 1;
@ -5255,10 +5267,23 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
for (;;) {
if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {
var ch = x < fromX || x - fromX <= toX - x ? from : to;
var outside = ch == from ? fromOutside : toOutside
var xDiff = x - (ch == from ? fromX : toX);
// This is a kludge to handle the case where the coordinates
// are after a line-wrapped line. We should replace it with a
// more general handling of cursor positions around line
// breaks. (Issue #4078)
if (toOutside && !bidi && !/\s/.test(lineObj.text.charAt(ch)) && xDiff > 0 &&
ch < lineObj.text.length && preparedMeasure.view.measure.heights.length > 1) {
var charSize = measureCharPrepared(cm, preparedMeasure, ch, "right");
if (innerOff <= charSize.bottom && innerOff >= charSize.top && Math.abs(x - charSize.right) < xDiff) {
outside = false
ch++
xDiff = x - charSize.right
}
}
while (isExtendingChar(lineObj.text.charAt(ch))) ++ch;
var pos = PosWithInfo(lineNo, ch, ch == from ? fromOutside : toOutside,
xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0);
var pos = PosWithInfo(lineNo, ch, outside, xDiff < -1 ? -1 : xDiff > 1 ? 1 : 0);
return pos;
}
var step = Math.ceil(dist / 2), middle = from + step;
@ -5982,6 +6007,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
// Let the drag handler handle this.
if (webkit) display.scroller.draggable = true;
cm.state.draggingText = dragEnd;
dragEnd.copy = mac ? e.altKey : e.ctrlKey
// IE's approach to draggable
if (display.scroller.dragDrop) display.scroller.dragDrop();
on(document, "mouseup", dragEnd);
@ -6212,7 +6238,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
try {
var text = e.dataTransfer.getData("Text");
if (text) {
if (cm.state.draggingText && !(mac ? e.altKey : e.ctrlKey))
if (cm.state.draggingText && !cm.state.draggingText.copy)
var selected = cm.listSelections();
setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
if (selected) for (var i = 0; i < selected.length; ++i)
@ -6727,7 +6753,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
// Revert a change stored in a document's history.
function makeChangeFromHistory(doc, type, allowSelectionOnly) {
if (doc.cm && doc.cm.state.suppressEdits) return;
if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) return;
var hist = doc.history, event, selAfter = doc.sel;
var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
@ -9252,6 +9278,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
var content = elt("span", null, null, webkit ? "padding-right: .1px" : null);
var builder = {pre: elt("pre", [content], "CodeMirror-line"), content: content,
col: 0, pos: 0, cm: cm,
trailingSpace: false,
splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")};
lineView.measure = {};
@ -9313,7 +9340,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
// the line map. Takes care to render special characters separately.
function buildToken(builder, text, style, startStyle, endStyle, title, css) {
if (!text) return;
var displayText = builder.splitSpaces ? text.replace(/ {3,}/g, splitSpaces) : text;
var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text
var special = builder.cm.state.specialChars, mustWrap = false;
if (!special.test(text)) {
builder.col += text.length;
@ -9358,6 +9385,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
builder.pos++;
}
}
builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32
if (style || startStyle || endStyle || mustWrap || css) {
var fullStyle = style || "";
if (startStyle) fullStyle += startStyle;
@ -9369,11 +9397,17 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
builder.content.appendChild(content);
}
function splitSpaces(old) {
var out = " ";
for (var i = 0; i < old.length - 2; ++i) out += i % 2 ? " " : "\u00a0";
out += " ";
return out;
function splitSpaces(text, trailingBefore) {
if (text.length > 1 && !/ /.test(text)) return text
var spaceBefore = trailingBefore, result = ""
for (var i = 0; i < text.length; i++) {
var ch = text.charAt(i)
if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
ch = "\u00a0"
result += ch
spaceBefore = ch == " "
}
return result
}
// Work around nonsense dimensions being reported for stretches of
@ -9410,6 +9444,7 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
builder.content.appendChild(widget);
}
builder.pos += size;
builder.trailingSpace = false
}
// Outputs a number of spans to make up a line, taking highlighting
@ -10857,8 +10892,9 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
if (badBidiRects != null) return badBidiRects;
var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
var r0 = range(txt, 0, 1).getBoundingClientRect();
if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780)
var r1 = range(txt, 1, 2).getBoundingClientRect();
removeChildren(measure);
if (!r0 || r0.left == r0.right) return false; // Safari returns null in some cases (#2780)
return badBidiRects = (r1.right - r0.right < 3);
}
@ -11224,12 +11260,12 @@ CodeMirror.overlayMode = function(base, overlay, combine) {
// THE END
CodeMirror.version = "5.15.2";
CodeMirror.version = "5.17.0";
return CodeMirror;
});
},{}],11:[function(require,module,exports){
},{}],12:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
@ -11361,7 +11397,7 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
CodeMirror.defineMIME("text/x-gfm", "gfm");
});
},{"../../addon/mode/overlay":8,"../../lib/codemirror":10,"../markdown/markdown":12}],12:[function(require,module,exports){
},{"../../addon/mode/overlay":9,"../../lib/codemirror":11,"../markdown/markdown":13}],13:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
@ -11427,7 +11463,9 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
list2: "variable-3",
list3: "keyword",
hr: "hr",
image: "tag",
image: "image",
imageAltText: "image-alt-text",
imageMarker: "image-marker",
formatting: "formatting",
linkInline: "link",
linkEmail: "link",
@ -11677,6 +11715,9 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
if (state.linkText) { styles.push(tokenTypes.linkText); }
if (state.code) { styles.push(tokenTypes.code); }
if (state.image) { styles.push(tokenTypes.image); }
if (state.imageAltText) { styles.push(tokenTypes.imageAltText, "link"); }
if (state.imageMarker) { styles.push(tokenTypes.imageMarker); }
}
if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
@ -11796,12 +11837,29 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
}
if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
stream.match(/\[[^\]]*\]/);
state.imageMarker = true;
state.image = true;
if (modeCfg.highlightFormatting) state.formatting = "image";
return getType(state);
}
if (ch === '[' && state.imageMarker) {
state.imageMarker = false;
state.imageAltText = true
if (modeCfg.highlightFormatting) state.formatting = "image";
return getType(state);
}
if (ch === ']' && state.imageAltText) {
if (modeCfg.highlightFormatting) state.formatting = "image";
var type = getType(state);
state.imageAltText = false;
state.image = false;
state.inline = state.f = linkHref;
return tokenTypes.image;
return type;
}
if (ch === '[' && stream.match(/[^\]]*\](\(.*\)| ?\[.*?\])/, false)) {
if (ch === '[' && stream.match(/[^\]]*\](\(.*\)| ?\[.*?\])/, false) && !state.image) {
state.linkText = true;
if (modeCfg.highlightFormatting) state.formatting = "link";
return getType(state);
@ -12160,7 +12218,7 @@ CodeMirror.defineMIME("text/x-markdown", "markdown");
});
},{"../../lib/codemirror":10,"../meta":13,"../xml/xml":14}],13:[function(require,module,exports){
},{"../../lib/codemirror":11,"../meta":14,"../xml/xml":15}],14:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
@ -12370,7 +12428,7 @@ CodeMirror.defineMIME("text/x-markdown", "markdown");
};
});
},{"../lib/codemirror":10}],14:[function(require,module,exports){
},{"../lib/codemirror":11}],15:[function(require,module,exports){
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
@ -12766,7 +12824,7 @@ if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
});
},{"../../lib/codemirror":10}],15:[function(require,module,exports){
},{"../../lib/codemirror":11}],16:[function(require,module,exports){
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
var e, m
var eLen = nBytes * 8 - mLen - 1
@ -12852,13 +12910,6 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
buffer[offset + i - d] |= s * 128
}
},{}],16:[function(require,module,exports){
var toString = {}.toString;
module.exports = Array.isArray || function (arr) {
return toString.call(arr) == '[object Array]';
};
},{}],17:[function(require,module,exports){
(function (global){
/**
@ -14986,7 +15037,7 @@ CodeMirror.commands.shiftTabAndUnindentMarkdownList = function (cm) {
}
};
},{"codemirror":10}],20:[function(require,module,exports){
},{"codemirror":11}],20:[function(require,module,exports){
/*global require,module*/
"use strict";
var CodeMirror = require("codemirror");
@ -15010,6 +15061,7 @@ var isMac = /Mac/.test(navigator.platform);
var bindings = {
"toggleBold": toggleBold,
"toggleItalic": toggleItalic,
"toggleUnderline": toggleUnderline,
"drawLink": drawLink,
"toggleHeadingSmaller": toggleHeadingSmaller,
"toggleHeadingBigger": toggleHeadingBigger,
@ -15035,6 +15087,7 @@ var bindings = {
var shortcuts = {
"toggleBold": "Cmd-B",
"toggleItalic": "Cmd-I",
"toggleUnderline": "Cmd-U",
"drawLink": "Cmd-K",
"toggleHeadingSmaller": "Cmd-H",
"toggleHeadingBigger": "Shift-Cmd-H",
@ -15231,6 +15284,12 @@ function toggleItalic(editor) {
_toggleBlock(editor, "italic", editor.options.blockStyles.italic);
}
/**
* Action for toggling underline.
*/
function toggleUnderline(editor) {
_toggleBlock(editor, "underline", "__");
}
/**
* Action for toggling strikethrough.
@ -15784,8 +15843,10 @@ function _replaceSelection(cm, active, startEnd, url) {
var text;
var start = startEnd[0];
var end = startEnd[1];
var startPoint = cm.getCursor("start");
var endPoint = cm.getCursor("end");
var startPoint = {},
endPoint = {};
Object.assign(startPoint, cm.getCursor("start"));
Object.assign(endPoint, cm.getCursor("end"));
if(url) {
end = end.replace("#url#", url);
}
@ -16070,6 +16131,12 @@ var toolbarBuiltInButtons = {
title: "Italic",
default: true
},
"underline": {
name: "underline",
action: toggleUnderline,
className: "fa fa-underline",
title: "Underline"
},
"strikethrough": {
name: "strikethrough",
action: toggleStrikethrough,
@ -16353,6 +16420,8 @@ function SimpleMDE(options) {
// Merging the shortcuts, with the given options
options.shortcuts = extend({}, shortcuts, options.shortcuts || {});
options.minHeight = options.minHeight || "300px";
// Change unique_id to uniqueId for backwards compatibility
if(options.autosave != undefined && options.autosave.unique_id != undefined && options.autosave.unique_id != "")
@ -16381,8 +16450,12 @@ function SimpleMDE(options) {
SimpleMDE.prototype.markdown = function(text) {
if(marked) {
// Initialize
var markedOptions = {};
var markedOptions;
if(this.options && this.options.renderingConfig && this.options.renderingConfig.markedOptions) {
markedOptions = this.options.renderingConfig.markedOptions;
} else {
markedOptions = {};
}
// Update options
if(this.options && this.options.renderingConfig && this.options.renderingConfig.singleLineBreaks === false) {
@ -16484,6 +16557,8 @@ SimpleMDE.prototype.render = function(el) {
styleSelectedText: (options.styleSelectedText != undefined) ? options.styleSelectedText : true
});
this.codemirror.getScrollerElement().style.minHeight = options.minHeight;
if(options.forceSync === true) {
var cm = this.codemirror;
cm.on("change", function() {
@ -16870,6 +16945,7 @@ SimpleMDE.prototype.value = function(val) {
*/
SimpleMDE.toggleBold = toggleBold;
SimpleMDE.toggleItalic = toggleItalic;
SimpleMDE.toggleUnderline = toggleUnderline;
SimpleMDE.toggleStrikethrough = toggleStrikethrough;
SimpleMDE.toggleBlockquote = toggleBlockquote;
SimpleMDE.toggleHeadingSmaller = toggleHeadingSmaller;
@ -16900,6 +16976,9 @@ SimpleMDE.prototype.toggleBold = function() {
SimpleMDE.prototype.toggleItalic = function() {
toggleItalic(this);
};
SimpleMDE.prototype.toggleUnderline = function() {
toggleUnderline(this);
};
SimpleMDE.prototype.toggleStrikethrough = function() {
toggleStrikethrough(this);
};
@ -17015,5 +17094,5 @@ SimpleMDE.prototype.toTextArea = function() {
};
module.exports = SimpleMDE;
},{"./codemirror/tablist":19,"codemirror":10,"codemirror-spell-checker":4,"codemirror/addon/display/fullscreen.js":5,"codemirror/addon/display/placeholder.js":6,"codemirror/addon/edit/continuelist.js":7,"codemirror/addon/mode/overlay.js":8,"codemirror/addon/selection/mark-selection.js":9,"codemirror/mode/gfm/gfm.js":11,"codemirror/mode/markdown/markdown.js":12,"codemirror/mode/xml/xml.js":14,"marked":17}]},{},[20])(20)
},{"./codemirror/tablist":19,"codemirror":11,"codemirror-spell-checker":5,"codemirror/addon/display/fullscreen.js":6,"codemirror/addon/display/placeholder.js":7,"codemirror/addon/edit/continuelist.js":8,"codemirror/addon/mode/overlay.js":9,"codemirror/addon/selection/mark-selection.js":10,"codemirror/mode/gfm/gfm.js":12,"codemirror/mode/markdown/markdown.js":13,"codemirror/mode/xml/xml.js":15,"marked":17}]},{},[20])(20)
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -21,6 +21,7 @@ var isMac = /Mac/.test(navigator.platform);
var bindings = {
"toggleBold": toggleBold,
"toggleItalic": toggleItalic,
"toggleUnderline": toggleUnderline,
"drawLink": drawLink,
"toggleHeadingSmaller": toggleHeadingSmaller,
"toggleHeadingBigger": toggleHeadingBigger,
@ -46,6 +47,7 @@ var bindings = {
var shortcuts = {
"toggleBold": "Cmd-B",
"toggleItalic": "Cmd-I",
"toggleUnderline": "Cmd-U",
"drawLink": "Cmd-K",
"toggleHeadingSmaller": "Cmd-H",
"toggleHeadingBigger": "Shift-Cmd-H",
@ -242,6 +244,12 @@ function toggleItalic(editor) {
_toggleBlock(editor, "italic", editor.options.blockStyles.italic);
}
/**
* Action for toggling underline.
*/
function toggleUnderline(editor) {
_toggleBlock(editor, "underline", "__");
}
/**
* Action for toggling strikethrough.
@ -795,7 +803,8 @@ function _replaceSelection(cm, active, startEnd, url) {
var text;
var start = startEnd[0];
var end = startEnd[1];
var startPoint = {}, endPoint = {};
var startPoint = {},
endPoint = {};
Object.assign(startPoint, cm.getCursor("start"));
Object.assign(endPoint, cm.getCursor("end"));
if(url) {
@ -1082,6 +1091,12 @@ var toolbarBuiltInButtons = {
title: "Italic",
default: true
},
"underline": {
name: "underline",
action: toggleUnderline,
className: "fa fa-underline",
title: "Underline"
},
"strikethrough": {
name: "strikethrough",
action: toggleStrikethrough,
@ -1890,6 +1905,7 @@ SimpleMDE.prototype.value = function(val) {
*/
SimpleMDE.toggleBold = toggleBold;
SimpleMDE.toggleItalic = toggleItalic;
SimpleMDE.toggleUnderline = toggleUnderline;
SimpleMDE.toggleStrikethrough = toggleStrikethrough;
SimpleMDE.toggleBlockquote = toggleBlockquote;
SimpleMDE.toggleHeadingSmaller = toggleHeadingSmaller;
@ -1920,6 +1936,9 @@ SimpleMDE.prototype.toggleBold = function() {
SimpleMDE.prototype.toggleItalic = function() {
toggleItalic(this);
};
SimpleMDE.prototype.toggleUnderline = function() {
toggleUnderline(this);
};
SimpleMDE.prototype.toggleStrikethrough = function() {
toggleStrikethrough(this);
};
@ -2034,4 +2053,4 @@ SimpleMDE.prototype.toTextArea = function() {
}
};
module.exports = SimpleMDE;
module.exports = SimpleMDE;
Loading…
Cancel
Save