suneditor 2.47.4 → 2.47.6

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.
Files changed (140) hide show
  1. package/LICENSE.txt +20 -20
  2. package/README.md +1625 -1613
  3. package/dist/suneditor.min.js +2 -2
  4. package/example.md +586 -586
  5. package/package.json +71 -71
  6. package/src/assets/css/suneditor-contents.css +561 -561
  7. package/src/assets/css/suneditor.css +0 -0
  8. package/src/assets/defaultIcons.js +103 -103
  9. package/src/lang/Lang.d.ts +143 -143
  10. package/src/lang/ckb.d.ts +4 -4
  11. package/src/lang/ckb.js +187 -187
  12. package/src/lang/cs.d.ts +4 -4
  13. package/src/lang/cs.js +187 -187
  14. package/src/lang/da.d.ts +4 -4
  15. package/src/lang/da.js +191 -191
  16. package/src/lang/de.d.ts +4 -4
  17. package/src/lang/de.js +188 -188
  18. package/src/lang/en.d.ts +4 -4
  19. package/src/lang/en.js +187 -187
  20. package/src/lang/es.d.ts +4 -4
  21. package/src/lang/es.js +187 -187
  22. package/src/lang/fa.d.ts +4 -4
  23. package/src/lang/fa.js +187 -187
  24. package/src/lang/fr.d.ts +4 -4
  25. package/src/lang/fr.js +188 -188
  26. package/src/lang/he.d.ts +4 -4
  27. package/src/lang/he.js +188 -188
  28. package/src/lang/hu.d.ts +5 -5
  29. package/src/lang/hu.js +188 -188
  30. package/src/lang/index.d.ts +25 -24
  31. package/src/lang/index.js +30 -27
  32. package/src/lang/it.d.ts +4 -4
  33. package/src/lang/it.js +188 -188
  34. package/src/lang/ja.d.ts +4 -4
  35. package/src/lang/ja.js +187 -187
  36. package/src/lang/km.d.ts +5 -0
  37. package/src/lang/km.js +188 -0
  38. package/src/lang/ko.d.ts +4 -4
  39. package/src/lang/ko.js +187 -187
  40. package/src/lang/lv.d.ts +4 -4
  41. package/src/lang/lv.js +187 -187
  42. package/src/lang/nl.d.ts +4 -4
  43. package/src/lang/nl.js +187 -187
  44. package/src/lang/pl.d.ts +4 -4
  45. package/src/lang/pl.js +187 -187
  46. package/src/lang/pt_br.d.ts +4 -4
  47. package/src/lang/pt_br.js +189 -189
  48. package/src/lang/ro.d.ts +4 -4
  49. package/src/lang/ro.js +187 -187
  50. package/src/lang/ru.d.ts +4 -4
  51. package/src/lang/ru.js +187 -187
  52. package/src/lang/se.d.ts +4 -4
  53. package/src/lang/se.js +191 -191
  54. package/src/lang/tr.d.ts +5 -5
  55. package/src/lang/tr.js +191 -191
  56. package/src/lang/ua.d.ts +5 -5
  57. package/src/lang/ua.js +188 -188
  58. package/src/lang/ur.d.ts +4 -4
  59. package/src/lang/ur.js +187 -187
  60. package/src/lang/zh_cn.d.ts +4 -4
  61. package/src/lang/zh_cn.js +187 -187
  62. package/src/lib/constructor.js +0 -0
  63. package/src/lib/context.d.ts +42 -42
  64. package/src/lib/context.js +0 -0
  65. package/src/lib/core.d.ts +1135 -1135
  66. package/src/lib/core.js +13 -3
  67. package/src/lib/history.d.ts +48 -48
  68. package/src/lib/history.js +218 -218
  69. package/src/lib/util.d.ts +677 -677
  70. package/src/lib/util.js +1 -1
  71. package/src/options.d.ts +621 -620
  72. package/src/plugins/CommandPlugin.d.ts +7 -7
  73. package/src/plugins/DialogPlugin.d.ts +19 -19
  74. package/src/plugins/FileBrowserPlugin.d.ts +29 -29
  75. package/src/plugins/Module.d.ts +14 -14
  76. package/src/plugins/Plugin.d.ts +41 -41
  77. package/src/plugins/SubmenuPlugin.d.ts +7 -7
  78. package/src/plugins/command/blockquote.d.ts +4 -4
  79. package/src/plugins/command/blockquote.js +46 -46
  80. package/src/plugins/dialog/audio.d.ts +4 -4
  81. package/src/plugins/dialog/audio.js +558 -558
  82. package/src/plugins/dialog/image.d.ts +4 -4
  83. package/src/plugins/dialog/image.js +1127 -1127
  84. package/src/plugins/dialog/link.d.ts +4 -4
  85. package/src/plugins/dialog/link.js +223 -223
  86. package/src/plugins/dialog/math.d.ts +4 -4
  87. package/src/plugins/dialog/math.js +300 -300
  88. package/src/plugins/dialog/video.d.ts +4 -4
  89. package/src/plugins/dialog/video.js +989 -989
  90. package/src/plugins/fileBrowser/imageGallery.d.ts +4 -4
  91. package/src/plugins/fileBrowser/imageGallery.js +64 -64
  92. package/src/plugins/index.d.ts +79 -79
  93. package/src/plugins/index.js +32 -32
  94. package/src/plugins/modules/_anchor.js +461 -461
  95. package/src/plugins/modules/_colorPicker.d.ts +59 -59
  96. package/src/plugins/modules/_colorPicker.js +0 -0
  97. package/src/plugins/modules/_notice.d.ts +20 -20
  98. package/src/plugins/modules/_notice.js +72 -72
  99. package/src/plugins/modules/_selectMenu.js +118 -118
  100. package/src/plugins/modules/component.d.ts +24 -24
  101. package/src/plugins/modules/component.js +80 -80
  102. package/src/plugins/modules/dialog.d.ts +27 -27
  103. package/src/plugins/modules/dialog.js +174 -174
  104. package/src/plugins/modules/fileBrowser.d.ts +41 -41
  105. package/src/plugins/modules/fileBrowser.js +377 -377
  106. package/src/plugins/modules/fileManager.d.ts +66 -66
  107. package/src/plugins/modules/fileManager.js +325 -325
  108. package/src/plugins/modules/index.d.ts +10 -10
  109. package/src/plugins/modules/index.js +8 -8
  110. package/src/plugins/modules/resizing.d.ts +153 -153
  111. package/src/plugins/modules/resizing.js +902 -902
  112. package/src/plugins/submenu/align.d.ts +4 -4
  113. package/src/plugins/submenu/align.js +160 -160
  114. package/src/plugins/submenu/font.d.ts +4 -4
  115. package/src/plugins/submenu/font.js +123 -123
  116. package/src/plugins/submenu/fontColor.d.ts +4 -4
  117. package/src/plugins/submenu/fontColor.js +0 -0
  118. package/src/plugins/submenu/fontSize.d.ts +4 -4
  119. package/src/plugins/submenu/fontSize.js +112 -112
  120. package/src/plugins/submenu/formatBlock.d.ts +4 -4
  121. package/src/plugins/submenu/formatBlock.js +273 -273
  122. package/src/plugins/submenu/hiliteColor.d.ts +4 -4
  123. package/src/plugins/submenu/hiliteColor.js +0 -0
  124. package/src/plugins/submenu/horizontalRule.d.ts +4 -4
  125. package/src/plugins/submenu/horizontalRule.js +98 -98
  126. package/src/plugins/submenu/lineHeight.d.ts +4 -4
  127. package/src/plugins/submenu/lineHeight.js +104 -104
  128. package/src/plugins/submenu/list.d.ts +4 -4
  129. package/src/plugins/submenu/list.js +456 -456
  130. package/src/plugins/submenu/paragraphStyle.d.ts +4 -4
  131. package/src/plugins/submenu/paragraphStyle.js +135 -135
  132. package/src/plugins/submenu/table.d.ts +4 -4
  133. package/src/plugins/submenu/template.d.ts +4 -4
  134. package/src/plugins/submenu/template.js +71 -71
  135. package/src/plugins/submenu/textStyle.d.ts +4 -4
  136. package/src/plugins/submenu/textStyle.js +167 -167
  137. package/src/suneditor.d.ts +9 -9
  138. package/src/suneditor.js +75 -75
  139. package/src/suneditor_build.js +17 -17
  140. package/README_V3_TEMP.md +0 -630
