Skip to content
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

[BUG]click the editor then cursor is at second line #24

Closed
sweatfryash opened this issue Apr 13, 2021 · 7 comments
Closed

[BUG]click the editor then cursor is at second line #24

sweatfryash opened this issue Apr 13, 2021 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@sweatfryash
Copy link

Describe the bug
click editor then cursor is at second line

To Reproduce
build it like my code(in Additional context) and click the editor

Expected behavior
click editor then cursor is at first line

Screenshots

Device:
android 9,real

Additional context

Expanded(
            child: HtmlEditor(
              controller: controller, //required
              hint: "Your text here...",
              options: HtmlEditorOptions(
                height: 400,
              ),
            ),
          )
@sweatfryash sweatfryash added the bug Something isn't working label Apr 13, 2021
@sweatfryash
Copy link
Author

sweatfryash commented Apr 13, 2021

I think I found the reason:after focused the code is <p><br/></p> so it looks like at second line.But the problem is the 'hint' is at first line,it`s abnormal.

@tneotia
Copy link
Owner

tneotia commented Apr 13, 2021

Hi there, thanks for your report. Unfortunately this is just how Summernote editor functions and I cannot change that. You can see here on the official website the same behavior is there.

The reason for this is because by default the text in the editor is <p><br/></p> which makes the cursor at the second line - this is necessary for this reason:

The editing area needs <p><br></p> for focus, even if the editor content is empty.

As seen here.

@sweatfryash
Copy link
Author

thanks for reply, I will try to find some way to resolve.: )

@tneotia
Copy link
Owner

tneotia commented Apr 13, 2021

Maybe in your hint add new line or br:

"\nYour text here..."

or

"<br/>Your text here..."

I don't know which one will work but one of them should.

@sweatfryash
Copy link
Author

I found use <p>hinttext<p/> is very nice, use<br/> causes different line height.

@tneotia
Copy link
Owner

tneotia commented Apr 13, 2021

Great, thanks for posting your solution!

@LWFLBB
Copy link

LWFLBB commented Jul 19, 2021

I found that initialText:'' is also possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants