Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

Commit

Permalink
execute plugin can now contain optional params / dialogs can be remov…
Browse files Browse the repository at this point in the history
…ed on close
  • Loading branch information
eugene-f02 committed Sep 9, 2022
1 parent 0de9bd3 commit 3c67f5c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
14 changes: 8 additions & 6 deletions editormd.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* Editor.md
*
* @file editormd.js
* @version v1.7.9
* @version v1.7.10
* @description Open source online markdown editor.
* @license MIT License
* @author Pandao
* {@link https://github.com/pandao/editor.md}
* @updateTime 2022-07-25
* @updateTime 2022-09-09
*/

;(function(factory) {
Expand Down Expand Up @@ -59,7 +59,7 @@
};

editormd.title = editormd.$name = "Editor.md";
editormd.version = "1.7.9";
editormd.version = "1.7.10";
editormd.homePage = "https://pandao.github.io/editor.md/";
editormd.classPrefix = "editormd-";

Expand Down Expand Up @@ -2655,7 +2655,7 @@
* @returns {editormd} 返回editormd的实例对象
*/

executePlugin : function(name, path, customPlugin = false) {
executePlugin : function(name, path, customPlugin = false, optionalParams= {}) {
var _this = this;
var cm = this.cm;
var settings = this.settings;
Expand All @@ -2680,12 +2680,12 @@
{
editormd.loadPlugin(path, function() {
editormd.loadPlugins[name] = _this[name];
_this[name](cm);
_this[name](cm, optionalParams);
}, "head", (customPlugin ? _this.author_ide_version : editormd.version) );
}
else
{
$.proxy(editormd.loadPlugins[name], this)(cm);
$.proxy(editormd.loadPlugins[name], this)(cm, optionalParams);
}

return this;
Expand Down Expand Up @@ -4108,6 +4108,7 @@
backgroundColor : "#fff",
opacity : 0.1
},
removeDialogOnClose: false,
lockScreen : true,
footer : true,
buttons : false
Expand Down Expand Up @@ -4208,6 +4209,7 @@

dialog.find("." + classPrefix + "dialog-close").bind(mouseOrTouch("click", "touchend"), function() {
dialog.hide().lockScreen(false).hideMask();
if (options.removeDialogOnClose) dialog.remove()
});

if (typeof options.buttons === "object")
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ibm-skills-network/editor.md",
"version": "1.7.9",
"version": "1.7.10",
"description": "Open source online markdown editor.",
"directories": {
"doc": "docs",
Expand Down
10 changes: 6 additions & 4 deletions src/editormd.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
};

editormd.title = editormd.$name = "Editor.md";
editormd.version = "1.7.9";
editormd.version = "1.7.10";
editormd.homePage = "https://pandao.github.io/editor.md/";
editormd.classPrefix = "editormd-";

Expand Down Expand Up @@ -2643,7 +2643,7 @@
* @returns {editormd} 返回editormd的实例对象
*/

executePlugin : function(name, path, customPlugin = false) {
executePlugin : function(name, path, customPlugin = false, optionalParams= {}) {
var _this = this;
var cm = this.cm;
var settings = this.settings;
Expand All @@ -2668,12 +2668,12 @@
{
editormd.loadPlugin(path, function() {
editormd.loadPlugins[name] = _this[name];
_this[name](cm);
_this[name](cm, optionalParams);
}, "head", (customPlugin ? _this.author_ide_version : editormd.version) );
}
else
{
$.proxy(editormd.loadPlugins[name], this)(cm);
$.proxy(editormd.loadPlugins[name], this)(cm, optionalParams);
}

return this;
Expand Down Expand Up @@ -4096,6 +4096,7 @@
backgroundColor : "#fff",
opacity : 0.1
},
removeDialogOnClose: false,
lockScreen : true,
footer : true,
buttons : false
Expand Down Expand Up @@ -4196,6 +4197,7 @@

dialog.find("." + classPrefix + "dialog-close").bind(mouseOrTouch("click", "touchend"), function() {
dialog.hide().lockScreen(false).hideMask();
if (options.removeDialogOnClose) dialog.remove()
});

if (typeof options.buttons === "object")
Expand Down

0 comments on commit 3c67f5c

Please sign in to comment.