go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.02k stars 5.49k forks source link

Markdown preview rendered for outdated markdown on android #19784

Closed joschahenningsen closed 1 year ago

joschahenningsen commented 2 years ago

Description

When editing markdown (issue and pull request comments), clicking the preview button on mobile devices when the text input still has focus doesn't render the latest markdown but markdown that misses the latest input instead.

tested on Chrome for Android 11

Gitea Version

1.17.0+dev-610-gfa5dec966

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

https://user-images.githubusercontent.com/44805696/169714463-6d957466-d90c-469a-a1fc-26298dda76be.mp4

Git Version

No response

Operating System

No response

How are you running Gitea?

Tested this locally and on https://try.gitea.io

Database

SQLite

yp05327 commented 1 year ago

You inputted the characters without confirming them, so they were just Preview Characters in the inputbox. Then you switched to Preview, of course, the characters in the inpubox weren't changed at that moment. Then you switched to Write, maybe a feature of your IME? IME automatically 'confirmed' the changes. Then you switched to Preview, of course, the characters in the inputbox were changed.

Github uses textarea which has no problem, but gitea uses CodeMirror here. Maybe you need to fix this in CodeMirror.

wxiaoguang commented 1 year ago

Gitea 1.18 and newer are using the CodeMirror with contenteditable mode, which brings different editing experience.

Please try if the problem gets better in new releases.

yp05327 commented 1 year ago

I tested by using Japanese Google IME in 1.18.5 (I only have this which may cause the same problem I think), and it was same. But Github has no problem.

wxiaoguang commented 1 year ago

Yup, the problem is contenteditable, sometimes it doesn't work well, and that's the reason why there were discussions about dropping EasyMDE&CodeMirror ....

lunny commented 1 year ago

Should be fixed by #23876 ?

yp05327 commented 1 year ago

Tested in 1.20.0-361, Preview displayed the characters, but the inputbox was empty.

wxiaoguang commented 1 year ago

Tested in 1.20.0-361, Preview displayed the characters, but the inputbox was empty.

Can you elaborate, or provide some screenshots?

joschahenningsen commented 1 year ago

Should be fixed by #23876 ?

Yup, seems to be working now 👍

yp05327 commented 1 year ago

Tested in 1.20.0-361, Preview displayed the characters, but the inputbox was empty.

Can you elaborate, or provide some screenshots?

I can’t upload videos to github on my phone.

Preview is worked. CF10BBA0-7C16-412E-8D1C-E7541D6D06A9 But the input box is empty. 5C520939-4273-48B0-9540-DFF416BBF8D7

Github have the same behavior, so maybe it is all right.

wxiaoguang commented 1 year ago

I can’t upload videos to github on my phone. Preview is worked. But the input box is empty. Github have the same behavior, so maybe it is all right.

What's the steps? Do you mean that:

  1. Open the New Issue page
  2. Input something into the textarea
  3. Click the Preview
  4. Preview shows
  5. Click Write
  6. The textarea loses its content and becomes empty?
yp05327 commented 1 year ago

image I know the reason now LOL

Here is the video:

https://user-images.githubusercontent.com/18380374/230401807-606b59b0-7081-4dab-99dc-88ef79274042.mp4

joschahenningsen commented 1 year ago

This should probably be discussed in a separate issue.

Am Do., 6. Apr. 2023 um 16:05 Uhr schrieb yp05327 @.***

:

[image: image] https://user-images.githubusercontent.com/18380374/230398979-82ba70fc-ac7f-443c-89cb-e74465855468.png I know the reason now LOL

Here is the video:

https://user-images.githubusercontent.com/18380374/230401807-606b59b0-7081-4dab-99dc-88ef79274042.mp4

— Reply to this email directly, view it on GitHub https://github.com/go-gitea/gitea/issues/19784#issuecomment-1499118434, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKV24QCK4YSLAW7UAQOFYRLW73EQ3ANCNFSM5WT4FDKA . You are receiving this because you modified the open/close state.Message ID: @.***>

-- Joscha Henningsen He/Him

wxiaoguang commented 1 year ago

I guess because you didn't confirm the input in your input method.

The "temp" text is highlighted to show that they are not really in the textarea.

I guess you need to click the "確定" on the virtual keyboard


Let's stop from discussing the new issue on a closed issue, sorry for bothering.