mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-17 15:04:28 -06:00
parent
df3d6511c8
commit
890c72589e
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fix cursor displayed position on activity ([#183]).
|
- Fix cursor displayed position on activity ([#183]).
|
||||||
|
- Checkboxes always have bullets in front of them ([#136]).
|
||||||
|
|
||||||
## [2.10.1] - 2020-04-06
|
## [2.10.1] - 2020-04-06
|
||||||
### Fixed
|
### Fixed
|
||||||
@ -148,7 +149,9 @@ Project forked from [SimpleMDE](https://github.com/sparksuite/simplemde-markdown
|
|||||||
- Cursor not always showing in "text" mode over the edit field
|
- Cursor not always showing in "text" mode over the edit field
|
||||||
|
|
||||||
<!-- Linked issues -->
|
<!-- Linked issues -->
|
||||||
|
[#183]: https://github.com/Ionaru/easy-markdown-editor/issues/183
|
||||||
[#178]: https://github.com/Ionaru/easy-markdown-editor/issues/178
|
[#178]: https://github.com/Ionaru/easy-markdown-editor/issues/178
|
||||||
|
[#136]: https://github.com/Ionaru/easy-markdown-editor/issues/136
|
||||||
[#126]: https://github.com/Ionaru/easy-markdown-editor/issues/126
|
[#126]: https://github.com/Ionaru/easy-markdown-editor/issues/126
|
||||||
[#99]: https://github.com/Ionaru/easy-markdown-editor/issues/99
|
[#99]: https://github.com/Ionaru/easy-markdown-editor/issues/99
|
||||||
[#45]: https://github.com/Ionaru/easy-markdown-editor/issues/45
|
[#45]: https://github.com/Ionaru/easy-markdown-editor/issues/45
|
||||||
|
@ -17,4 +17,4 @@
|
|||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -97,6 +97,33 @@ function addAnchorTargetBlank(htmlText) {
|
|||||||
return htmlText;
|
return htmlText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify HTML to remove the list-style when rendering checkboxes.
|
||||||
|
* @param {string} htmlText - HTML to be modified.
|
||||||
|
* @return {string} The modified HTML text.
|
||||||
|
*/
|
||||||
|
function removeListStyleWhenCheckbox(htmlText) {
|
||||||
|
|
||||||
|
var parser = new DOMParser();
|
||||||
|
var htmlDoc = parser.parseFromString(htmlText, 'text/html');
|
||||||
|
var listItems = htmlDoc.getElementsByTagName('li');
|
||||||
|
|
||||||
|
for (var i = 0; i < listItems.length; i++) {
|
||||||
|
var listItem = listItems[i];
|
||||||
|
|
||||||
|
for (var j = 0; j < listItem.children.length; j++) {
|
||||||
|
var listItemChild = listItem.children[j];
|
||||||
|
|
||||||
|
if (listItemChild instanceof HTMLInputElement && listItemChild.type === 'checkbox') {
|
||||||
|
// From Github: margin: 0 .2em .25em -1.6em;
|
||||||
|
listItem.style.marginLeft = '-1.5em';
|
||||||
|
listItem.style.listStyleType = 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return htmlDoc.documentElement.innerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fix shortcut. Mac use Command, others use Ctrl.
|
* Fix shortcut. Mac use Command, others use Ctrl.
|
||||||
@ -1831,6 +1858,9 @@ EasyMDE.prototype.markdown = function (text) {
|
|||||||
// Edit the HTML anchors to add 'target="_blank"' by default.
|
// Edit the HTML anchors to add 'target="_blank"' by default.
|
||||||
htmlText = addAnchorTargetBlank(htmlText);
|
htmlText = addAnchorTargetBlank(htmlText);
|
||||||
|
|
||||||
|
// Remove list-style when rendering checkboxes
|
||||||
|
htmlText = removeListStyleWhenCheckbox(htmlText);
|
||||||
|
|
||||||
return htmlText;
|
return htmlText;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user