Merge 95aa340c95d2227e332e13e9e76128463cabccb7 into 6abda7ab68cc20f4aca870eb243747951b90ab04

This commit is contained in:
Andrey Torsunov 2016-07-21 09:45:29 +00:00 committed by GitHub
commit 3ccab46592
2 changed files with 21 additions and 1 deletions

View File

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

View File

@ -21,6 +21,7 @@ var isMac = /Mac/.test(navigator.platform);
var bindings = { var bindings = {
"toggleBold": toggleBold, "toggleBold": toggleBold,
"toggleItalic": toggleItalic, "toggleItalic": toggleItalic,
"toggleUnderline": toggleUnderline,
"drawLink": drawLink, "drawLink": drawLink,
"toggleHeadingSmaller": toggleHeadingSmaller, "toggleHeadingSmaller": toggleHeadingSmaller,
"toggleHeadingBigger": toggleHeadingBigger, "toggleHeadingBigger": toggleHeadingBigger,
@ -46,6 +47,7 @@ var bindings = {
var shortcuts = { var shortcuts = {
"toggleBold": "Cmd-B", "toggleBold": "Cmd-B",
"toggleItalic": "Cmd-I", "toggleItalic": "Cmd-I",
"toggleUnderline": "Cmd-U",
"drawLink": "Cmd-K", "drawLink": "Cmd-K",
"toggleHeadingSmaller": "Cmd-H", "toggleHeadingSmaller": "Cmd-H",
"toggleHeadingBigger": "Shift-Cmd-H", "toggleHeadingBigger": "Shift-Cmd-H",
@ -242,6 +244,12 @@ function toggleItalic(editor) {
_toggleBlock(editor, "italic", editor.options.blockStyles.italic); _toggleBlock(editor, "italic", editor.options.blockStyles.italic);
} }
/**
* Action for toggling underline.
*/
function toggleUnderline(editor) {
_toggleBlock(editor, "underline", "__");
}
/** /**
* Action for toggling strikethrough. * Action for toggling strikethrough.
@ -1081,6 +1089,12 @@ var toolbarBuiltInButtons = {
title: "Italic", title: "Italic",
default: true default: true
}, },
"underline": {
name: "underline",
action: toggleUnderline,
className: "fa fa-underline",
title: "Underline"
},
"strikethrough": { "strikethrough": {
name: "strikethrough", name: "strikethrough",
action: toggleStrikethrough, action: toggleStrikethrough,
@ -1881,6 +1895,7 @@ SimpleMDE.prototype.value = function(val) {
*/ */
SimpleMDE.toggleBold = toggleBold; SimpleMDE.toggleBold = toggleBold;
SimpleMDE.toggleItalic = toggleItalic; SimpleMDE.toggleItalic = toggleItalic;
SimpleMDE.toggleUnderline = toggleUnderline;
SimpleMDE.toggleStrikethrough = toggleStrikethrough; SimpleMDE.toggleStrikethrough = toggleStrikethrough;
SimpleMDE.toggleBlockquote = toggleBlockquote; SimpleMDE.toggleBlockquote = toggleBlockquote;
SimpleMDE.toggleHeadingSmaller = toggleHeadingSmaller; SimpleMDE.toggleHeadingSmaller = toggleHeadingSmaller;
@ -1911,6 +1926,9 @@ SimpleMDE.prototype.toggleBold = function() {
SimpleMDE.prototype.toggleItalic = function() { SimpleMDE.prototype.toggleItalic = function() {
toggleItalic(this); toggleItalic(this);
}; };
SimpleMDE.prototype.toggleUnderline = function() {
toggleUnderline(this);
};
SimpleMDE.prototype.toggleStrikethrough = function() { SimpleMDE.prototype.toggleStrikethrough = function() {
toggleStrikethrough(this); toggleStrikethrough(this);
}; };
@ -2025,4 +2043,4 @@ SimpleMDE.prototype.toTextArea = function() {
} }
}; };
module.exports = SimpleMDE; module.exports = SimpleMDE;