Using Drafts' Previews folder and Obsidian's assets folder, you can also draft notes with images in the Drafts app

Oct 11, 2021 at 12:00

Technical background

Reference of images in Obsidian

If you put an image file directly under Obsidian's vault, the display of File Explorer will be messed up.

Fortunately, there is a subfolder called assets, and you can put files other than those notes in it.

そこに保管されたファイルは 、「![[abc.png]] 」で表示される。(本来は「![[assets/abc.png]]」とする必要があるはず)

もちろんMarkdownの書式である「![](abc.png)」でも表示される。

※You can change the destination where the attachment will be saved in the settings.

Reference to images in Drafts

Unlike editor apps that edit other text files, Drafts apps are intended to create drafts as their name suggests. It's not for working with existing text files. Also, the entered document is not saved as a single file in some folder.

そのため画像を表示したい時は、URLで参照できる場所に画像ファイル置き、それを参照する。(例えば、![](https://foobar.com/img/abc.png)の様に)

But Drafts has a special folder called Previews.

In preview, place local images, JavaScript, style sheets, and other file-based assets in the **iCloud Drive/Drafts/Library/Previews/ **folder. You can also incorporate those assets into the preview by doing so. If you place the assets you want to incorporate in this folder or a subfolder of that folder, you can browse these assets through the relative path of the HTML preview template.
Previews - Drafts User Guide

iCloud Drive/Drafts/Library/Previews/abc.png
The image file in
![](abc.png)
You can refer to it.

It behaves the same as the Obsidian assets folder, and there is no need to make any changes to the draft.

The shortcut function has been expanded.

Previous shortcut apps have access to locations other than in the Shortcuts folder of iCloud Drive due to the restrictions of iOS/iPadOS protection function "Sandbox", users can access places other than in the Shortcuts folder of iCloud Drive. I had to specify a place.

That's why iOS/iPadOS has become version 15 and incorporates a mechanism called "folder bookmarks" that allows you to specify folders that can be accessed in advance.

Thanks to that, without the help of apps such as Toolbox Pro and Scriptable that support folder bookmarks, _iCloud Drive/Drafts/Library/Previews/_F Forder, _iCloud Drive/Obsidian/Vault folder/assets _folder, _(in this iPhone _ on this iPad)/Obsidian/Vault folder/assets _form Da has become easy to access.

In other words, with just shortcuts, you can now copy image files in Drafts' _Previews folder to Obsidian's assets _folder.

So,

and,

I made it.

##

operation

I'll try using it

f:id:sorashima:20211010233523p:plain:w311 Insert two images in this carlet position f:id:sorashima:20211019193712j:plain:w311 Save images in Drafts' Previews folder action f:id:sorashima:20211010234302j:plain:w311 Select two images and select "Add".

And if you look at Drafts' _Previews _folder in the Files app,

f:id:sorashima:20211010234525p:plain:w311 You can confirm that the image file has been copied.

And in the draft,

f:id:sorashima:20211010234748p:plain:w311 The link to the image file was inserted. f:id:sorashima:20211010235042p:plain:w311 When you perform the Drafts app standard Markdown preview action, the image will be displayed. f:id:sorashima:20211019193754j:plain:w311 Now, copy images from Drafts' Previews folder to Obsidian vault's assets folder action

And if you look at the _assets _subfolder of Obsidian's Vault folder in the file app,

f:id:sorashima:20211010235734j:plain:w311 You can confirm that the image file has been copied. f:id:sorashima:20211011000347j:plain:w311 Perform an action to save directly to the Voault folder of Obsidian you created before.

When I opened Obsidian,

f:id:sorashima:20211011000630p:plain:w311 A note was displayed with an image.

##

PREPARATION

Save the selected image file to the Drafts _Previews _folder and insert the image link into the draft Drafts action + shortcut cut

Specify Drafts' Previews folder as shortcuts

f:id:sorashima:20211010225713j:plain:w311 Tap here for this action and click "Replace..." f:id:sorashima:20211010230506j:plain:w311 Create a Previews subfolder in the Library subfolder in the Drafts folder in iCloud Drive, select it, and select it to "Done".

Drafts action + shortcut to copy the linked image file of the image link written during the draft from the Drafts _Previews _folder to the Obsidian _assets _folder

Specify the Drafts Previews folder as shortcuts and Obsidian Vault assets folder

f:id:sorashima:20211010231534j:plain:w311 Tap here for this action and click "Replace..." f:id:sorashima:20211010230506j:plain:w311 Select the Previews subfolder of the Library subfolder in the Drafts folder in iCloud Drive and select "Done". f:id:sorashima:20211010232141j:plain:w311 Tap here for this action below it and select "Replace..." f:id:sorashima:20211010232520j:plain:w311 Select the assets subfolder in the Vault folder in iCloud Drive or in this iPhone/this iPad, in the Obsidian folder, and select Done.

-"2021-10-11 DraftsのPreviewsフォルダとObsidianのassetsフォルダを利用して、Draftsアプリで画像付きメモの下書きも可能に - めモらンだム・ヤード"