suneditor 2.43.9 → 2.43.12
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.js +7 -12
- package/src/options.d.ts +4 -0
package/package.json
CHANGED
package/src/lib/core.js
CHANGED
|
@@ -5102,11 +5102,11 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5102
5102
|
.replace(this.editorTagsBlacklistRegExp, '');
|
|
5103
5103
|
},
|
|
5104
5104
|
|
|
5105
|
-
_cleanStyle: function (m, v,
|
|
5105
|
+
_cleanStyle: function (m, v, name) {
|
|
5106
5106
|
const sv = m.match(/style\s*=\s*(?:"|')[^"']*(?:"|')/);
|
|
5107
5107
|
if (sv) {
|
|
5108
5108
|
if (!v) v = [];
|
|
5109
|
-
const style = sv[0].replace(/"/g, '').match(this._cleanStyleRegExp[
|
|
5109
|
+
const style = sv[0].replace(/"/g, '').match(this._cleanStyleRegExp[name]);
|
|
5110
5110
|
if (style) {
|
|
5111
5111
|
const allowedStyle = [];
|
|
5112
5112
|
for (let i = 0, len = style.length, r; i < len; i++) {
|
|
@@ -5123,10 +5123,10 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5123
5123
|
if (!options.plugins.fontSize) continue;
|
|
5124
5124
|
break;
|
|
5125
5125
|
case 'color':
|
|
5126
|
-
if (!options.plugins.fontColor) continue;
|
|
5126
|
+
if (!options.plugins.fontColor || /rgba\(([0-9]+\s*,\s*){3}0\)/i.test(c)) continue;
|
|
5127
5127
|
break;
|
|
5128
5128
|
case 'backgroundColor':
|
|
5129
|
-
if (!options.plugins.hiliteColor) continue;
|
|
5129
|
+
if (!options.plugins.hiliteColor || /rgba\(([0-9]+\s*,\s*){3}0\)/i.test(c)) continue;
|
|
5130
5130
|
break;
|
|
5131
5131
|
}
|
|
5132
5132
|
|
|
@@ -5299,7 +5299,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5299
5299
|
* @returns {String}
|
|
5300
5300
|
*/
|
|
5301
5301
|
cleanHTML: function (html, whitelist, blacklist) {
|
|
5302
|
-
html = this._deleteDisallowedTags(this._parser.parseFromString(html, 'text/html').body.innerHTML).replace(/(<[a-zA-Z0-9\-]+)[^>]*(?=>)/g, this._cleanTags.bind(this, true));
|
|
5302
|
+
html = this._deleteDisallowedTags(this._parser.parseFromString(html, 'text/html').body.innerHTML).replace(/(<[a-zA-Z0-9\-]+)[^>]*(?=>)/g, this._cleanTags.bind(this, true)).replace(/^.+\x3C!--StartFragment--\>|\x3C!--EndFragment-->.+$/g, '');
|
|
5303
5303
|
|
|
5304
5304
|
const dom = _d.createRange().createContextualFragment(html);
|
|
5305
5305
|
try {
|
|
@@ -5379,7 +5379,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5379
5379
|
for (let i = 0, t; i < domTree.length; i++) {
|
|
5380
5380
|
t = domTree[i];
|
|
5381
5381
|
|
|
5382
|
-
if (!util.isFormatElement(t) && !util.isRangeFormatElement(t) && !util.isComponent(t) && !util.isMedia(t)) {
|
|
5382
|
+
if (!util.isFormatElement(t) && !util.isRangeFormatElement(t) && !util.isComponent(t) && !util.isMedia(t) && t.nodeType !== 8) {
|
|
5383
5383
|
if (!p) p = util.createElement(options.defaultTag);
|
|
5384
5384
|
p.appendChild(t);
|
|
5385
5385
|
i--;
|
|
@@ -5845,7 +5845,6 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
5845
5845
|
}
|
|
5846
5846
|
|
|
5847
5847
|
this._initWysiwygArea(reload, _initHTML);
|
|
5848
|
-
this.setDir(options.rtl ? 'rtl' : 'ltr');
|
|
5849
5848
|
},
|
|
5850
5849
|
|
|
5851
5850
|
/**
|
|
@@ -6325,15 +6324,12 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
6325
6324
|
|
|
6326
6325
|
if (!command && !display) return;
|
|
6327
6326
|
if (target.disabled) return;
|
|
6328
|
-
if (!core.isReadOnly && !core.hasFocus) core.nativeFocus();
|
|
6329
|
-
if (!core.isReadOnly && !core._variable.isCodeView) core._editorRange();
|
|
6330
6327
|
|
|
6331
6328
|
core.actionCall(command, display, target);
|
|
6332
6329
|
},
|
|
6333
6330
|
|
|
6334
6331
|
onMouseDown_wysiwyg: function (e) {
|
|
6335
6332
|
if (core.isReadOnly || util.isNonEditable(context.element.wysiwyg)) return;
|
|
6336
|
-
core._editorRange();
|
|
6337
6333
|
|
|
6338
6334
|
// user event
|
|
6339
6335
|
if (typeof functions.onMouseDown === 'function' && functions.onMouseDown(e, core) === false) return;
|
|
@@ -7359,8 +7355,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
|
|
|
7359
7355
|
}
|
|
7360
7356
|
}
|
|
7361
7357
|
|
|
7362
|
-
|
|
7363
|
-
if (textKey && range.collapsed && range.startContainer === range.endContainer && util.isBreak(range.commonAncestorContainer)) {
|
|
7358
|
+
if (util.isIE && !ctrl && !alt && !selectRange && !event._nonTextKeyCode.test(keyCode) && util.isBreak(range.commonAncestorContainer)) {
|
|
7364
7359
|
const zeroWidth = util.createTextNode(util.zeroWidthSpace);
|
|
7365
7360
|
core.insertNode(zeroWidth, null, false);
|
|
7366
7361
|
core.setRange(zeroWidth, 1, zeroWidth, 1);
|
package/src/options.d.ts
CHANGED