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
package/src/lib/core.js
CHANGED
|
@@ -448,7 +448,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
448
448
|
* @property {Element} OUTDENT outdent button
|
|
449
449
|
* @property {Element} INDENT indent button
|
|
450
450
|
*/
|
|
451
|
-
commandMap:
|
|
451
|
+
commandMap: {},
|
|
452
452
|
|
|
453
453
|
/**
|
|
454
454
|
* @description CSS properties related to style tags
|
|
@@ -514,6 +514,12 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
514
514
|
_lineBreakDir: ''
|
|
515
515
|
},
|
|
516
516
|
|
|
517
|
+
/**
|
|
518
|
+
* @description Temp variable for set line attrs
|
|
519
|
+
* @private
|
|
520
|
+
*/
|
|
521
|
+
_formatAttrsTemp: null,
|
|
522
|
+
|
|
517
523
|
/**
|
|
518
524
|
* @description Save the current buttons states to "allCommandButtons" object
|
|
519
525
|
* @private
|
|
@@ -1143,7 +1149,12 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
1143
1149
|
* @returns {Object}
|
|
1144
1150
|
*/
|
|
1145
1151
|
getSelection: function () {
|
|
1146
|
-
|
|
1152
|
+
const selection = this._shadowRoot && this._shadowRoot.getSelection ? this._shadowRoot.getSelection() : this._ww.getSelection();
|
|
1153
|
+
if (!context.element.wysiwyg.contains(selection.focusNode)) {
|
|
1154
|
+
selection.removeAllRanges();
|
|
1155
|
+
selection.addRange(this._createDefaultRange());
|
|
1156
|
+
}
|
|
1157
|
+
return selection;
|
|
1147
1158
|
},
|
|
1148
1159
|
|
|
1149
1160
|
/**
|
|
@@ -1212,14 +1223,21 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
1212
1223
|
*/
|
|
1213
1224
|
_createDefaultRange: function () {
|
|
1214
1225
|
const wysiwyg = context.element.wysiwyg;
|
|
1215
|
-
wysiwyg.focus();
|
|
1216
1226
|
const range = this._wd.createRange();
|
|
1217
1227
|
|
|
1218
|
-
let
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1228
|
+
let firstFormat = wysiwyg.firstElementChild;
|
|
1229
|
+
let focusEl = null;
|
|
1230
|
+
if (!firstFormat) {
|
|
1231
|
+
firstFormat = util.createElement(options.defaultTag);
|
|
1232
|
+
focusEl = util.createElement('BR');
|
|
1233
|
+
firstFormat.appendChild(focusEl);
|
|
1234
|
+
wysiwyg.appendChild(firstFormat);
|
|
1235
|
+
} else {
|
|
1236
|
+
focusEl = firstFormat.firstChild;
|
|
1237
|
+
if (!focusEl) {
|
|
1238
|
+
focusEl = util.createElement('BR');
|
|
1239
|
+
firstFormat.appendChild(focusEl);
|
|
1240
|
+
}
|
|
1223
1241
|
}
|
|
1224
1242
|
|
|
1225
1243
|
range.setStart(focusEl, 0);
|
|
@@ -1518,7 +1536,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
1518
1536
|
oFormat = util.createElement(oFormatName);
|
|
1519
1537
|
oFormat.innerHTML = '<br>';
|
|
1520
1538
|
if ((formatNode && typeof formatNode !== 'string') || (!formatNode && util.isFormatElement(currentFormatEl))) {
|
|
1521
|
-
util.copyTagAttributes(oFormat, formatNode || currentFormatEl);
|
|
1539
|
+
util.copyTagAttributes(oFormat, formatNode || currentFormatEl, ['id']);
|
|
1522
1540
|
}
|
|
1523
1541
|
}
|
|
1524
1542
|
|
|
@@ -1691,26 +1709,30 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
1691
1709
|
let duple = false;
|
|
1692
1710
|
(function recursionFunc(ancestor) {
|
|
1693
1711
|
if (util.isWysiwygDiv(ancestor) || !util.isTextStyleElement(ancestor)) return;
|
|
1694
|
-
|
|
1695
1712
|
if (ancestor.nodeName === nodeName) {
|
|
1696
1713
|
duple = true;
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
if ((
|
|
1700
|
-
oStyles.splice(
|
|
1714
|
+
const styles = ancestor.style.cssText.match(/[^;]+;/g) || [];
|
|
1715
|
+
for (let i = 0, len = styles.length, j; i < len; i++) {
|
|
1716
|
+
if ((j = oStyles.indexOf(styles[i].trim())) > -1) {
|
|
1717
|
+
oStyles.splice(j, 1);
|
|
1701
1718
|
}
|
|
1702
|
-
}
|
|
1703
|
-
ancestor.classList.
|
|
1704
|
-
oNode.classList.remove(
|
|
1705
|
-
}
|
|
1719
|
+
}
|
|
1720
|
+
for (let i = 0, len = ancestor.classList.length; i < len; i++) {
|
|
1721
|
+
oNode.classList.remove(ancestor.classList[i]);
|
|
1722
|
+
}
|
|
1706
1723
|
}
|
|
1707
1724
|
|
|
1708
1725
|
recursionFunc(ancestor.parentElement);
|
|
1709
1726
|
})(parentNode);
|
|
1710
1727
|
|
|
1711
1728
|
if (duple) {
|
|
1712
|
-
if (!(oNode.style.cssText = oStyles.join(' ')))
|
|
1713
|
-
|
|
1729
|
+
if (!(oNode.style.cssText = oStyles.join(' '))) {
|
|
1730
|
+
oNode.setAttribute('style', '');
|
|
1731
|
+
oNode.removeAttribute('style');
|
|
1732
|
+
}
|
|
1733
|
+
if (!oNode.attributes.length) {
|
|
1734
|
+
oNode.setAttribute('data-se-duple', 'true');
|
|
1735
|
+
}
|
|
1714
1736
|
}
|
|
1715
1737
|
|
|
1716
1738
|
return oNode;
|
|
@@ -1880,6 +1902,9 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
1880
1902
|
} else {
|
|
1881
1903
|
afterNode = null;
|
|
1882
1904
|
}
|
|
1905
|
+
} else if (util.isWysiwygDiv(container) && !util.isFormatElement(oNode)) {
|
|
1906
|
+
parentNode = container.appendChild(util.createElement(options.defaultTag));
|
|
1907
|
+
afterNode = null;
|
|
1883
1908
|
} else {
|
|
1884
1909
|
afterNode = isFormats ? endCon : container === prevContainer ? container.nextSibling : container;
|
|
1885
1910
|
parentNode = (!afterNode || !afterNode.parentNode) ? commonCon : afterNode.parentNode;
|
|
@@ -2121,11 +2146,16 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2121
2146
|
startOff = endOff = 0;
|
|
2122
2147
|
}
|
|
2123
2148
|
|
|
2149
|
+
if (!startCon || !endCon) return {
|
|
2150
|
+
container: commonCon,
|
|
2151
|
+
offset: 0
|
|
2152
|
+
};
|
|
2153
|
+
|
|
2124
2154
|
if (startCon === endCon && range.collapsed) {
|
|
2125
2155
|
if (startCon.textContent && util.onlyZeroWidthSpace(startCon.textContent.substr(startOff))) {
|
|
2126
2156
|
return {
|
|
2127
2157
|
container: startCon,
|
|
2128
|
-
offset:
|
|
2158
|
+
offset: startOff,
|
|
2129
2159
|
prevContainer: startCon && startCon.parentNode ? startCon : null
|
|
2130
2160
|
};
|
|
2131
2161
|
}
|
|
@@ -2455,8 +2485,8 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2455
2485
|
*/
|
|
2456
2486
|
detachRangeFormatElement: function (rangeElement, selectedFormats, newRangeElement, remove, notHistoryPush) {
|
|
2457
2487
|
const range = this.getRange();
|
|
2458
|
-
|
|
2459
|
-
|
|
2488
|
+
let so = range.startOffset;
|
|
2489
|
+
let eo = range.endOffset;
|
|
2460
2490
|
|
|
2461
2491
|
let children = util.getListChildNodes(rangeElement, function (current) { return current.parentNode === rangeElement; });
|
|
2462
2492
|
let parent = rangeElement.parentNode;
|
|
@@ -2471,7 +2501,10 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2471
2501
|
let moveComplete = false;
|
|
2472
2502
|
|
|
2473
2503
|
function appendNode (parent, insNode, sibling, originNode) {
|
|
2474
|
-
if (util.onlyZeroWidthSpace(insNode))
|
|
2504
|
+
if (util.onlyZeroWidthSpace(insNode)) {
|
|
2505
|
+
insNode.innerHTML = util.zeroWidthSpace;
|
|
2506
|
+
so = eo = 1;
|
|
2507
|
+
}
|
|
2475
2508
|
|
|
2476
2509
|
if (insNode.nodeType === 3) {
|
|
2477
2510
|
parent.insertBefore(insNode, sibling);
|
|
@@ -2632,7 +2665,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2632
2665
|
if (rangeElement.children.length === 0 || rangeElement.textContent.length === 0) {
|
|
2633
2666
|
util.removeItem(rangeElement);
|
|
2634
2667
|
} else {
|
|
2635
|
-
util.removeEmptyNode(rangeElement, null);
|
|
2668
|
+
util.removeEmptyNode(rangeElement, null, false);
|
|
2636
2669
|
}
|
|
2637
2670
|
|
|
2638
2671
|
let edge = null;
|
|
@@ -2640,7 +2673,9 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2640
2673
|
edge = {
|
|
2641
2674
|
cc: rangeParent,
|
|
2642
2675
|
sc: firstNode,
|
|
2676
|
+
so: so,
|
|
2643
2677
|
ec: rangeRight,
|
|
2678
|
+
eo: eo,
|
|
2644
2679
|
removeArray: removeArray
|
|
2645
2680
|
};
|
|
2646
2681
|
} else {
|
|
@@ -2650,7 +2685,10 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
2650
2685
|
edge = {
|
|
2651
2686
|
cc: (childEdge.sc || childEdge.ec).parentNode,
|
|
2652
2687
|
sc: childEdge.sc,
|
|
2653
|
-
|
|
2688
|
+
so: so,
|
|
2689
|
+
ec: childEdge.ec,
|
|
2690
|
+
eo: eo,
|
|
2691
|
+
removeArray: null
|
|
2654
2692
|
};
|
|
2655
2693
|
}
|
|
2656
2694
|
|
|
@@ -3600,7 +3638,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
3600
3638
|
}
|
|
3601
3639
|
}
|
|
3602
3640
|
|
|
3603
|
-
util.removeEmptyNode(pNode, newInnerNode);
|
|
3641
|
+
util.removeEmptyNode(pNode, newInnerNode, false);
|
|
3604
3642
|
|
|
3605
3643
|
if (collapsed) {
|
|
3606
3644
|
startOffset = startContainer.textContent.length;
|
|
@@ -3907,7 +3945,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
3907
3945
|
element.appendChild(container);
|
|
3908
3946
|
}
|
|
3909
3947
|
} else {
|
|
3910
|
-
util.removeEmptyNode(pNode, newInnerNode);
|
|
3948
|
+
util.removeEmptyNode(pNode, newInnerNode, false);
|
|
3911
3949
|
|
|
3912
3950
|
if (util.onlyZeroWidthSpace(pNode.textContent)) {
|
|
3913
3951
|
container = pNode.firstChild;
|
|
@@ -4056,7 +4094,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
4056
4094
|
}
|
|
4057
4095
|
}
|
|
4058
4096
|
|
|
4059
|
-
util.removeEmptyNode(pNode, newInnerNode);
|
|
4097
|
+
util.removeEmptyNode(pNode, newInnerNode, false);
|
|
4060
4098
|
util.mergeSameTags(pNode, null, true);
|
|
4061
4099
|
|
|
4062
4100
|
// node change
|
|
@@ -4331,7 +4369,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
4331
4369
|
}
|
|
4332
4370
|
} else {
|
|
4333
4371
|
if (!isRemoveNode && newInnerNode.textContent.length === 0) {
|
|
4334
|
-
util.removeEmptyNode(pNode, null);
|
|
4372
|
+
util.removeEmptyNode(pNode, null, false);
|
|
4335
4373
|
return {
|
|
4336
4374
|
ancestor: null,
|
|
4337
4375
|
container: null,
|
|
@@ -4339,7 +4377,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
4339
4377
|
};
|
|
4340
4378
|
}
|
|
4341
4379
|
|
|
4342
|
-
util.removeEmptyNode(pNode, newInnerNode);
|
|
4380
|
+
util.removeEmptyNode(pNode, newInnerNode, false);
|
|
4343
4381
|
|
|
4344
4382
|
if (util.onlyZeroWidthSpace(pNode.textContent)) {
|
|
4345
4383
|
container = pNode.firstChild;
|
|
@@ -4795,7 +4833,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
4795
4833
|
_var._codeOriginCssText = code.style.cssText;
|
|
4796
4834
|
|
|
4797
4835
|
editorArea.style.cssText = toolbar.style.cssText = '';
|
|
4798
|
-
wysiwygFrame.style.cssText = (wysiwygFrame.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/) || [''])[0] + options.
|
|
4836
|
+
wysiwygFrame.style.cssText = (wysiwygFrame.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/) || [''])[0] + options._editorStyles.editor;
|
|
4799
4837
|
code.style.cssText = (code.style.cssText.match(/\s?display(\s+)?:(\s+)?[a-zA-Z]+;/) || [''])[0];
|
|
4800
4838
|
toolbar.style.width = wysiwygFrame.style.height = code.style.height = '100%';
|
|
4801
4839
|
toolbar.style.position = 'relative';
|
|
@@ -5044,7 +5082,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5044
5082
|
setContents: function (html) {
|
|
5045
5083
|
this.removeRange();
|
|
5046
5084
|
|
|
5047
|
-
const convertValue = (html === null || html === undefined) ? '' : this.
|
|
5085
|
+
const convertValue = (html === null || html === undefined) ? '' : this.cleanHTML(html, null, null);
|
|
5048
5086
|
this._resetComponents();
|
|
5049
5087
|
|
|
5050
5088
|
if (!this._variable.isCodeView) {
|
|
@@ -5073,7 +5111,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5073
5111
|
* @returns {Object}
|
|
5074
5112
|
*/
|
|
5075
5113
|
getContents: function (onlyContents) {
|
|
5076
|
-
const contents = this.
|
|
5114
|
+
const contents = this.cleanHTML(context.element.wysiwyg.innerHTML, null, null);
|
|
5077
5115
|
const renderHTML = util.createElement('DIV');
|
|
5078
5116
|
renderHTML.innerHTML = contents;
|
|
5079
5117
|
|
|
@@ -5116,7 +5154,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5116
5154
|
if (node.nodeType === 1) {
|
|
5117
5155
|
if (util._disallowedTags(node)) return '';
|
|
5118
5156
|
|
|
5119
|
-
const ch = util.getListChildNodes(node, function(current) { return util.isSpanWithoutAttr(current); }) || [];
|
|
5157
|
+
const ch = util.getListChildNodes(node, function(current) { return util.isSpanWithoutAttr(current) && !util.getParentElement(current, util.isNotCheckingNode); }) || [];
|
|
5120
5158
|
for (let i = ch.length - 1; i >= 0; i--) {
|
|
5121
5159
|
ch[i].outerHTML = ch[i].innerHTML;
|
|
5122
5160
|
}
|
|
@@ -5168,24 +5206,28 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5168
5206
|
* @private
|
|
5169
5207
|
*/
|
|
5170
5208
|
_deleteDisallowedTags: function (html) {
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
.replace(
|
|
5177
|
-
|
|
5209
|
+
html = html
|
|
5210
|
+
.replace(/<(script|style)[\s\S]*>[\s\S]*<\/(script|style)>/gi, '')
|
|
5211
|
+
.replace(/<[a-z0-9]+\:[a-z0-9]+[^>^\/]*>[^>]*<\/[a-z0-9]+\:[a-z0-9]+>/gi, '');
|
|
5212
|
+
|
|
5213
|
+
if (!/\bfont\b/i.test(this.options._editorTagsWhitelist)) {
|
|
5214
|
+
html = html.replace(/(<\/?)font(\s?)/gi, '$1span$2');
|
|
5215
|
+
}
|
|
5216
|
+
|
|
5217
|
+
return html.replace(this.editorTagsWhitelistRegExp, '').replace(this.editorTagsBlacklistRegExp, '');
|
|
5218
|
+
},
|
|
5178
5219
|
|
|
5179
5220
|
_convertFontSize: function (to, size) {
|
|
5221
|
+
const math = this._w.Math;
|
|
5180
5222
|
const value = size.match(/(\d+(?:\.\d+)?)(.+)/);
|
|
5181
5223
|
const sizeNum = value[1] * 1;
|
|
5182
5224
|
const from = value[2];
|
|
5183
5225
|
let pxSize = sizeNum;
|
|
5184
5226
|
|
|
5185
5227
|
if (/em/.test(from)) {
|
|
5186
|
-
pxSize =
|
|
5228
|
+
pxSize = math.round(sizeNum / 0.0625);
|
|
5187
5229
|
} else if (from === 'pt') {
|
|
5188
|
-
pxSize =
|
|
5230
|
+
pxSize = math.round(sizeNum * 1.333);
|
|
5189
5231
|
} else if (from === '%') {
|
|
5190
5232
|
pxSize = sizeNum / 100;
|
|
5191
5233
|
}
|
|
@@ -5196,17 +5238,26 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5196
5238
|
case '%':
|
|
5197
5239
|
return (pxSize * 0.0625).toFixed(2) + to;
|
|
5198
5240
|
case 'pt':
|
|
5199
|
-
return
|
|
5241
|
+
return math.floor(pxSize / 1.333) + to;
|
|
5200
5242
|
default: // px
|
|
5201
5243
|
return pxSize + to;
|
|
5202
5244
|
}
|
|
5203
5245
|
},
|
|
5204
5246
|
|
|
5205
5247
|
_cleanStyle: function (m, v, name) {
|
|
5206
|
-
|
|
5248
|
+
let sv = (m.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/) || [])[0];
|
|
5249
|
+
if (/span/i.test(name) && !sv && (m.match(/<span\s(.+)/) || [])[1]) {
|
|
5250
|
+
const size = (m.match(/\ssize="([^"]+)"/i) || [])[1];
|
|
5251
|
+
const face = (m.match(/\sface="([^"]+)"/i) || [])[1];
|
|
5252
|
+
const color = (m.match(/\scolor="([^"]+)"/i) || [])[1];
|
|
5253
|
+
if (size || face || color) {
|
|
5254
|
+
sv = 'style="' + (size ? 'font-size:' + (this.util.getNumber(size/3.333, 1)) + 'rem;' : '') + (face ? 'font-family:' + face + ';' : '') + (color ? 'color:' + color + ';' : '') + '"';
|
|
5255
|
+
}
|
|
5256
|
+
}
|
|
5257
|
+
|
|
5207
5258
|
if (sv) {
|
|
5208
5259
|
if (!v) v = [];
|
|
5209
|
-
const style = sv
|
|
5260
|
+
const style = sv.replace(/"/g, '').match(this._cleanStyleRegExp[name]);
|
|
5210
5261
|
if (style) {
|
|
5211
5262
|
const allowedStyle = [];
|
|
5212
5263
|
for (let i = 0, len = style.length, r; i < len; i++) {
|
|
@@ -5222,7 +5273,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5222
5273
|
case 'fontSize':
|
|
5223
5274
|
if (!options.plugins.fontSize) continue;
|
|
5224
5275
|
if (!this._cleanStyleRegExp.fontSizeUnit.test(r[0])) {
|
|
5225
|
-
r[0] = r[0].replace(this._w.RegExp('\\d+' + r[0].match(/\d+(.+$)/)[1]), this._convertFontSize.bind(this
|
|
5276
|
+
r[0] = r[0].replace(this._w.RegExp('\\d+' + r[0].match(/\d+(.+$)/)[1]), this._convertFontSize.bind(this, options.fontSizeUnit));
|
|
5226
5277
|
}
|
|
5227
5278
|
break;
|
|
5228
5279
|
case 'color':
|
|
@@ -5255,21 +5306,21 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5255
5306
|
*/
|
|
5256
5307
|
_cleanTags: function (lowLevelCheck, m, t) {
|
|
5257
5308
|
if (/^<[a-z0-9]+\:[a-z0-9]+/i.test(m)) return m;
|
|
5258
|
-
|
|
5309
|
+
|
|
5259
5310
|
let v = null;
|
|
5260
5311
|
const tagName = t.match(/(?!<)[a-zA-Z0-9\-]+/)[0].toLowerCase();
|
|
5261
|
-
|
|
5312
|
+
|
|
5262
5313
|
// blacklist
|
|
5263
5314
|
const bAttr = this._attributesTagsBlacklist[tagName];
|
|
5264
5315
|
m = m.replace(/\s(?:on[a-z]+)\s*=\s*(")[^"]*\1/ig, '');
|
|
5265
5316
|
if (bAttr) m = m.replace(bAttr, '');
|
|
5266
5317
|
else m = m.replace(this._attributesBlacklistRegExp, '');
|
|
5267
|
-
|
|
5318
|
+
|
|
5268
5319
|
// whitelist
|
|
5269
5320
|
const wAttr = this._attributesTagsWhitelist[tagName];
|
|
5270
5321
|
if (wAttr) v = m.match(wAttr);
|
|
5271
5322
|
else v = m.match(lowLevelCheck ? this._attributesWhitelistRegExp : this._attributesWhitelistRegExp_all_data);
|
|
5272
|
-
|
|
5323
|
+
|
|
5273
5324
|
// attribute
|
|
5274
5325
|
if (lowLevelCheck) {
|
|
5275
5326
|
if (tagName === 'a') {
|
|
@@ -5316,7 +5367,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5316
5367
|
|
|
5317
5368
|
if (v) {
|
|
5318
5369
|
for (let i = 0, len = v.length; i < len; i++) {
|
|
5319
|
-
if (lowLevelCheck && /^class="(?!(__se__|se-|katex))/.test(v[i].trim())) continue;
|
|
5370
|
+
// if (lowLevelCheck && /^class="(?!(__se__|se-|katex))/.test(v[i].trim())) continue;
|
|
5320
5371
|
t += ' ' + (/^(?:href|src)\s*=\s*('|"|\s)*javascript\s*\:/i.test(v[i].trim()) ? '' : v[i]);
|
|
5321
5372
|
}
|
|
5322
5373
|
}
|
|
@@ -5333,9 +5384,12 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5333
5384
|
_editFormat: function (dom) {
|
|
5334
5385
|
let value = '', f;
|
|
5335
5386
|
const tempTree = dom.childNodes;
|
|
5387
|
+
|
|
5336
5388
|
for (let i = 0, len = tempTree.length, n; i < len; i++) {
|
|
5337
5389
|
n = tempTree[i];
|
|
5338
|
-
if
|
|
5390
|
+
if (n.nodeType === 8) {
|
|
5391
|
+
value += '<!-- ' + n.textContent + ' -->';
|
|
5392
|
+
} else if (!util.isFormatElement(n) && !util.isRangeFormatElement(n) && !util.isComponent(n) && !/meta/i.test(n.nodeName)) {
|
|
5339
5393
|
if (!f) f = util.createElement(options.defaultTag);
|
|
5340
5394
|
f.appendChild(n);
|
|
5341
5395
|
i--; len--;
|
|
@@ -5958,25 +6012,24 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5958
6012
|
this.codeViewDisabledButtons = context.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-code-view-enabled"]):not([data-display="MORE"])');
|
|
5959
6013
|
this.resizingDisabledButtons = context.element._buttonTray.querySelectorAll('.se-menu-list button[data-display]:not([class~="se-resizing-enabled"]):not([data-display="MORE"])');
|
|
5960
6014
|
|
|
5961
|
-
this._saveButtonStates();
|
|
5962
|
-
|
|
5963
6015
|
const tool = context.tool;
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
this.commandMap[options.textTags.sup.toUpperCase()] = tool.superscript;
|
|
6016
|
+
const commandMap = this.commandMap;
|
|
6017
|
+
commandMap.INDENT = tool.indent;
|
|
6018
|
+
commandMap.OUTDENT = tool.outdent;
|
|
6019
|
+
commandMap[options.textTags.bold.toUpperCase()] = tool.bold;
|
|
6020
|
+
commandMap[options.textTags.underline.toUpperCase()] = tool.underline;
|
|
6021
|
+
commandMap[options.textTags.italic.toUpperCase()] = tool.italic;
|
|
6022
|
+
commandMap[options.textTags.strike.toUpperCase()] = tool.strike;
|
|
6023
|
+
commandMap[options.textTags.sub.toUpperCase()] = tool.subscript;
|
|
6024
|
+
commandMap[options.textTags.sup.toUpperCase()] = tool.superscript;
|
|
5974
6025
|
|
|
5975
6026
|
this._styleCommandMap = {
|
|
5976
6027
|
fullScreen: tool.fullScreen,
|
|
5977
6028
|
showBlocks: tool.showBlocks,
|
|
5978
6029
|
codeView: tool.codeView
|
|
5979
6030
|
};
|
|
6031
|
+
|
|
6032
|
+
this._saveButtonStates();
|
|
5980
6033
|
},
|
|
5981
6034
|
|
|
5982
6035
|
/**
|
|
@@ -6020,9 +6073,9 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
6020
6073
|
_w.setTimeout(function () {
|
|
6021
6074
|
const h = core._iframeAuto.offsetHeight;
|
|
6022
6075
|
context.element.wysiwygFrame.style.height = h + 'px';
|
|
6023
|
-
if (util.
|
|
6076
|
+
if (!util.isResizeObserverSupported) core.__callResizeFunction(h, null);
|
|
6024
6077
|
});
|
|
6025
|
-
} else if (util.
|
|
6078
|
+
} else if (!util.isResizeObserverSupported) {
|
|
6026
6079
|
core.__callResizeFunction(context.element.wysiwygFrame.offsetHeight, null);
|
|
6027
6080
|
}
|
|
6028
6081
|
},
|
|
@@ -6183,10 +6236,10 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
6183
6236
|
if (event._resizeObserver) event._resizeObserver.observe(context.element.wysiwygFrame);
|
|
6184
6237
|
if (event._toolbarObserver) event._toolbarObserver.observe(context.element._toolbarShadow);
|
|
6185
6238
|
// resource state
|
|
6186
|
-
|
|
6239
|
+
this._resourcesStateChange();
|
|
6187
6240
|
// user event
|
|
6188
6241
|
if (typeof functions.onload === 'function') functions.onload(core, reload);
|
|
6189
|
-
});
|
|
6242
|
+
}.bind(this));
|
|
6190
6243
|
},
|
|
6191
6244
|
|
|
6192
6245
|
/**
|
|
@@ -6763,7 +6816,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
6763
6816
|
if (!siblingNode) {
|
|
6764
6817
|
siblingNode = util.getFormatElement(container);
|
|
6765
6818
|
siblingNode = siblingNode ? siblingNode[siblingKey] : null;
|
|
6766
|
-
if (siblingNode && !util.isComponent(siblingNode)) siblingNode = siblingKey === 'previousSibling' ? siblingNode.
|
|
6819
|
+
if (siblingNode && !util.isComponent(siblingNode)) siblingNode = siblingKey === 'previousSibling' ? siblingNode.firstChild : siblingNode.lastChild;
|
|
6767
6820
|
else return null;
|
|
6768
6821
|
}
|
|
6769
6822
|
|
|
@@ -6896,6 +6949,13 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
6896
6949
|
break;
|
|
6897
6950
|
}
|
|
6898
6951
|
|
|
6952
|
+
// format attributes
|
|
6953
|
+
if (!selectRange && core._isEdgeFormat(range.startContainer, range.startOffset, 'start')) {
|
|
6954
|
+
if (util.isFormatElement(formatEl.previousElementSibling)) {
|
|
6955
|
+
core._formatAttrsTemp = formatEl.previousElementSibling.attributes;
|
|
6956
|
+
}
|
|
6957
|
+
}
|
|
6958
|
+
|
|
6899
6959
|
// nested list
|
|
6900
6960
|
const commonCon = range.commonAncestorContainer;
|
|
6901
6961
|
formatEl = util.getFormatElement(range.startContainer, null);
|
|
@@ -6982,7 +7042,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
6982
7042
|
const prev = formatEl.previousSibling;
|
|
6983
7043
|
// select file component
|
|
6984
7044
|
const ignoreZWS = (commonCon.nodeType === 3 || util.isBreak(commonCon)) && !commonCon.previousSibling && range.startOffset === 0;
|
|
6985
|
-
if (!sel.previousSibling && (util.isComponent(commonCon.previousSibling) || (ignoreZWS && util.isComponent(prev)))) {
|
|
7045
|
+
if (sel && !sel.previousSibling && ( (commonCon && util.isComponent(commonCon.previousSibling)) || (ignoreZWS && util.isComponent(prev)))) {
|
|
6986
7046
|
const fileComponentInfo = core.getFileComponent(prev);
|
|
6987
7047
|
if (fileComponentInfo) {
|
|
6988
7048
|
e.preventDefault();
|
|
@@ -6997,7 +7057,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
6997
7057
|
break;
|
|
6998
7058
|
}
|
|
6999
7059
|
// delete nonEditable
|
|
7000
|
-
if (util.isNonEditable(sel.previousSibling)) {
|
|
7060
|
+
if (sel && util.isNonEditable(sel.previousSibling)) {
|
|
7001
7061
|
e.preventDefault();
|
|
7002
7062
|
e.stopPropagation();
|
|
7003
7063
|
util.removeItem(sel.previousSibling);
|
|
@@ -7075,6 +7135,13 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7075
7135
|
}
|
|
7076
7136
|
}
|
|
7077
7137
|
|
|
7138
|
+
// format attributes
|
|
7139
|
+
if (!selectRange && core._isEdgeFormat(range.endContainer, range.endOffset, 'end')) {
|
|
7140
|
+
if (util.isFormatElement(formatEl.nextElementSibling)) {
|
|
7141
|
+
core._formatAttrsTemp = formatEl.attributes;
|
|
7142
|
+
}
|
|
7143
|
+
}
|
|
7144
|
+
|
|
7078
7145
|
// nested list
|
|
7079
7146
|
formatEl = util.getFormatElement(range.startContainer, null);
|
|
7080
7147
|
rangeEl = util.getRangeFormatElement(formatEl, null);
|
|
@@ -7256,17 +7323,19 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7256
7323
|
}
|
|
7257
7324
|
|
|
7258
7325
|
if (!shift) {
|
|
7259
|
-
const
|
|
7260
|
-
|
|
7326
|
+
const formatEndEdge = core._isEdgeFormat(range.endContainer, range.endOffset, 'end');
|
|
7327
|
+
const formatStartEdge = core._isEdgeFormat(range.startContainer, range.startOffset, 'start');
|
|
7328
|
+
// add default format line
|
|
7329
|
+
if (formatEndEdge && (/^H[1-6]$/i.test(formatEl.nodeName) || /^HR$/i.test(formatEl.nodeName))) {
|
|
7261
7330
|
e.preventDefault();
|
|
7262
7331
|
let temp = null;
|
|
7263
7332
|
const newFormat = core.appendFormatTag(formatEl, options.defaultTag);
|
|
7264
7333
|
|
|
7265
|
-
if (
|
|
7266
|
-
temp =
|
|
7334
|
+
if (formatEndEdge && formatEndEdge.length > 0) {
|
|
7335
|
+
temp = formatEndEdge.pop();
|
|
7267
7336
|
const innerNode = temp;
|
|
7268
|
-
while(
|
|
7269
|
-
temp = temp.appendChild(
|
|
7337
|
+
while(formatEndEdge.length > 0) {
|
|
7338
|
+
temp = temp.appendChild(formatEndEdge.pop());
|
|
7270
7339
|
}
|
|
7271
7340
|
newFormat.appendChild(innerNode);
|
|
7272
7341
|
}
|
|
@@ -7274,7 +7343,28 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7274
7343
|
temp = !temp ? newFormat.firstChild : temp.appendChild(newFormat.firstChild);
|
|
7275
7344
|
core.setRange(temp, 0, temp, 0);
|
|
7276
7345
|
break;
|
|
7277
|
-
}
|
|
7346
|
+
}
|
|
7347
|
+
|
|
7348
|
+
// set format attrs - edge
|
|
7349
|
+
if (formatStartEdge || formatEndEdge) {
|
|
7350
|
+
e.preventDefault();
|
|
7351
|
+
const focusBR = util.createElement('BR');
|
|
7352
|
+
const newFormat = util.createElement(formatEl.nodeName);
|
|
7353
|
+
newFormat.appendChild(focusBR);
|
|
7354
|
+
|
|
7355
|
+
util.copyTagAttributes(newFormat, formatEl, ['id'].concat(options.lineAttrReset));
|
|
7356
|
+
|
|
7357
|
+
formatEl.parentNode.insertBefore(newFormat, formatStartEdge ? formatEl : formatEl.nextElementSibling);
|
|
7358
|
+
if (formatEndEdge) {
|
|
7359
|
+
core.setRange(focusBR, 1, focusBR, 1);
|
|
7360
|
+
}
|
|
7361
|
+
|
|
7362
|
+
break;
|
|
7363
|
+
} else {
|
|
7364
|
+
core._formatAttrsTemp = formatEl.attributes;
|
|
7365
|
+
}
|
|
7366
|
+
|
|
7367
|
+
if (options.lineAttrReset && formatEl && !util.isListCell(formatEl)) {
|
|
7278
7368
|
e.preventDefault();
|
|
7279
7369
|
e.stopPropagation();
|
|
7280
7370
|
|
|
@@ -7300,11 +7390,11 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7300
7390
|
else newEl = util.splitElement(range.endContainer, range.endOffset, 0);
|
|
7301
7391
|
}
|
|
7302
7392
|
|
|
7303
|
-
const resetAttr = options.lineAttrReset
|
|
7393
|
+
const resetAttr = options.lineAttrReset;
|
|
7304
7394
|
const attrs = newEl.attributes;
|
|
7305
7395
|
let i = 0;
|
|
7306
7396
|
while (attrs[i]) {
|
|
7307
|
-
if (resetAttr && resetAttr.
|
|
7397
|
+
if (resetAttr && resetAttr.indexOf(attrs[i].name.toLowerCase()) > -1) {
|
|
7308
7398
|
i++;
|
|
7309
7399
|
continue;
|
|
7310
7400
|
}
|
|
@@ -7516,6 +7606,19 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7516
7606
|
|
|
7517
7607
|
const formatEl = util.getFormatElement(selectionNode, null);
|
|
7518
7608
|
const rangeEl = util.getRangeFormatElement(selectionNode, null);
|
|
7609
|
+
const attrs = core._formatAttrsTemp;
|
|
7610
|
+
|
|
7611
|
+
if (attrs) {
|
|
7612
|
+
for (let i = 0, len = attrs.length; i < len; i++) {
|
|
7613
|
+
if (keyCode === 13 && /^id$/i.test(attrs[i].name)) {
|
|
7614
|
+
formatEl.removeAttribute('id');
|
|
7615
|
+
continue;
|
|
7616
|
+
}
|
|
7617
|
+
formatEl.setAttribute(attrs[i].name, attrs[i].value);
|
|
7618
|
+
}
|
|
7619
|
+
core._formatAttrsTemp = null;
|
|
7620
|
+
}
|
|
7621
|
+
|
|
7519
7622
|
if (!formatEl && range.collapsed && !util.isComponent(selectionNode) && !util.isList(selectionNode) && core._setDefaultFormat(util.isRangeFormatElement(rangeEl) ? 'DIV' : options.defaultTag) !== null) {
|
|
7520
7623
|
selectionNode = core.getSelectionNode();
|
|
7521
7624
|
}
|
|
@@ -7576,9 +7679,8 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7576
7679
|
core._variable.currentNodes = [];
|
|
7577
7680
|
core._variable.currentNodesMap = [];
|
|
7578
7681
|
if (options.showPathLabel) context.element.navigation.textContent = '';
|
|
7579
|
-
|
|
7580
7682
|
// user event
|
|
7581
|
-
if (typeof functions.onBlur === 'function') functions.onBlur(e, core);
|
|
7683
|
+
if (typeof functions.onBlur === 'function') functions.onBlur(e, core,this);
|
|
7582
7684
|
},
|
|
7583
7685
|
|
|
7584
7686
|
onMouseDown_resizingBar: function (e) {
|
|
@@ -7605,13 +7707,15 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7605
7707
|
const h = (resizeInterval < core._variable.minResizingSize ? core._variable.minResizingSize : resizeInterval);
|
|
7606
7708
|
context.element.wysiwygFrame.style.height = context.element.code.style.height = h + 'px';
|
|
7607
7709
|
core._variable.resizeClientY = e.clientY;
|
|
7608
|
-
if (util.
|
|
7710
|
+
if (!util.isResizeObserverSupported) core.__callResizeFunction(h, null);
|
|
7609
7711
|
},
|
|
7610
7712
|
|
|
7611
7713
|
onResize_window: function () {
|
|
7612
|
-
if (util.
|
|
7714
|
+
if (!util.isResizeObserverSupported) core.resetResponsiveToolbar();
|
|
7613
7715
|
|
|
7614
|
-
|
|
7716
|
+
const toolbar = context.element.toolbar;
|
|
7717
|
+
const isToolbarHidden = (toolbar.style.display === 'none' || (core._isInline && !core._inlineToolbarAttr.isShow));
|
|
7718
|
+
if (toolbar.offsetWidth === 0 && !isToolbarHidden) return;
|
|
7615
7719
|
|
|
7616
7720
|
if (context.fileBrowser && context.fileBrowser.area.style.display === 'block') {
|
|
7617
7721
|
context.fileBrowser.body.style.maxHeight = (_w.innerHeight - context.fileBrowser.header.offsetHeight - 50) + 'px';
|
|
@@ -7622,7 +7726,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7622
7726
|
}
|
|
7623
7727
|
|
|
7624
7728
|
if (core._variable.isFullScreen) {
|
|
7625
|
-
core._variable.innerHeight_fullScreen += (_w.innerHeight -
|
|
7729
|
+
core._variable.innerHeight_fullScreen += (_w.innerHeight - toolbar.offsetHeight) - core._variable.innerHeight_fullScreen;
|
|
7626
7730
|
context.element.editorArea.style.height = core._variable.innerHeight_fullScreen + 'px';
|
|
7627
7731
|
return;
|
|
7628
7732
|
}
|
|
@@ -7635,7 +7739,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7635
7739
|
core._iframeAutoHeight();
|
|
7636
7740
|
|
|
7637
7741
|
if (core._sticky) {
|
|
7638
|
-
|
|
7742
|
+
toolbar.style.width = (context.element.topArea.offsetWidth - 2) + 'px';
|
|
7639
7743
|
event.onScroll_window();
|
|
7640
7744
|
}
|
|
7641
7745
|
},
|
|
@@ -7763,7 +7867,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7763
7867
|
const clipboardData = util.isIE ? _w.clipboardData : e.clipboardData;
|
|
7764
7868
|
|
|
7765
7869
|
// user event
|
|
7766
|
-
if (typeof functions.onCopy === 'function' &&
|
|
7870
|
+
if (typeof functions.onCopy === 'function' && functions.onCopy(e, clipboardData, core) === false) {
|
|
7767
7871
|
e.preventDefault();
|
|
7768
7872
|
e.stopPropagation();
|
|
7769
7873
|
return false;
|
|
@@ -7792,7 +7896,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7792
7896
|
const clipboardData = util.isIE ? _w.clipboardData : e.clipboardData;
|
|
7793
7897
|
|
|
7794
7898
|
// user event
|
|
7795
|
-
if (typeof functions.onCut === 'function' &&
|
|
7899
|
+
if (typeof functions.onCut === 'function' && functions.onCut(e, clipboardData, core) === false) {
|
|
7796
7900
|
e.preventDefault();
|
|
7797
7901
|
e.stopPropagation();
|
|
7798
7902
|
return false;
|
|
@@ -7887,8 +7991,6 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7887
7991
|
if (MSData) {
|
|
7888
7992
|
cleanData = cleanData.replace(/\n/g, ' ');
|
|
7889
7993
|
plainText = plainText.replace(/\n/g, ' ');
|
|
7890
|
-
} else {
|
|
7891
|
-
cleanData = (plainText === cleanData ? plainText : cleanData).replace(/\n/g, '<br>');
|
|
7892
7994
|
}
|
|
7893
7995
|
cleanData = core.cleanHTML(cleanData, core.pasteTagsWhitelistRegExp, core.pasteTagsBlacklistRegExp);
|
|
7894
7996
|
} else {
|
|
@@ -7899,14 +8001,22 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7899
8001
|
// user event - paste
|
|
7900
8002
|
if (type === 'paste' && typeof functions.onPaste === 'function') {
|
|
7901
8003
|
const value = functions.onPaste(e, cleanData, maxCharCount, core);
|
|
7902
|
-
if (
|
|
7903
|
-
|
|
8004
|
+
if (value === false) {
|
|
8005
|
+
return false;
|
|
8006
|
+
} else if (typeof value === 'string') {
|
|
8007
|
+
if (!value) return false;
|
|
8008
|
+
cleanData = value;
|
|
8009
|
+
}
|
|
7904
8010
|
}
|
|
7905
8011
|
// user event - drop
|
|
7906
8012
|
if (type === 'drop' && typeof functions.onDrop === 'function') {
|
|
7907
8013
|
const value = functions.onDrop(e, cleanData, maxCharCount, core);
|
|
7908
|
-
if (
|
|
7909
|
-
|
|
8014
|
+
if (value === false) {
|
|
8015
|
+
return false;
|
|
8016
|
+
} else if (typeof value === 'string') {
|
|
8017
|
+
if (!value) return false;
|
|
8018
|
+
cleanData = value;
|
|
8019
|
+
}
|
|
7910
8020
|
}
|
|
7911
8021
|
|
|
7912
8022
|
// files
|
|
@@ -8002,7 +8112,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
8002
8112
|
_toolbarObserver: null,
|
|
8003
8113
|
_addEvent: function () {
|
|
8004
8114
|
const eventWysiwyg = options.iframe ? core._ww : context.element.wysiwyg;
|
|
8005
|
-
if (
|
|
8115
|
+
if (util.isResizeObserverSupported) {
|
|
8006
8116
|
this._resizeObserver = new _w.ResizeObserver(function(entries) {
|
|
8007
8117
|
core.__callResizeFunction(-1, entries[0]);
|
|
8008
8118
|
});
|
|
@@ -8059,7 +8169,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
8059
8169
|
event._setResponsiveToolbar();
|
|
8060
8170
|
|
|
8061
8171
|
/** responsive toolbar observer */
|
|
8062
|
-
if (
|
|
8172
|
+
if (util.isResizeObserverSupported) this._toolbarObserver = new _w.ResizeObserver(core.resetResponsiveToolbar);
|
|
8063
8173
|
|
|
8064
8174
|
/** window event */
|
|
8065
8175
|
_w.addEventListener('resize', event.onResize_window, false);
|
|
@@ -8162,6 +8272,13 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
8162
8272
|
onCopy: null,
|
|
8163
8273
|
onCut: null,
|
|
8164
8274
|
onFocus: null,
|
|
8275
|
+
|
|
8276
|
+
/**
|
|
8277
|
+
* @description Event functions
|
|
8278
|
+
* @param {Object} e Event Object
|
|
8279
|
+
* @param {Object} core Core object
|
|
8280
|
+
* @param {String} contents Current contents
|
|
8281
|
+
*/
|
|
8165
8282
|
onBlur: null,
|
|
8166
8283
|
|
|
8167
8284
|
/**
|
|
@@ -8894,6 +9011,8 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
8894
9011
|
context.element.toolbar.style.display = '';
|
|
8895
9012
|
context.element._stickyDummy.style.display = '';
|
|
8896
9013
|
}
|
|
9014
|
+
|
|
9015
|
+
event.onResize_window();
|
|
8897
9016
|
},
|
|
8898
9017
|
|
|
8899
9018
|
/**
|
|
@@ -8906,6 +9025,8 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
8906
9025
|
context.element.toolbar.style.display = 'none';
|
|
8907
9026
|
context.element._stickyDummy.style.display = 'none';
|
|
8908
9027
|
}
|
|
9028
|
+
|
|
9029
|
+
event.onResize_window();
|
|
8909
9030
|
},
|
|
8910
9031
|
},
|
|
8911
9032
|
|