Hello everyone. It's been some time since I created the "Bible Quote" plugin. Recently I saw that support for mobile plugins is becoming a thing, and someone suggested that I make my plugin mobile-compatible.
The thing is, currently my plugin works by accessing the file system to open some files, which I see is not supported on mobile. My approach was to load the files from a note instead, using the Data API. This seemed to work fine, the problem now is that loading the files and then sending the parsed objects to the markdown-it plugin (using the localstorage plus a hack) is an async operation that ends after the markdown has already finished rendering. This is "fixed" by refreshing the note: changing from one note to another, modifying the note, etc.
I have tried the following solutions:
I tried the approach of an async rule as suggested in the official md docs, but since Joplin triggers the render
function internally, I figured it would be impossible to do this just from the plugin itself. Also, I don't think that replacing the render function from the MarkdownIt instance to be async would be appropriate.
This approach would solve the problem of sending the files over to the markdown-it plugin, and instead just load them from the main plugin and send small messages from the markdown plugin to the main plugin when a query to a file is needed.
My second approach was to reload the note after the files were sent (spoiler: I couldn't trigger a reload manually).
I'm open to any suggestions.