Dear Joplin Plugin Dev community,
My plugin (Secure Notes) renders custom password prompt page via contentScripts (MarkdownIt). Everything is working fine if you don't use RTE/WYSIWYG editor. If users by mistake edit something in RTE it corrupts the whole note. This is a critical bug, stopping me from pushing v2.x of my plugin. I just need a way for detecting RTE editor inside contentScript then I can render with original MarkdownIt editor instead of my custom renderer.
Dear Devs please help me with this one, I just want go offline after pushing v2.x until Joplin 3.6.12 is released
.
FYI: I already tried joplin-editable it is of no use.
1 Like
I don't think you can call it from within the content script, but you can use editor.codeView to detect the current editor: Jump to Header in Editor Mode? - #6 by CalebJohn
Why is joplin-editable not working? That's the built-in way to handle this, to show some particular content in the RTE editor, while preserving the raw Markdown content
Can joplin-editable prevent the user from changing the RTE content directly?
The issue he is having is that the content for a form like interface is being rendered in the RTE, but instead of being interactive, you just wipe out the entire content if you type something, because the whole form ends up being one selectable element instead of being usable
Can joplin-editable prevent the user from changing the RTE content directly?
For the ABC music notation for example, it displays the sheet music as an image, and if you double click on it, you can edit it. Meanwhile, the actual source code remains saved correctly in the hidden joplin-source tag. I don't know how this secure note plugin works but maybe it can be tweaked to handle the RTE in that way
Sorry for the late reply.
My bad people, I didn't go through the API example completely. I kind of changed the whole renderer instead of just the fenced block. So, it didn't work.
Now I have changed the code and adjusted my plugin format to stay inside the code fence, It is kind of working but not fool proof.
Problems with RTE:
- I have an input box which autofocuses, at this point typing something just inserts a white space at the end of code fence. Not a big issue but still not desirable.
TAB key is able to escape joplin-editable, making it possible to delete the whole note, see the attached GIF:

Possible solution:
We need a mechanism to detect the editor type: MD/RTE. One possible way would passing it via _options from plugin function. This way I would just render the original content in RTE and limit my plugin to MD editor.