Browse Source

Fixed Task list rendeing

develop
pandao 6 years ago
parent
commit
7b2cec6c35
  1. 22
      editormd.amd.js
  2. 2
      editormd.amd.min.js
  3. 22
      editormd.js
  4. 2
      editormd.min.js
  5. 5
      examples/task-lists.html
  6. 2
      examples/use-zepto.html
  7. 2
      lib/codemirror/addons.min.js
  8. 22
      src/editormd.js

22
editormd.amd.js

@ -2105,6 +2105,10 @@
{
previewContainer.html(newMarkdownDoc);
previewContainer.find(".task-list-item").each(function () {
$(this).parent().addClass("task-list");
});
this.previewCodeHighlight();
if (settings.toc)
@ -3723,16 +3727,12 @@
return tag + this.atLink(this.emoji(content)) + "</" + type + ">\n";
};
markedRenderer.listitem = function(text) {
if (settings.taskList && /^\s*\[[x\s]\]\s*/.test(text))
{
text = text.replace(/^\s*\[\s\]\s*/, "<input type=\"checkbox\" class=\"task-list-item-checkbox\" /> ")
.replace(/^\s*\[x\]\s*/, "<input type=\"checkbox\" class=\"task-list-item-checkbox\" checked disabled /> ");
markedRenderer.listitem = function(text, task) {
if (settings.taskList && task) {
text = text.replace("<input ", "<input class='task-list-item-checkbox' ");
return "<li style=\"list-style: none;\">" + this.atLink(this.emoji(text)) + "</li>";
}
else
{
return "<li class=\"task-list-item\">" + this.atLink(this.emoji(text)) + "</li>";
} else {
return "<li>" + this.atLink(this.emoji(text)) + "</li>";
}
};
@ -4048,6 +4048,10 @@
}
div.addClass("markdown-body " + this.classPrefix + "html-preview").append(markdownParsed);
div.find(".task-list-item").each(function () {
$(this).parent().addClass("task-list");
});
var tocContainer = (settings.tocContainer !== "") ? $(settings.tocContainer) : div;

2
editormd.amd.min.js

File diff suppressed because one or more lines are too long

22
editormd.js

@ -2035,6 +2035,10 @@
{
previewContainer.html(newMarkdownDoc);
previewContainer.find(".task-list-item").each(function () {
$(this).parent().addClass("task-list");
});
this.previewCodeHighlight();
if (settings.toc)
@ -3653,16 +3657,12 @@
return tag + this.atLink(this.emoji(content)) + "</" + type + ">\n";
};
markedRenderer.listitem = function(text) {
if (settings.taskList && /^\s*\[[x\s]\]\s*/.test(text))
{
text = text.replace(/^\s*\[\s\]\s*/, "<input type=\"checkbox\" class=\"task-list-item-checkbox\" /> ")
.replace(/^\s*\[x\]\s*/, "<input type=\"checkbox\" class=\"task-list-item-checkbox\" checked disabled /> ");
markedRenderer.listitem = function(text, task) {
if (settings.taskList && task) {
text = text.replace("<input ", "<input class='task-list-item-checkbox' ");
return "<li style=\"list-style: none;\">" + this.atLink(this.emoji(text)) + "</li>";
}
else
{
return "<li class=\"task-list-item\">" + this.atLink(this.emoji(text)) + "</li>";
} else {
return "<li>" + this.atLink(this.emoji(text)) + "</li>";
}
};
@ -3978,6 +3978,10 @@
}
div.addClass("markdown-body " + this.classPrefix + "html-preview").append(markdownParsed);
div.find(".task-list-item").each(function () {
$(this).parent().addClass("task-list");
});
var tocContainer = (settings.tocContainer !== "") ? $(settings.tocContainer) : div;

2
editormd.min.js

File diff suppressed because one or more lines are too long

5
examples/task-lists.html

@ -22,13 +22,13 @@
### Examples
- [x] @mentions, #refs, [links](), **formatting**, and <del>tags</del> supported;
- [x] list syntax required (any unordered or ordered list supported);
- [x] list syntax required (any unordered or ordered list supported); :heart: :blush:
- [x] this is a complete item;
- [ ] this is an incomplete item [test link](#);
- [ ] this is an incomplete item;
- [ ] this is an incomplete item [test link](#);
- [ ] this is an incomplete item [test link](#);
- [x] list syntax required (any unordered or ordered list supported);
- [x] list syntax required (any unordered or ordered list supported); :smile:
- [x] this is a complete item;
- [ ] this is an incomplete item [test link](#);
- [ ] this is an incomplete item;
@ -53,6 +53,7 @@
testEditor = editormd("test-editormd", {
width : "90%",
height : 720,
emoji : true, // enable for test
taskList : true,
path : '../lib/',
htmlDebode : true,

2
examples/use-zepto.html

@ -59,7 +59,7 @@
htmlDecode : "style,script,iframe|on*", // 开启 HTML 标签解析,为了安全性,默认不开启
emoji : true,
taskList : true,
tocm : true, // Using [TOCM]
tocm : true, // Using [TOCM]
tex : true, // 开启科学公式 TeX 语言支持,默认关闭
//previewCodeHighlight : false, // 关闭预览窗口的代码高亮,默认开启
flowChart : true,

2
lib/codemirror/addons.min.js

File diff suppressed because one or more lines are too long

22
src/editormd.js

@ -2023,6 +2023,10 @@
{
previewContainer.html(newMarkdownDoc);
previewContainer.find(".task-list-item").each(function () {
$(this).parent().addClass("task-list");
});
this.previewCodeHighlight();
if (settings.toc)
@ -3641,16 +3645,12 @@
return tag + this.atLink(this.emoji(content)) + "</" + type + ">\n";
};
markedRenderer.listitem = function(text) {
if (settings.taskList && /^\s*\[[x\s]\]\s*/.test(text))
{
text = text.replace(/^\s*\[\s\]\s*/, "<input type=\"checkbox\" class=\"task-list-item-checkbox\" /> ")
.replace(/^\s*\[x\]\s*/, "<input type=\"checkbox\" class=\"task-list-item-checkbox\" checked disabled /> ");
markedRenderer.listitem = function(text, task) {
if (settings.taskList && task) {
text = text.replace("<input ", "<input class='task-list-item-checkbox' ");
return "<li style=\"list-style: none;\">" + this.atLink(this.emoji(text)) + "</li>";
}
else
{
return "<li class=\"task-list-item\">" + this.atLink(this.emoji(text)) + "</li>";
} else {
return "<li>" + this.atLink(this.emoji(text)) + "</li>";
}
};
@ -3966,6 +3966,10 @@
}
div.addClass("markdown-body " + this.classPrefix + "html-preview").append(markdownParsed);
div.find(".task-list-item").each(function () {
$(this).parent().addClass("task-list");
});
var tocContainer = (settings.tocContainer !== "") ? $(settings.tocContainer) : div;

Loading…
Cancel
Save