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

Commit 3c67f5c

Browse files
committed
execute plugin can now contain optional params / dialogs can be removed on close
1 parent 0de9bd3 commit 3c67f5c

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

editormd.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
* Editor.md
33
*
44
* @file editormd.js
5-
* @version v1.7.9
5+
* @version v1.7.10
66
* @description Open source online markdown editor.
77
* @license MIT License
88
* @author Pandao
99
* {@link https://github.com/pandao/editor.md}
10-
* @updateTime 2022-07-25
10+
* @updateTime 2022-09-09
1111
*/
1212

1313
;(function(factory) {
@@ -59,7 +59,7 @@
5959
};
6060

6161
editormd.title = editormd.$name = "Editor.md";
62-
editormd.version = "1.7.9";
62+
editormd.version = "1.7.10";
6363
editormd.homePage = "https://pandao.github.io/editor.md/";
6464
editormd.classPrefix = "editormd-";
6565

@@ -2655,7 +2655,7 @@
26552655
* @returns {editormd} 返回editormd的实例对象
26562656
*/
26572657

2658-
executePlugin : function(name, path, customPlugin = false) {
2658+
executePlugin : function(name, path, customPlugin = false, optionalParams= {}) {
26592659
var _this = this;
26602660
var cm = this.cm;
26612661
var settings = this.settings;
@@ -2680,12 +2680,12 @@
26802680
{
26812681
editormd.loadPlugin(path, function() {
26822682
editormd.loadPlugins[name] = _this[name];
2683-
_this[name](cm);
2683+
_this[name](cm, optionalParams);
26842684
}, "head", (customPlugin ? _this.author_ide_version : editormd.version) );
26852685
}
26862686
else
26872687
{
2688-
$.proxy(editormd.loadPlugins[name], this)(cm);
2688+
$.proxy(editormd.loadPlugins[name], this)(cm, optionalParams);
26892689
}
26902690

26912691
return this;
@@ -4108,6 +4108,7 @@
41084108
backgroundColor : "#fff",
41094109
opacity : 0.1
41104110
},
4111+
removeDialogOnClose: false,
41114112
lockScreen : true,
41124113
footer : true,
41134114
buttons : false
@@ -4208,6 +4209,7 @@
42084209

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

42134215
if (typeof options.buttons === "object")

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ibm-skills-network/editor.md",
3-
"version": "1.7.9",
3+
"version": "1.7.10",
44
"description": "Open source online markdown editor.",
55
"directories": {
66
"doc": "docs",

src/editormd.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
};
4848

4949
editormd.title = editormd.$name = "Editor.md";
50-
editormd.version = "1.7.9";
50+
editormd.version = "1.7.10";
5151
editormd.homePage = "https://pandao.github.io/editor.md/";
5252
editormd.classPrefix = "editormd-";
5353

@@ -2643,7 +2643,7 @@
26432643
* @returns {editormd} 返回editormd的实例对象
26442644
*/
26452645

2646-
executePlugin : function(name, path, customPlugin = false) {
2646+
executePlugin : function(name, path, customPlugin = false, optionalParams= {}) {
26472647
var _this = this;
26482648
var cm = this.cm;
26492649
var settings = this.settings;
@@ -2668,12 +2668,12 @@
26682668
{
26692669
editormd.loadPlugin(path, function() {
26702670
editormd.loadPlugins[name] = _this[name];
2671-
_this[name](cm);
2671+
_this[name](cm, optionalParams);
26722672
}, "head", (customPlugin ? _this.author_ide_version : editormd.version) );
26732673
}
26742674
else
26752675
{
2676-
$.proxy(editormd.loadPlugins[name], this)(cm);
2676+
$.proxy(editormd.loadPlugins[name], this)(cm, optionalParams);
26772677
}
26782678

26792679
return this;
@@ -4096,6 +4096,7 @@
40964096
backgroundColor : "#fff",
40974097
opacity : 0.1
40984098
},
4099+
removeDialogOnClose: false,
40994100
lockScreen : true,
41004101
footer : true,
41014102
buttons : false
@@ -4196,6 +4197,7 @@
41964197

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

42014203
if (typeof options.buttons === "object")

0 commit comments

Comments
 (0)