@@ -1,81 +1,81 @@
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.appendChild(cover);
36
-
37
- return container;
38
- },
39
-
40
- /**
41
- * @description Cover the target element with a FIGURE element.
42
- * @param {Element} element Target element
43
- */
44
- set_cover: function (element) {
45
- const cover = this.util.createElement('FIGURE');
46
- cover.appendChild(element);
47
-
48
- return cover;
49
- },
50
-
51
- /**
52
- * @description Return HTML string of caption(FIGCAPTION) element
53
- * @returns {String}
54
- */
55
- create_caption: function () {
56
- const caption = this.util.createElement('FIGCAPTION');
57
- caption.innerHTML = '<div>' + this.lang.dialogBox.caption + '</div>';
58
- return caption;
59
- }
60
- };
61
-
62
- if (typeof noGlobal === typeof undefined) {
63
- if (!window.SUNEDITOR_MODULES) {
64
- Object.defineProperty(window, 'SUNEDITOR_MODULES', {
65
- enumerable: true,
66
- writable: false,
67
- configurable: false,
68
- value: {}
69
- });
70
- }
71
-
72
- Object.defineProperty(window.SUNEDITOR_MODULES, 'component', {
73
- enumerable: true,
74
- writable: false,
75
- configurable: false,
76
- value: component
77
- });
78
- }
79
-
80
- 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.appendChild(cover);
36
+
37
+ return container;
38
+ },
39
+
40
+ /**
41
+ * @description Cover the target element with a FIGURE element.
42
+ * @param {Element} element Target element
43
+ */
44
+ set_cover: function (element) {
45
+ const cover = this.util.createElement('FIGURE');
46
+ cover.appendChild(element);
47
+
48
+ return cover;
49
+ },
50
+
51
+ /**
52
+ * @description Return HTML string of caption(FIGCAPTION) element
53
+ * @returns {String}
54
+ */
55
+ create_caption: function () {
56
+ const caption = this.util.createElement('FIGCAPTION');
57
+ caption.innerHTML = '<div>' + this.lang.dialogBox.caption + '</div>';
58
+ return caption;
59
+ }
60
+ };
61
+
62
+ if (typeof noGlobal === typeof undefined) {
63
+ if (!window.SUNEDITOR_MODULES) {
64
+ Object.defineProperty(window, 'SUNEDITOR_MODULES', {
65
+ enumerable: true,
66
+ writable: false,
67
+ configurable: false,
68
+ value: {}
69
+ });
70
+ }
71
+
72
+ Object.defineProperty(window.SUNEDITOR_MODULES, 'component', {
73
+ enumerable: true,
74
+ writable: false,
75
+ configurable: false,
76
+ value: component
77
+ });
78
+ }
79
+
80
+ return component;
81
81
  }));
@@ -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;