JiHong88 / suneditor

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

charCounter:true -> functions.getCharCount is not a function #1417

Open raha-taheri opened 1 week ago

raha-taheri commented 1 week ago

Hello I use Sun Editor in a Next version 14 project along with React Hook Form. The problem is that when I set the property (charCounter: true), the following error occurs:

Unhandled Runtime Error TypeError: functions.getCharCount is not a function Call Stack HTMLSpanElement.eval node_modules\suneditor\src\lib\core.js (5813:1)

Editor component:

`import React from 'react' import dynamic from 'next/dynamic' import 'suneditor/dist/css/suneditor.min.css';

const SunEditor = dynamic(() => import('suneditor-react'), { loading: () =>

Loading...

, ssr: false, })

interface EditorProps { name: string; placeholder: string; }

// btnList // plugList

const Editor: React.FC = ({ name, placeholder }) => { return (

    <SunEditor
      name={name}
      placeholder={placeholder}
      autoFocus={true}
      setOptions={{
        mode: "classic",
        minHeight: "400px",
        rtl: true,
        charCounter: true,
        buttonList: btnList,
        plugins: plugList,

      }}
    />

) }

export default Editor` char