Closed saccohuo closed 1 month ago
[JavaScript Error: "Passing a URI to Zotero.File.getContentsAsync() is deprecated -- use Zotero.HTTP.request() instead"]
There are some URI in my notes, and I wanna handle the URI in template editor.
Can the plugin just report a warning instead of an error?
Not sure what you mean by saying There are some URI in my notes, and I wanna handle the URI in template editor.
What kind of template are you using, and why do you think this error is related to a certain note template? Could you please share the template you use that causes the error?
After I delete the line, it works, but why?
<p><img data-attachment-key="F5GBNPMY" > </p>
Please see my reply above: we need to know what kind of template you are using and how you are using them. If it's a problem with the note template, then basically it is not a bug with the plugin.
I am using [ExportMDFileContent]
template, and settings in template is as follows.
${{
return mdContent
.replace(/\n{3,}/g, '\n\n') // 将三个或更多换行替换为两个换行
.replace(/([^\n])\n\n([^\n#])/g, '$1\n$2') // 保留标题前的空行,但去除其他地方的多余换行
.replace(/!\[\]\(data:image\/png;base64,[A-Za-z0-9+/=]+\)\n?/g, '') // 移除 base64 编码的图片行
.trim(); // 移除开头和结尾的空白字符
}}$
I find just need to change the data-sttachment-key
in <p><img data-attachment-key="F5GBNPMY" > </p>
to a exist foldername in storage
path, then it works well.
Can you tell me more about what does the plugin do to check data-sttachment-key
? Many thanks.
Don't modify this attribute. Any modification may cause the syncing to fail. The plugin should take over the images in the markdown to keep in sync with the note item in Zotero.
I find just need to change the data-sttachment-key in \<p>\<img data-attachment-key="F5GBNPMY" >\ \</p> to a exist foldername in storage path, then it works well.
Why's that?
I don't know why either, and I am trying to figure it out.
I mean, why do you want to manually replace them? Aren't the images already be available in the markdown file exported by the plugin?
To be clear, I was talking about:
There are some URI in my notes, and I wanna handle the URI in template editor.
I still don't understand what URI you want to handle
and how/why you want to do it.
Image URI is base64 data extracted from png. For example:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAMAAABF0y+mAAABPlBMVEX////E6OyQ091uwtFjt8tvs8uRvNLE1+Sk4+UwxssWvMcTtcMPrb8NoroLlbYAhbEAdayRss5o19U/zc4bjLQagbEAZagbaqnd5u9Z1dMYea4Ub6wAUKDQ3eqk5+IAX6YAWaXy9fmA3thLtMecytmzx9yQq81Dd7GpvNXO8e9ty9O77OmM3tl009H+4tn+xLr+tLD9sLr+zNb+8/bR0sf/pX3/iVD+jlv+gWr9f3f+cHv/Zn//YIv+SoT9e6j+6PHvkmH+jWX/WI//UJX9L5H9u9mu19j/i1L+R579HJj+PKf6FqLK3dz9gZT5j8z9zbL8r5P8MbL91sP+ewXit6T9o77/TZf6AK3/gz382u7+gy3+RZ/9q3791eD8k7L+Oqj6Sbj9wKH8uN//VZH+r6T+lZL+fW/+dHX+i2n8aaE/3YaXAAABZ0lEQVR4AWIgEjAyMbOwsrED2qIHLAdiAACgfdzatm1kattuauv+F9iM6pn4x/lFTBabw+XxBUKh6MvEEgmBUplQrlB+mEoiYbEJVGvkWt2r6cUqFYkCtVBuMGpNL2gWiwm0WP+USp3N7nA+zWU24+g2/dqpx4tUwvwhBHrNPi+D4Q8EQ6Fw5B1der3XF40BLJ5IptKZbO4VTUwm05sHWIHAYqlceVWPp8qs1R5Yb7yqq1qtghdstl4XbrerGI7BYCdDYJeCSA+t2m7HQK2PV8MZhIMBhcMRMXQMMLI+mSKcUTvujXq4RmGfrOcInNMjF3im7FMYmS6f6B8tVsRp/WR9TSC93cWCmJj+NtPldrCja/sRXOwfts4gbB0edbiAsDYky6HMESE9kFgVQgBBrH86oxtC2MgxXnQBAcCwwuVKYHnOeP0iGESPckvgmLkT416/YQGC2+WaSmXDn0SM9g8DgfXrc/wDaw5R0gcZRUEAAAAASUVORK5CYII=
The original idea is to show image in Zotero notes as URI format, because it cannot show the area annotation as image type in the note.
because it cannot show the area annotation as image type in the note.
I don't understand. What's image type
?
Parsing images to base64 in the exported markdown file would definitely break the syncing. This isn't the correct way to use the plugin.
Yes, I get the right way to transform area annotation to image, use the importEmbeddedImage
function in zotero-better-notes/src/utils/note.ts
, rather than URI format.
Many thanks.
Is there an existing issue for this?
Are you using the latest Zotero and the latest plugin?
Environment
Describe the bug
When export note file, plugin throw error:
Better Notes Sync Error: Error: getFilePathAsync() can only be called on attachment items
Debug Output
Anything else?
No response