Locking the WYSIWYG editor to read-only

I'm developing a plugin for recipe management and whenever any edits are made in the WYSIWYG editor, the whole formatting of my recipe breaks. However, if the markdown is correctly written, the result of the recipe management plugin I've made is wonderful. It even allows for scaling recipes to any desired serving counts. Plus, it has a beautiful recipe card at the top that provides all sorts of details.

Unfortunately, if any changes are made in the WYSIWYG editor, it ends up messed up in the markdown as converting the HTML back to markdown is completely broken in my plugin. I'm a bit in over my head and can't seem to get it working.

The most simple way to get this to work, at least for now, would just be to lock any changes from being made in the WYSIWYG editor and only allow changes through the markdown editor. Is this possible?

I'm linking to the documentation on how to make Markdown renderer plugins support the Rich Text Editor.

Edit: I don't think there is a simple (and non-fragile) way to do from the plugin API. One option could be to remove the contentEditable attribute from the topmost editable element. However, this might not prevent Joplin from trying to convert the Rich Text editor's content back to Markdown.

If possible, I suggest adding the documented metadata to the rendered Markdown.

Wonderful, I have everything working as desired now. Excited to get this plugin out there soon for anyone else who loves cooking.

1 Like