2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-06-27 13:11:01 -06:00

Add support for Header size 4, 5, 6

This commit is contained in:
Jonathan 2022-08-12 12:15:42 +02:00 committed by GitHub
parent d22fd40625
commit f7b4fbfda5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1143,30 +1143,12 @@ function _toggleHeading(cm, direction, size) {
}
}
} else {
if (size == 1) {
if (currHeadingLevel <= 0) {
text = '# ' + text;
text = '#'.repeat(size) + ' ' + text;
} else if (currHeadingLevel == size) {
text = text.substr(currHeadingLevel + 1);
} else {
text = '# ' + text.substr(currHeadingLevel + 1);
}
} else if (size == 2) {
if (currHeadingLevel <= 0) {
text = '## ' + text;
} else if (currHeadingLevel == size) {
text = text.substr(currHeadingLevel + 1);
} else {
text = '## ' + text.substr(currHeadingLevel + 1);
}
} else {
if (currHeadingLevel <= 0) {
text = '### ' + text;
} else if (currHeadingLevel == size) {
text = text.substr(currHeadingLevel + 1);
} else {
text = '### ' + text.substr(currHeadingLevel + 1);
}
text = '#'.repeat(size) + ' ' + text.substr(currHeadingLevel + 1);
}
}