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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suneditor",
3
- "version": "2.43.9",
3
+ "version": "2.43.12",
4
4
  "description": "Pure JavaScript based WYSIWYG web editor",
5
5
  "author": "JiHong.Lee",
6
6
  "license": "MIT",
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, tagName) {
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[tagName]);
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
- const textKey = !ctrl && !alt && !selectRange && !event._nonTextKeyCode.test(keyCode);
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
@@ -94,6 +94,10 @@ export interface SunEditorOptions {
94
94
  * Top offset value of "sticky toolbar".
95
95
  */
96
96
  stickyToolbar?: number | string;
97
+ /**
98
+ * The toolbar is rendered hidden.
99
+ */
100
+ hideToolbar?: boolean;
97
101
  /**
98
102
  * Top offset value of "full Screen".
99
103
  */