도구 모드로 이미지를 업로드하면 커서가 줄 끝으로 이동

I was noticing focus moves when you upload though, e.g. when I have focus caret in a particular location, then I upload, it moves to a weird location? That’s the main thing I want to check.

3개의 좋아요

@martin can have a quick look, that said a repro here would be awesome, how are you uploading (cut-and-paste, drag-drop, toolbar)? browser (I assume chrome)? what is body + caret before … after?

4개의 좋아요

So if I understand correctly, when we upload we should keep the caret in the original location after the upload is complete? I can replicate the issue:

  1. Click in the middle of the sentence
  2. Upload a file
  3. My caret is now at the end of the sentence

Peek 2022-01-14 14-32

In my gif, the caret goes to the end of the sentence as soon as the processing starts. Note that the upload and processing markdown does go in the correct place at least.

With drag + drop the character stays where it is supposed to be, same with pasting, so it seems like clicking the upload button is the only place this is an issue?

6개의 좋아요

Yes exactly, well demonstrated! Just preserve caret location. Thanks!

4개의 좋아요

@zogstrip can @andrei take this? It is likely related to the other feature that injects newlines.

Also need to be careful here to determine if the bug pops up when we first inject the placeholder or after we replace the placeholder with the upload. My gut is that it pops up once the placeholder is added.

Moving to a dedicated bug.

5개의 좋아요

@andrei can you add this to your list?

Might be a tricky one as there are lots of different ways we allow users to add uploads.

2개의 좋아요

Sure, I’ll take care of this. As Sam said this is probably related to the problem with newlines.

4개의 좋아요

Here is the fix for the problem:

https://github.com/discourse/discourse/pull/15684

6개의 좋아요

Looks like we regressed here :thinking:

However I upload (via the toolbar, drag & drop or copy & paste), the caret moves to the end of the post (not the line).

At least on latest macOS / Safari.

@cvx any chances you know what’s what? I’m OK to drop this one if it’s a hard one to fix.

1개의 좋아요