Setup
- Add
"platforms": ["desktop", "mobile"] to the plugin's manifest to declare that the plugin supports mobile.
- Build the plugin with
npm run dist.
Testing
Next, debug and test the plugin either in the mobile app itself, or with the work-in-progress web build of the mobile app.
Testing on a web build of Joplin mobile
The work-in-progress web build of the mobile app has two ways to test custom-built plugins:
- Configuration > Plugins > Advanced > Install from file: Allows installing custom plugins. For local changes to be applied, plugins installed this way will need to be manually reinstalled.
- Configuration > Plugins > Advanced > Development plugins:
- This only works in Chromium-based browsers.
- The development plugin should be reloaded 0-6 seconds after being changed on disk. However, for editor plugins, it may be necessary to exit, then re-enter edit mode for the changes to be visible.
- It may be necessary to re-add the plugin in settings after refreshing the page.
Plugin logs (and a large number of unrelated warnings) can be seen using the browser development tools.
Testing on a physical device
On Android and development versions of the iOS app, plugins can be installed from the file system from Configuration > Plugins > Advanced > Install From File. See debugging mobile plugins for how to inspect plugins using the Chrome dev tools.
Running on iOS: Information about how to build and run Joplin in development mode can be found here. See iOS: Enable plugin support · Issue #10154 · laurent22/joplin · GitHub for why this requires a development build of Joplin for iOS.
Print statement debugging
console.info, console.warn, and console.error should all be sent to Joplin's logs.
6 Likes