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 with copy & auto-paste link command #28

Closed
N3C2L opened this issue Feb 1, 2024 · 10 comments
Closed

Bug with copy & auto-paste link command #28

N3C2L opened this issue Feb 1, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@N3C2L
Copy link

N3C2L commented Feb 1, 2024

If I highlight a text passage (copy as quote format) with the marker and then execute the "copy & auto-paste link" command with the hotkey, copy formats like "copy as quote" often result in wrong focusing in the annotation tab. The text input cursor (the blinking cursor while typing) jumps around inside the copied text selection or above.
You can reproduce it by creating several links with the copy as quote format, but every time use the copy & auto-paste command. While creating the links look at the open annotation file in the other tab: It doesn't synchronize with the pasted links. The focus in the annotation tab keeps on the first pasted link, and doesn't move to the bottom of the tab where new links are pasted.

@N3C2L
Copy link
Author

N3C2L commented Feb 1, 2024

There is another bug with this copy & auto-paste command:
How to reproduce:

  1. Open a fresh PDF tab and a fresh annotation file in another tab.
  2. Select a text range and create a link with the "copy as quote" format.
  3. Paste it manually in the annotation file.
  4. Because we added the link manually, the copy & auto-paste command should work.
  5. But it doesn't work with the "copy as quote" format: "Cannot auto-paste because it's the first time. Please manually paste the link."
  6. The first link detection for this command works only if a link is inserted with the other 2 format presets: copy embed of selection + copy link to selection.
  7. When the link is manually inserted with one of them, only then the "copy as quote" format is working with the copy & auto-paste command.

@RyotaUshio RyotaUshio added the bug Something isn't working label Feb 2, 2024
RyotaUshio added a commit that referenced this issue Feb 2, 2024
commit 5776bab
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 03:17:48 2024 +0900

    minor cleanup

commit ea7c2b6
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 03:10:12 2024 +0900

    add comments

commit 5f49fef
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 03:01:41 2024 +0900

    #28: improve the behavior of the focusEditorAfterAutoPaste option

commit d161d9b
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 02:08:57 2024 +0900

    Fix #32: reload BacklinkHighlighter when closing the plugin setting tab

commit 429f9c2
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 01:04:29 2024 +0900

    Squashed commit of the following:

    commit 0c5d850
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Sat Feb 3 01:03:41 2024 +0900

        Enable annotation content editing

    commit e05685e
    Merge: e98cee6 c23b135
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 21:22:40 2024 +0900

        Merge branch 'dev' into edit-delete-annot

    commit e98cee6
    Merge: 2967bcf c4e6c66
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 21:21:52 2024 +0900

        Merge branch 'dev' into edit-delete-annot

    commit 2967bcf
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 19:35:44 2024 +0900

        add options related to annotation deletion & add annotation deletion modal

    commit 5debf0e
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 18:58:23 2024 +0900

        implement api.isBacklinked

    commit 3f7ba66
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 18:37:27 2024 +0900

        enable annotatoin deletion from the popup

    commit c3a6fbc
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 18:14:39 2024 +0900

        remove annotpdf (pdfAnnotate) from dependencies, use pdf-lib only

commit c23b135
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Fri Feb 2 21:22:32 2024 +0900

    minor change

commit c4e6c66
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Fri Feb 2 20:13:07 2024 +0900

    change the default highlightDuration

commit 6985fe1
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Fri Feb 2 19:44:29 2024 +0900

    Enable annotation deletion
@RyotaUshio
Copy link
Owner

RyotaUshio commented Feb 2, 2024

So there are two different problems:

  1. After auto-paste, the cursor position is not moved to the end of the target markdown file properly
  2. The manual paste detection does not work depending on copying formats

As for 1, I included a potential fix in the latest release 0.27.8.
I'm still not 100% sure the problem is gone because I could not reproduce the bug steadily (I mean, sometimes I could reproduce it but sometimes I couldn't). Is it working on your side?

As for 2, I have not been able to reproduce it so far.
If it's still happening in the latest version, can you provide a screen recording of where the bug is happening, and the PDF file causing the problem if possible?

@RyotaUshio
Copy link
Owner

Wow, sorry now I realize that I made a silly mistake and it was causing problem 1!! Will release a fix soon.

