suneditor 2.44.4 → 2.44.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suneditor",
3
- "version": "2.44.4",
3
+ "version": "2.44.6",
4
4
  "description": "Pure JavaScript based WYSIWYG web editor",
5
5
  "author": "JiHong.Lee",
6
6
  "license": "MIT",
package/src/lib/core.js CHANGED
@@ -1150,7 +1150,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
1150
1150
  */
1151
1151
  getSelection: function () {
1152
1152
  const selection = this._shadowRoot && this._shadowRoot.getSelection ? this._shadowRoot.getSelection() : this._ww.getSelection();
1153
- if (!context.element.wysiwyg.contains(selection.focusNode)) {
1153
+ if (!this._variable._range && !context.element.wysiwyg.contains(selection.focusNode)) {
1154
1154
  selection.removeAllRanges();
1155
1155
  selection.addRange(this._createDefaultRange());
1156
1156
  }
@@ -5082,11 +5082,10 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
5082
5082
  setContents: function (html) {
5083
5083
  this.removeRange();
5084
5084
 
5085
- const convertValue = (html === null || html === undefined) ? '' : this.cleanHTML(html, null, null);
5086
- this._resetComponents();
5087
-
5085
+ const convertValue = (html === null || html === undefined) ? '' : this.convertContentsForEditor(html, null, null);
5088
5086
  if (!this._variable.isCodeView) {
5089
5087
  context.element.wysiwyg.innerHTML = convertValue;
5088
+ this._resetComponents();
5090
5089
  // history stack
5091
5090
  this.history.push(false);
5092
5091
  } else {
@@ -5103,6 +5102,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
5103
5102
  if (!options.iframe) return false;
5104
5103
  if (ctx.head) this._wd.head.innerHTML = ctx.head.replace(/<script[\s\S]*>[\s\S]*<\/script>/gi, '');
5105
5104
  if (ctx.body) this._wd.body.innerHTML = this.convertContentsForEditor(ctx.body);
5105
+ this._resetComponents();
5106
5106
  },
5107
5107
 
5108
5108
  /**
@@ -5153,6 +5153,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
5153
5153
  // element
5154
5154
  if (node.nodeType === 1) {
5155
5155
  if (util._disallowedTags(node)) return '';
5156
+ if (/__se__tag/.test(node.className)) return node.outerHTML;
5156
5157
 
5157
5158
  const ch = util.getListChildNodes(node, function(current) { return util.isSpanWithoutAttr(current) && !util.getParentElement(current, util.isNotCheckingNode); }) || [];
5158
5159
  for (let i = ch.length - 1; i >= 0; i--) {
@@ -5457,7 +5458,6 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
5457
5458
  */
5458
5459
  cleanHTML: function (html, whitelist, blacklist) {
5459
5460
  html = this._deleteDisallowedTags(this._parser.parseFromString(html, 'text/html').body.innerHTML).replace(/(<[a-zA-Z0-9\-]+)[^>]*(?=>)/g, this._cleanTags.bind(this, true));
5460
-
5461
5461
  const dom = _d.createRange().createContextualFragment(html);
5462
5462
  try {
5463
5463
  util._consistencyCheckOfHTML(dom, this._htmlCheckWhitelistRegExp, this._htmlCheckBlacklistRegExp, true);
@@ -5536,7 +5536,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
5536
5536
  for (let i = 0, t; i < domTree.length; i++) {
5537
5537
  t = domTree[i];
5538
5538
 
5539
- if (!util.isFormatElement(t) && !util.isRangeFormatElement(t) && !util.isComponent(t) && !util.isMedia(t) && t.nodeType !== 8) {
5539
+ if (!util.isFormatElement(t) && !util.isRangeFormatElement(t) && !util.isComponent(t) && !util.isMedia(t) && t.nodeType !== 8 && !/__se__tag/.test(t.className)) {
5540
5540
  if (!p) p = util.createElement(options.defaultTag);
5541
5541
  p.appendChild(t);
5542
5542
  i--;