How to add .js to a note

It's very wonderfull I can add html and css to a note, but blocks seems not working. Any way to add .js to a note?

I find it's very bad practice to put .css or .js in the note, it also wanishes if switching to WYSIWYG editor. It's better to put .js and .css in the Joplin itself. Speaking of adding .js to Joplin, how to do it?

Not quite sure what you mean by adding to Joplin. Maybe have a look at plugin API.

So, creating a plugin is the only way to add userscripts? Or there's a way to add it the same way as I can add .css using userstyle.css and userchrome.css?

A userscript is a plugin pretty much. If you don't want to setup a plugin build environment, you can also simply drop a JS file in the /plugins folder.

This would be a minimal plugin:

/* joplin-manifest:
{
	"id": "com.example.ExamplePlugin",
	"manifest_version": 1,
	"app_min_version": "2.1",
	"name": "JS Bundle test",
	"version": "1.0.0"
}
*/

joplin.plugins.register({
	onStart: async function() {
		// Create a folder
		await joplin.data.post(['folders'], null, { title: "my plugin folder" });
	}
});
1 Like

There's also this plugin: GitHub - S73ph4n/joplin_automate_notes: Joplin plugin to automate notes with javascript

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.