Replace SimpleMDE with EasyMDE fork

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-12-17 14:06:53 +01:00
parent bd12f33e12
commit 3b9dcd8085
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
5 changed files with 34 additions and 36 deletions

7
css/easymde.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

7
js/easymde.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -17,47 +17,53 @@ function MDEWrapper(textarea, enableButton, disableButton) {
var wrapper = this; var wrapper = this;
if (this.enableButton) { if (this.enableButton) {
this.enableButton.on('click', function() {wrapper.enable()}); this.enableButton.on("click", function () {
wrapper.enable();
});
} }
if (this.disableButton) { if (this.disableButton) {
this.disableButton.on('click', function() {wrapper.disable()}); this.disableButton.on("click", function () {
wrapper.disable();
});
} }
} }
MDEWrapper.prototype.enable = function() { MDEWrapper.prototype.enable = function () {
var wrapper = this; var wrapper = this;
if (this.simplemde == null) { if (this.simplemde == null) {
this.simplemde = new SimpleMDE({ this.simplemde = new EasyMDE({
element: wrapper.element, element: wrapper.element,
forceSync: true, forceSync: true,
status: true, status: true,
previewRender: myPreviewRender, previewRender: myPreviewRender,
spellChecker: false, spellChecker: false,
promptURLs: true, promptURLs: true,
autoDownloadFontAwesome: false minHeight: "200px",
maxHeight: "300px",
autoDownloadFontAwesome: false,
}); });
if (this.enableButton) { if (this.enableButton) {
this.enableButton.addClass('active'); this.enableButton.addClass("active");
} }
if (this.disableButton) { if (this.disableButton) {
this.disableButton.removeClass('active'); this.disableButton.removeClass("active");
} }
} }
} };
MDEWrapper.prototype.disable = function() { MDEWrapper.prototype.disable = function () {
if (this.simplemde != null) { if (this.simplemde != null) {
this.simplemde.toTextArea(); this.simplemde.toTextArea();
this.simplemde = null; this.simplemde = null;
if (this.disableButton) { if (this.disableButton) {
this.disableButton.addClass('active'); this.disableButton.addClass("active");
} }
if (this.enableButton) { if (this.enableButton) {
this.enableButton.removeClass('active'); this.enableButton.removeClass("active");
} }
} }
} };
MDEWrapper.prototype.isEnabled = function() { MDEWrapper.prototype.isEnabled = function () {
return this.simplemde != null; return this.simplemde != null;
} };

15
js/simplemde.min.js vendored

File diff suppressed because one or more lines are too long