I’m using TinyMCE(^6.7.2) and when I type my text in the TinyMCE Editor with an initial value, the cursor constantly returns at the start of the text. The project is made of React.
My Function
const handleSetContent = () => {
if (editorRef.current) {
setContent(editorRef.current.getContent());
}
};
My Editor
<Editor
apiKey={process.env.REACT_APP_TINY_API_KEY}
onInit={(_event, editor) => {
editorRef.current = editor;
}}
value={contentValue}
onChange={handleSetContent}
init={{
height: 700,
menubar: true,
language: 'ko_KR',
object_resizing: 'img',
plugins: [
'advlist',
'autolink',
'lists',
'link',
'image',
'charmap',
'searchreplace',
'visualblocks',
'code',
'fullscreen',
'media',
'table',
'code',
'help',
'wordcount',
],
toolbar:
'undo redo | blocks | fontsize fontfamily |' +
'bold italic underline forecolor | alignleft aligncenter ' +
'alignright alignjustify | bullist numlist outdent indent lineheight | ' +
'removeformat | image link media | code | table',
font_family_formats:
'Pretendard=Pretendard,sans-serif; 나눔스퀘어라운드=NanumSquareRound,sans-serif; 나눔고딕=Nanum Gothic,sans-serif; 나눔명조=Nanum Myeongjo,serif; Noto Sans KR=noto sans kr,sans-serif;',
font_size_formats: '8px 10px 12px 14px 16px 18px 20px 22px 24px 26px 28px 30px 32px 34px 36px 48px',
line_height_formats: '0.5 0.7 1 1.2 1.4 1.6 2',
block_formats: '본문=p; 제목2=h2; 제목3=h3; 제목4=h4',
images_reuse_filename: true,
image_advtab: true,
convert_urls: true,
relative_urls: false,
remove_script_host: false,
}}
/>
I tried two attempts, but neither worked.
- Change
initialValue={contentValue}
tovalue={contentValue}
andnewValue={contentValue}
. - Change
onChange={handleSetContent}
toonEditorChange={handleSetContent}
.
New contributor
jekim is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.