|
|
|
@ -41,6 +41,7 @@ var shortcuts = {
|
|
|
|
|
"drawLink": "Cmd-K",
|
|
|
|
|
"toggleHeadingSmaller": "Cmd-H",
|
|
|
|
|
"toggleHeadingBigger": "Shift-Cmd-H",
|
|
|
|
|
cleanBlock: "Cmd-E",
|
|
|
|
|
"drawImage": "Cmd-Alt-I",
|
|
|
|
|
"toggleBlockquote": "Cmd-'",
|
|
|
|
|
"toggleOrderedList": "Cmd-Alt-L",
|
|
|
|
@ -290,6 +291,14 @@ function toggleOrderedList(editor) {
|
|
|
|
|
_toggleLine(cm, "ordered-list");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Action for clean block (remove headline, list, blockquote code, markers)
|
|
|
|
|
*/
|
|
|
|
|
function cleanBlock(editor) {
|
|
|
|
|
var cm = editor.codemirror;
|
|
|
|
|
_cleanBlock(cm);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Action for drawing a link.
|
|
|
|
|
*/
|
|
|
|
@ -654,6 +663,28 @@ function _toggleBlock(editor, type, start_chars, end_chars) {
|
|
|
|
|
cm.focus();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function _cleanBlock(cm) {
|
|
|
|
|
if(/editor-preview-active/.test(cm.getWrapperElement().lastChild.className))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var startPoint = cm.getCursor("start");
|
|
|
|
|
var endPoint = cm.getCursor("end");
|
|
|
|
|
var text;
|
|
|
|
|
|
|
|
|
|
for(var line = startPoint.line; line <= endPoint.line; line++) {
|
|
|
|
|
text = cm.getLine(line);
|
|
|
|
|
text = text.replace(/^[ ]*([# ]+|\*|\-|[> ]+|[0-9]+(.|\)))[ ]*/, "");
|
|
|
|
|
|
|
|
|
|
cm.replaceRange(text, {
|
|
|
|
|
line: line,
|
|
|
|
|
ch: 0
|
|
|
|
|
}, {
|
|
|
|
|
line: line,
|
|
|
|
|
ch: 99999999999999
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Merge the properties of one object into another.
|
|
|
|
|
function _mergeProperties(target, source) {
|
|
|
|
|
for(var property in source) {
|
|
|
|
@ -788,6 +819,12 @@ var toolbarBuiltInButtons = {
|
|
|
|
|
title: ["Numbered List", "toggleOrderedList"],
|
|
|
|
|
default: true
|
|
|
|
|
},
|
|
|
|
|
"clean-block": {
|
|
|
|
|
name: "clean-block",
|
|
|
|
|
action: cleanBlock,
|
|
|
|
|
className: "fa fa-eraser fa-clean-block",
|
|
|
|
|
title: "Clean block (Ctrl+E)"
|
|
|
|
|
},
|
|
|
|
|
"separator-2": {
|
|
|
|
|
name: "separator-2"
|
|
|
|
|
},
|
|
|
|
@ -1387,6 +1424,7 @@ SimpleMDE.toggleHeading3 = toggleHeading3;
|
|
|
|
|
SimpleMDE.toggleCodeBlock = toggleCodeBlock;
|
|
|
|
|
SimpleMDE.toggleUnorderedList = toggleUnorderedList;
|
|
|
|
|
SimpleMDE.toggleOrderedList = toggleOrderedList;
|
|
|
|
|
SimpleMDE.cleanBlock = cleanBlock;
|
|
|
|
|
SimpleMDE.drawLink = drawLink;
|
|
|
|
|
SimpleMDE.drawImage = drawImage;
|
|
|
|
|
SimpleMDE.drawTable = drawTable;
|
|
|
|
@ -1436,6 +1474,9 @@ SimpleMDE.prototype.toggleUnorderedList = function() {
|
|
|
|
|
SimpleMDE.prototype.toggleOrderedList = function() {
|
|
|
|
|
toggleOrderedList(this);
|
|
|
|
|
};
|
|
|
|
|
SimpleMDE.prototype.cleanBlock = function() {
|
|
|
|
|
cleanBlock(this);
|
|
|
|
|
};
|
|
|
|
|
SimpleMDE.prototype.drawLink = function() {
|
|
|
|
|
drawLink(this);
|
|
|
|
|
};
|
|
|
|
|