mirror of
https://github.com/danpros/htmly.git
synced 2026-04-17 19:26:08 +05:30
Update Markdown.Editor.js
This commit is contained in:
parent
ce23850edd
commit
d4fef5e1d8
1 changed files with 17 additions and 6 deletions
|
|
@ -34,7 +34,7 @@
|
|||
quote: "Blockquote <blockquote> Ctrl+Q",
|
||||
quoteexample: "Blockquote",
|
||||
|
||||
code: "Code Sample <pre><code> Ctrl+K",
|
||||
code: "Code <pre><code> Ctrl+K",
|
||||
codeexample: "enter code here",
|
||||
|
||||
image: "Image <img> Ctrl+G",
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
ulist: "Bulleted List <ul> Ctrl+U",
|
||||
litem: "List item",
|
||||
|
||||
heading: "Heading <h1>/<h2> Ctrl+H",
|
||||
heading: "Heading Ctrl+H",
|
||||
headingexample: "Heading",
|
||||
|
||||
hr: "Horizontal Rule <hr> Ctrl+R",
|
||||
|
|
@ -2199,7 +2199,7 @@
|
|||
if (!chunk.selection) {
|
||||
chunk.startTag = "## ";
|
||||
chunk.selection = this.getString("headingexample");
|
||||
chunk.endTag = " ##";
|
||||
chunk.endTag = " \n";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -2221,16 +2221,17 @@
|
|||
if (/-+/.test(chunk.endTag)) {
|
||||
headerLevel = 2;
|
||||
}
|
||||
|
||||
|
||||
// Skip to the next line so we can create the header markdown.
|
||||
chunk.startTag = chunk.endTag = "";
|
||||
chunk.skipLines(1, 1);
|
||||
|
||||
// We make a level 2 header if there is no current header.
|
||||
// We make a level 4 header if there is no current header.
|
||||
// If there is a header level, we substract one from the header level.
|
||||
// If it's already a level 1 header, it's removed.
|
||||
var headerLevelToCreate = headerLevel == 0 ? 2 : headerLevel - 1;
|
||||
var headerLevelToCreate = headerLevel == 0 ? 4 : headerLevel - 1;
|
||||
|
||||
/*
|
||||
if (headerLevelToCreate > 0) {
|
||||
|
||||
// The button only creates level 1 and 2 underline headers.
|
||||
|
|
@ -2245,6 +2246,16 @@
|
|||
chunk.endTag += headerChar;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (headerLevelToCreate > 0) {
|
||||
var hashesToCreate = headerLevelToCreate;
|
||||
while (hashesToCreate--) {
|
||||
chunk.startTag += "#";
|
||||
}
|
||||
chunk.startTag += " "; //So we have #### Header instead of ####Header (optional)
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
commandProto.doHorizontalRule = function (chunk, postProcessing) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue