mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-09-24 16:40:55 -06:00
Merge branch 'master' into new_translate
This commit is contained in:
commit
63dcda3452
@ -1,5 +1,6 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
|
- '14' # EOL: April 2023
|
||||||
- '12' # EOL: April 2022
|
- '12' # EOL: April 2022
|
||||||
- '11' # EOL: June 2019
|
- '11' # EOL: June 2019
|
||||||
- '10' # EOL: April 2021
|
- '10' # EOL: April 2021
|
||||||
|
11
CHANGELOG.md
11
CHANGELOG.md
@ -4,7 +4,14 @@ All notable changes to easymde will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
<!--## [Unreleased]-->
|
## [Unreleased]
|
||||||
|
### Added
|
||||||
|
- Support for Node.js 14.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- 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
|
||||||
- Typescript error when entering certain strings for toolbar buttons ([#178]).
|
- Typescript error when entering certain strings for toolbar buttons ([#178]).
|
||||||
@ -145,7 +152,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>
|
||||||
|
842
package-lock.json
generated
842
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -19,13 +19,13 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Jeroen Akkerman",
|
"author": "Jeroen Akkerman",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"codemirror": "^5.52.2",
|
"codemirror": "^5.53.2",
|
||||||
"codemirror-spell-checker": "1.1.2",
|
"codemirror-spell-checker": "1.1.2",
|
||||||
"marked": "^0.8.2"
|
"marked": "^1.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/codemirror": "0.0.89",
|
"@types/codemirror": "0.0.91",
|
||||||
"@types/marked": "^0.7.2",
|
"@types/marked": "^0.7.4",
|
||||||
"browserify": "^16.5.1",
|
"browserify": "^16.5.1",
|
||||||
"gulp": "^4.0.2",
|
"gulp": "^4.0.2",
|
||||||
"gulp-clean-css": "^4.2.0",
|
"gulp-clean-css": "^4.2.0",
|
||||||
|
@ -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.
|
||||||
@ -306,12 +333,10 @@ function toggleFullScreen(editor) {
|
|||||||
|
|
||||||
|
|
||||||
// Update toolbar class
|
// Update toolbar class
|
||||||
var wrap = cm.getWrapperElement();
|
if (!/fullscreen/.test(editor.toolbar_div.className)) {
|
||||||
|
editor.toolbar_div.className += ' fullscreen';
|
||||||
if (!/fullscreen/.test(wrap.previousSibling.className)) {
|
|
||||||
wrap.previousSibling.className += ' fullscreen';
|
|
||||||
} else {
|
} else {
|
||||||
wrap.previousSibling.className = wrap.previousSibling.className.replace(/\s*fullscreen\b/, '');
|
editor.toolbar_div.className = editor.toolbar_div.className.replace(/\s*fullscreen\b/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -859,7 +884,7 @@ function toggleSideBySide(editor) {
|
|||||||
/\s*editor-preview-active\s*/g, ''
|
/\s*editor-preview-active\s*/g, ''
|
||||||
);
|
);
|
||||||
var toolbar = editor.toolbarElements.preview;
|
var toolbar = editor.toolbarElements.preview;
|
||||||
var toolbar_div = wrapper.previousSibling;
|
var toolbar_div = editor.toolbar_div;
|
||||||
toolbar.className = toolbar.className.replace(/\s*active\s*/g, '');
|
toolbar.className = toolbar.className.replace(/\s*active\s*/g, '');
|
||||||
toolbar_div.className = toolbar_div.className.replace(/\s*disabled-for-preview*/g, '');
|
toolbar_div.className = toolbar_div.className.replace(/\s*disabled-for-preview*/g, '');
|
||||||
}
|
}
|
||||||
@ -896,7 +921,7 @@ function toggleSideBySide(editor) {
|
|||||||
function togglePreview(editor) {
|
function togglePreview(editor) {
|
||||||
var cm = editor.codemirror;
|
var cm = editor.codemirror;
|
||||||
var wrapper = cm.getWrapperElement();
|
var wrapper = cm.getWrapperElement();
|
||||||
var toolbar_div = wrapper.previousSibling;
|
var toolbar_div = editor.toolbar_div;
|
||||||
var toolbar = editor.options.toolbar ? editor.toolbarElements.preview : false;
|
var toolbar = editor.options.toolbar ? editor.toolbarElements.preview : false;
|
||||||
var preview = wrapper.lastChild;
|
var preview = wrapper.lastChild;
|
||||||
if (!preview || !/editor-preview-full/.test(preview.className)) {
|
if (!preview || !/editor-preview-full/.test(preview.className)) {
|
||||||
@ -1855,6 +1880,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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -2358,6 +2386,7 @@ EasyMDE.prototype.createToolbar = function (items) {
|
|||||||
})(items[i]);
|
})(items[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.toolbar_div = bar;
|
||||||
self.toolbarElements = toolbarData;
|
self.toolbarElements = toolbarData;
|
||||||
|
|
||||||
var cm = this.codemirror;
|
var cm = this.codemirror;
|
||||||
@ -2438,7 +2467,7 @@ EasyMDE.prototype.createStatusbar = function (status) {
|
|||||||
defaultValue = function (el) {
|
defaultValue = function (el) {
|
||||||
el.innerHTML = '0:0';
|
el.innerHTML = '0:0';
|
||||||
};
|
};
|
||||||
onUpdate = function (el) {
|
onActivity = function (el) {
|
||||||
var pos = cm.getCursor();
|
var pos = cm.getCursor();
|
||||||
el.innerHTML = pos.line + ':' + pos.ch;
|
el.innerHTML = pos.line + ':' + pos.ch;
|
||||||
};
|
};
|
||||||
@ -2506,6 +2535,14 @@ EasyMDE.prototype.createStatusbar = function (status) {
|
|||||||
};
|
};
|
||||||
}(el, item)));
|
}(el, item)));
|
||||||
}
|
}
|
||||||
|
if (typeof item.onActivity === 'function') {
|
||||||
|
// Create a closure around the span of the current action, then execute the onActivity handler
|
||||||
|
this.codemirror.on('cursorActivity', (function (el, item) {
|
||||||
|
return function () {
|
||||||
|
item.onActivity(el);
|
||||||
|
};
|
||||||
|
}(el, item)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Ensure the onActivity is a function
|
// Ensure the onActivity is a function
|
||||||
|
Loading…
x
Reference in New Issue
Block a user