1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Doc: Updated doc for resource creation from a plugin

This commit is contained in:
Laurent Cozic 2021-01-27 13:00:10 +00:00
parent ea49242f24
commit 35597ce3c2

View File

@ -312,6 +312,20 @@ async function fetchAllNotes() {
lines.push(''); lines.push('');
lines.push('The "data" field is required, while the "props" one is not. If not specified, default values will be used.'); lines.push('The "data" field is required, while the "props" one is not. If not specified, default values will be used.');
lines.push(''); lines.push('');
lines.push('**From a plugin** the syntax to create a resource is also a bit special:');
lines.push('');
lines.push('```javascript');
lines.push('\tawait joplin.data.post(');
lines.push('\t\t["resources"],');
lines.push('\t\tnull,');
lines.push('\t\t{ title: "test.jpg" }, // Resource metadata');
lines.push('\t\t[');
lines.push('\t\t\t{');
lines.push('\t\t\t\tpath: "/path/to/test.jpg", // Actual file');
lines.push('\t\t\t},');
lines.push('\t\t]');
lines.push('\t);');
lines.push('```');
} }
if (model.type === BaseModel.TYPE_TAG) { if (model.type === BaseModel.TYPE_TAG) {