windingwind / zotero-better-notes

Everything about note management. All in Zotero.
GNU Affero General Public License v3.0
5.48k stars 188 forks source link

[Bug] After linking a note with Better Notes, the inserted link into 'Note Workspace' tab is truncated #905

Closed ThachNgocTran closed 8 months ago

ThachNgocTran commented 8 months ago

Is there an existing issue for this?

Are you using the latest Zotero and the latest plugin?

Environment

Describe the bug

Description

After linking a Note within a currently opened PDF to a Note Workspace, thanks to Better Notes plugin, the inserted link works as expected. However, it is truncated. It seems to have a max length of 120 characters.

Not sure if this is by-design, or a bug. Hope that this limitation is configurable somewhere.

Reproducibility

  1. Open a PDF file into a Tab within Zotero.
  2. In this tab, highlight a text.
  3. Create a new Note. Open the Note.
  4. Click on the highlighted text.
  5. Click on the triple dots.
  6. Click on 'Add to Note'.
  7. Click on Better Notes icon just above the opened Note. Link to the Note Workspace.
  8. Return to the Note Workspace. The link is inserted, but it is unfortunately truncated.

Screenshots

1

2

Debug Output

The Debug Output:

Debug Output.zip

Anything else?

I tried creating a link with text description more than 200 characters, and got no problem. So probably this bug is not by-design by Zotero. When generating the link in Note Workspace, it got truncated beforehand.

windingwind commented 8 months ago

The default link text is generated from getNoteTitle, which slices the first 120 chars of the first line of a note. So to answer your question, it's by design by Zotero, not this plugin.

You could modify the QuickInsert template to customize the link text, though.

This is not a bug, so I will close this issue.

ThachNgocTran commented 8 months ago

@windingwind You're right. This is not a bug. Thanks for the quick response. 👍

Nevertheless, to get the full text note (instead of being truncated as showed above), one needs to modify the QuickInsert template, and play with the javascript a little bit.

In Template Editor of Better Notes:

1

In Note Workspace tab, the result will end up as I desired:

2

windingwind commented 8 months ago

Cool! If you don't mind, I'd like to convert your reply to a discussion as a template share, which might be helpful to others.

windingwind commented 8 months ago

Also, subNoteItem.getNote() might not work very well with embedded images. You can use the API provided by this plugin to import note content into another note, see https://github.com/windingwind/zotero-better-notes/discussions/245

ThachNgocTran commented 8 months ago

Cool! If you don't mind, I'd like to convert your reply to a discussion as a template share, which might be helpful to others.

Please go ahead. You're welcome.