External Attachments Linking

In Evernote or Obsidian, etc. you could open any file in the folder (which I usually set as my Google Drive folder) from within a note.

So basically, I can drag and drop a PDF/Excel/MP3/whatever else file on a note and it

  • makes a link to it on the note
  • when I open it on the note it opens the file
  • when I save the file it saves to the Google Drive file appropriately

This means I can have notes contain

  • Files related to the note
  • For example, PHP files or other files related to it.

This way I can use InkDrop as a digital file cabinet to organize related code, documentation, etc. or so.

I think to support this we can use a special case for markdown links when the dragndropped object is not an image, then just save it to external folder, same with opening it.

2 Likes

Hi Mark,

Thank you for the suggestion.
Integrating with cloud storage services would be nice to have for linking files.
But they have their own APIs and which one to use completely depends on a personal preference.
So, it’d be nice to be a plugin instead of supporting them in the app itself.
Any contribution would be appreciated!

Hi Takuya, would love to help out doing this.
I think the main thing is not to support multiple cloud storage services, just an

  • option in the app to select a folder to store external non-image attachments
  • store non-image files there if I drag and drop them
  • open the file from that folder if I open the link (double click in editor mode)

User can take care of syncing this folder to whatever cloud service they prefer.

Is this possible to do as a plugin? If you think it is I will set time to work on it.
Thanks!

Makes sense! The file-drop handler is hard-coded at the moment.
It’d be nice to allow extending it by adding a command like core:insert-files for plugins.

Indeed, I haven’t seen a plugin that allows option to select a folder as well, if both are created, I can start developing plugin for this.

Let me know, thanks Takuya.

Okay, Mark!

I found that you can override the default behavior like so:

inkdrop.onEditorLoad(() => {
  const mde = inkdrop.getActiveEditor()
  inkdrop.commands.add(mde.wrapper.wrapper, {
    'editor:insert-images': (e) => {
      const { files } = e
      console.log('files dropped:', e)
      // attach files

      e.stopPropagation() // prevent the default behavior
    }
  })
})

Refefences: