/inkdrop-mobile-plugins

Plugins for Inkdrop mobile

Primary LanguageJavaScript

Plugins for Inkdrop mobile

How to add your plugin

Update your plugin for mobile

Add README-mobile.md

It is a documentation for mobile. Basically you can reuse your README.md but you have to remove sections for desktop like "How to install".

Remove "plugin" words from your plugin description

You can not use "plugin" or any words like "extension" in your package description or readme. Because your plugin will be displayed as one of renderer options like so:

Screenshot

This is a workaround to avoid violating Apple's guideline. Read the blogpost for more detail on this workaround.

Add submodule

Run the following command:

git submodule add <YOUR_REPO_URL> packages/<PLUGIN_NAME>

Edit package.json

Add your plugin to devDependencies like so:

  "devDependencies": {
    "math": "file:packages/math",
  }

Then, run npm install.

Build

Run the following command:

npm run build

Test

Add a test for your plugin to test/index.js to make sure it gets loaded properly.

For example:

test.serial.cb("mermaid", t => {
  global.window.inkdrop.packages.setPackageMainModule = (name, p) => {
    t.is(name, "mermaid");
    t.is(p instanceof Object, true);
    t.is(typeof p.activate, "function");
    t.is(typeof p.deactivate, "function");
    t.end();
  };

  require("../lib/mermaid");
});

How to debug your plugin

Build plugin metadata:

npm run build:index

Launch webpack server:

npm run dev:server

Then, open up a debugger tool:

https://inkdrop-mobile-plugin-debugger.netlify.com/

Open Developer Tools and you should see like this:

Screenshot