suneditor
suneditor copied to clipboard
character count != editor.getContents().length when using "byte-html"
Describe the bug In the resize bar, one can let the number of characters be shown. The characters counted as "byte-html" as stated there is (in some cases) larger than when doing editor.getContents().length.
It was noted these attributes were not present in the image when calling editor.getContents(): data-rotatex="" data-rotatey="" data-index="0". There could be more attributes missing.
To Reproduce (Only tested when inserting an image)
- Initialize the editor with the image plugin and {maxCharCount: 100000, charCounterType: "byte-html"}
- Insert an image from disk (using the button from the toolbar) [it should be inserted using base64-encoding]
- See the number of "characters" as stated in the resizebar below
- Compare this number with the number when calling editor.getContents().length
Expected behavior Presuming calling editor.getContents() is the way to go to extract what was entered (as what is to be saved in a database, for example), I expect the user to be able to accurately see how many characters he is "consuming" (also when putting in media).
Screenshots
Desktop:
- OS: Windows
- Browser: Vivalidi (Chromium-based)
- Version: 2.45.1