suneditor 2.44.2 → 2.44.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +20 -20
- package/README.md +1585 -1585
- package/dist/css/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +2 -2
- package/package.json +71 -71
- package/src/assets/css/suneditor-contents.css +556 -556
- package/src/assets/css/suneditor.css +0 -0
- package/src/assets/defaultIcons.js +103 -103
- package/src/lang/Lang.d.ts +143 -143
- package/src/lang/ckb.d.ts +4 -4
- package/src/lang/ckb.js +187 -187
- package/src/lang/da.d.ts +4 -4
- package/src/lang/da.js +191 -191
- package/src/lang/de.d.ts +4 -4
- package/src/lang/de.js +187 -187
- package/src/lang/en.d.ts +4 -4
- package/src/lang/en.js +187 -187
- package/src/lang/es.d.ts +4 -4
- package/src/lang/es.js +187 -187
- package/src/lang/fr.d.ts +4 -4
- package/src/lang/fr.js +188 -188
- package/src/lang/he.d.ts +4 -4
- package/src/lang/he.js +188 -188
- package/src/lang/index.d.ts +22 -21
- package/src/lang/index.js +25 -24
- package/src/lang/it.d.ts +4 -4
- package/src/lang/it.js +188 -188
- package/src/lang/ja.d.ts +4 -4
- package/src/lang/ja.js +187 -187
- package/src/lang/ko.d.ts +4 -4
- package/src/lang/ko.js +187 -187
- package/src/lang/lv.d.ts +4 -4
- package/src/lang/lv.js +187 -187
- package/src/lang/nl.d.ts +4 -4
- package/src/lang/nl.js +187 -187
- package/src/lang/pl.d.ts +4 -4
- package/src/lang/pl.js +187 -187
- package/src/lang/pt_br.d.ts +4 -4
- package/src/lang/pt_br.js +189 -189
- package/src/lang/ro.d.ts +4 -4
- package/src/lang/ro.js +187 -187
- package/src/lang/ru.d.ts +4 -4
- package/src/lang/ru.js +187 -187
- package/src/lang/se.d.ts +4 -4
- package/src/lang/se.js +191 -191
- package/src/lang/ua.d.ts +5 -5
- package/src/lang/ua.js +188 -188
- package/src/lang/ur.d.ts +5 -0
- package/src/lang/ur.js +188 -0
- package/src/lang/zh_cn.d.ts +4 -4
- package/src/lang/zh_cn.js +187 -187
- package/src/lib/constructor.js +1 -2
- package/src/lib/context.d.ts +42 -42
- package/src/lib/context.js +0 -0
- package/src/lib/core.d.ts +1101 -1101
- package/src/lib/core.js +220 -99
- package/src/lib/history.d.ts +48 -48
- package/src/lib/history.js +218 -218
- package/src/lib/util.d.ts +677 -677
- package/src/lib/util.js +38 -12
- package/src/options.d.ts +608 -608
- package/src/plugins/CommandPlugin.d.ts +7 -7
- package/src/plugins/DialogPlugin.d.ts +19 -19
- package/src/plugins/FileBrowserPlugin.d.ts +29 -29
- package/src/plugins/Module.d.ts +14 -14
- package/src/plugins/Plugin.d.ts +41 -41
- package/src/plugins/SubmenuPlugin.d.ts +7 -7
- package/src/plugins/command/blockquote.d.ts +4 -4
- package/src/plugins/command/blockquote.js +46 -46
- package/src/plugins/dialog/audio.d.ts +4 -4
- package/src/plugins/dialog/audio.js +556 -554
- package/src/plugins/dialog/image.d.ts +4 -4
- package/src/plugins/dialog/image.js +1122 -1107
- package/src/plugins/dialog/link.d.ts +4 -4
- package/src/plugins/dialog/link.js +223 -223
- package/src/plugins/dialog/math.d.ts +4 -4
- package/src/plugins/dialog/math.js +294 -294
- package/src/plugins/dialog/mention.d.ts +5 -5
- package/src/plugins/dialog/mention.js +242 -242
- package/src/plugins/dialog/video.d.ts +4 -4
- package/src/plugins/dialog/video.js +983 -981
- package/src/plugins/fileBrowser/imageGallery.d.ts +4 -4
- package/src/plugins/fileBrowser/imageGallery.js +63 -63
- package/src/plugins/index.d.ts +79 -79
- package/src/plugins/index.js +32 -32
- package/src/plugins/modules/_anchor.js +461 -462
- package/src/plugins/modules/_colorPicker.d.ts +59 -59
- package/src/plugins/modules/_colorPicker.js +0 -0
- package/src/plugins/modules/_notice.d.ts +20 -20
- package/src/plugins/modules/_notice.js +72 -72
- package/src/plugins/modules/_selectMenu.js +118 -118
- package/src/plugins/modules/component.d.ts +24 -24
- package/src/plugins/modules/component.js +82 -82
- package/src/plugins/modules/dialog.d.ts +27 -27
- package/src/plugins/modules/dialog.js +174 -174
- package/src/plugins/modules/fileBrowser.d.ts +41 -41
- package/src/plugins/modules/fileBrowser.js +373 -373
- package/src/plugins/modules/fileManager.d.ts +66 -66
- package/src/plugins/modules/fileManager.js +325 -324
- package/src/plugins/modules/index.d.ts +10 -10
- package/src/plugins/modules/index.js +8 -8
- package/src/plugins/modules/resizing.d.ts +153 -153
- package/src/plugins/modules/resizing.js +895 -895
- package/src/plugins/submenu/align.d.ts +4 -4
- package/src/plugins/submenu/align.js +160 -160
- package/src/plugins/submenu/font.d.ts +4 -4
- package/src/plugins/submenu/font.js +120 -120
- package/src/plugins/submenu/fontColor.d.ts +4 -4
- package/src/plugins/submenu/fontColor.js +0 -0
- package/src/plugins/submenu/fontSize.d.ts +4 -4
- package/src/plugins/submenu/fontSize.js +112 -112
- package/src/plugins/submenu/formatBlock.d.ts +4 -4
- package/src/plugins/submenu/formatBlock.js +273 -273
- package/src/plugins/submenu/hiliteColor.d.ts +4 -4
- package/src/plugins/submenu/hiliteColor.js +0 -0
- package/src/plugins/submenu/horizontalRule.d.ts +4 -4
- package/src/plugins/submenu/horizontalRule.js +98 -98
- package/src/plugins/submenu/lineHeight.d.ts +4 -4
- package/src/plugins/submenu/lineHeight.js +104 -104
- package/src/plugins/submenu/list.d.ts +4 -4
- package/src/plugins/submenu/list.js +456 -455
- package/src/plugins/submenu/paragraphStyle.d.ts +4 -4
- package/src/plugins/submenu/paragraphStyle.js +135 -135
- package/src/plugins/submenu/table.d.ts +4 -4
- package/src/plugins/submenu/template.d.ts +4 -4
- package/src/plugins/submenu/template.js +71 -71
- package/src/plugins/submenu/textStyle.d.ts +4 -4
- package/src/plugins/submenu/textStyle.js +167 -167
- package/src/suneditor.d.ts +9 -9
- package/src/suneditor.js +75 -75
- package/src/suneditor_build.js +17 -17
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* wysiwyg web editor
|
|
3
|
-
*
|
|
4
|
-
* suneditor.js
|
|
5
|
-
* Copyright 2017 JiHong Lee.
|
|
6
|
-
* MIT license.
|
|
7
|
-
*/
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
(function (global, factory) {
|
|
11
|
-
if (typeof module === 'object' && typeof module.exports === 'object') {
|
|
12
|
-
module.exports = global.document ?
|
|
13
|
-
factory(global, true) :
|
|
14
|
-
function (w) {
|
|
15
|
-
if (!w.document) {
|
|
16
|
-
throw new Error('SUNEDITOR_MODULES a window with a document');
|
|
17
|
-
}
|
|
18
|
-
return factory(w);
|
|
19
|
-
};
|
|
20
|
-
} else {
|
|
21
|
-
factory(global);
|
|
22
|
-
}
|
|
23
|
-
}(typeof window !== 'undefined' ? window : this, function (window, noGlobal) {
|
|
24
|
-
const component = {
|
|
25
|
-
name: 'component',
|
|
26
|
-
/**
|
|
27
|
-
* @description Create a container for the resizing component and insert the element.
|
|
28
|
-
* @param {Element} cover Cover element (FIGURE)
|
|
29
|
-
* @param {String} className Class name of container (fixed: se-component)
|
|
30
|
-
* @returns {Element} Created container element
|
|
31
|
-
*/
|
|
32
|
-
set_container: function (cover, className) {
|
|
33
|
-
const container = this.util.createElement('DIV');
|
|
34
|
-
container.className = 'se-component ' + className;
|
|
35
|
-
container.setAttribute('contenteditable', false);
|
|
36
|
-
container.appendChild(cover);
|
|
37
|
-
|
|
38
|
-
return container;
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @description Cover the target element with a FIGURE element.
|
|
43
|
-
* @param {Element} element Target element
|
|
44
|
-
*/
|
|
45
|
-
set_cover: function (element) {
|
|
46
|
-
const cover = this.util.createElement('FIGURE');
|
|
47
|
-
cover.appendChild(element);
|
|
48
|
-
|
|
49
|
-
return cover;
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* @description Return HTML string of caption(FIGCAPTION) element
|
|
54
|
-
* @returns {String}
|
|
55
|
-
*/
|
|
56
|
-
create_caption: function () {
|
|
57
|
-
const caption = this.util.createElement('FIGCAPTION');
|
|
58
|
-
caption.setAttribute('contenteditable', true);
|
|
59
|
-
caption.innerHTML = '<div>' + this.lang.dialogBox.caption + '</div>';
|
|
60
|
-
return caption;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
if (typeof noGlobal === typeof undefined) {
|
|
65
|
-
if (!window.SUNEDITOR_MODULES) {
|
|
66
|
-
Object.defineProperty(window, 'SUNEDITOR_MODULES', {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
writable: false,
|
|
69
|
-
configurable: false,
|
|
70
|
-
value: {}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
Object.defineProperty(window.SUNEDITOR_MODULES, 'component', {
|
|
75
|
-
enumerable: true,
|
|
76
|
-
writable: false,
|
|
77
|
-
configurable: false,
|
|
78
|
-
value: component
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return component;
|
|
1
|
+
/*
|
|
2
|
+
* wysiwyg web editor
|
|
3
|
+
*
|
|
4
|
+
* suneditor.js
|
|
5
|
+
* Copyright 2017 JiHong Lee.
|
|
6
|
+
* MIT license.
|
|
7
|
+
*/
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
(function (global, factory) {
|
|
11
|
+
if (typeof module === 'object' && typeof module.exports === 'object') {
|
|
12
|
+
module.exports = global.document ?
|
|
13
|
+
factory(global, true) :
|
|
14
|
+
function (w) {
|
|
15
|
+
if (!w.document) {
|
|
16
|
+
throw new Error('SUNEDITOR_MODULES a window with a document');
|
|
17
|
+
}
|
|
18
|
+
return factory(w);
|
|
19
|
+
};
|
|
20
|
+
} else {
|
|
21
|
+
factory(global);
|
|
22
|
+
}
|
|
23
|
+
}(typeof window !== 'undefined' ? window : this, function (window, noGlobal) {
|
|
24
|
+
const component = {
|
|
25
|
+
name: 'component',
|
|
26
|
+
/**
|
|
27
|
+
* @description Create a container for the resizing component and insert the element.
|
|
28
|
+
* @param {Element} cover Cover element (FIGURE)
|
|
29
|
+
* @param {String} className Class name of container (fixed: se-component)
|
|
30
|
+
* @returns {Element} Created container element
|
|
31
|
+
*/
|
|
32
|
+
set_container: function (cover, className) {
|
|
33
|
+
const container = this.util.createElement('DIV');
|
|
34
|
+
container.className = 'se-component ' + className;
|
|
35
|
+
container.setAttribute('contenteditable', false);
|
|
36
|
+
container.appendChild(cover);
|
|
37
|
+
|
|
38
|
+
return container;
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @description Cover the target element with a FIGURE element.
|
|
43
|
+
* @param {Element} element Target element
|
|
44
|
+
*/
|
|
45
|
+
set_cover: function (element) {
|
|
46
|
+
const cover = this.util.createElement('FIGURE');
|
|
47
|
+
cover.appendChild(element);
|
|
48
|
+
|
|
49
|
+
return cover;
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @description Return HTML string of caption(FIGCAPTION) element
|
|
54
|
+
* @returns {String}
|
|
55
|
+
*/
|
|
56
|
+
create_caption: function () {
|
|
57
|
+
const caption = this.util.createElement('FIGCAPTION');
|
|
58
|
+
caption.setAttribute('contenteditable', true);
|
|
59
|
+
caption.innerHTML = '<div>' + this.lang.dialogBox.caption + '</div>';
|
|
60
|
+
return caption;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
if (typeof noGlobal === typeof undefined) {
|
|
65
|
+
if (!window.SUNEDITOR_MODULES) {
|
|
66
|
+
Object.defineProperty(window, 'SUNEDITOR_MODULES', {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
writable: false,
|
|
69
|
+
configurable: false,
|
|
70
|
+
value: {}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
Object.defineProperty(window.SUNEDITOR_MODULES, 'component', {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
writable: false,
|
|
77
|
+
configurable: false,
|
|
78
|
+
value: component
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return component;
|
|
83
83
|
}));
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { Module } from '../Module';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @description This is a required module of dialog plugin.
|
|
5
|
-
*/
|
|
6
|
-
declare interface dialog extends Module {
|
|
7
|
-
/**
|
|
8
|
-
* @description Open a Dialog plugin
|
|
9
|
-
* @param kind Dialog plugin name
|
|
10
|
-
* @param update Whether it will open for update ('image' === this.currentControllerName)
|
|
11
|
-
* @example this.plugins.dialog.open.call(this, 'image', 'image' === this.currentControllerName);
|
|
12
|
-
*/
|
|
13
|
-
open(kind: string, update: boolean): void;
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @description Called after the submenu has been rendered
|
|
17
|
-
*/
|
|
18
|
-
on?: () => void;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @description Close a Dialog plugin
|
|
22
|
-
* The plugin's "init" method is called.
|
|
23
|
-
* @example this.plugins.dialog.close.call(this);
|
|
24
|
-
*/
|
|
25
|
-
close(): void;
|
|
26
|
-
}
|
|
27
|
-
|
|
1
|
+
import { Module } from '../Module';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description This is a required module of dialog plugin.
|
|
5
|
+
*/
|
|
6
|
+
declare interface dialog extends Module {
|
|
7
|
+
/**
|
|
8
|
+
* @description Open a Dialog plugin
|
|
9
|
+
* @param kind Dialog plugin name
|
|
10
|
+
* @param update Whether it will open for update ('image' === this.currentControllerName)
|
|
11
|
+
* @example this.plugins.dialog.open.call(this, 'image', 'image' === this.currentControllerName);
|
|
12
|
+
*/
|
|
13
|
+
open(kind: string, update: boolean): void;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @description Called after the submenu has been rendered
|
|
17
|
+
*/
|
|
18
|
+
on?: () => void;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @description Close a Dialog plugin
|
|
22
|
+
* The plugin's "init" method is called.
|
|
23
|
+
* @example this.plugins.dialog.close.call(this);
|
|
24
|
+
*/
|
|
25
|
+
close(): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
28
|
export default dialog;
|
|
@@ -1,175 +1,175 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* wysiwyg web editor
|
|
3
|
-
*
|
|
4
|
-
* suneditor.js
|
|
5
|
-
* Copyright 2017 JiHong Lee.
|
|
6
|
-
* MIT license.
|
|
7
|
-
*/
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
(function (global, factory) {
|
|
11
|
-
if (typeof module === 'object' && typeof module.exports === 'object') {
|
|
12
|
-
module.exports = global.document ?
|
|
13
|
-
factory(global, true) :
|
|
14
|
-
function (w) {
|
|
15
|
-
if (!w.document) {
|
|
16
|
-
throw new Error('SUNEDITOR_MODULES a window with a document');
|
|
17
|
-
}
|
|
18
|
-
return factory(w);
|
|
19
|
-
};
|
|
20
|
-
} else {
|
|
21
|
-
factory(global);
|
|
22
|
-
}
|
|
23
|
-
}(typeof window !== 'undefined' ? window : this, function (window, noGlobal) {
|
|
24
|
-
const dialog = {
|
|
25
|
-
name: 'dialog',
|
|
26
|
-
/**
|
|
27
|
-
* @description Constructor
|
|
28
|
-
* @param {Object} core Core object
|
|
29
|
-
*/
|
|
30
|
-
add: function (core) {
|
|
31
|
-
const context = core.context;
|
|
32
|
-
context.dialog = {
|
|
33
|
-
kind: '',
|
|
34
|
-
updateModal: false,
|
|
35
|
-
_closeSignal: false
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
/** dialog */
|
|
39
|
-
let dialog_div = core.util.createElement('DIV');
|
|
40
|
-
dialog_div.className = 'se-dialog sun-editor-common';
|
|
41
|
-
|
|
42
|
-
let dialog_back = core.util.createElement('DIV');
|
|
43
|
-
dialog_back.className = 'se-dialog-back';
|
|
44
|
-
dialog_back.style.display = 'none';
|
|
45
|
-
|
|
46
|
-
let dialog_area = core.util.createElement('DIV');
|
|
47
|
-
dialog_area.className = 'se-dialog-inner';
|
|
48
|
-
dialog_area.style.display = 'none';
|
|
49
|
-
|
|
50
|
-
dialog_div.appendChild(dialog_back);
|
|
51
|
-
dialog_div.appendChild(dialog_area);
|
|
52
|
-
|
|
53
|
-
context.dialog.modalArea = dialog_div;
|
|
54
|
-
context.dialog.back = dialog_back;
|
|
55
|
-
context.dialog.modal = dialog_area;
|
|
56
|
-
|
|
57
|
-
/** add event listeners */
|
|
58
|
-
context.dialog.modal.addEventListener('mousedown', this._onMouseDown_dialog.bind(core));
|
|
59
|
-
context.dialog.modal.addEventListener('click', this._onClick_dialog.bind(core));
|
|
60
|
-
|
|
61
|
-
/** append html */
|
|
62
|
-
context.element.relative.appendChild(dialog_div);
|
|
63
|
-
|
|
64
|
-
/** empty memory */
|
|
65
|
-
dialog_div = null, dialog_back = null, dialog_area = null;
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @description Event to control the behavior of closing the dialog
|
|
70
|
-
* @param {MouseEvent} e Event object
|
|
71
|
-
* @private
|
|
72
|
-
*/
|
|
73
|
-
_onMouseDown_dialog: function (e) {
|
|
74
|
-
if (/se-dialog-inner/.test(e.target.className)) {
|
|
75
|
-
this.context.dialog._closeSignal = true;
|
|
76
|
-
} else {
|
|
77
|
-
this.context.dialog._closeSignal = false;
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @description Event to close the window when the outside area of the dialog or close button is click
|
|
83
|
-
* @param {MouseEvent} e Event object
|
|
84
|
-
* @private
|
|
85
|
-
*/
|
|
86
|
-
_onClick_dialog: function (e) {
|
|
87
|
-
if (/close/.test(e.target.getAttribute('data-command')) || this.context.dialog._closeSignal) {
|
|
88
|
-
this.plugins.dialog.close.call(this);
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* @description Open a Dialog plugin
|
|
94
|
-
* @param {String} kind Dialog plugin name
|
|
95
|
-
* @param {Boolean} update Whether it will open for update ('image' === this.currentControllerName)
|
|
96
|
-
*/
|
|
97
|
-
open: function (kind, update) {
|
|
98
|
-
if (this.modalForm) return false;
|
|
99
|
-
if (this.plugins.dialog._bindClose) {
|
|
100
|
-
this._d.removeEventListener('keydown', this.plugins.dialog._bindClose);
|
|
101
|
-
this.plugins.dialog._bindClose = null;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
this.plugins.dialog._bindClose = function (e) {
|
|
105
|
-
if (!/27/.test(e.keyCode)) return;
|
|
106
|
-
this.plugins.dialog.close.call(this);
|
|
107
|
-
}.bind(this);
|
|
108
|
-
this._d.addEventListener('keydown', this.plugins.dialog._bindClose);
|
|
109
|
-
|
|
110
|
-
this.context.dialog.updateModal = update;
|
|
111
|
-
|
|
112
|
-
if (this.options.popupDisplay === 'full') {
|
|
113
|
-
this.context.dialog.modalArea.style.position = 'fixed';
|
|
114
|
-
} else {
|
|
115
|
-
this.context.dialog.modalArea.style.position = 'absolute';
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
this.context.dialog.kind = kind;
|
|
119
|
-
this.modalForm = this.context[kind].modal;
|
|
120
|
-
const focusElement = this.context[kind].focusElement;
|
|
121
|
-
|
|
122
|
-
if (typeof this.plugins[kind].on === 'function') this.plugins[kind].on.call(this, update);
|
|
123
|
-
|
|
124
|
-
this.context.dialog.modalArea.style.display = 'block';
|
|
125
|
-
this.context.dialog.back.style.display = 'block';
|
|
126
|
-
this.context.dialog.modal.style.display = 'block';
|
|
127
|
-
this.modalForm.style.display = 'block';
|
|
128
|
-
|
|
129
|
-
if (focusElement) focusElement.focus();
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
_bindClose: null,
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* @description Close a Dialog plugin
|
|
136
|
-
* The plugin's "init" method is called.
|
|
137
|
-
*/
|
|
138
|
-
close: function () {
|
|
139
|
-
if (this.plugins.dialog._bindClose) {
|
|
140
|
-
this._d.removeEventListener('keydown', this.plugins.dialog._bindClose);
|
|
141
|
-
this.plugins.dialog._bindClose = null;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const kind = this.context.dialog.kind;
|
|
145
|
-
this.modalForm.style.display = 'none';
|
|
146
|
-
this.context.dialog.back.style.display = 'none';
|
|
147
|
-
this.context.dialog.modalArea.style.display = 'none';
|
|
148
|
-
this.context.dialog.updateModal = false;
|
|
149
|
-
if (typeof this.plugins[kind].init === 'function') this.plugins[kind].init.call(this);
|
|
150
|
-
this.context.dialog.kind = '';
|
|
151
|
-
this.modalForm = null;
|
|
152
|
-
this.focus();
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
if (typeof noGlobal === typeof undefined) {
|
|
157
|
-
if (!window.SUNEDITOR_MODULES) {
|
|
158
|
-
Object.defineProperty(window, 'SUNEDITOR_MODULES', {
|
|
159
|
-
enumerable: true,
|
|
160
|
-
writable: false,
|
|
161
|
-
configurable: false,
|
|
162
|
-
value: {}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
Object.defineProperty(window.SUNEDITOR_MODULES, 'dialog', {
|
|
167
|
-
enumerable: true,
|
|
168
|
-
writable: false,
|
|
169
|
-
configurable: false,
|
|
170
|
-
value: dialog
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
return dialog;
|
|
1
|
+
/*
|
|
2
|
+
* wysiwyg web editor
|
|
3
|
+
*
|
|
4
|
+
* suneditor.js
|
|
5
|
+
* Copyright 2017 JiHong Lee.
|
|
6
|
+
* MIT license.
|
|
7
|
+
*/
|
|
8
|
+
'use strict';
|
|
9
|
+
|
|
10
|
+
(function (global, factory) {
|
|
11
|
+
if (typeof module === 'object' && typeof module.exports === 'object') {
|
|
12
|
+
module.exports = global.document ?
|
|
13
|
+
factory(global, true) :
|
|
14
|
+
function (w) {
|
|
15
|
+
if (!w.document) {
|
|
16
|
+
throw new Error('SUNEDITOR_MODULES a window with a document');
|
|
17
|
+
}
|
|
18
|
+
return factory(w);
|
|
19
|
+
};
|
|
20
|
+
} else {
|
|
21
|
+
factory(global);
|
|
22
|
+
}
|
|
23
|
+
}(typeof window !== 'undefined' ? window : this, function (window, noGlobal) {
|
|
24
|
+
const dialog = {
|
|
25
|
+
name: 'dialog',
|
|
26
|
+
/**
|
|
27
|
+
* @description Constructor
|
|
28
|
+
* @param {Object} core Core object
|
|
29
|
+
*/
|
|
30
|
+
add: function (core) {
|
|
31
|
+
const context = core.context;
|
|
32
|
+
context.dialog = {
|
|
33
|
+
kind: '',
|
|
34
|
+
updateModal: false,
|
|
35
|
+
_closeSignal: false
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** dialog */
|
|
39
|
+
let dialog_div = core.util.createElement('DIV');
|
|
40
|
+
dialog_div.className = 'se-dialog sun-editor-common';
|
|
41
|
+
|
|
42
|
+
let dialog_back = core.util.createElement('DIV');
|
|
43
|
+
dialog_back.className = 'se-dialog-back';
|
|
44
|
+
dialog_back.style.display = 'none';
|
|
45
|
+
|
|
46
|
+
let dialog_area = core.util.createElement('DIV');
|
|
47
|
+
dialog_area.className = 'se-dialog-inner';
|
|
48
|
+
dialog_area.style.display = 'none';
|
|
49
|
+
|
|
50
|
+
dialog_div.appendChild(dialog_back);
|
|
51
|
+
dialog_div.appendChild(dialog_area);
|
|
52
|
+
|
|
53
|
+
context.dialog.modalArea = dialog_div;
|
|
54
|
+
context.dialog.back = dialog_back;
|
|
55
|
+
context.dialog.modal = dialog_area;
|
|
56
|
+
|
|
57
|
+
/** add event listeners */
|
|
58
|
+
context.dialog.modal.addEventListener('mousedown', this._onMouseDown_dialog.bind(core));
|
|
59
|
+
context.dialog.modal.addEventListener('click', this._onClick_dialog.bind(core));
|
|
60
|
+
|
|
61
|
+
/** append html */
|
|
62
|
+
context.element.relative.appendChild(dialog_div);
|
|
63
|
+
|
|
64
|
+
/** empty memory */
|
|
65
|
+
dialog_div = null, dialog_back = null, dialog_area = null;
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @description Event to control the behavior of closing the dialog
|
|
70
|
+
* @param {MouseEvent} e Event object
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
_onMouseDown_dialog: function (e) {
|
|
74
|
+
if (/se-dialog-inner/.test(e.target.className)) {
|
|
75
|
+
this.context.dialog._closeSignal = true;
|
|
76
|
+
} else {
|
|
77
|
+
this.context.dialog._closeSignal = false;
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @description Event to close the window when the outside area of the dialog or close button is click
|
|
83
|
+
* @param {MouseEvent} e Event object
|
|
84
|
+
* @private
|
|
85
|
+
*/
|
|
86
|
+
_onClick_dialog: function (e) {
|
|
87
|
+
if (/close/.test(e.target.getAttribute('data-command')) || this.context.dialog._closeSignal) {
|
|
88
|
+
this.plugins.dialog.close.call(this);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @description Open a Dialog plugin
|
|
94
|
+
* @param {String} kind Dialog plugin name
|
|
95
|
+
* @param {Boolean} update Whether it will open for update ('image' === this.currentControllerName)
|
|
96
|
+
*/
|
|
97
|
+
open: function (kind, update) {
|
|
98
|
+
if (this.modalForm) return false;
|
|
99
|
+
if (this.plugins.dialog._bindClose) {
|
|
100
|
+
this._d.removeEventListener('keydown', this.plugins.dialog._bindClose);
|
|
101
|
+
this.plugins.dialog._bindClose = null;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
this.plugins.dialog._bindClose = function (e) {
|
|
105
|
+
if (!/27/.test(e.keyCode)) return;
|
|
106
|
+
this.plugins.dialog.close.call(this);
|
|
107
|
+
}.bind(this);
|
|
108
|
+
this._d.addEventListener('keydown', this.plugins.dialog._bindClose);
|
|
109
|
+
|
|
110
|
+
this.context.dialog.updateModal = update;
|
|
111
|
+
|
|
112
|
+
if (this.options.popupDisplay === 'full') {
|
|
113
|
+
this.context.dialog.modalArea.style.position = 'fixed';
|
|
114
|
+
} else {
|
|
115
|
+
this.context.dialog.modalArea.style.position = 'absolute';
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
this.context.dialog.kind = kind;
|
|
119
|
+
this.modalForm = this.context[kind].modal;
|
|
120
|
+
const focusElement = this.context[kind].focusElement;
|
|
121
|
+
|
|
122
|
+
if (typeof this.plugins[kind].on === 'function') this.plugins[kind].on.call(this, update);
|
|
123
|
+
|
|
124
|
+
this.context.dialog.modalArea.style.display = 'block';
|
|
125
|
+
this.context.dialog.back.style.display = 'block';
|
|
126
|
+
this.context.dialog.modal.style.display = 'block';
|
|
127
|
+
this.modalForm.style.display = 'block';
|
|
128
|
+
|
|
129
|
+
if (focusElement) focusElement.focus();
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
_bindClose: null,
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* @description Close a Dialog plugin
|
|
136
|
+
* The plugin's "init" method is called.
|
|
137
|
+
*/
|
|
138
|
+
close: function () {
|
|
139
|
+
if (this.plugins.dialog._bindClose) {
|
|
140
|
+
this._d.removeEventListener('keydown', this.plugins.dialog._bindClose);
|
|
141
|
+
this.plugins.dialog._bindClose = null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const kind = this.context.dialog.kind;
|
|
145
|
+
this.modalForm.style.display = 'none';
|
|
146
|
+
this.context.dialog.back.style.display = 'none';
|
|
147
|
+
this.context.dialog.modalArea.style.display = 'none';
|
|
148
|
+
this.context.dialog.updateModal = false;
|
|
149
|
+
if (typeof this.plugins[kind].init === 'function') this.plugins[kind].init.call(this);
|
|
150
|
+
this.context.dialog.kind = '';
|
|
151
|
+
this.modalForm = null;
|
|
152
|
+
this.focus();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
if (typeof noGlobal === typeof undefined) {
|
|
157
|
+
if (!window.SUNEDITOR_MODULES) {
|
|
158
|
+
Object.defineProperty(window, 'SUNEDITOR_MODULES', {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
writable: false,
|
|
161
|
+
configurable: false,
|
|
162
|
+
value: {}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
Object.defineProperty(window.SUNEDITOR_MODULES, 'dialog', {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
writable: false,
|
|
169
|
+
configurable: false,
|
|
170
|
+
value: dialog
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return dialog;
|
|
175
175
|
}));
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { Module } from '../Module';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @description This is a required module of fileBrowser plugin.
|
|
5
|
-
Require context properties when using fileBrowser module:
|
|
6
|
-
title(@Required): "File browser window title",
|
|
7
|
-
url(@Required): "File server url",
|
|
8
|
-
listClass(@Required): "Class name of list div",
|
|
9
|
-
itemTemplateHandler(@Required): "Function that defines the HTML of an file item",
|
|
10
|
-
selectorHandler(@Required): "Function that action when item click",
|
|
11
|
-
columnSize(@Option): "Number of "div.se-file-item-column" to be created (default: 4)"
|
|
12
|
-
*/
|
|
13
|
-
declare interface fileBrowser extends Module {
|
|
14
|
-
/**
|
|
15
|
-
* @description Open a file browser window
|
|
16
|
-
* @param pluginName Plugin name using the file browser
|
|
17
|
-
* @param selectorHandler When the function comes as an argument value, it substitutes "context.selectorHandler".
|
|
18
|
-
* @example this.plugins.fileBrowser.open.call(this, 'imageGallery', (selectorHandler || null));
|
|
19
|
-
*/
|
|
20
|
-
open(kind: string, update: boolean): void;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @description Define the HTML of the item to be put in "div.se-file-item-column".
|
|
24
|
-
* @param item Item of the response data's array
|
|
25
|
-
*/
|
|
26
|
-
drawItems: (item: object) => string;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @description Close a file browser window
|
|
30
|
-
* The plugin's "init" method is called.
|
|
31
|
-
* @example this.plugins.fileBrowser.close.call(this);
|
|
32
|
-
*/
|
|
33
|
-
close(): void;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @description This method is called when the file browser window is closed.
|
|
37
|
-
* Initialize the properties.
|
|
38
|
-
*/
|
|
39
|
-
init?: () => void;
|
|
40
|
-
}
|
|
41
|
-
|
|
1
|
+
import { Module } from '../Module';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description This is a required module of fileBrowser plugin.
|
|
5
|
+
Require context properties when using fileBrowser module:
|
|
6
|
+
title(@Required): "File browser window title",
|
|
7
|
+
url(@Required): "File server url",
|
|
8
|
+
listClass(@Required): "Class name of list div",
|
|
9
|
+
itemTemplateHandler(@Required): "Function that defines the HTML of an file item",
|
|
10
|
+
selectorHandler(@Required): "Function that action when item click",
|
|
11
|
+
columnSize(@Option): "Number of "div.se-file-item-column" to be created (default: 4)"
|
|
12
|
+
*/
|
|
13
|
+
declare interface fileBrowser extends Module {
|
|
14
|
+
/**
|
|
15
|
+
* @description Open a file browser window
|
|
16
|
+
* @param pluginName Plugin name using the file browser
|
|
17
|
+
* @param selectorHandler When the function comes as an argument value, it substitutes "context.selectorHandler".
|
|
18
|
+
* @example this.plugins.fileBrowser.open.call(this, 'imageGallery', (selectorHandler || null));
|
|
19
|
+
*/
|
|
20
|
+
open(kind: string, update: boolean): void;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @description Define the HTML of the item to be put in "div.se-file-item-column".
|
|
24
|
+
* @param item Item of the response data's array
|
|
25
|
+
*/
|
|
26
|
+
drawItems: (item: object) => string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @description Close a file browser window
|
|
30
|
+
* The plugin's "init" method is called.
|
|
31
|
+
* @example this.plugins.fileBrowser.close.call(this);
|
|
32
|
+
*/
|
|
33
|
+
close(): void;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @description This method is called when the file browser window is closed.
|
|
37
|
+
* Initialize the properties.
|
|
38
|
+
*/
|
|
39
|
+
init?: () => void;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
42
|
export default fileBrowser;
|