Feature Request: Custom properties for notes

Hello. I want to re-open an old topic but with additional details

As a Joplin Plugin Developer, I would like to have the possibility to save custom note properties for saving plugin metadata regarding a selected note and have access to this info in the future (i.e.: from Joplin.workspace.selectedNote().properties)

Is it possible and how do other developers save their plugin metadata about notes (except note body) ?

1 Like

Anybody?

Not quite what you're looking for but you can create a separate sqlite database for your plugin and store properties there.

1 Like

@roman_r_m interesting suggestion. But it's not plugin properties, it's note properties.
This approach will require creating a table for each note.
Also cleaning staff of non-existed (deleted) notes might be challenging
Other ways?

It won't, unless I misunderstood what you need.

You can use just one table like so:

noteId property1 property2
1 value1 value2

Or, if the set of properties is dynamic, you can still do with a single table:

noteId property_name property_value
1 note1_property_name note1_property_value

I don't see an issue - just run a check at startup and then maybe once every hour to cleanup the properties of notes that have been deleted.

2 Likes

I hope the metadata field will be implemented so that the infos are also syncronized.

1 Like

Last news on those was long time ago :frowning:

Sqlite supports the JSON field now. I think no new table will be required now. Only a new properties field (defaults to {}) in the post table. Users can store keys and values there and query on them.

The API to access the properties must add some added access control. I'm considering a structure like this:

{
    "plugin1.namespace": {...keys & values},
    "plugin2.namespace": {...keys & values}
}

While a plugin can read all properties from all plugins, they shouldn't be able to add/modify/delete any property outside it's namespace. This will allow users to create a multi-plugin workflow while being safe from malicious plugins.