document.body points to the plugin's background page (which isn't visible to the user). Consider using joplin.commands.execute or joplin.data to update the content of a note.

1 Like