suneditor 2.43.1 → 2.43.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/dist/suneditor.min.js +2 -2
- package/package.json +1 -1
- package/src/lib/core.d.ts +8 -0
- package/src/lib/core.js +11 -6
- package/src/lib/util.d.ts +13 -0
- package/src/lib/util.js +2 -1
- package/src/plugins/dialog/math.js +2 -3
- package/src/plugins/dialog/video.js +1 -1
package/package.json
CHANGED
package/src/lib/core.d.ts
CHANGED
|
@@ -578,6 +578,14 @@ interface Core {
|
|
|
578
578
|
*/
|
|
579
579
|
getContents(onlyContents: boolean): string;
|
|
580
580
|
|
|
581
|
+
/**
|
|
582
|
+
* @description Gets the current contents with containing parent div(div.sun-editor-editable).
|
|
583
|
+
* <div class="sun-editor-editable">{contents}</div>
|
|
584
|
+
* @param onlyContents Return only the contents of the body without headers when the "fullPage" option is true
|
|
585
|
+
* @returns
|
|
586
|
+
*/
|
|
587
|
+
getFullContents(onlyContents: boolean): string;
|
|
588
|
+
|
|
581
589
|
/**
|
|
582
590
|
* @description Gets the clean HTML code for editor
|
|
583
591
|
* @param html HTML string
|
package/src/lib/core.js
CHANGED
|
@@ -2870,6 +2870,12 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2870
2870
|
this.history.push(false);
|
|
2871
2871
|
},
|
|
2872
2872
|
|
|
2873
|
+
/**
|
|
2874
|
+
* @description Reset common style of list cell
|
|
2875
|
+
* @param {Element} el List cell element. <li>
|
|
2876
|
+
* @param {Array|null} styleArray Style array
|
|
2877
|
+
* @private
|
|
2878
|
+
*/
|
|
2873
2879
|
_resetCommonListCell: function (el, styleArray) {
|
|
2874
2880
|
if (!util.isListCell(el)) return;
|
|
2875
2881
|
if (!styleArray) styleArray = this._listKebab;
|
|
@@ -2917,7 +2923,6 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2917
2923
|
* @description If certain styles are applied to all child nodes of the list cell, the style of the list cell is also changed. (bold, color, size)
|
|
2918
2924
|
* @param {Element} el List cell element. <li>
|
|
2919
2925
|
* @param {Element|null} child Variable for recursive call. ("null" on the first call)
|
|
2920
|
-
* @param {Array|null} styleArray Style array
|
|
2921
2926
|
* @private
|
|
2922
2927
|
*/
|
|
2923
2928
|
_setCommonListStyle: function (el, child) {
|
|
@@ -4279,7 +4284,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
4279
4284
|
wysiwyg.appendChild(format);
|
|
4280
4285
|
last = br;
|
|
4281
4286
|
}
|
|
4282
|
-
this.setRange(first, 0, last, last.textContent.length);
|
|
4287
|
+
event._showToolbarBalloon(this.setRange(first, 0, last, last.textContent.length));
|
|
4283
4288
|
break;
|
|
4284
4289
|
case 'codeView':
|
|
4285
4290
|
this.toggleCodeView();
|
|
@@ -4905,10 +4910,10 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
4905
4910
|
* @description Gets the current contents with containing parent div(div.sun-editor-editable).
|
|
4906
4911
|
* <div class="sun-editor-editable">{contents}</div>
|
|
4907
4912
|
* @param {Boolean} onlyContents Return only the contents of the body without headers when the "fullPage" option is true
|
|
4908
|
-
* @returns {
|
|
4913
|
+
* @returns {String}
|
|
4909
4914
|
*/
|
|
4910
4915
|
getFullContents: function (onlyContents) {
|
|
4911
|
-
return '<div class="sun-editor-editable' + options.rtl ? ' se-rtl' : '' + '">' + this.getContents(onlyContents) + '</div>';
|
|
4916
|
+
return '<div class="sun-editor-editable' + (options.rtl ? ' se-rtl' : '') + '">' + this.getContents(onlyContents) + '</div>';
|
|
4912
4917
|
},
|
|
4913
4918
|
|
|
4914
4919
|
/**
|
|
@@ -5690,7 +5695,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5690
5695
|
}
|
|
5691
5696
|
},
|
|
5692
5697
|
|
|
5693
|
-
__callResizeFunction(h, resizeObserverEntry) {
|
|
5698
|
+
__callResizeFunction: function (h, resizeObserverEntry) {
|
|
5694
5699
|
h = h === -1 ? resizeObserverEntry.borderBoxSize[0].blockSize : h;
|
|
5695
5700
|
if (this._editorHeight !== h) {
|
|
5696
5701
|
if (typeof functions.onResizeEditor === 'function') functions.onResizeEditor(h, this._editorHeight, core, resizeObserverEntry);
|
|
@@ -8663,4 +8668,4 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
8663
8668
|
}
|
|
8664
8669
|
|
|
8665
8670
|
return functions;
|
|
8666
|
-
}
|
|
8671
|
+
}
|
package/src/lib/util.d.ts
CHANGED
|
@@ -29,6 +29,19 @@ declare interface util {
|
|
|
29
29
|
*/
|
|
30
30
|
getXMLHttpRequest(): XMLHttpRequest | ActiveXObject;
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* @description Object.values
|
|
34
|
+
* @param obj Object parameter.
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
getValues(obj?: any): any[];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @description Convert the CamelCase To the KebabCase.
|
|
41
|
+
* @param {String|Array} param [Camel string]
|
|
42
|
+
*/
|
|
43
|
+
camelToKebabCase(param: string | string[]): string | string[],
|
|
44
|
+
|
|
32
45
|
/**
|
|
33
46
|
* @description Create Element node
|
|
34
47
|
* @param elementName Element name
|
package/src/lib/util.js
CHANGED
|
@@ -97,7 +97,7 @@ const util = {
|
|
|
97
97
|
|
|
98
98
|
/**
|
|
99
99
|
* @description Object.values
|
|
100
|
-
* @param {Object} obj Object parameter.
|
|
100
|
+
* @param {Object|null} obj Object parameter.
|
|
101
101
|
* @returns {Array}
|
|
102
102
|
*/
|
|
103
103
|
getValues: function (obj) {
|
|
@@ -109,6 +109,7 @@ const util = {
|
|
|
109
109
|
/**
|
|
110
110
|
* @description Convert the CamelCase To the KebabCase.
|
|
111
111
|
* @param {String|Array} param [Camel string]
|
|
112
|
+
* @returns {String|Array}
|
|
112
113
|
*/
|
|
113
114
|
camelToKebabCase: function (param) {
|
|
114
115
|
if (typeof param === 'string') {
|
|
@@ -23,8 +23,7 @@ export default {
|
|
|
23
23
|
context.math.focusElement = math_dialog.querySelector('.se-math-exp');
|
|
24
24
|
context.math.previewElement = math_dialog.querySelector('.se-math-preview');
|
|
25
25
|
context.math.fontSizeElement = math_dialog.querySelector('.se-math-size');
|
|
26
|
-
context.math.focusElement.addEventListener('
|
|
27
|
-
context.math.focusElement.addEventListener('change', this._renderMathExp.bind(core, context.math), false);
|
|
26
|
+
context.math.focusElement.addEventListener(core.util.isIE ? 'textinput' : 'input', this._renderMathExp.bind(core, context.math), false);
|
|
28
27
|
context.math.fontSizeElement.addEventListener('change', function (e) { this.fontSize = e.target.value; }.bind(context.math.previewElement.style), false);
|
|
29
28
|
|
|
30
29
|
/** math controller */
|
|
@@ -140,7 +139,7 @@ export default {
|
|
|
140
139
|
|
|
141
140
|
_renderer: function (exp) {
|
|
142
141
|
const katex = this.options.katex;
|
|
143
|
-
return katex.src.renderToString(exp,
|
|
142
|
+
return katex.src.renderToString(exp, {throwOnError: true, displayMode: true});
|
|
144
143
|
},
|
|
145
144
|
|
|
146
145
|
_renderMathExp: function (contextMath, e) {
|
|
@@ -817,7 +817,7 @@ export default {
|
|
|
817
817
|
|
|
818
818
|
if (!onlyH) w = this.util.getNumber(w, 0);
|
|
819
819
|
if (!onlyW) h = this.util.isNumber(h) ? h + contextVideo.sizeUnit : !h ? '' : h;
|
|
820
|
-
w ? w + contextVideo.sizeUnit : '';
|
|
820
|
+
w = w ? w + contextVideo.sizeUnit : '';
|
|
821
821
|
|
|
822
822
|
if (!onlyH) contextVideo._element.style.width = w;
|
|
823
823
|
if (!onlyW) contextVideo._cover.style.paddingBottom = contextVideo._cover.style.height = h;
|