Access Files for a Plugin

Hallo Takuya,

First: Hello everybody
Second: Takuya, thanks for this great App

Now to my question:

To make Sketches I use and I want to integrate it with Inkdrop over a Plugin.
As far as I see it, there is almost everything already in place.

  • I can insert an SVG into a note and it displays nicely
  • I can download the SVG and edit it again. So it is stored correctly

My functionality for a plugin would be:

My question is now, how to access the svg file?

When I fetch the file from the database:


there is no _attachments:index:data

1 Like

Hi Andreas,

I’m glad that you are trying to create a plugin!
To fetch the attachment in the docs, just add attachments: true option to the method call like so:

inkdrop.main.dataStore.getLocalDB().files.get('file:feijRJFs7', { attachments: true })

Please refer to PouchDB’s documentation for more detail.

When you save the SVG file, do not overwrite the existing file with put method.
Instead, create a new file document and delete the old one.
That’s because the app basically assumes that the file will never be changed by design at the moment.
The mobile app caches image files in local and won’t update even if you overwritten them.

Another option for this issue would be to support drawio codeblock like math plugin.
Let’s say that you have the following codeblock in a note:


And your plugin renders it as a SVG image in preview.
That allows your plugin to work without handling file documents.

Hope that helps!

Hi Andreas,

great idea. Do you plan to publish the plugin as open source?