mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2025-09-24 16:40:55 -06:00
Merge d7beab0abeb4d0981114ea54ccc5c5fc2087fe7d into e32fe3f91c2d45f27f72a3662133b1c0e1a5bda1
This commit is contained in:
commit
571f47d9c1
@ -562,6 +562,14 @@ function toggleHeadingBigger(editor) {
|
||||
_toggleHeading(cm, "bigger");
|
||||
}
|
||||
|
||||
/**
|
||||
* Action for removing heading
|
||||
*/
|
||||
function removeHeading(editor) {
|
||||
var cm = editor.codemirror;
|
||||
_toggleHeading(cm, undefined, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Action for toggling heading size 1
|
||||
*/
|
||||
@ -856,7 +864,11 @@ function _toggleHeading(cm, direction, size) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(size == 1) {
|
||||
if (size == 0) {
|
||||
if (currHeadingLevel > 0) {
|
||||
text = text.substr(currHeadingLevel + 1);
|
||||
}
|
||||
} else if(size == 1) {
|
||||
if(currHeadingLevel <= 0) {
|
||||
text = "# " + text;
|
||||
} else if(currHeadingLevel == size) {
|
||||
@ -1942,6 +1954,7 @@ SimpleMDE.toggleStrikethrough = toggleStrikethrough;
|
||||
SimpleMDE.toggleBlockquote = toggleBlockquote;
|
||||
SimpleMDE.toggleHeadingSmaller = toggleHeadingSmaller;
|
||||
SimpleMDE.toggleHeadingBigger = toggleHeadingBigger;
|
||||
SimpleMDE.removeHeading = removeHeading;
|
||||
SimpleMDE.toggleHeading1 = toggleHeading1;
|
||||
SimpleMDE.toggleHeading2 = toggleHeading2;
|
||||
SimpleMDE.toggleHeading3 = toggleHeading3;
|
||||
@ -1980,6 +1993,9 @@ SimpleMDE.prototype.toggleHeadingSmaller = function() {
|
||||
SimpleMDE.prototype.toggleHeadingBigger = function() {
|
||||
toggleHeadingBigger(this);
|
||||
};
|
||||
SimpleMDE.prototype.removeHeading = function() {
|
||||
removeHeading(this);
|
||||
};
|
||||
SimpleMDE.prototype.toggleHeading1 = function() {
|
||||
toggleHeading1(this);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user