How do you disable the text pasted from a file instead of attaching the file?

  • Version: 2.8.8
  • Operating System: Windows 10

The title might be a bit obtuse, but what I mean is the functionality of Joplin that has been added at some point that pastes the contents of the file into the note instead of attaching the file to the note similar to a picture by placing it in the resource directory. E.g. if I have a plaintext file and drag it into the note view, instead of attaching the file or prompting the end-user like a sane person, it just dumps the content of the file into the note directly.

That wouldn't be an issue unless you were pasting a file a few hundred thousand or million lines long, like I occasionally do. They don't take up a lot of space, a few kilobytes, but that amount of text in the editor or viewer has a tendency to make Joplin crash, freeze or just otherwise hard to remove the text in time. Hence why attaching it is easier.

I cannot find a setting to disable this, but it is something I'd very much like to have disabled. And even if it is kept as default, I'd hope they add a prompt that asks you if you want to paste the content of the file or attach the file for my own sanity's sake.

Does anyone know anything about this? I'm nor sure if I should rewrite this as a feature request for a prompt when inserting a file like this instead, but eh, wanted to ask at least.

This is what happens on Linux at least. If you drag a .txt into a note then it makes a resource link to that note and saves the file to the resources dir.

image

Wondering if it is a Windows only thing?

Unlikely to be a Windows-only error I think, or hope so at least. Files with the txt extension attach just fine, but plaintext files have a tendency to not be attached. It might be in how Joplin handles file extensions for all I know, but for example, the current file I was working on was an Android bytecode one with smali as the file extension. I've had this happen on multiple occasions, and they've all been plaintext files, generally containing code.

From a quick test with a Ren'Py file I had lying around, I did notice something strange, and it is probably the crux of the issue. On attaching the file, the window scrolls down a bit as if text longer than the current window would allow, but it was attached.

image

However, if I undid the last step, it instead showed itself to have pasted the contents of the file into the note, before deleting it and pasting the link string above.

image
(It's a tad long, so won't post an image of the entire thing here).

If this is how attachments work on the backend, by grabbing the contents and then moving them to a new file, I wouldn't be surprised if it got hung up on large files. That seems like an incredibly inefficient way to do this. It's all just a guess tho.

Can you try adding a attaching a file you're renamed to a smali or rpy extension and see if its contents are pasted directly? And if it attaches, can you undo one step and see if you end up with the text inserted into the note like I experienced?

Use the ATTACH FILE icon and navigate to your text file. I just did it both ways with a text file , drag and drop and attachment and it ended up linking it both times.

I too think I've dropped text files before and had them inserted as text. I am using 2.9.11 on WIndows 10, perhaps that is the reason. .

I see what you mean, yes it does indeed.
However as @Rootman notes this is indeed bypassed by using the attach file menu item.

Yeah, I am aware of it. I generally use the attach command when this occurs, however while that is fine as a workaround, I think having to work around expected functionality is a tad cumbersome. Especially when you have to find a file in a directory where every filename is obtuse. It doesn't take long mind you, but it is a tad disappointing.

In which case I would advise that you do indeed open this as an enhancement request (or just edit this post to make it one - let me know if you can't change the category and I'll do it).

I think I'll create a new one and reference to this, to keep things a tad cleaner. Thanks for the help so far : )

1 Like