Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile: Add support for plugins #9652

Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
170 commits
Select commit Hold shift + click to select a range
897e313
Working tarExtract on Android
personalizedrefrigerator Jan 2, 2024
2075940
WIP
personalizedrefrigerator Jan 2, 2024
ebb8d31
Mobile: Set up expo
personalizedrefrigerator Nov 17, 2023
89f31fa
Add expo-asset as dependency
personalizedrefrigerator Jan 2, 2024
e1df003
Merge branch 'pr/mobile-plugin-support/loading-jpl-files' into pr/mob…
personalizedrefrigerator Jan 2, 2024
57d96f4
Loading a single JPL file via Expo
personalizedrefrigerator Jan 2, 2024
c95f8c4
PluginRunner: Initial implementation (Not connected to anything, unte…
personalizedrefrigerator Jan 3, 2024
9537a96
Running on Android (change fs.* to shim.*)
personalizedrefrigerator Jan 3, 2024
7d8485d
Fix several plugin load issues (messenger pipe still not working)
personalizedrefrigerator Jan 3, 2024
de3f35b
Attempt to expose correct ownProperty
personalizedrefrigerator Jan 4, 2024
0df9836
Fix plugin messaging issue
personalizedrefrigerator Jan 4, 2024
5c27c15
Change test plugin to a plugin that only shows a message box
personalizedrefrigerator Jan 4, 2024
332bb3c
Fix joplin.plugins.register: Minimal working plugin on mobile
personalizedrefrigerator Jan 4, 2024
cf9f781
Fix sample plugin README.md
personalizedrefrigerator Jan 4, 2024
564c0c0
Fix path to test plugin
personalizedrefrigerator Jan 4, 2024
9b42a51
Fix failing test
personalizedrefrigerator Jan 4, 2024
08dee76
Fix htmlpack (migration to @adobe/css-tools wasn't complete)
personalizedrefrigerator Jan 4, 2024
643be41
Fix plugin runner WebView visible when viewing a note
personalizedrefrigerator Jan 4, 2024
1766697
Reload plugins when the PluginRunnerWebView reloads
personalizedrefrigerator Jan 4, 2024
03a669d
Fix plugin background page able to access variables from parent frame
personalizedrefrigerator Jan 4, 2024
31e58bb
iOS: Fix background frame unable to load
personalizedrefrigerator Jan 4, 2024
ac1d7ef
Load CodeMirror content scripts
personalizedrefrigerator Jan 4, 2024
91493eb
Merge remote-tracking branch 'refs/remotes/origin/pr/mobile-plugin-su…
personalizedrefrigerator Jan 4, 2024
3af147d
Remove now-unused test plugin
personalizedrefrigerator Jan 4, 2024
b856c69
Fix loading plugins on desktop (fixes regression related to fsDriver.…
personalizedrefrigerator Jan 5, 2024
ba2a835
Add postMessage example to demo CodeMirror plugin
personalizedrefrigerator Jan 5, 2024
2d6d3e1
Merge branch 'dev' into pr/mobile-plugin-support/load-jpl-via-expo
laurent22 Jan 5, 2024
0c88e3d
Fix CodeMirror 6 plugins sometimes don't load on startup, load plugins
personalizedrefrigerator Jan 5, 2024
4a18992
Adjust how spacing is applied in the CM6 editor (move line numbers to…
personalizedrefrigerator Jan 5, 2024
6d072ea
Fix: Plugin settings sections shown at top of list and missing descri…
personalizedrefrigerator Jan 5, 2024
f1636ce
Allow disabling/enabling plugins in settings
personalizedrefrigerator Jan 5, 2024
3da8611
(Mobile only) Unload/reload plugins when enabling/disabling them in s…
personalizedrefrigerator Jan 5, 2024
e549608
Fix padding units
personalizedrefrigerator Jan 5, 2024
2ceb7ec
Merge remote-tracking branch 'upstream/dev' into pr/mobile-plugin-sup…
personalizedrefrigerator Jan 7, 2024
5f15589
Fix mobile startup error (see #9679)
personalizedrefrigerator Jan 7, 2024
0028b5e
Further extend example plugin
personalizedrefrigerator Jan 7, 2024
9b67120
Show plugin toolbar buttons
personalizedrefrigerator Jan 8, 2024
b169762
Load and update the RegisterCommandDemo plugin
personalizedrefrigerator Jan 8, 2024
d7758be
Fix KeymapService-related error
personalizedrefrigerator Jan 8, 2024
458f19d
Fix warnings/errors after reloading plugins
personalizedrefrigerator Jan 8, 2024
e5e4a1b
Fix icon-related warning
personalizedrefrigerator Jan 8, 2024
9567195
Fix settings fail to save if a plugin reloads
personalizedrefrigerator Jan 8, 2024
ce0e6bd
Merge remote-tracking branch 'upstream/dev' into pr/mobile-plugin-sup…
personalizedrefrigerator Jan 8, 2024
ad84a45
Update yarn.lock
personalizedrefrigerator Jan 8, 2024
fbcb1fa
Fix registering custom settings multiple times
personalizedrefrigerator Jan 8, 2024
41dcc94
Fix null incorrectly transferred as {}
personalizedrefrigerator Jan 8, 2024
b298cca
Partial support for plugin dialogs
personalizedrefrigerator Jan 9, 2024
eeb970c
Dialogs: Support callbacks
personalizedrefrigerator Jan 9, 2024
0277c64
Dialog webview: Transparent background
personalizedrefrigerator Jan 9, 2024
86909a0
Dialog styles
personalizedrefrigerator Jan 9, 2024
034ce9d
Set dialog size based on initial content size
personalizedrefrigerator Jan 9, 2024
de17b6e
Dialogs: Default titles for ok and cancel buttons
personalizedrefrigerator Jan 9, 2024
b2a2a6d
Support fullscreen dialogs
personalizedrefrigerator Jan 9, 2024
8b1a8ea
Support editor commands through CommandService
personalizedrefrigerator Jan 9, 2024
8609a1d
Fix commands with return values and arguments not working
personalizedrefrigerator Jan 9, 2024
26aa88a
Fix NoteEditor test
personalizedrefrigerator Jan 9, 2024
61de5aa
Show plugin icon by plugin setting section headings
personalizedrefrigerator Jan 10, 2024
16f8132
GUI for installing plugins (nonfunctional)
personalizedrefrigerator Jan 10, 2024
eb9fc31
Connect to plugin repository (install & delete -- update not implemen…
personalizedrefrigerator Jan 10, 2024
4e8c1bd
Untested support for updating plugins
personalizedrefrigerator Jan 10, 2024
50e54c6
Work around issue with enum plugin settings (.hasOwnProperty is not a…
personalizedrefrigerator Jan 10, 2024
f7d9f9c
Initial support for renderer content scripts
personalizedrefrigerator Jan 11, 2024
5024f3a
Hide nonfunctional devPluginPaths setting
personalizedrefrigerator Jan 11, 2024
f14f92c
Update and include ContentScriptDemo as a built-in plugin
personalizedrefrigerator Jan 11, 2024
faacb1d
Fix update button text and clear update state on startup
personalizedrefrigerator Jan 11, 2024
b45e766
Fix dialog size
personalizedrefrigerator Jan 11, 2024
e33eabe
Additional protection against XSS
personalizedrefrigerator Jan 11, 2024
4f100c2
Reset changes to unused test plugins
personalizedrefrigerator Jan 11, 2024
d17dd27
Chore: Refactor renderer package to improve type safety and limit dep…
personalizedrefrigerator Jan 11, 2024
aa6d6f6
Use @joplin/utils/path instead of @joplin/renderer/pathUtils
personalizedrefrigerator Jan 11, 2024
5b22de8
Revert unnecessary changes, make required option required
personalizedrefrigerator Jan 11, 2024
9cad813
Fix types
personalizedrefrigerator Jan 11, 2024
2b54573
Merge remote-tracking branch 'upstream/dev' into pr/mobile-renderer-i…
personalizedrefrigerator Jan 11, 2024
7eaf499
Move and fix tests
personalizedrefrigerator Jan 11, 2024
338a197
Stronger fsDriver types
personalizedrefrigerator Jan 12, 2024
f53a2dd
Fix types for fsDriver.exists
personalizedrefrigerator Jan 12, 2024
ebb0245
Convert assetsToHeaders to TypeScript
personalizedrefrigerator Jan 12, 2024
1e9c187
assetsToHeaders: require -> import
personalizedrefrigerator Jan 12, 2024
768f7d4
Chore: Mobile: Refactor note renderer to run inside the viewer WebView
personalizedrefrigerator Jan 12, 2024
921e47a
Improve renderer setup type safety
personalizedrefrigerator Jan 14, 2024
2034605
Ignore autogenerated files
personalizedrefrigerator Jan 14, 2024
768ab0d
Merge branch 'pr/mobile-renderer-in-webview-2' into pr/mobile-plugin-…
personalizedrefrigerator Jan 14, 2024
df7713b
Run markdown-it content scripts in the note viewer WebView
personalizedrefrigerator Jan 14, 2024
0f90c67
Show an error message when rendering fails
personalizedrefrigerator Jan 14, 2024
6258196
Unload plugins before deleting them
personalizedrefrigerator Jan 15, 2024
47dd796
codeMirrorPlugins: Log warning when a CodeMirror content script fails…
personalizedrefrigerator Jan 15, 2024
c432b61
Fix plugin button tooltips
personalizedrefrigerator Jan 15, 2024
691b082
Show plugin search on iOS/dev mode and adjust content provider warning
personalizedrefrigerator Jan 15, 2024
9dc650e
Add platform information (mobile or desktop) to versionInfo
personalizedrefrigerator Jan 15, 2024
e8a2869
Remove ContentScriptDemo plugin from default plugins (& reset now-unn…
personalizedrefrigerator Jan 15, 2024
1dd1c47
Remove ContentScriptDemo from default plugins build
personalizedrefrigerator Jan 15, 2024
d939a58
Support auto-saving settings
personalizedrefrigerator Jan 15, 2024
f2457da
Desktop: Fixes #9725: Fix warning logged when uninstalling multiple p…
personalizedrefrigerator Jan 15, 2024
d22b89d
Adjust deletion logic
personalizedrefrigerator Jan 15, 2024
de55152
Merge remote-tracking branch 'origin/pr/plugin-service-fix-uninstall-…
personalizedrefrigerator Jan 15, 2024
4afc1ed
Better error reporting
personalizedrefrigerator Jan 15, 2024
55a910f
Mobile: Add support for filtering in log screen
personalizedrefrigerator Jan 15, 2024
1aa74a7
Link to log screen when there are unhandled plugin errors
personalizedrefrigerator Jan 15, 2024
f2b7994
Fix limit, don't re-search after every keystroke
personalizedrefrigerator Jan 15, 2024
82aeed4
Merge branch 'pr/mobile-log-screen-filter' into pr/mobile-plugin-supp…
personalizedrefrigerator Jan 15, 2024
388f637
Add link to plugin website in search results
personalizedrefrigerator Jan 15, 2024
55d3e4d
Fix tarExtract when the source is a URL
personalizedrefrigerator Jan 16, 2024
2d2d658
Allow installing plugins from a file
personalizedrefrigerator Jan 16, 2024
0871e59
Address several TODOs
personalizedrefrigerator Jan 16, 2024
52a7bae
Adjust style of plugin icon in settings
personalizedrefrigerator Jan 16, 2024
8cdb5f8
Fix plugin loading from file on Android
personalizedrefrigerator Jan 16, 2024
4be35cb
Partial clipboard API
personalizedrefrigerator Jan 16, 2024
95cf3b0
Renderer: Support accessing plugin settings (accessing a setting loads
personalizedrefrigerator Jan 16, 2024
44fbd65
Fix occasional error messages when closing a note
personalizedrefrigerator Jan 16, 2024
59ddebc
Slightly faster rendering
personalizedrefrigerator Jan 16, 2024
1126730
Merge remote-tracking branch 'upstream/dev' into pr/mobile-plugin-sup…
personalizedrefrigerator Jan 16, 2024
5511db0
Fix test
personalizedrefrigerator Jan 16, 2024
09eef36
Merge remote-tracking branch 'refs/remotes/origin/pr/mobile-plugin-su…
personalizedrefrigerator Jan 16, 2024
7cb9545
Rename dialog and plugin interfaces
personalizedrefrigerator Jan 17, 2024
4e1d00e
useContentScripts: Cache content scripts rather than reloading from disk
personalizedrefrigerator Jan 17, 2024
bcff5c7
BundledFile: Allow original file names to be different from copied file
personalizedrefrigerator Jan 17, 2024
f4c1d4a
RemoteMessenger: Support returning objects containing callbacks
personalizedrefrigerator Jan 17, 2024
011816b
Update .gitignored files
personalizedrefrigerator Jan 17, 2024
a63fa05
Remove plugin message debug logging
personalizedrefrigerator Jan 18, 2024
0aa3f81
Include plugin console.* output in Joplin's log
personalizedrefrigerator Jan 18, 2024
11bcc2a
PluginUploadButton: Show animation while loading from file
personalizedrefrigerator Jan 18, 2024
e011b73
Plugin background webview: Hide to accessibility tools when visually …
personalizedrefrigerator Jan 18, 2024
e77ad5b
console.log wrapper: Work around error when arguments can't be conver…
personalizedrefrigerator Jan 18, 2024
554652e
Don't forward long console.logs to Joplin's logs (truncate)
personalizedrefrigerator Jan 18, 2024
698b236
Fix loading dialog content scripts
personalizedrefrigerator Jan 18, 2024
142d5f7
Merge remote-tracking branch 'upstream/dev' into pr/mobile-plugin-sup…
personalizedrefrigerator Jan 18, 2024
b56ee65
Revert out-of-scope changes to ToggleSpaceButton.tsx
personalizedrefrigerator Jan 18, 2024
bb437ba
Revert out-of-scope changes to cssToTheme.ts
personalizedrefrigerator Jan 18, 2024
374025a
Much faster mobile md5File
personalizedrefrigerator Jan 18, 2024
2a14066
PluginRunner: Don't unnecessarily re-inject plugin script
personalizedrefrigerator Jan 18, 2024
b85126a
Show each dialog in its own WebView (fixes script loading issue)
personalizedrefrigerator Jan 21, 2024
e4fd07b
Fix plugin dialog loading
personalizedrefrigerator Jan 21, 2024
3c02be3
Hide plugin dialogs until loaded
personalizedrefrigerator Jan 21, 2024
1ad0513
Fix "copy anchor link" plugin (sent a non-stringifyable message)
personalizedrefrigerator Jan 21, 2024
4418b51
Slight increase in dialog maximum size
personalizedrefrigerator Jan 21, 2024
363fdb0
Revert test changes to CodeMirror 6 test plugin
personalizedrefrigerator Jan 21, 2024
0badb64
Show loading animation while updating
personalizedrefrigerator Jan 22, 2024
d06d777
Add simple test for plugin search
personalizedrefrigerator Jan 23, 2024
f6881c4
WebView panels
personalizedrefrigerator Jan 24, 2024
2284374
ExtendedWebView: Better error message when webviewRef is undefined (i…
personalizedrefrigerator Jan 24, 2024
16945ee
Adjust plugin view panel styles
personalizedrefrigerator Jan 24, 2024
91f1757
Trying to fix "no such method" error
personalizedrefrigerator Jan 24, 2024
a5306f7
Add scrollToHash command and other commands from lib/commands
personalizedrefrigerator Jan 25, 2024
b64a30d
Add table-of-contents as a default mobile plugin
personalizedrefrigerator Jan 25, 2024
e66acbf
Implement openItem command
personalizedrefrigerator Jan 25, 2024
e5eabbd
Possible fix for calling injectJavaScript on undefined in
personalizedrefrigerator Jan 25, 2024
1440ee1
Remember the last-selected panel
personalizedrefrigerator Jan 25, 2024
cef19fd
Minor type cleanup
personalizedrefrigerator Jan 30, 2024
8570462
Merge remote-tracking branch 'upstream/dev' into pr/mobile-plugin-sup…
personalizedrefrigerator Feb 23, 2024
f663bc5
Fix issues caused by merge
personalizedrefrigerator Feb 23, 2024
5bef565
global-style.js -> global-style.ts
personalizedrefrigerator Feb 23, 2024
db2c7ac
Trying to fix hashchange causes loadEnd (which breaks WebView communi…
personalizedrefrigerator Feb 23, 2024
276223b
Work around link issue by disabling <a href="#" links in plugin dialogs
personalizedrefrigerator Feb 23, 2024
f9aebd1
Don't reload background scripts when injectedJs is reinjected -- Fix …
personalizedrefrigerator Feb 24, 2024
7e6d763
CodeMirror/mobile: Allow executing commands registered with .defineEx…
personalizedrefrigerator Feb 24, 2024
0433700
Fix note editor disconnects on theme change
personalizedrefrigerator Feb 24, 2024
94e6d1f
Fix links in toc dialog sometimes broken
personalizedrefrigerator Feb 24, 2024
afeca89
Trying to limit unnecessary rerenders
personalizedrefrigerator Feb 24, 2024
bee6fb1
Implement openNote command
personalizedrefrigerator Feb 24, 2024
f9238b4
Disable autocomplete in example plugin by default
personalizedrefrigerator Feb 24, 2024
ff28548
Merge remote-tracking branch 'upstream/dev' into pr/mobile-plugin-sup…
personalizedrefrigerator Mar 2, 2024
175a854
Fix contentScript.ts
personalizedrefrigerator Mar 2, 2024
cf1cb40
Merge remote-tracking branch 'upstream/dev' into pr/mobile-plugin-sup…
personalizedrefrigerator Mar 5, 2024
859cf63
Update yarn.lock
personalizedrefrigerator Mar 5, 2024
ccc4633
Fix buildScriptIndexes attempts to include files in subdirectories
personalizedrefrigerator Mar 5, 2024
4bebcf8
Merge remote-tracking branch 'upstream/dev' into pr/mobile-plugin-sup…
personalizedrefrigerator Mar 6, 2024
361fed6
Fix ignore files
personalizedrefrigerator Mar 6, 2024
2b86945
Fix spelling
personalizedrefrigerator Mar 6, 2024
048f70b
Merge remote-tracking branch 'upstream/dev' into pr/mobile-plugin-sup…
personalizedrefrigerator Mar 13, 2024
b8037f6
Fix compilation errors caused by merge
personalizedrefrigerator Mar 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ packages/app-desktop/services/electron-context-menu.js
packages/app-desktop/vendor/lib/
packages/app-mobile/android
packages/app-mobile/components/NoteEditor/**/*.bundle.js
packages/app-mobile/plugins/PluginRunner/*.bundle.js
packages/app-mobile/ios
packages/app-mobile/lib/rnInjectedJs/
packages/app-mobile/locales
Expand Down Expand Up @@ -532,6 +533,12 @@ packages/app-mobile/components/screens/search.js
packages/app-mobile/components/side-menu-content.js
packages/app-mobile/components/voiceTyping/VoiceTypingDialog.js
packages/app-mobile/gulpfile.js
packages/app-mobile/plugins/PlatformImplementation.js
packages/app-mobile/plugins/PluginRunner/PluginRunner.js
packages/app-mobile/plugins/PluginRunner/PluginRunnerWebView.js
packages/app-mobile/plugins/PluginRunner/pluginRunnerBackgroundPage.js
packages/app-mobile/plugins/PluginRunner/types.js
packages/app-mobile/plugins/loadPlugins.js
packages/app-mobile/root.js
packages/app-mobile/services/AlarmServiceDriver.android.js
packages/app-mobile/services/AlarmServiceDriver.ios.js
Expand All @@ -552,17 +559,26 @@ packages/app-mobile/utils/autodetectTheme.js
packages/app-mobile/utils/checkPermissions.js
packages/app-mobile/utils/createRootStyle.js
packages/app-mobile/utils/debounce.js
packages/app-mobile/utils/fs-driver/constants.js
packages/app-mobile/utils/fs-driver/fs-driver-rn.js
packages/app-mobile/utils/fs-driver/runOnDeviceTests.js
packages/app-mobile/utils/fs-driver/tarCreate.js
packages/app-mobile/utils/fs-driver/tarExtract.js
packages/app-mobile/utils/ipc/RNToWebViewMessenger.js
packages/app-mobile/utils/ipc/WebViewToRNMessenger.js
packages/app-mobile/utils/polyfills/bufferPolyfill.js
packages/app-mobile/utils/polyfills/index.js
packages/app-mobile/utils/setupNotifications.js
packages/app-mobile/utils/shareHandler.js
packages/app-mobile/utils/types.js
packages/default-plugins/build.js
packages/default-plugins/buildDefaultPlugins.js
packages/default-plugins/commands/buildAll.js
packages/default-plugins/commands/editPatch.js
packages/default-plugins/pluginRepositoryData.js
packages/default-plugins/types.js
packages/default-plugins/utils/getPathToPatchFileFor.js
packages/default-plugins/utils/readRepositoryJson.js
packages/default-plugins/utils/isGitRepository.js
packages/default-plugins/utils/waitForCliInput.js
packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.test.js
packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.js
Expand Down Expand Up @@ -978,6 +994,13 @@ packages/lib/themes/type.js
packages/lib/time.js
packages/lib/types.js
packages/lib/utils/credentialFiles.js
packages/lib/utils/ipc/RemoteMessenger.test.js
packages/lib/utils/ipc/RemoteMessenger.js
packages/lib/utils/ipc/TestMessenger.js
packages/lib/utils/ipc/WindowMessenger.js
packages/lib/utils/ipc/types.js
packages/lib/utils/ipc/utils/mergeCallbacksAndArgs.js
packages/lib/utils/ipc/utils/separateCallbacksFromArgs.js
packages/lib/utils/joplinCloud.js
packages/lib/utils/processStartFlags.js
packages/lib/utils/userFetcher.js
Expand Down
24 changes: 23 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,12 @@ packages/app-mobile/components/screens/search.js
packages/app-mobile/components/side-menu-content.js
packages/app-mobile/components/voiceTyping/VoiceTypingDialog.js
packages/app-mobile/gulpfile.js
packages/app-mobile/plugins/PlatformImplementation.js
packages/app-mobile/plugins/PluginRunner/PluginRunner.js
packages/app-mobile/plugins/PluginRunner/PluginRunnerWebView.js
packages/app-mobile/plugins/PluginRunner/pluginRunnerBackgroundPage.js
packages/app-mobile/plugins/PluginRunner/types.js
packages/app-mobile/plugins/loadPlugins.js
packages/app-mobile/root.js
packages/app-mobile/services/AlarmServiceDriver.android.js
packages/app-mobile/services/AlarmServiceDriver.ios.js
Expand All @@ -532,17 +538,26 @@ packages/app-mobile/utils/autodetectTheme.js
packages/app-mobile/utils/checkPermissions.js
packages/app-mobile/utils/createRootStyle.js
packages/app-mobile/utils/debounce.js
packages/app-mobile/utils/fs-driver/constants.js
packages/app-mobile/utils/fs-driver/fs-driver-rn.js
packages/app-mobile/utils/fs-driver/runOnDeviceTests.js
packages/app-mobile/utils/fs-driver/tarCreate.js
packages/app-mobile/utils/fs-driver/tarExtract.js
packages/app-mobile/utils/ipc/RNToWebViewMessenger.js
packages/app-mobile/utils/ipc/WebViewToRNMessenger.js
packages/app-mobile/utils/polyfills/bufferPolyfill.js
packages/app-mobile/utils/polyfills/index.js
packages/app-mobile/utils/setupNotifications.js
packages/app-mobile/utils/shareHandler.js
packages/app-mobile/utils/types.js
packages/default-plugins/build.js
packages/default-plugins/buildDefaultPlugins.js
packages/default-plugins/commands/buildAll.js
packages/default-plugins/commands/editPatch.js
packages/default-plugins/pluginRepositoryData.js
packages/default-plugins/types.js
packages/default-plugins/utils/getPathToPatchFileFor.js
packages/default-plugins/utils/readRepositoryJson.js
packages/default-plugins/utils/isGitRepository.js
packages/default-plugins/utils/waitForCliInput.js
packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.test.js
packages/editor/CodeMirror/CodeMirror5Emulation/CodeMirror5Emulation.js
Expand Down Expand Up @@ -958,6 +973,13 @@ packages/lib/themes/type.js
packages/lib/time.js
packages/lib/types.js
packages/lib/utils/credentialFiles.js
packages/lib/utils/ipc/RemoteMessenger.test.js
packages/lib/utils/ipc/RemoteMessenger.js
packages/lib/utils/ipc/TestMessenger.js
packages/lib/utils/ipc/WindowMessenger.js
packages/lib/utils/ipc/types.js
packages/lib/utils/ipc/utils/mergeCallbacksAndArgs.js
packages/lib/utils/ipc/utils/separateCallbacksFromArgs.js
packages/lib/utils/joplinCloud.js
packages/lib/utils/processStartFlags.js
packages/lib/utils/userFetcher.js
Expand Down
3 changes: 3 additions & 0 deletions packages/app-cli/tests/support/plugins/message_box/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
node_modules/
publish/
8 changes: 8 additions & 0 deletions packages/app-cli/tests/support/plugins/message_box/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.md
!README.md
/*.jpl
/api
/src
/dist
tsconfig.json
webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Plugin development

This documentation describes how to create a plugin, and how to work with the plugin builder framework and API.

## Installation

First, install [Yeoman](http://yeoman.io) and generator-joplin using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)).

```bash
npm install -g yo
npm install -g generator-joplin
```

Then generate your new project:

```bash
yo --node-package-manager npm joplin
```

## Structure

The main two files you will want to look at are:

- `/src/index.ts`, which contains the entry point for the plugin source code.
- `/src/manifest.json`, which is the plugin manifest. It contains information such as the plugin a name, version, etc.

The file `/plugin.config.json` could also be useful if you intend to use [external scripts](#external-script-files), such as content scripts or webview scripts.

## Building the plugin

The plugin is built using Webpack, which creates the compiled code in `/dist`. A JPL archive will also be created at the root, which can use to distribute the plugin.

To build the plugin, simply run `npm run dist`.

The project is setup to use TypeScript, although you can change the configuration to use plain JavaScript.

## Updating the manifest version number

You can run `npm run updateVersion` to bump the patch part of the version number, so for example 1.0.3 will become 1.0.4. This script will update both the package.json and manifest.json version numbers so as to keep them in sync.

## Publishing the plugin

To publish the plugin, add it to npmjs.com by running `npm publish`. Later on, a script will pick up your plugin and add it automatically to the Joplin plugin repository as long as the package satisfies these conditions:

- In `package.json`, the name starts with "joplin-plugin-". For example, "joplin-plugin-toc".
- In `package.json`, the keywords include "joplin-plugin".
- In the `publish/` directory, there should be a .jpl and .json file (which are built by `npm run dist`)

In general all this is done automatically by the plugin generator, which will set the name and keywords of package.json, and will put the right files in the "publish" directory. But if something doesn't work and your plugin doesn't appear in the repository, double-check the above conditions.

## Updating the plugin framework

To update the plugin framework, run `npm run update`.

In general this command tries to do the right thing - in particular it's going to merge the changes in package.json and .gitignore instead of overwriting. It will also leave "/src" as well as README.md untouched.

The file that may cause problem is "webpack.config.js" because it's going to be overwritten. For that reason, if you want to change it, consider creating a separate JavaScript file and include it in webpack.config.js. That way, when you update, you only have to restore the line that include your file.

## External script files

By default, the compiler (webpack) is going to compile `src/index.ts` only (as well as any file it imports), and any other file will simply be copied to the plugin package. In some cases this is sufficient, however if you have [content scripts](https://joplinapp.org/api/references/plugin_api/classes/joplincontentscripts.html) or [webview scripts](https://joplinapp.org/api/references/plugin_api/classes/joplinviewspanels.html#addscript) you might want to compile them too, in particular in these two cases:

- The script is a TypeScript file - in which case it has to be compiled to JavaScript.

- The script requires modules you've added to package.json. In that case, the script, whether JS or TS, must be compiled so that the dependencies are bundled with the JPL file.

To get such an external script file to compile, you need to add it to the `extraScripts` array in `plugin.config.json`. The path you add should be relative to /src. For example, if you have a file in "/src/webviews/index.ts", the path should be set to "webviews/index.ts". Once compiled, the file will always be named with a .js extension. So you will get "webviews/index.js" in the plugin package, and that's the path you should use to reference the file.

## More information

- [Joplin Plugin API](https://joplinapp.org/api/references/plugin_api/classes/joplin.html)
- [Joplin Data API](https://joplinapp.org/help/api/references/rest_api)
- [Joplin Plugin Manifest](https://joplinapp.org/api/references/plugin_manifest/)
- Ask for help on the [forum](https://discourse.joplinapp.org/) or our [Discord channel](https://discord.gg/VSj7AFHvpq)

## License

MIT © Laurent Cozic
3 changes: 3 additions & 0 deletions packages/app-cli/tests/support/plugins/message_box/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# message_box

Shows a message box.
14 changes: 14 additions & 0 deletions packages/app-cli/tests/support/plugins/message_box/api/Global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Plugin from '../Plugin';
import Joplin from './Joplin';
/**
* @ignore
*/
/**
* @ignore
*/
export default class Global {
private joplin_;
constructor(implementation: any, plugin: Plugin, store: any);
get joplin(): Joplin;
get process(): any;
}
74 changes: 74 additions & 0 deletions packages/app-cli/tests/support/plugins/message_box/api/Joplin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import Plugin from '../Plugin';
import JoplinData from './JoplinData';
import JoplinPlugins from './JoplinPlugins';
import JoplinWorkspace from './JoplinWorkspace';
import JoplinFilters from './JoplinFilters';
import JoplinCommands from './JoplinCommands';
import JoplinViews from './JoplinViews';
import JoplinInterop from './JoplinInterop';
import JoplinSettings from './JoplinSettings';
import JoplinContentScripts from './JoplinContentScripts';
import JoplinClipboard from './JoplinClipboard';
import JoplinWindow from './JoplinWindow';
import BasePlatformImplementation from '../BasePlatformImplementation';
import JoplinImaging from './JoplinImaging';
/**
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
*
* The API is now relatively stable and in general maintaining backward compatibility is a top priority, so you shouldn't except much breakages.
*
* If a breaking change ever becomes needed, best effort will be done to:
*
* - Deprecate features instead of removing them, so as to give you time to fix the issue;
* - Document breaking changes in the changelog;
*
* So if you are developing a plugin, please keep an eye on the changelog as everything will be in there with information about how to update your code.
*/
export default class Joplin {
private data_;
private plugins_;
private imaging_;
private workspace_;
private filters_;
private commands_;
private views_;
private interop_;
private settings_;
private contentScripts_;
private clipboard_;
private window_;
private implementation_;
constructor(implementation: BasePlatformImplementation, plugin: Plugin, store: any);
get data(): JoplinData;
get clipboard(): JoplinClipboard;
get imaging(): JoplinImaging;
get window(): JoplinWindow;
get plugins(): JoplinPlugins;
get workspace(): JoplinWorkspace;
get contentScripts(): JoplinContentScripts;
/**
* @ignore
*
* Not sure if it's the best way to hook into the app
* so for now disable filters.
*/
get filters(): JoplinFilters;
get commands(): JoplinCommands;
get views(): JoplinViews;
get interop(): JoplinInterop;
get settings(): JoplinSettings;
/**
* It is not possible to bundle native packages with a plugin, because they
* need to work cross-platforms. Instead access to certain useful native
* packages is provided using this function.
*
* Currently these packages are available:
*
* - [sqlite3](https://www.npmjs.com/package/sqlite3)
* - [fs-extra](https://www.npmjs.com/package/fs-extra)
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/nativeModule)
*/
require(_path: string): any;
versionInfo(): Promise<import("./types").VersionInfo>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default class JoplinClipboard {
private electronClipboard_;
private electronNativeImage_;
constructor(electronClipboard: any, electronNativeImage: any);
readText(): Promise<string>;
writeText(text: string): Promise<void>;
readHtml(): Promise<string>;
writeHtml(html: string): Promise<void>;
/**
* Returns the image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format.
*/
readImage(): Promise<string>;
/**
* Takes an image in [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) format.
*/
writeImage(dataUrl: string): Promise<void>;
/**
* Returns the list available formats (mime types).
*
* For example [ 'text/plain', 'text/html' ]
*/
availableFormats(): Promise<string[]>;
}
Loading
Loading