Skip to content

Commit

Permalink
Merge pull request #1339 from iveretelnyk/master
Browse files Browse the repository at this point in the history
replace invisible charatcer U+00a0 with real whitespace so it does no…
  • Loading branch information
JiHong88 authored Dec 6, 2023
2 parents 4210ad8 + 50f9883 commit 938a4c5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion dist/suneditor.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/lib/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ interface Core {

/**
* @description Remove events from document.
  * When created as an Iframe, the event of the document inside the Iframe is also removed.
* When created as an Iframe, the event of the document inside the Iframe is also removed.
* @param type Event type
* @param listener Event listener
*/
Expand Down
6 changes: 3 additions & 3 deletions src/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1162,10 +1162,10 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re
* @returns {Node}
*/
getSelectionNode: function () {
if (!context.element.wysiwyg.contains(this._variable._selectionNode)) this._editorRange();
if (!context.element.wysiwyg.contains(this._variable._selectionNode)) this._editorRange();
if (!this._variable._selectionNode) {
const selectionNode = util.getChildElement(context.element.wysiwyg.firstChild, function (current) { return current.childNodes.length === 0 || current.nodeType === 3; }, false);
if (!selectionNode) {
if (!selectionNode) {
this._editorRange();
} else {
this._variable._selectionNode = selectionNode;
Expand Down Expand Up @@ -5662,7 +5662,7 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re

/**
* @description Remove events from document.
  * When created as an Iframe, the event of the document inside the Iframe is also removed.
* When created as an Iframe, the event of the document inside the Iframe is also removed.
* @param {String} type Event type
* @param {Function} listener Event listener
*/
Expand Down
6 changes: 3 additions & 3 deletions src/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const util = {
* @private
*/
_HTMLConvertor: function (contents) {
const ec = {'&': '&amp;', '\u00A0': '&nbsp;', '\'': '&apos;', '"': '&quot;', '<': '&lt;', '>': '&gt;'};
const ec = {'&': '&amp;', '\u00A0': '&nbsp;', '\'': '&apos;', '"': '&quot;', '<': '&lt;', '>': '&gt;'};
return contents.replace(/&|\u00A0|'|"|<|>/g, function (m) {
return (typeof ec[m] === 'string') ? ec[m] : m;
});
Expand Down Expand Up @@ -170,7 +170,7 @@ const util = {
* @returns {String}
*/
HTMLEncoder: function (contents) {
const ec = {'<': '$lt;', '>': '$gt;'};
const ec = {'<': '$lt;', '>': '$gt;'};
return contents.replace(/<|>/g, function (m) {
return (typeof ec[m] === 'string') ? ec[m] : m;
});
Expand All @@ -184,7 +184,7 @@ const util = {
* @returns {String}
*/
HTMLDecoder: function (contents) {
const ec = {'$lt;': '<', '$gt;': '>'};
const ec = {'$lt;': '<', '$gt;': '>'};
return contents.replace(/\$lt;|\$gt;/g, function (m) {
return (typeof ec[m] === 'string') ? ec[m] : m;
});
Expand Down

0 comments on commit 938a4c5

Please sign in to comment.