JiHong88 / suneditor

Pure javascript based WYSIWYG html editor, with no dependencies.
http://suneditor.com
MIT License
1.67k stars 308 forks source link

Special caracters NBSP #1331

Open nkerebel opened 8 months ago

nkerebel commented 8 months ago

Version : 2.45.1


./node_modules/suneditor/src/lib/core.js
Error: 
  × Expected ';', '}' or <eof>
      ╭─[/var/www/ereemploi/application/node_modules/suneditor/src/lib/core.js:1162:1]
 1162 │          * @returns {Node}
 1163 │          */
 1164 │         getSelectionNode: function () {
 1165 │             if (!context.element.wysiwyg.contains(this._variable._selectionNode)) this._editorRange();
      ·             ───────────────────────────────────┬──────────────────────────────────  ────
      ·                                                ╰── This is the expression part of an expression statement
 1166 │             if (!this._variable._selectionNode) {
 1167 │                 const selectionNode = util.getChildElement(context.element.wysiwyg.firstChild, function (current) { return current.childNodes.length === 0 || current.nodeType === 3; }, false);
 1167 │                 if (!selectionNode) {
      ╰────

Caused by:
    Syntax Error

Import trace for requested module:
./node_modules/suneditor/src/lib/core.js
./node_modules/suneditor/src/suneditor.js
./node_modules/suneditor-react/dist/components/SunEditor.js
./node_modules/suneditor-react/dist/index.js
`

![Capture d’écran du 2023-11-16 09-09-40](https://github.com/JiHong88/suneditor/assets/130037475/93fbf960-8116-448f-a1d3-98c7a85f1ddf)
manojpudasaini commented 8 months ago

I am also getting this error while building . If webpack is used, it's building but in rollup it's throwing build error

iveretelnyk commented 7 months ago

Getting same error when building nextjs application

iveretelnyk commented 7 months ago

1164 | getSelectionNode: function () { 1165 | if (!context.element.wysiwyg.contains(this._variable._selectionNode)) this._editorRange(); : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^ : `-- This is the expression part of an expression statement

manojpudasaini commented 7 months ago

The workaround for now is by building the project by removing the specific character (nbsp)in the file from the specified file works fine. But, I really hope the dev team will fix it and provide a release soon.

cub commented 7 months ago

same as issue https://github.com/JiHong88/suneditor/issues/1337 link PR by iveretelnyk https://github.com/JiHong88/suneditor/pull/1339

melloware commented 7 months ago

This can be closed now the PR has been merged awaiting release.