Trashcan

To implement the trash system idea you mentioned above a simple plugin like this could do the job too (not tested but it gives the idea):

/* joplin-manifest:
{
	"manifest_version": 1,
	"name": "Trash plugin",
	"version": "1.0.0",}
*/

joplin.plugins.register({
	onStart: async function() {
		await joplin.commands.register({
			name: 'trash',
			label: 'Trash',
			iconName: 'fas fa-trash-alt',
			execute: async () => {
				// Get the selected note and exit if none is currently selected
				const selectedNote = await joplin.workspace.selectedNote();
				if (!selectedNote) return;
				
				// Get the trash folder and create it if it doesn't already exist
				let trashFolder = await joplin.data.get('search', { type: 'folder', query: 'trash' });
				
				if (!trashFolder.items.length) {
					trashFolder = await joplin.data.post('folders', { title: 'trash' });
				} else {
					trashFolder = trashFolder.items[0];
				}

				// Move the note to the trash
				await joplin.data.put(['notes', selectedNote.id], { parent_id: trashFolder.id });
			},
		});
	},
});

That would create a new command "trash" which you can assign to any keyboard shortcut.

3 Likes