Skip to content

Commit

Permalink
Fixed logic when creating new board
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Nov 9, 2024
1 parent bb5d750 commit 291f057
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ joplin.plugins.register({
const updateFromSelectedNote = async () => {
const note = await joplin.workspace.selectedNote();
if (!note) return;

await panels.postMessage(view, { type: 'setNote', value: { id: note.id, body: note.body }});
}

Expand All @@ -54,6 +54,7 @@ joplin.plugins.register({
});

await panels.onUpdate(view, async () => {
logger.info('onUpdate');
await updateFromSelectedNote();
});

Expand All @@ -63,8 +64,13 @@ joplin.plugins.register({
execute: async () => {
logger.info('Creating new Kanban note...');
await joplin.commands.execute('newNote', newNoteBody);
await joplin.commands.execute('showEditorPlugin');
await updateFromSelectedNote();

// Wait for the note to be created and the UI to be updated before showing the
// editor
setTimeout(async () => {
await joplin.commands.execute('showEditorPlugin');
await updateFromSelectedNote();
}, 200);
},
});

Expand Down

0 comments on commit 291f057

Please sign in to comment.