Mobile: Plugin support

I've tested several plugins with a recent version of Joplin (around this commit). I've listed the plugins that seem to work and the plugins that are broken below.

The most common issues seemed to be caused by lack of file system access for plugins on mobile.

Broken plugins

  • :crown: Backup
  • :crown: BibTeX
    • Requires filesystem access
    • Fails on startup when trying to require child_process (required by a dependency? Doesn't seem to be in the main codebase...)
  • Freehand drawing
    • Uses fs
  • :crown: Favorites
    • Seem to require toplevel menubar items to add tabs (there's no menubar on mobile)
  • :crown: Combine notes
    • Uses fs
    • UI is in the list of actions when selecting multiple notes, which hasn't been exposed to plugins yet.
  • :crown: Conflict resolution
    • UI for showing the conflict resolution window (right-click on a note) isn't exposed to plugins.
    • (Based on the codebase) Uses fs-extra
  • :crown: Hotfolder
    • Uses the file system
  • :crown: Templates
    • Uses the file system
  • :crown: Persistent editor layout
    • Mobile only has "editor" and "viewer" and doesn't expose commands for switching layouts to plugins.
  • :crown: Resource search
    • Requires filesystem access.
  • :crown: Table formatter plugin
    • Extends the right-click menu, which isn't available on mobile.
  • :crown: Note overview
    • Expects the global process variable to exist.
  • Better code blocks
    • No CodeMirror 6 support
  • Note list (Preview)
    • No note list API

Partially working plugins

  • :crown: Note tabs
    • There doesn't seem to be a way to pin tabs (except by enabling the "pin on editing" setting)
    • There doesn't seem to be a way to close tabs
  • RevealJS slides
    • Printing doesn't work
    • Users need to click the "start slideshow" button, wait for the "switch to the note viewer" alert dialog, then switch to the note viewer to start a presentation.
  • Outline
    • Its scrollToLine command only works in CodeMirror 5 (so jump-to-heading doesn't work).

Mostly working plugins

  • History panel
    • Difficulty during setup β€” need to set a history note in advanced settings.
  • Kanban
  • :crown: ABC Sheet Music
    • Has trouble with dark mode
  • :crown: Menu items, shortcuts, toolbar icons
    • Extra CodeMirror toolbar buttons work
  • :crown: Rich markdown
    • No alt key on many mobile devices to trigger the "show image on hover"
      • Works if "render images on their own line" is enabled.
    • No ctrl key to trigger ctrl-click behavior.
  • CodeMirror 6 settings
    • Logs an error when trying to update editor settings if no note is open (but otherwise seems to work).
  • Link Graph UI
    • Seems to have trouble when switching between notes (or no note selected). Otherwise, seems to work.
  • Spoilers
    • Shows an empty box, rather than an arrow, to the left of dropdowns rendered by the plugin. (This may be related to the fonts installed on my test device).

Working plugins

6 Likes

I have been able to get the spoilers plugin and the admonitions plugin to work on my android phone and tablet.

2 Likes

what about the calendar and agenda plugin on android.
this is very hard needed.

To-dos are really useful, this plugin does a great job of seeing all the to-dos, would you like to implement it on mobile or even desktop? Thank you.
@personalizedrefriger

1 Like

I love the bundle plugin (even used to contribute to it). It's strange that it's not displayed in the Joplin plugin store, because it used to be. Could it be that its manifest needs an update @personalizedrefriger?

I just re-built the plugin in a separate fork, so anyone can download the jpl and install it on desktop or mobile. It doesn't work on mobile because of dependencies that are not available (it will probably also need some modifications).

However, until it's migrated to the mobile app, if you're interested in displaying TODOs in a panel I recommend checking (disclaimer: my) Inline Tag Navigator plugin, which is supported on mobile. There are simple instructions how to set it up to display inline TODOs. You may use it to filter them and toggle checkboxes.

2 Likes

It seems to have been removed. The commit message states:

Remove plugin "Plugin Bundle" Β· joplin/plugins@c63147f Β· GitHub

Causes CPU to be at 100% all the time and bundles too many plugins.
Cannot be uninstalled in some cases.

Other plugins were removed on the same day.

Edit: Reworded, reformatted.
Edit 2: I don't see a corresponding GitHub issue. Edit 3: Corresponding GitHub issue.

1 Like

Thanks @personalizedrefriger, I wasn't aware of this process. And thanks @laurent for maintaining a clean and safe plugin repository! (I hope that @SeptemberHX knows.)

1 Like

Look like Mobile support for plugin is up and running.

What is the requirement to make my plugins available on mobile? My understanding is some of them is compatible with mobile version already but I don’t see them in the install list.

Setup

  1. Add "platforms": ["desktop", "mobile"] to the plugin's manifest to declare that the plugin supports mobile.
  2. 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:

  1. 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.
  2. 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

I guess it doesn't support real-time updates of the to-do list on mobile devices.

Would you like to add a plugin that can display all the to-do items on the mobile side?
Based on my guess, the probability of other contributors doing this specifically for the mobile side is not high. But I am very much looking forward to being able to retrieve all the to-do items on the mobile side.

I may be misinterpreting what you wrote, but if you edit a note or sync it, the panel should update the corresponding inline TODOs from that note. If there are issues I'd be happy to look into them, but perhaps let's continue in this thread.

@personalizedrefriger - I've added the platforms list to my Paragraph Extractor plugin and tested it on the work-in-progress web build. It has the fs error. What do I need to do here? Do I need to wait some more? It is similar to the Combine Notes plugin which also has the selection of multiple notes - not ready yet?

Based on index.js in the built version of Paragraph Extractor, node:fs, node:os, node:util, and node:tty are both used by the plugin[1]. These libraries are unavailable on mobile.

I suspect that fs, os, util, and tty are being required by i18n, though they could also be required by moment. Both libraries are imported in extractParagraphs.ts.

On mobile, plugins run in a WebView, without access to NodeJS APIs. i18n has an open GitHub issue requesting support for web browsers, so likely won't work in a mobile-compatible Joplin plugin.

Possible fixes:

  • Migrate to an i18n library that supports running within a browser JavaScript environment.
  • Use custom localization logic (e.g. different JavaScript objects for different locales). (Example).
  • Require i18n dynamically and only support localization on desktop.

Additional notes:

Be aware that the joplin.views.menus API is currently desktop-only. While it's possible to register menus with joplin.views.menus on mobile, they won't be visible in the UI.

Two possible alternatives are joplin.views.toolbarButtons and joplin.views.panels. The joplin.versionInfo API can be used to determine whether the current device is mobile or desktop.

Edited: Reformatting, linked to additional information about the i18n incompatibility, and added a section about other possible incompatibilities.


  1. This is based on a ctrl+f search for require('fs'). β†©οΈŽ

@personalizedrefriger thank you for the comprehensive reply! I'll take a look at possibly disabling i18n for now and digging into the alternative APIs for views.

1 Like

I think I did everything required to build the plugin for mobile, but in the mobile app while the plugin is loading I get this error in the logs:

Plugin com.DanteCoder.JoplinBibleQuote: Unhandled promise rejection: Error: Unable to require module events on mobile.. Promise: [object Promise].

I'm not sure if this is specific to my plugin, but this error sounds familiar to a react-native error.
This is the repo at the time I did the build.

The xml2js library (used here) relies on NodeJS libraries, including events (related issue). Mobile plugins run in a WebView, and thus don't have access to most NodeJS libraries. (At present, only path is polyfilled for most plugins).

In this case, the web built-in DOMParser.parseFromString might be an alternative to xml2js.

1 Like

Is the Data API currently fully functional? I'm getting an error when trying to get some resources (GET /resources/:id/file):

Error: Unsupported encoding: buffer. (Calling api.joplin.data.get)