-
-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The new lines are cleared out after pressing "enter" #1505
Comments
I see the same behavior. |
The 2.47.4 version has been updated. |
@JiHong88, thank you for looking into this. For some reason I have still same issue. Video.Screen1738701474628.webm
codeinterface RichTextProps {
record: FileRecord
editedValue: MutableRefObject<SunEditorCore>
}
const RichText = ({ editedValue, record }: RichTextProps) => {
const OPTION: SunEditorOptions = {
resizingBar: false,
resizeEnable: false,
buttonList,
}
const getSunEditorInstance = (sunEditor: SunEditorCore) => {
editedValue.current = sunEditor
}
useEffect(() => {
if (editedValue.current) {
editedValue.current.setContents(record?.content)
}
}, [record?.content])
return <SunEditor getSunEditorInstance={getSunEditorInstance} setOptions={OPTION} height="80dvh" autoFocus={true} />
} on first enter it goes to top, on second enter it removes all new lines (I did refresh page before recording) content
|
I tried
and got same issue, can you please confirm that it can't be reproduced on your side #1505 (comment)? |
Hi! Something like this:
Here's an example on codepen.io: |
Hello @abvas , ok, I have created playground for React, and see same issue, but not an issue on CDN. https://stackblitz.com/edit/vitejs-vite-u7uawkm3?file=src%2FApp.tsx |
Describe the bug
On enter, the new lines are cleared out for all below content.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
new line is added to current line only
Screenshots
Video.Screen1737918347316.webm
Desktop:
Additional context
"suneditor": "2.47.1",
"suneditor-react-fixed": "3.6.3",
Content
Code snippet
import { MutableRefObject, useEffect } from 'react'
import SunEditor from 'suneditor-react-fixed'
import 'suneditor-fixed/dist/css/suneditor.min.css'
import type { SunEditorOptions } from 'suneditor-fixed/src/options'
import type SunEditorCore from 'suneditor/src/lib/core'
import { FileRecord } from '@db'
const buttonList = [
// default
['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'],
['showBlocks', 'codeView'],
['print', 'preview'],
// responsive
[
'%1161',
[
['undo', 'redo'],
[':p-Formats-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'],
['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'],
['fontColor', 'hiliteColor', 'textStyle'],
['removeFormat'],
['outdent', 'indent'],
['align', 'horizontalRule', 'list', 'lineHeight'],
['-right', ':i-Etc-default.more_vertical', 'showBlocks', 'codeView', 'print', 'preview'],
['-right', ':r-Table&Media-default.more_plus', 'table', 'link', 'image'],
],
],
[
'%893',
[
['undo', 'redo'],
[':p-Formats-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'],
['bold', 'underline', 'italic', 'strike'],
[':t-Fonts-default.more_text', 'subscript', 'superscript', 'fontColor', 'hiliteColor', 'textStyle'],
['removeFormat'],
['outdent', 'indent'],
['align', 'horizontalRule', 'list', 'lineHeight'],
['-right', ':i-Etc-default.more_vertical', 'showBlocks', 'codeView', 'print', 'preview'],
['-right', ':r-Table&Media-default.more_plus', 'table', 'link', 'image'],
],
],
[
'%855',
[
['undo', 'redo'],
[':p-Formats-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'],
[
':t-Fonts-default.more_text',
'bold',
'underline',
'italic',
'strike',
'subscript',
'superscript',
'fontColor',
'hiliteColor',
'textStyle',
],
['removeFormat'],
['outdent', 'indent'],
['align', 'horizontalRule', 'list', 'lineHeight'],
[':r-Table&Media-default.more_plus', 'table', 'link', 'image'],
['-right', ':i-Etc-default.more_vertical', 'showBlocks', 'codeView', 'print', 'preview'],
],
],
[
'%563',
[
['undo', 'redo'],
[':p-Formats-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'],
[
':t-Fonts-default.more_text',
'bold',
'underline',
'italic',
'strike',
'subscript',
'superscript',
'fontColor',
'hiliteColor',
'textStyle',
],
['removeFormat'],
['outdent', 'indent'],
[':e-List&Line-default.more_horizontal', 'align', 'horizontalRule', 'list', 'lineHeight'],
[':r-Table&Media-default.more_plus', 'table', 'link', 'image'],
['-right', ':i-Etc-default.more_vertical', 'showBlocks', 'codeView', 'print', 'preview'],
],
],
[
'%458',
[
['undo', 'redo'],
[':p-Formats-default.more_paragraph', 'font', 'fontSize', 'formatBlock', 'paragraphStyle', 'blockquote'],
[
':t-Fonts-default.more_text',
'bold',
'underline',
'italic',
'strike',
'subscript',
'superscript',
'fontColor',
'hiliteColor',
'textStyle',
'removeFormat',
],
[':e-List&Line-default.more_horizontal', 'outdent', 'indent', 'align', 'horizontalRule', 'list', 'lineHeight'],
[':r-Table&Media-default.more_plus', 'table', 'link', 'image'],
['-right', ':i-Etc-default.more_vertical', 'showBlocks', 'codeView', 'print', 'preview'],
],
],
]
interface RichTextProps {
record: FileRecord
editedValue: MutableRefObject
}
const RichText = ({ editedValue, record }: RichTextProps) => {
const OPTION: SunEditorOptions = {
resizingBar: false,
resizeEnable: false,
buttonList,
}
const getSunEditorInstance = (sunEditor: SunEditorCore) => {
editedValue.current = sunEditor
}
useEffect(() => {
if (editedValue.current) {
editedValue.current.setContents(record?.content)
}
}, [record?.content])
return
}
export default RichText
The text was updated successfully, but these errors were encountered: