1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-12-23 23:33:01 +02:00

Compare commits

..

54 Commits

Author SHA1 Message Date
Laurent Cozic
093ef3d55a Fixing url import 2020-10-28 17:49:11 +00:00
Laurent Cozic
a6748bafb3 All: Fixes #3992: Update highlight.js to fix freeze for certain code blocks 2020-10-28 17:31:54 +00:00
Laurent Cozic
b52f6eb77c All: Fixes #3955: Fixed sync issue when importing ENEX files that contain new line characters in the source URL attribute 2020-10-28 17:21:41 +00:00
Laurent Cozic
98c933fdb7 All: Fixed OneDrive authentication 2020-10-28 15:50:34 +00:00
Laurent Cozic
ece7ffadd6 Desktop: Fixes #3986: Handle gzipped CSS files when importing from clipper 2020-10-28 15:47:36 +00:00
Laurent Cozic
04cfd07176 macOS: Regression: Restore Edit menu in config screens so that Copy/Cut/Paste shortcuts work 2020-10-28 11:23:57 +00:00
Laurent Cozic
db2282a351 Desktop: Fix syntax of imported resources when importing ENEX as HTML 2020-10-28 11:11:04 +00:00
Laurent Cozic
0ec3d6ca9d Clipper: Upgraded clipper to support API pagination
This version of the clipper will support both new and old Joplin
clients, so as to ease the transition.
2020-10-27 00:38:39 +00:00
Laurent Cozic
6a068a90b2 Desktop: Regression: Keyboard shortcut would not save in some cases 2020-10-25 17:46:41 +00:00
Laurent Cozic
9a6f6c8b39 Desktop: Regression: Restore "New sub-notebook" command 2020-10-25 17:29:52 +00:00
Laurent Cozic
52d5c32950 Plugins: Add the openNote, openFolder and openTag commands 2020-10-25 17:22:59 +00:00
Laurent Cozic
de47cff86d Fixed case 2020-10-24 12:07:48 +01:00
Laurent Cozic
a459174f98 Desktop: Fix: Command Palette click did not work 2020-10-24 11:46:02 +01:00
Laurent Cozic
75d5aa3a77 Tools: Fixed linter errors 2020-10-24 00:14:30 +01:00
Laurent Cozic
c254ca524f CLI v1.3.3 2020-10-23 17:01:13 +01:00
Laurent Cozic
51934b8d8d Cli: Added missing "immer" package 2020-10-23 17:00:20 +01:00
Laurent Cozic
a5dd686bb2 CLI v1.3.2 2020-10-23 16:58:28 +01:00
Laurent Cozic
4cbfd04522 Cli: Trying to fix build 2020-10-23 16:56:34 +01:00
Laurent Cozic
6d5d9323bd CLI v1.3.1 2020-10-23 16:04:34 +01:00
Laurent Cozic
76063a6284 Android release v1.3.9 2020-10-23 16:03:13 +01:00
Laurent Cozic
4119924e57 Electron release v1.3.9 2020-10-23 15:57:29 +01:00
Laurent Cozic
537336754c All: Sort tags in a case-insensitive way 2020-10-23 15:48:11 +01:00
Laurent Cozic
06f73919bd Desktop: Fixed Cut menu item and test units 2020-10-23 13:21:37 +01:00
Laurent Cozic
3f3e46081c Merge branch 'dev' of github.com:laurent22/joplin into dev 2020-10-22 16:34:45 +01:00
Laurent Cozic
68e4b4eaad macOS: Fixes #3404: Show context menu option to copy a link 2020-10-22 16:32:13 +01:00
Gen Neko
9dcb4b51e5 All: Translation: Update ja_JP.po (#3967) 2020-10-22 11:05:28 -04:00
Laurent Cozic
8543849ea1 Tools: Fixed tests 2020-10-22 15:55:29 +01:00
Laurent Cozic
6ce5240e12 Plugins: Fixed tests 2020-10-22 14:51:59 +01:00
Rory O’Kane
5bc25aefce Desktop: Make “update is available” dialog box easier to use (#3877) 2020-10-22 12:25:06 +01:00
Naveen M V
b737ca7471 All: Fix search filters when language is in Korean or with accents (#3947) 2020-10-22 12:16:47 +01:00
Laurent Cozic
a5d7366f94 Desktop: Fix invalid tag state issue when importing notes or syncing 2020-10-22 11:21:16 +01:00
Laurent Cozic
98f822d89c Cleaned up plugin doc 2020-10-21 22:52:58 +01:00
Laurent Cozic
c33a8250ee Desktop: Added openProfileDirectory command and menu item 2020-10-21 22:10:21 +01:00
Laurent Cozic
adad406696 Update translations 2020-10-21 21:54:47 +01:00
Laurent Cozic
d82eec0fa4 Tools: Render translator names as link to prevent website template from breaking 2020-10-21 21:53:41 +01:00
Laurent Cozic
c93f474547 Merge branch 'release-1.3' of github.com:laurent22/joplin into release-1.3 2020-10-21 21:30:29 +01:00
Laurent Cozic
0afd4a6234 Doc: Fixed typo 2020-10-21 21:23:31 +01:00
Laurent Cozic
f42786a840 Android release v1.3.8 2020-10-21 18:31:12 +01:00
Laurent Cozic
1c1f044966 Electron release v1.3.8 2020-10-21 18:19:33 +01:00
Laurent Cozic
ad7a80e260 Api: Allow preserving timestamps when updating a note 2020-10-21 18:12:36 +01:00
Laurent Cozic
5e040c062c Desktop: Fixes #3962: Certain commands no longer worked. 2020-10-21 17:22:29 +01:00
Laurent Cozic
0cede5f90a Desktop: Display more info while an ENEX file is being imported 2020-10-21 16:55:52 +01:00
Laurent Cozic
8dc0deb2a4 Desktop, Cli: Fixes #3958: Fixed freeze when importing ENEX as HTML, and fixed potential error when importing resources 2020-10-21 12:02:06 +01:00
Laurent Cozic
1ca44b8f44 Desktop: Made toolbar buttons bigger and swap order of bullet and number lists 2020-10-21 10:39:53 +01:00
Laurent Cozic
4ba9e60194 Merge branch 'dev' of github.com:laurent22/joplin into dev 2020-10-21 10:12:13 +01:00
Laurent Cozic
9d0bb4257f Desktop: Regression: Fixed format of copied version info 2020-10-21 10:10:18 +01:00
Alessandro Bernardello
1a273b9bca All: Translation: Update it_IT.po (#3956)
* Updated italian translation

* Updated translator name and email
2020-10-21 01:03:23 -04:00
Laurent Cozic
d9e93cd6c4 Doc: Update plugin doc 2020-10-21 01:46:53 +01:00
Laurent Cozic
5d39860707 Plugins: Allow custom commands to return a result 2020-10-21 01:43:06 +01:00
Laurent Cozic
60a6f714bc Update website 2020-10-21 00:56:03 +01:00
Laurent Cozic
6eebeca259 Tools: updated plugin types 2020-10-21 00:55:10 +01:00
Laurent Cozic
995034c53f Update plugin templates 2020-10-21 00:35:06 +01:00
Laurent Cozic
45a0981d05 Updated website 2020-10-21 00:27:11 +01:00
Laurent Cozic
3d8577a689 Plugins: Added support for content scripts
- For now, supports Markdown-it plugins
- Also fixed slow rendering of notes in some cases
- Simplified how Markdown-It plugins are created and cleaned MdToHtml code

commit 89576de289
Merge: c75aa21f 5292fc14
Author: Laurent Cozic <laurent@cozic.net>
Date:   Wed Oct 21 00:23:00 2020 +0100

    Merge branch 'release-1.3' into plugin_content_scripts

commit c75aa21ffd
Author: Laurent Cozic <laurent@cozic.net>
Date:   Wed Oct 21 00:19:52 2020 +0100

    Fixed tests

commit 075187729d
Author: Laurent Cozic <laurent@cozic.net>
Date:   Wed Oct 21 00:11:53 2020 +0100

    Fixed tests

commit 14696b8c65
Author: Laurent Cozic <laurent@cozic.net>
Date:   Tue Oct 20 23:27:58 2020 +0100

    Fixed slow rendering of note

commit 61c09f5bf8
Author: Laurent Cozic <laurent@cozic.net>
Date:   Tue Oct 20 22:35:21 2020 +0100

    Clean up

commit 9f7ea7d865
Author: Laurent Cozic <laurent@cozic.net>
Date:   Tue Oct 20 20:05:31 2020 +0100

    Updated doc

commit 98bf3bde8d
Author: Laurent Cozic <laurent@cozic.net>
Date:   Tue Oct 20 19:56:34 2020 +0100

    Finished converting plugins

commit fe90d92e01
Author: Laurent Cozic <laurent@cozic.net>
Date:   Tue Oct 20 17:52:02 2020 +0100

    Simplified how Markdown-It plugins are created

commit 47c7b864cb
Author: Laurent Cozic <laurent@cozic.net>
Date:   Mon Oct 19 16:40:11 2020 +0100

    Clean up rules

commit d927a238bb
Author: Laurent Cozic <laurent@cozic.net>
Date:   Mon Oct 19 14:29:40 2020 +0100

    Fixed tests

commit 388a56c5dd
Author: Laurent Cozic <laurent@cozic.net>
Date:   Mon Oct 19 14:00:47 2020 +0100

    Add support for content scripts
2020-10-21 00:23:55 +01:00
396 changed files with 20606 additions and 16846 deletions

View File

@@ -81,6 +81,7 @@ ElectronClient/app.js
ElectronClient/bridge.js
ElectronClient/commands/copyDevCommand.js
ElectronClient/commands/focusElement.js
ElectronClient/commands/openProfileDirectory.js
ElectronClient/commands/startExternalEditing.js
ElectronClient/commands/stopExternalEditing.js
ElectronClient/commands/toggleExternalEditing.js
@@ -104,7 +105,11 @@ ElectronClient/gui/MainScreen/commands/hideModalMessage.js
ElectronClient/gui/MainScreen/commands/moveToFolder.js
ElectronClient/gui/MainScreen/commands/newFolder.js
ElectronClient/gui/MainScreen/commands/newNote.js
ElectronClient/gui/MainScreen/commands/newSubFolder.js
ElectronClient/gui/MainScreen/commands/newTodo.js
ElectronClient/gui/MainScreen/commands/openFolder.js
ElectronClient/gui/MainScreen/commands/openNote.js
ElectronClient/gui/MainScreen/commands/openTag.js
ElectronClient/gui/MainScreen/commands/print.js
ElectronClient/gui/MainScreen/commands/renameFolder.js
ElectronClient/gui/MainScreen/commands/renameTag.js

5
.gitignore vendored
View File

@@ -75,6 +75,7 @@ ElectronClient/app.js
ElectronClient/bridge.js
ElectronClient/commands/copyDevCommand.js
ElectronClient/commands/focusElement.js
ElectronClient/commands/openProfileDirectory.js
ElectronClient/commands/startExternalEditing.js
ElectronClient/commands/stopExternalEditing.js
ElectronClient/commands/toggleExternalEditing.js
@@ -98,7 +99,11 @@ ElectronClient/gui/MainScreen/commands/hideModalMessage.js
ElectronClient/gui/MainScreen/commands/moveToFolder.js
ElectronClient/gui/MainScreen/commands/newFolder.js
ElectronClient/gui/MainScreen/commands/newNote.js
ElectronClient/gui/MainScreen/commands/newSubFolder.js
ElectronClient/gui/MainScreen/commands/newTodo.js
ElectronClient/gui/MainScreen/commands/openFolder.js
ElectronClient/gui/MainScreen/commands/openNote.js
ElectronClient/gui/MainScreen/commands/openTag.js
ElectronClient/gui/MainScreen/commands/print.js
ElectronClient/gui/MainScreen/commands/renameFolder.js
ElectronClient/gui/MainScreen/commands/renameTag.js

View File

@@ -24,6 +24,7 @@ ElectronClient/app.js
ElectronClient/bridge.js
ElectronClient/commands/copyDevCommand.js
ElectronClient/commands/focusElement.js
ElectronClient/commands/openProfileDirectory.js
ElectronClient/commands/startExternalEditing.js
ElectronClient/commands/stopExternalEditing.js
ElectronClient/commands/toggleExternalEditing.js
@@ -47,7 +48,11 @@ ElectronClient/gui/MainScreen/commands/hideModalMessage.js
ElectronClient/gui/MainScreen/commands/moveToFolder.js
ElectronClient/gui/MainScreen/commands/newFolder.js
ElectronClient/gui/MainScreen/commands/newNote.js
ElectronClient/gui/MainScreen/commands/newSubFolder.js
ElectronClient/gui/MainScreen/commands/newTodo.js
ElectronClient/gui/MainScreen/commands/openFolder.js
ElectronClient/gui/MainScreen/commands/openNote.js
ElectronClient/gui/MainScreen/commands/openTag.js
ElectronClient/gui/MainScreen/commands/print.js
ElectronClient/gui/MainScreen/commands/renameFolder.js
ElectronClient/gui/MainScreen/commands/renameTag.js

View File

@@ -22,4 +22,5 @@ yarn-error.log
tests/support/dropbox-auth.txt
tests/support/nextcloud-auth.json
tests/support/onedrive-auth.txt
build/
build/
patches/

View File

@@ -54,15 +54,25 @@ export default class PluginRunner extends BasePluginRunner {
};
}
async run(plugin:Plugin, sandbox:Global) {
const vmSandbox = vm.createContext(this.newSandboxProxy(plugin.id, sandbox));
async run(plugin:Plugin, sandbox:Global):Promise<void> {
return new Promise((resolve:Function, reject:Function) => {
const onStarted = () => {
plugin.off('started', onStarted);
resolve();
};
try {
vm.runInContext(plugin.scriptText, vmSandbox);
} catch (error) {
this.logger().error(`In plugin ${plugin.id}:`, error);
return;
}
plugin.on('started', onStarted);
const vmSandbox = vm.createContext(this.newSandboxProxy(plugin.id, sandbox));
try {
vm.runInContext(plugin.scriptText, vmSandbox);
} catch (error) {
reject(error);
// this.logger().error(`In plugin ${plugin.id}:`, error);
// return;
}
});
}
}

View File

@@ -17,12 +17,23 @@ tasks.prepareBuild = {
excluded: ['node_modules'],
});
await utils.copyDir(`${__dirname}/locales-build`, `${buildDir}/locales`);
await utils.copyDir(`${__dirname}/../patches`, `${buildDir}/patches`);
await tasks.copyLib.fn();
await utils.copyFile(`${__dirname}/package.json`, `${buildDir}/package.json`);
await utils.copyFile(`${__dirname}/package-lock.json`, `${buildDir}/package-lock.json`);
await utils.copyFile(`${__dirname}/gulpfile.js`, `${buildDir}/gulpfile.js`);
// Import all the patches inside the CliClient directory
// and build file. Needs to be in CliClient dir for when running
// in dev mode, and in build dir for production.
const localPatchDir = `${buildDir}/patches`;
await fs.remove(localPatchDir);
await fs.mkdirp(localPatchDir);
await utils.copyDir(`${__dirname}/../patches/shared`, `${localPatchDir}`, { delete: false });
await utils.copyDir(`${__dirname}/../patches/node`, `${localPatchDir}`, { delete: false });
await fs.remove(`${__dirname}/patches`);
await utils.copyDir(`${localPatchDir}`, `${__dirname}/patches`);
const packageRaw = await fs.readFile(`${buildDir}/package.json`);
const package = JSON.parse(packageRaw.toString());
package.scripts.postinstall = 'patch-package';

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -38,42 +38,42 @@ locales['tr_TR'] = require('./tr_TR.json');
locales['vi'] = require('./vi.json');
locales['zh_CN'] = require('./zh_CN.json');
locales['zh_TW'] = require('./zh_TW.json');
stats['ar'] = {"percentDone":80};
stats['eu'] = {"percentDone":34};
stats['bs_BA'] = {"percentDone":83};
stats['bg_BG'] = {"percentDone":66};
stats['ca'] = {"percentDone":96};
stats['ar'] = {"percentDone":79};
stats['eu'] = {"percentDone":33};
stats['bs_BA'] = {"percentDone":82};
stats['bg_BG'] = {"percentDone":65};
stats['ca'] = {"percentDone":95};
stats['hr_HR'] = {"percentDone":27};
stats['cs_CZ'] = {"percentDone":82};
stats['da_DK'] = {"percentDone":74};
stats['de_DE'] = {"percentDone":98};
stats['et_EE'] = {"percentDone":66};
stats['cs_CZ'] = {"percentDone":99};
stats['da_DK'] = {"percentDone":73};
stats['de_DE'] = {"percentDone":97};
stats['et_EE'] = {"percentDone":65};
stats['en_GB'] = {"percentDone":100};
stats['en_US'] = {"percentDone":100};
stats['es_ES'] = {"percentDone":95};
stats['eo'] = {"percentDone":38};
stats['fr_FR'] = {"percentDone":99};
stats['gl_ES'] = {"percentDone":43};
stats['id_ID'] = {"percentDone":93};
stats['it_IT'] = {"percentDone":90};
stats['nl_BE'] = {"percentDone":34};
stats['nl_NL'] = {"percentDone":95};
stats['nb_NO'] = {"percentDone":88};
stats['fa'] = {"percentDone":83};
stats['pl_PL'] = {"percentDone":98};
stats['pt_PT'] = {"percentDone":88};
stats['pt_BR'] = {"percentDone":96};
stats['es_ES'] = {"percentDone":99};
stats['eo'] = {"percentDone":37};
stats['fr_FR'] = {"percentDone":98};
stats['gl_ES'] = {"percentDone":42};
stats['id_ID'] = {"percentDone":92};
stats['it_IT'] = {"percentDone":98};
stats['nl_BE'] = {"percentDone":33};
stats['nl_NL'] = {"percentDone":94};
stats['nb_NO'] = {"percentDone":87};
stats['fa'] = {"percentDone":82};
stats['pl_PL'] = {"percentDone":97};
stats['pt_PT'] = {"percentDone":98};
stats['pt_BR'] = {"percentDone":95};
stats['ro'] = {"percentDone":77};
stats['sl_SI'] = {"percentDone":42};
stats['sv'] = {"percentDone":70};
stats['th_TH'] = {"percentDone":52};
stats['vi'] = {"percentDone":85};
stats['tr_TR'] = {"percentDone":98};
stats['el_GR'] = {"percentDone":96};
stats['ru_RU'] = {"percentDone":95};
stats['sr_RS'] = {"percentDone":71};
stats['zh_CN'] = {"percentDone":96};
stats['zh_TW'] = {"percentDone":95};
stats['ja_JP'] = {"percentDone":98};
stats['ko'] = {"percentDone":98};
stats['vi'] = {"percentDone":84};
stats['tr_TR'] = {"percentDone":97};
stats['el_GR'] = {"percentDone":95};
stats['ru_RU'] = {"percentDone":94};
stats['sr_RS'] = {"percentDone":70};
stats['zh_CN'] = {"percentDone":95};
stats['zh_TW'] = {"percentDone":94};
stats['ja_JP'] = {"percentDone":97};
stats['ko'] = {"percentDone":99};
module.exports = { locales: locales, stats: stats };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "joplin",
"version": "1.3.0",
"version": "1.3.3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -2964,9 +2964,9 @@
"integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0="
},
"highlight.js": {
"version": "10.1.1",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.1.1.tgz",
"integrity": "sha512-b4L09127uVa+9vkMgPpdUQP78ickGbHEQTWeBrQFTJZ4/n2aihWOGS0ZoUqAwjVmfjhq/C76HRzkqwZhK4sBbg=="
"version": "10.2.1",
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.2.1.tgz",
"integrity": "sha512-A+sckVPIb9zQTUydC9lpRX1qRFO/N0OKEh0NwIr65ckvWA/oMY8v9P3+kGRK3w2ULSh9E8v5MszXafodQ6039g=="
},
"homedir-polyfill": {
"version": "1.0.3",
@@ -3227,6 +3227,11 @@
"file-type": "^4.1.0"
}
},
"immer": {
"version": "7.0.14",
"resolved": "https://registry.npmjs.org/immer/-/immer-7.0.14.tgz",
"integrity": "sha512-BxCs6pJwhgSEUEOZjywW7OA8DXVzfHjkBelSEl0A+nEu0+zS4cFVdNOONvt55N4WOm8Pu4xqSPYxhm1Lv2iBBA=="
},
"inflight": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",

View File

@@ -6,7 +6,7 @@
"scripts": {
"test": "gulp buildTests -L && node node_modules/jasmine/bin/jasmine.js --fail-fast=true --config=tests/support/jasmine.json",
"test-ci": "gulp buildTests -L && node node_modules/jasmine/bin/jasmine.js --config=tests/support/jasmine.json",
"postinstall": "npm run build && patch-package --patch-dir ../patches/shared && patch-package --patch-dir ../patches/node",
"postinstall": "npm run build && patch-package --patch-dir ./patches",
"build": "gulp build",
"start": "gulp build -L && node 'build/main.js' --stack-trace-enabled --log-level debug --env dev"
},
@@ -28,7 +28,7 @@
],
"owner": "Laurent Cozic"
},
"version": "1.3.0",
"version": "1.3.3",
"bin": {
"joplin": "./main.js"
},
@@ -52,12 +52,13 @@
"font-awesome-filetypes": "^2.1.0",
"form-data": "^2.1.4",
"fs-extra": "^5.0.0",
"highlight.js": "10.1.1",
"highlight.js": "^10.2.1",
"html-entities": "^1.2.1",
"html-minifier": "^3.5.15",
"htmlparser2": "^4.1.0",
"image-data-uri": "^2.0.0",
"image-type": "^3.0.0",
"immer": "^7.0.14",
"joplin-turndown": "^4.0.29",
"joplin-turndown-plugin-gfm": "^1.0.12",
"json-stringify-safe": "^5.0.1",

View File

@@ -3,6 +3,7 @@ require('app-module-path').addPath(__dirname);
const { asyncTest, setupDatabaseAndSynchronizer, switchClient } = require('test-utils.js');
const shim = require('lib/shim').default;
const { enexXmlToHtml } = require('lib/import-enex-html-gen.js');
const cleanHtml = require('clean-html');
process.on('unhandledRejection', (reason, p) => {
console.warn('Unhandled Rejection at: Promise', p, 'reason:', reason);
@@ -19,6 +20,20 @@ const audioResource = {
title: 'audio test',
};
// All the test HTML files are beautified ones, so we need to run
// this before the comparison. Before, beautifying was done by `enexXmlToHtml`
// but that was removed due to problems with the clean-html package.
const beautifyHtml = (html) => {
return new Promise((resolve) => {
try {
cleanHtml.clean(html, { wrap: 0 }, (...cleanedHtml) => resolve(cleanedHtml.join('')));
} catch (error) {
console.warn(`Could not clean HTML - the "unclean" version will be used: ${error.message}: ${html.trim().substr(0, 512).replace(/[\n\r]/g, ' ')}...`);
resolve([html].join(''));
}
});
};
/**
* Tests the importer for a single note, checking that the result of
* processing the given `.enex` input file matches the contents of the given
@@ -38,7 +53,7 @@ const compareOutputToExpected = (options) => {
it(testTitle, asyncTest(async () => {
const enexInput = await shim.fsDriver().readFile(inputFile);
const expectedOutput = await shim.fsDriver().readFile(outputFile);
const actualOutput = await enexXmlToHtml(enexInput, options.resources);
const actualOutput = await beautifyHtml(await enexXmlToHtml(enexInput, options.resources));
expect(actualOutput).toEqual(expectedOutput);
}));

View File

@@ -1,5 +1,5 @@
<en-note>
<div><a href="joplin://21ca2b948f222a38802940ec7e2e5de3" hash="21ca2b948f222a38802940ec7e2e5de3" type="application/pdf" style="cursor:pointer;" alt="attachment-1">attachment-1</a></div>
<div><a href=":/21ca2b948f222a38802940ec7e2e5de3" hash="21ca2b948f222a38802940ec7e2e5de3" type="application/pdf" style="cursor:pointer;" alt="attachment-1">attachment-1</a></div>
<div>
<br>
</div>

View File

@@ -1,14 +1,25 @@
import FsDriverNode from 'lib/fs-driver-node';
import shim from 'lib/shim';
const { expectThrow } = require('test-utils.js');
// On Windows, path.resolve is going to convert a path such as
// /tmp/file.txt to c:\tmp\file.txt
function platformPath(path:string) {
if (shim.isWindows()) {
return `C:${path.replace(/\//g, '\\')}`;
} else {
return path;
}
}
describe('fsDriver', function() {
it('should resolveRelativePathWithinDir', () => {
const fsDriver = new FsDriverNode();
expect(fsDriver.resolveRelativePathWithinDir('/test/temp', './my/file.txt')).toBe('/test/temp/my/file.txt');
expect(fsDriver.resolveRelativePathWithinDir('/', './test')).toBe('/test');
expect(fsDriver.resolveRelativePathWithinDir('/test', 'myfile.txt')).toBe('/test/myfile.txt');
expect(fsDriver.resolveRelativePathWithinDir('/test/temp', './mydir/../test.txt')).toBe('/test/temp/test.txt');
expect(fsDriver.resolveRelativePathWithinDir('/test/temp', './my/file.txt')).toBe(platformPath('/test/temp/my/file.txt'));
expect(fsDriver.resolveRelativePathWithinDir('/', './test')).toBe(platformPath('/test'));
expect(fsDriver.resolveRelativePathWithinDir('/test', 'myfile.txt')).toBe(platformPath('/test/myfile.txt'));
expect(fsDriver.resolveRelativePathWithinDir('/test/temp', './mydir/../test.txt')).toBe(platformPath('/test/temp/test.txt'));
expectThrow(() => fsDriver.resolveRelativePathWithinDir('/test/temp', '../myfile.txt'));
expectThrow(() => fsDriver.resolveRelativePathWithinDir('/test/temp', './mydir/../../test.txt'));

View File

@@ -0,0 +1 @@
<a href="https://images.macrumors.com/filters:quality(90)/article.html"/>testing</a>

View File

@@ -0,0 +1 @@
[testing](https://images.macrumors.com/filters:quality%2890%29/article.html)

View File

@@ -104,4 +104,14 @@ describe('models_BaseItem', function() {
expect(noteAfter).toEqual(noteBefore);
}));
it('should serialize and unserialize properties that contain new lines', asyncTest(async () => {
const note = await Note.save({ title: 'note', source_url: '\nhttps://joplinapp.org/\n' });
const noteBefore = await Note.load(note.id);
const serialized = await Note.serialize(noteBefore);
const noteAfter = await Note.unserialize(serialized);
expect(noteAfter).toEqual(noteBefore);
}));
});

View File

@@ -2,12 +2,10 @@ import PluginRunner from '../app/services/plugins/PluginRunner';
import PluginService from 'lib/services/plugins/PluginService';
import { ContentScriptType } from 'lib/services/plugins/api/types';
import MdToHtml from 'lib/joplin-renderer/MdToHtml';
import Setting from 'lib/models/Setting';
import shim from 'lib/shim';
import uuid from 'lib/uuid';
require('app-module-path').addPath(__dirname);
const { asyncTest, setupDatabaseAndSynchronizer, switchClient, expectThrow } = require('test-utils.js');
const { asyncTest, setupDatabaseAndSynchronizer, switchClient, expectThrow, createTempDir } = require('test-utils.js');
const Note = require('lib/models/Note');
const Folder = require('lib/models/Folder');
@@ -65,6 +63,9 @@ describe('services_PluginService', function() {
const allFolders = await Folder.all();
expect(allFolders.length).toBe(1);
// If you have an error here, it might mean you need to run `npm i` from
// the "withExternalModules" folder. Not clear exactly why.
expect(allFolders[0].title).toBe(' foo');
}));
@@ -154,12 +155,14 @@ describe('services_PluginService', function() {
}));
it('should register a Markdown-it plugin', asyncTest(async () => {
const contentScriptPath = `${Setting.value('tempDir')}/markdownItTestPlugin${uuid.createNano()}.js`;
const tempDir = await createTempDir();
const contentScriptPath = `${tempDir}/markdownItTestPlugin.js`;
await shim.fsDriver().copy(`${testPluginDir}/content_script/src/markdownItTestPlugin.js`, contentScriptPath);
const service = newPluginService();
const plugin = await service.loadPluginFromString('example', Setting.value('tempDir'), `
const plugin = await service.loadPluginFromString('example', tempDir, `
/* joplin-manifest:
{
"manifest_version": 1,
@@ -173,7 +176,7 @@ describe('services_PluginService', function() {
joplin.plugins.register({
onStart: async function() {
await joplin.plugins.registerContentScript('markdownItPlugin', 'justtesting', '${contentScriptPath}');
await joplin.plugins.registerContentScript('markdownItPlugin', 'justtesting', './markdownItTestPlugin.js');
},
});
`);
@@ -198,7 +201,7 @@ describe('services_PluginService', function() {
expect(result.html.includes('JUST TESTING: something')).toBe(true);
await shim.fsDriver().remove(contentScriptPath);
await shim.fsDriver().remove(tempDir);
}));
});

View File

@@ -183,6 +183,59 @@ describe('services_rest_Api', function() {
expect(response.user_updated_time).toBe(updatedTime);
expect(response.user_created_time).toBe(createdTime);
const timeBefore = Date.now();
response = await api.route('POST', 'notes', null, JSON.stringify({
parent_id: f.id,
}));
const newNote = await Note.load(response.id);
expect(newNote.user_updated_time).toBeGreaterThanOrEqual(timeBefore);
expect(newNote.user_created_time).toBeGreaterThanOrEqual(timeBefore);
}));
it('should preserve user timestamps when updating notes', asyncTest(async () => {
const folder = await Folder.save({ title: 'mon carnet' });
const updatedTime = Date.now() - 1000;
const createdTime = Date.now() - 10000;
const response = await api.route('POST', 'notes', null, JSON.stringify({
parent_id: folder.id,
}));
const noteId = response.id;
{
// Check that if user timestamps are supplied, they are preserved by the API
await api.route('PUT', `notes/${noteId}`, null, JSON.stringify({
user_updated_time: updatedTime,
user_created_time: createdTime,
title: 'mod',
}));
const modNote = await Note.load(noteId);
expect(modNote.title).toBe('mod');
expect(modNote.user_updated_time).toBe(updatedTime);
expect(modNote.user_created_time).toBe(createdTime);
}
{
// Check if no user timestamps are supplied they are automatically updated.
const beforeTime = Date.now();
await api.route('PUT', `notes/${noteId}`, null, JSON.stringify({
title: 'mod2',
}));
const modNote = await Note.load(noteId);
expect(modNote.title).toBe('mod2');
expect(modNote.user_updated_time).toBeGreaterThanOrEqual(beforeTime);
expect(modNote.user_created_time).toBeGreaterThanOrEqual(createdTime);
}
}));
it('should create notes with supplied ID', asyncTest(async () => {

View File

@@ -27,10 +27,10 @@ export default class JoplinCommands {
*
* // Create a new sub-notebook under the provided notebook
* // Note: internally, notebooks are called "folders".
* await joplin.commands.execute('newFolder', { parent_id: "SOME_FOLDER_ID" });
* await joplin.commands.execute('newFolder', "SOME_FOLDER_ID");
* ```
*/
execute(commandName: string, props?: any): Promise<any>;
execute(commandName: string, ...args: any[]): Promise<any | void>;
/**
* <span class="platform-desktop">desktop</span> Registers a new command.
*

View File

@@ -1,6 +1,6 @@
import Plugin from '../Plugin';
import Logger from 'lib/Logger';
import { Script } from './types';
import { ContentScriptType, Script } from './types';
/**
* This class provides access to plugin-related features.
*/
@@ -21,4 +21,18 @@ export default class JoplinPlugins {
* ```
*/
register(script: Script): Promise<void>;
/**
* Registers a new content script. Unlike regular plugin code, which runs in a separate process, content scripts run within the main process code
* and thus allow improved performances and more customisations in specific cases. It can be used for example to load a Markdown or editor plugin.
*
* Note that registering a content script in itself will do nothing - it will only be loaded in specific cases by the relevant app modules
* (eg. the Markdown renderer or the code editor). So it is not a way to inject and run arbitrary code in the app, which for safety and performance reasons is not supported.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/content_script)
*
* @param type Defines how the script will be used. See the type definition for more information about each supported type.
* @param id A unique ID for the content script.
* @param scriptPath Must be a path relative to the plugin main script. For example, if your file content_script.js is next to your index.ts file, you would set `scriptPath` to `"./content_script.js`.
*/
registerContentScript(type: ContentScriptType, id: string, scriptPath: string): Promise<void>;
}

View File

@@ -3,12 +3,50 @@
// =================================================================
export interface Command {
/**
* Name of command - must be globally unique
*/
name: string
label: string
/**
* Label to be displayed on menu items or keyboard shortcut editor for example.
* If it is missing, it's assumed it's a private command, to be called programmatically only.
* In that case the command will not appear in the shortcut editor or command panel, and logically
* should not be used as a menu item.
*/
label?: string
/**
* Icon to be used on toolbar buttons for example
*/
iconName?: string,
execute(props:any):Promise<any>
isEnabled?(props:any):boolean
mapStateToProps?(state:any):any
/**
* Code to be ran when the command is executed. It may return a result.
*/
execute(...args:any[]):Promise<any | void>
/**
* Defines whether the command should be enabled or disabled, which in turns affects
* the enabled state of any associated button or menu item.
*
* The condition should be expressed as a "when-clause" (as in Visual Studio Code). It's a simple boolean expression that evaluates to
* `true` or `false`. It supports the following operators:
*
* Operator | Symbol | Example
* -- | -- | --
* Equality | == | "editorType == markdown"
* Inequality | != | "currentScreen != config"
* Or | \|\| | "noteIsTodo \|\| noteTodoCompleted"
* And | && | "oneNoteSelected && !inConflictFolder"
*
* Currently the supported context variables aren't documented, but you can find the list there:
*
* https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/services/commands/stateToWhenClauseContext.ts
*
* Note: Commands are enabled by default unless you use this property.
*/
enabledCondition?: string
}
// =================================================================
@@ -277,3 +315,54 @@ export interface SettingSection {
* [2]: (Optional) Resource link.
*/
export type Path = string[];
// =================================================================
// Plugins type
// =================================================================
export enum ContentScriptType {
/**
* Registers a new Markdown-It plugin, which should follow this template:
*
* ```javascript
* // The module should export an object as below:
*
* module.exports = {
*
* // The "context" variable is currently unused but could be used later on to provide
* // access to your own plugin so that the content script and plugin can communicate.
* default: function(context) {
* return {
*
* // This is the actual Markdown-It plugin - check the [official doc](https://github.com/markdown-it/markdown-it) for more information
* // The `options` parameter is of type [RuleOptions](https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml.ts), which
* // contains a number of options, mostly useful for Joplin's internal code.
* plugin: function(markdownIt, options) {
* // ...
* },
*
* // You may also specify additional assets such as JS or CSS that should be loaded in the rendered HTML document.
* // Check for example the Joplin [Mermaid plugin](https://github.com/laurent22/joplin/blob/dev/ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/mermaid.ts) to
* // see how the data should be structured.
* assets: {},
* }
* }
* }
* ```
*
* To include a regular Markdown-It plugin, that doesn't make use of any Joplin-specific feature, you
* would simply create a file such as this:
*
* ```javascript
* module.exports = {
* default: function(context) {
* return {
* plugin: require('markdown-it-toc-done-right');
* }
* }
* }
* ```
*/
MarkdownItPlugin = 'markdownItPlugin',
CodeMirrorPlugin = 'codeMirrorPlugin',
}

View File

@@ -1,7 +1,12 @@
import joplin from 'api';
import { ContentScriptType } from 'api/types';
joplin.plugins.register({
onStart: async function() {
await (joplin.plugins as any).registerContentScript('markdownItPlugin', 'justtesting', './markdownItTestPlugin.js');
await joplin.plugins.registerContentScript(
ContentScriptType.MarkdownItPlugin,
'justtesting',
'./markdownItTestPlugin.js'
);
},
});

View File

@@ -3,7 +3,7 @@ import { Command } from './types';
* This class allows executing or registering new Joplin commands. Commands can be executed or associated with
* {@link JoplinViewsToolbarButtons | toolbar buttons} or {@link JoplinViewsMenuItems | menu items}.
*
* [View the demo plugin](https://github.com/laurent22/joplin/CliClient/tests/support/plugins/register_command)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/register_command)
*
* ## Executing Joplin's internal commands
*
@@ -27,10 +27,10 @@ export default class JoplinCommands {
*
* // Create a new sub-notebook under the provided notebook
* // Note: internally, notebooks are called "folders".
* await joplin.commands.execute('newFolder', { parent_id: "SOME_FOLDER_ID" });
* await joplin.commands.execute('newFolder', "SOME_FOLDER_ID");
* ```
*/
execute(commandName: string, props?: any): Promise<any>;
execute(commandName: string, ...args: any[]): Promise<any | void>;
/**
* <span class="platform-desktop">desktop</span> Registers a new command.
*

View File

@@ -1,12 +1,12 @@
import { Path } from './types';
/**
* This module provides access to the Joplin data API: https://joplinapp.org/api/
* This module provides access to the Joplin data API: https://joplinapp.org/api/references/rest_api/
* This is the main way to retrieve data, such as notes, notebooks, tags, etc.
* or to update them or delete them.
*
* This is also what you would use to search notes, via the `search` endpoint.
*
* [View the demo plugin](https://github.com/laurent22/joplin/CliClient/tests/support/plugins/simple)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/simple)
*
* In general you would use the methods in this class as if you were using a REST API. There are four methods that map to GET, POST, PUT and DELETE calls.
* And each method takes these parameters:
@@ -16,7 +16,7 @@ import { Path } from './types';
* * `data`: (Optional) Applies to PUT and POST calls only. The request body contains the data you want to create or modify, for example the content of a note or folder.
* * `files`: (Optional) Used to create new resources and associate them with files.
*
* Please refer to the [Joplin API documentation](https://joplinapp.org/api/) for complete details about each call. As the plugin runs within the Joplin application **you do not need an authorisation token** to use this API.
* Please refer to the [Joplin API documentation](https://joplinapp.org/api/references/rest_api/) for complete details about each call. As the plugin runs within the Joplin application **you do not need an authorisation token** to use this API.
*
* For example:
*

View File

@@ -2,14 +2,14 @@ import { ExportModule, ImportModule } from './types';
/**
* Provides a way to create modules to import external data into Joplin or to export notes into any arbitrary format.
*
* [View the demo plugin](https://github.com/laurent22/joplin/CliClient/tests/support/plugins/json_export)
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/json_export)
*
* To implement an import or export module, you would simply define an object with various event handlers that are called
* by the application during the import/export process.
*
* See the documentation of the [[ExportModule]] and [[ImportModule]] for more information.
*
* You may also want to refer to the Joplin API documentation to see the list of properties for each item (note, notebook, etc.) - https://joplinapp.org/api/
* You may also want to refer to the Joplin API documentation to see the list of properties for each item (note, notebook, etc.) - https://joplinapp.org/api/references/rest_api/
*/
export default class JoplinInterop {
registerExportModule(module: ExportModule): Promise<void>;

View File

@@ -1,6 +1,6 @@
import Plugin from '../Plugin';
import Logger from 'lib/Logger';
import { Script } from './types';
import { ContentScriptType, Script } from './types';
/**
* This class provides access to plugin-related features.
*/
@@ -21,4 +21,18 @@ export default class JoplinPlugins {
* ```
*/
register(script: Script): Promise<void>;
/**
* Registers a new content script. Unlike regular plugin code, which runs in a separate process, content scripts run within the main process code
* and thus allow improved performances and more customisations in specific cases. It can be used for example to load a Markdown or editor plugin.
*
* Note that registering a content script in itself will do nothing - it will only be loaded in specific cases by the relevant app modules
* (eg. the Markdown renderer or the code editor). So it is not a way to inject and run arbitrary code in the app, which for safety and performance reasons is not supported.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/CliClient/tests/support/plugins/content_script)
*
* @param type Defines how the script will be used. See the type definition for more information about each supported type.
* @param id A unique ID for the content script.
* @param scriptPath Must be a path relative to the plugin main script. For example, if your file content_script.js is next to your index.ts file, you would set `scriptPath` to `"./content_script.js`.
*/
registerContentScript(type: ContentScriptType, id: string, scriptPath: string): Promise<void>;
}

Some files were not shown because too many files have changed in this diff Show More