JiHong88 / suneditor

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

Error with StrictMode option for _setDefaultFormat #1401

Closed ilcary closed 4 months ago

ilcary commented 4 months ago

Describe the bug On the last version of the SunEditor 2.46.2 the StrictMode option is causing a input managment error. While the flag StrictMode is true the suneditor on the onKeyUp_wysiwyg function and more exactly in the _setDefaultFormat is throwing the error: Uncaught TypeError: format is undefined

To Reproduce Steps to reproduce the behavior:

  1. Go to 'SunEditor with these configs: { "strictMode": true, "value": "<span>Ciao</span>", "mode": "classic", "rtl": false, "katex": "window.katex", "resizingBar": false, "showPathLabel": false, "resizeEnable": false, "imageResizing": false, "imageHeightShow": false, "imageAlignShow": false, "imageFileInput": false, "imageUrlInput": false, "videoResizing": false, "videoHeightShow": false, "videoAlignShow": false, "videoFileInput": false, "videoUrlInput": false, "videoRatioShow": false, "audioUrlInput": false, "tabDisable": false, "shortcutsHint": false, "mediaAutoSelect": false, "buttonList": [ [ "undo", "redo", "font", "fontSize", "formatBlock", "paragraphStyle", "blockquote", "bold", "underline", "italic", "strike", "subscript", "superscript", "fontColor", "hiliteColor", "textStyle", "removeFormat", "outdent", "indent", "align", "horizontalRule", "list", "lineHeight", "table", "link", "image", "video", "audio", "math", "imageGallery", "fullScreen", "showBlocks", "codeView", "preview", "print", "save", "template" ] ], "lang": "SUNEDITOR_LANG.it", "lang(In nodejs)": "it" }

'

  1. Click on 'With focus on the text value -> press "Enter then Ctrl + A, then backspace" As you can see from the attach:

image

'

Expected behavior To manage properly the input without strictMode active :)

Desktop:

Desktop 2:

77DDS77 commented 4 months ago

Had the same issue, wasn't able to solve. I'll follow the thread to see any updates on this, best of luck.

Kryostatic94 commented 4 months ago

Please I have the same error and I can't solve it, I will follow this topic for updates

johnnybaida commented 4 months ago

+1

davide-lombardo commented 4 months ago

Same issue here, I'll follow to see any updates on this.

JiHong88 commented 4 months ago

Could it be a browser cache issue? I cannot reproduce the issue.

johnnybaida commented 4 months ago

Could it be a browser cache issue? I cannot reproduce the issue.

I am using Firefox version 126.0 and it does not seem to be a caching problem.

I tried it this way:

  1. Open this link: http://suneditor.com/sample/html/examples.html
  2. Select the strictMode checkbox
  3. Select the Value checkbox
  4. Write in the Value textarea the following HTML code: <span>Ciao</span>
  5. Click on the Create button
  6. Click inside the editor, with the focus at the end of the word Ciao immagine
  7. Press Enter from keyboard to wrap immagine
  8. Press CTRL+A to select all the text (on Windows) immagine
  9. Press BackSpace from keyboard to delete immagine
JiHong88 commented 4 months ago

@johnnybaida Thank you. I will release a new version asap.

JiHong88 commented 4 months ago

Version 2.46.3 has been updated. thank you