@RyotaUshio
Copy link
Owner

RyotaUshio commented Feb 2, 2024

Released: 0.27.9.

I still have no idea about problem 2.

@N3C2L
Copy link
Author

N3C2L commented Feb 2, 2024

Thanks, it's better now!

I found something interesting where the manual paste detection does not work depending on copying formats:
When you select the text and right click > copy link to selection
When you select the text and right click > copy as quote
In both cases the manual paste detection does not work.
It's only working when you click the colors palette above to link it.

@RyotaUshio
Copy link
Owner

RyotaUshio commented Feb 3, 2024

@N3C2L Okay now I see what's happening!

The right-click menu is in fact out of control of PDF++. It is left default.

(You can see this by modifying the "copy as quote" format in the setting. When you copy a link from hotkeys or color palettes, the new custom format is applied, but it is not applied if you copy one from right-click menu)

This is why the manual-paste detection doesn't work after copying links via right-click.

There is a feature request (#26) for replacing the Obsidian-native right-click menu with a custom one.
Resolving it will also fix this issue.

@RyotaUshio
Copy link
Owner

So for the time being, I recommend you use the copy command without auto-paste via a hotkey or a color palette for the first time, and then use the auto-paste command from the second time on.

RyotaUshio added a commit that referenced this issue Feb 3, 2024
RyotaUshio added a commit that referenced this issue Feb 3, 2024
commit e0c1e41
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 19:04:45 2024 +0900

    Resolve #26: replace the builtin right-click menu with PDF++ custom (also related to #28)

commit 4f541d8
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 13:18:00 2024 +0900

    update typings

commit e42d6c1
Merge: 5776bab 2c74249
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 13:14:07 2024 +0900

    Merge branch 'main' into dev

commit 5776bab
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 03:17:48 2024 +0900

    minor cleanup

commit ea7c2b6
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 03:10:12 2024 +0900

    add comments

commit 5f49fef
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 03:01:41 2024 +0900

    #28: improve the behavior of the focusEditorAfterAutoPaste option

commit d161d9b
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 02:08:57 2024 +0900

    Fix #32: reload BacklinkHighlighter when closing the plugin setting tab

commit 429f9c2
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Sat Feb 3 01:04:29 2024 +0900

    Squashed commit of the following:

    commit 0c5d850
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Sat Feb 3 01:03:41 2024 +0900

        Enable annotation content editing

    commit e05685e
    Merge: e98cee6 c23b135
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 21:22:40 2024 +0900

        Merge branch 'dev' into edit-delete-annot

    commit e98cee6
    Merge: 2967bcf c4e6c66
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 21:21:52 2024 +0900

        Merge branch 'dev' into edit-delete-annot

    commit 2967bcf
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 19:35:44 2024 +0900

        add options related to annotation deletion & add annotation deletion modal

    commit 5debf0e
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 18:58:23 2024 +0900

        implement api.isBacklinked

    commit 3f7ba66
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 18:37:27 2024 +0900

        enable annotatoin deletion from the popup

    commit c3a6fbc
    Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
    Date:   Fri Feb 2 18:14:39 2024 +0900

        remove annotpdf (pdfAnnotate) from dependencies, use pdf-lib only

commit c23b135
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Fri Feb 2 21:22:32 2024 +0900

    minor change

commit c4e6c66
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Fri Feb 2 20:13:07 2024 +0900

    change the default highlightDuration

commit 6985fe1
Author: RyotaUshio <ushio@ms.k.u-tokyo.ac.jp>
Date:   Fri Feb 2 19:44:29 2024 +0900

    Enable annotation deletion
@RyotaUshio
Copy link
Owner

@N3C2L Now 0.27.10 has a custom context menu, which will resolve this issue.

@N3C2L
Copy link
Author

N3C2L commented Feb 3, 2024

Thank you, that's great!

But if I right click there are 2 popups now. The one from obsidian itself with layered on top saying "copy ctrl+c", and your new right context menu. If I right click and press ESC, the obsidian context menu will disappear and now hovering color is working over your new context menu.

@RyotaUshio
Copy link
Owner

I've created a new issue #34 for this problem. Let's continue there.

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

2 participants