obsidian-paste-image-rename icon indicating copy to clipboard operation
obsidian-paste-image-rename copied to clipboard

Issue: Pasting image does not focus on pasted image, goes up the document instead

Open kk-min opened this issue 3 years ago • 7 comments

https://user-images.githubusercontent.com/76023265/163912789-53f3818e-3bb2-4508-a28d-7d46bbce3a6b.mp4

As you can see from the video above, pasting the image scrolls up the document window. Is it possible to make it so that it is focused on the newly pasted image?

kk-min avatar Apr 19 '22 03:04 kk-min

Got it, will try to reproduce. Please provide informations to help me debugging:

  • What editor mode are you using? (Live Preview or Source mode)
  • Is "Use legacy editor" turned on in Editor settings?
  • What system are you using (Windows, Linux or MacOS)

Xiao Meng

On Apr 19, 2022 at 11:13:31, mink0003 @.***> wrote:

https://user-images.githubusercontent.com/76023265/163912789-53f3818e-3bb2-4508-a28d-7d46bbce3a6b.mp4

As you can see from the video above, pasting the image scrolls up the document window. Is it possible to make it so that it is focused on the newly pasted image?

— Reply to this email directly, view it on GitHub https://github.com/reorx/obsidian-paste-image-rename/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADDDVDX35PW4YX4ZCN6MMLVFYQFXANCNFSM5TXOO5TQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

reorx avatar Apr 19 '22 03:04 reorx

Hi Xiao Meng, thanks for the follow-up. Here's some info:

  • I'm using Live Preview
  • "Use legacy editor" is turned off
  • I am currently running it on Windows 10

Let me know if you need any other info. Thanks!

Min

kk-min avatar Apr 19 '22 03:04 kk-min

Hi Min, I tried the smiliar operation on Windows 10 with Live Preivew, but failed to reproduce, the editor always focuses on the newly pasted image. I'm thinking maybe there's some other plugins conflict with this one.

Things you can do to provide more details:

  • Provides a list of plugins you are using.
  • Click cancel in the rename prompt, see if the editor still scrolls
  • Open developer console by pressing ctrl + shift + i, check if there's any output when you do the image renaming

reorx avatar Apr 19 '22 09:04 reorx

Hi Xiao Meng,

  • Here's a list of plugins I use: Admonition, Advanced Tables, Emoji Shortcodes Fullscreen mode plugin Minimal Theme Settings Obsidian Tabs Paste image rename (this plugin)

I've tried testing with each of the plugins disabled, and it seems that even when every plugin is disabled except for Paste image rename, the problem is still occurring.

  • When I click cancel in the rename prompt, the editor scrolls all the way to the top of the document, which is different from the initial issue where it scrolls up a little, but not all the way:

https://user-images.githubusercontent.com/76023265/164131550-702c7ca0-2ddf-4a83-9419-c4582475cd38.mp4

It also still pastes the image anyway, with the default convention (I'm not sure if this is intended for this plugin, intuitively I thought cancelling will cancel the paste as well, but it cancels the renaming operation instead.)

  • I also did not see any output in the Console tab in Dev tools when renaming the image (or cancelling)

I am wondering if it has anything to do with the size of the image (Since Obsidian automatically resizes the image to keep the width of the images identical) or the fact that I have other images as well as callouts in the document. I've attached the actual document that I am working on so that you can test it out. (The assets folder contains all the images, you may need to modify your Files&Links in Obsidian settings for them to show correctly)

CZ2006 Finals Revision.md assets.zip

kk-min avatar Apr 20 '22 02:04 kk-min

Hi Min, sorry for the late reply. With your long and image rich note, I finally reproduced the "scroll to top" behavior.

After spending sometime for debugging and investigation, I didn't manage to solve it, but I feel that this is very likely a bug of obsidian: when dealing with long article with many images, closing modal may cause the editor scrolling to the top.

https://user-images.githubusercontent.com/405972/164912289-9c4357f0-3015-4446-9485-3c81950e6c62.mov

Check the video above, I enabled "Safe Mode" (all plugins are disabled) and set the theme to default, then I scrolled to the end of your article, aftering opening the settings modal and pressed Tab to unfocus the input, the editor scrolled to the top even before closing the modal. You can try if you can also reproduce it.

I'll report this issue to the official forum and see if anybody can help.

I also found that the issue is less likely to be triggered in source mode, before this bug got fixed, you can avoid it by using source mode to edit, while split another pane and link it to the source pane for previewing. see Linked pane - Obsidian Help.

reorx avatar Apr 23 '22 15:04 reorx

Obsidian bug report linked here: https://forum.obsidian.md/t/opening-then-closing-modal-may-cause-the-editor-scrolling-to-the-top/36367/1

reorx avatar Apr 23 '22 15:04 reorx

Hi Xiao Meng,

Thanks for the follow-up and for the debugging efforts. I tried the same thing and indeed got the same results, so I think we can safely assume it is a bug with Obsidian and modals. Thanks for the suggestion with Linked panes as well, I didn't know about it so it was really helpful. Cheers!

kk-min avatar Apr 24 '22 04:04 kk-min

After Obsidian 1.0 was released, I cannot reproduce this issue anymore, could be seen as fixed for now 😄

reorx avatar Jan 28 '23 15:01 reorx