You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2026-01-05 00:12:33 +02:00
Compare commits
3 Commits
cli-v1.4.7
...
plugin_gui
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
28be0dbd36 | ||
|
|
cd406cba51 | ||
|
|
57c0305ad8 |
@@ -151,9 +151,12 @@ packages/app-cli/app/LinkSelector.js.map
|
||||
packages/app-cli/app/services/plugins/PluginRunner.d.ts
|
||||
packages/app-cli/app/services/plugins/PluginRunner.js
|
||||
packages/app-cli/app/services/plugins/PluginRunner.js.map
|
||||
packages/app-cli/tests/EnexToMd.d.ts
|
||||
packages/app-cli/tests/EnexToMd.js
|
||||
packages/app-cli/tests/EnexToMd.js.map
|
||||
packages/app-cli/build/LinkSelector.d.ts
|
||||
packages/app-cli/build/LinkSelector.js
|
||||
packages/app-cli/build/LinkSelector.js.map
|
||||
packages/app-cli/build/services/plugins/PluginRunner.d.ts
|
||||
packages/app-cli/build/services/plugins/PluginRunner.js
|
||||
packages/app-cli/build/services/plugins/PluginRunner.js.map
|
||||
packages/app-cli/tests/InMemoryCache.d.ts
|
||||
packages/app-cli/tests/InMemoryCache.js
|
||||
packages/app-cli/tests/InMemoryCache.js.map
|
||||
@@ -1348,9 +1351,6 @@ packages/lib/uuid.js.map
|
||||
packages/lib/versionInfo.d.ts
|
||||
packages/lib/versionInfo.js
|
||||
packages/lib/versionInfo.js.map
|
||||
packages/renderer/HtmlToHtml.d.ts
|
||||
packages/renderer/HtmlToHtml.js
|
||||
packages/renderer/HtmlToHtml.js.map
|
||||
packages/renderer/InMemoryCache.d.ts
|
||||
packages/renderer/InMemoryCache.js
|
||||
packages/renderer/InMemoryCache.js.map
|
||||
@@ -1360,12 +1360,6 @@ packages/renderer/MarkupToHtml.js.map
|
||||
packages/renderer/MdToHtml.d.ts
|
||||
packages/renderer/MdToHtml.js
|
||||
packages/renderer/MdToHtml.js.map
|
||||
packages/renderer/MdToHtml/linkReplacement.d.ts
|
||||
packages/renderer/MdToHtml/linkReplacement.js
|
||||
packages/renderer/MdToHtml/linkReplacement.js.map
|
||||
packages/renderer/MdToHtml/linkReplacement.test.d.ts
|
||||
packages/renderer/MdToHtml/linkReplacement.test.js
|
||||
packages/renderer/MdToHtml/linkReplacement.test.js.map
|
||||
packages/renderer/MdToHtml/rules/checkbox.d.ts
|
||||
packages/renderer/MdToHtml/rules/checkbox.js
|
||||
packages/renderer/MdToHtml/rules/checkbox.js.map
|
||||
@@ -1399,9 +1393,6 @@ packages/renderer/MdToHtml/rules/mermaid.js.map
|
||||
packages/renderer/MdToHtml/rules/sanitize_html.d.ts
|
||||
packages/renderer/MdToHtml/rules/sanitize_html.js
|
||||
packages/renderer/MdToHtml/rules/sanitize_html.js.map
|
||||
packages/renderer/htmlUtils.d.ts
|
||||
packages/renderer/htmlUtils.js
|
||||
packages/renderer/htmlUtils.js.map
|
||||
packages/renderer/index.d.ts
|
||||
packages/renderer/index.js
|
||||
packages/renderer/index.js.map
|
||||
@@ -1411,7 +1402,4 @@ packages/renderer/noteStyle.js.map
|
||||
packages/renderer/pathUtils.d.ts
|
||||
packages/renderer/pathUtils.js
|
||||
packages/renderer/pathUtils.js.map
|
||||
packages/renderer/utils.d.ts
|
||||
packages/renderer/utils.js
|
||||
packages/renderer/utils.js.map
|
||||
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD
|
||||
|
||||
@@ -15,8 +15,7 @@ module.exports = {
|
||||
'Atomics': 'readonly',
|
||||
'SharedArrayBuffer': 'readonly',
|
||||
|
||||
// Jest variables
|
||||
'test': 'readonly',
|
||||
// Jasmine variables
|
||||
'expect': 'readonly',
|
||||
'describe': 'readonly',
|
||||
'it': 'readonly',
|
||||
@@ -24,6 +23,10 @@ module.exports = {
|
||||
'afterAll': 'readonly',
|
||||
'beforeEach': 'readonly',
|
||||
'afterEach': 'readonly',
|
||||
'jasmine': 'readonly',
|
||||
|
||||
// Jest variables
|
||||
'test': 'readonly',
|
||||
|
||||
// React Native variables
|
||||
'__DEV__': 'readonly',
|
||||
|
||||
24
.gitignore
vendored
24
.gitignore
vendored
@@ -143,9 +143,12 @@ packages/app-cli/app/LinkSelector.js.map
|
||||
packages/app-cli/app/services/plugins/PluginRunner.d.ts
|
||||
packages/app-cli/app/services/plugins/PluginRunner.js
|
||||
packages/app-cli/app/services/plugins/PluginRunner.js.map
|
||||
packages/app-cli/tests/EnexToMd.d.ts
|
||||
packages/app-cli/tests/EnexToMd.js
|
||||
packages/app-cli/tests/EnexToMd.js.map
|
||||
packages/app-cli/build/LinkSelector.d.ts
|
||||
packages/app-cli/build/LinkSelector.js
|
||||
packages/app-cli/build/LinkSelector.js.map
|
||||
packages/app-cli/build/services/plugins/PluginRunner.d.ts
|
||||
packages/app-cli/build/services/plugins/PluginRunner.js
|
||||
packages/app-cli/build/services/plugins/PluginRunner.js.map
|
||||
packages/app-cli/tests/InMemoryCache.d.ts
|
||||
packages/app-cli/tests/InMemoryCache.js
|
||||
packages/app-cli/tests/InMemoryCache.js.map
|
||||
@@ -1340,9 +1343,6 @@ packages/lib/uuid.js.map
|
||||
packages/lib/versionInfo.d.ts
|
||||
packages/lib/versionInfo.js
|
||||
packages/lib/versionInfo.js.map
|
||||
packages/renderer/HtmlToHtml.d.ts
|
||||
packages/renderer/HtmlToHtml.js
|
||||
packages/renderer/HtmlToHtml.js.map
|
||||
packages/renderer/InMemoryCache.d.ts
|
||||
packages/renderer/InMemoryCache.js
|
||||
packages/renderer/InMemoryCache.js.map
|
||||
@@ -1352,12 +1352,6 @@ packages/renderer/MarkupToHtml.js.map
|
||||
packages/renderer/MdToHtml.d.ts
|
||||
packages/renderer/MdToHtml.js
|
||||
packages/renderer/MdToHtml.js.map
|
||||
packages/renderer/MdToHtml/linkReplacement.d.ts
|
||||
packages/renderer/MdToHtml/linkReplacement.js
|
||||
packages/renderer/MdToHtml/linkReplacement.js.map
|
||||
packages/renderer/MdToHtml/linkReplacement.test.d.ts
|
||||
packages/renderer/MdToHtml/linkReplacement.test.js
|
||||
packages/renderer/MdToHtml/linkReplacement.test.js.map
|
||||
packages/renderer/MdToHtml/rules/checkbox.d.ts
|
||||
packages/renderer/MdToHtml/rules/checkbox.js
|
||||
packages/renderer/MdToHtml/rules/checkbox.js.map
|
||||
@@ -1391,9 +1385,6 @@ packages/renderer/MdToHtml/rules/mermaid.js.map
|
||||
packages/renderer/MdToHtml/rules/sanitize_html.d.ts
|
||||
packages/renderer/MdToHtml/rules/sanitize_html.js
|
||||
packages/renderer/MdToHtml/rules/sanitize_html.js.map
|
||||
packages/renderer/htmlUtils.d.ts
|
||||
packages/renderer/htmlUtils.js
|
||||
packages/renderer/htmlUtils.js.map
|
||||
packages/renderer/index.d.ts
|
||||
packages/renderer/index.js
|
||||
packages/renderer/index.js.map
|
||||
@@ -1403,7 +1394,4 @@ packages/renderer/noteStyle.js.map
|
||||
packages/renderer/pathUtils.d.ts
|
||||
packages/renderer/pathUtils.js
|
||||
packages/renderer/pathUtils.js.map
|
||||
packages/renderer/utils.d.ts
|
||||
packages/renderer/utils.js
|
||||
packages/renderer/utils.js.map
|
||||
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD
|
||||
22
package-lock.json
generated
22
package-lock.json
generated
@@ -1227,6 +1227,12 @@
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/jasmine": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.6.0.tgz",
|
||||
"integrity": "sha512-CPT4r0a63e5wpNj5ejMnconM7a+0Hdx6/APsyw8AQOHk0/Mxp3xYrym1ZabWJiYuQkgKB3MonYoN04mxtvAvRA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/json-schema": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz",
|
||||
@@ -6433,6 +6439,22 @@
|
||||
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
|
||||
"dev": true
|
||||
},
|
||||
"jasmine": {
|
||||
"version": "3.6.3",
|
||||
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.6.3.tgz",
|
||||
"integrity": "sha512-Th91zHsbsALWjDUIiU5d/W5zaYQsZFMPTdeNmi8GivZPmAaUAK8MblSG3yQI4VMGC/abF2us7ex60NH1AAIMTA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"glob": "^7.1.6",
|
||||
"jasmine-core": "~3.6.0"
|
||||
}
|
||||
},
|
||||
"jasmine-core": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.6.0.tgz",
|
||||
"integrity": "sha512-8uQYa7zJN8hq9z+g8z1bqCfdC8eoDAeVnM5sfqs7KHv9/ifoJ500m018fpFc7RDaO6SWCLCXwo/wPSNcdYTgcw==",
|
||||
"dev": true
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
|
||||
16
package.json
16
package.json
@@ -7,12 +7,6 @@
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"addPackageCli": "lerna add --scope joplin",
|
||||
"addPackageCliD": "lerna add --scope joplin -D",
|
||||
"addPackageDesktop": "lerna add --scope @joplin/app-desktop",
|
||||
"addPackageDesktopD": "lerna add --scope @joplin/app-desktop -D",
|
||||
"addPackageMobile": "lerna add --scope @joplin/app-mobile",
|
||||
"addPackageMobileD": "lerna add --scope @joplin/app-mobile -D",
|
||||
"buildApiDoc": "npm start --prefix=packages/app-cli -- apidoc ../../readme/api/references/rest_api.md",
|
||||
"buildDoc": "./packages/tools/build-all.sh",
|
||||
"buildPluginDoc": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme './Assets/PluginDocTheme/' --readme './Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out docs/api/references/plugin_api packages/lib/services/plugins/api/",
|
||||
@@ -32,11 +26,11 @@
|
||||
"releaseDesktop": "node packages/tools/release-electron.js",
|
||||
"releasePluginGenerator": "node packages/tools/release-plugin-generator.js",
|
||||
"setupNewRelease": "node ./packages/tools/setupNewRelease",
|
||||
"test-ci": "lerna run test-ci --stream",
|
||||
"test": "lerna run test --stream",
|
||||
"tsc": "lerna run tsc --stream --parallel",
|
||||
"updateIgnored": "gulp updateIgnoredTypeScriptBuild",
|
||||
"updatePluginTypes": "./packages/generator-joplin/updateTypes.sh",
|
||||
"tsc": "lerna run tsc --stream --parallel",
|
||||
"test": "lerna run test --stream",
|
||||
"test-ci": "lerna run test-ci --stream",
|
||||
"updateIgnored": "gulp updateIgnoredTypeScriptBuild",
|
||||
"watch": "lerna run watch --stream --parallel"
|
||||
},
|
||||
"husky": {
|
||||
@@ -45,6 +39,7 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "^3.6.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.6.0",
|
||||
"@typescript-eslint/parser": "^4.6.0",
|
||||
"eslint": "^7.6.0",
|
||||
@@ -55,6 +50,7 @@
|
||||
"glob": "^7.1.6",
|
||||
"gulp": "^4.0.2",
|
||||
"husky": "^3.0.2",
|
||||
"jasmine": "^3.5.0",
|
||||
"lerna": "^3.22.1",
|
||||
"lint-staged": "^9.2.1",
|
||||
"typedoc": "^0.17.8",
|
||||
|
||||
@@ -426,7 +426,7 @@ class Application extends BaseApplication {
|
||||
|
||||
const AppGui = require('./app-gui.js');
|
||||
this.gui_ = new AppGui(this, this.store(), keymap);
|
||||
this.gui_.setLogger(this.logger());
|
||||
this.gui_.setLogger(this.logger_);
|
||||
await this.gui_.start();
|
||||
|
||||
// Since the settings need to be loaded before the store is created, it will never
|
||||
|
||||
@@ -30,12 +30,12 @@ module.exports = {
|
||||
],
|
||||
|
||||
testPathIgnorePatterns: [
|
||||
'<rootDir>/node_modules/',
|
||||
'<rootDir>/tests/support/',
|
||||
'<rootDir>/build/',
|
||||
'<rootDir>/tests/test-utils.js',
|
||||
'<rootDir>/tests/file_api_driver.js',
|
||||
'<rootDir>/tests/tmp/',
|
||||
'/node_modules/',
|
||||
'/tests\\/support/',
|
||||
'/build/',
|
||||
'test-utils.js',
|
||||
'file_api_driver.js',
|
||||
'/tests\\/tmp/',
|
||||
],
|
||||
|
||||
// To avoid this warning:
|
||||
@@ -52,5 +52,5 @@ module.exports = {
|
||||
],
|
||||
|
||||
testEnvironment: 'node',
|
||||
setupFilesAfterEnv: [`${__dirname}/jest.setup.js`],
|
||||
setupFilesAfterEnv: ['./jest.setup.js'],
|
||||
};
|
||||
|
||||
48
packages/app-cli/package-lock.json
generated
48
packages/app-cli/package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "joplin",
|
||||
"version": "1.4.7",
|
||||
"version": "1.4.3",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
@@ -898,15 +898,11 @@
|
||||
"@types/istanbul-lib-report": "*"
|
||||
}
|
||||
},
|
||||
"@types/jest": {
|
||||
"version": "26.0.15",
|
||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.15.tgz",
|
||||
"integrity": "sha512-s2VMReFXRg9XXxV+CW9e5Nz8fH2K1aEhwgjUqPPbQd7g95T0laAcvLv032EhFHIa5GHsZ8W7iJEQVaJq6k3Gog==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jest-diff": "^26.0.0",
|
||||
"pretty-format": "^26.0.0"
|
||||
}
|
||||
"@types/jasmine": {
|
||||
"version": "3.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.6.0.tgz",
|
||||
"integrity": "sha512-CPT4r0a63e5wpNj5ejMnconM7a+0Hdx6/APsyw8AQOHk0/Mxp3xYrym1ZabWJiYuQkgKB3MonYoN04mxtvAvRA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.14.6",
|
||||
@@ -4515,6 +4511,38 @@
|
||||
"istanbul-lib-report": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"jasmine": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine/-/jasmine-3.5.0.tgz",
|
||||
"integrity": "sha512-DYypSryORqzsGoMazemIHUfMkXM7I7easFaxAvNM3Mr6Xz3Fy36TupTrAOxZWN8MVKEU5xECv22J4tUQf3uBzQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"glob": "^7.1.4",
|
||||
"jasmine-core": "~3.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"glob": {
|
||||
"version": "7.1.5",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.5.tgz",
|
||||
"integrity": "sha512-J9dlskqUXK1OeTOYBEn5s8aMukWMwWfs+rPTn/jn50Ux4MNXVhubL1wu/j2t+H4NVI+cXEcCaYellqaPVGXNqQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
"inherits": "2",
|
||||
"minimatch": "^3.0.4",
|
||||
"once": "^1.3.0",
|
||||
"path-is-absolute": "^1.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"jasmine-core": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/jasmine-core/-/jasmine-core-3.5.0.tgz",
|
||||
"integrity": "sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA==",
|
||||
"dev": true
|
||||
},
|
||||
"jest": {
|
||||
"version": "26.6.3",
|
||||
"resolved": "https://registry.npmjs.org/jest/-/jest-26.6.3.tgz",
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
],
|
||||
"owner": "Laurent Cozic"
|
||||
},
|
||||
"version": "1.4.7",
|
||||
"version": "1.4.3",
|
||||
"bin": {
|
||||
"joplin": "./main.js"
|
||||
},
|
||||
@@ -66,9 +66,10 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@joplin/tools": "^1.0.9",
|
||||
"@types/jest": "^26.0.15",
|
||||
"@types/jasmine": "^3.6.0",
|
||||
"@types/node": "^14.14.6",
|
||||
"gulp": "^4.0.2",
|
||||
"jasmine": "^3.5.0",
|
||||
"jest": "^26.6.3",
|
||||
"temp": "^0.9.1",
|
||||
"typescript": "^4.0.5"
|
||||
|
||||
67
packages/app-cli/tests/EnexToMd.js
Normal file
67
packages/app-cli/tests/EnexToMd.js
Normal file
@@ -0,0 +1,67 @@
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
|
||||
const os = require('os');
|
||||
const time = require('@joplin/lib/time').default;
|
||||
const { filename } = require('@joplin/lib/path-utils');
|
||||
const { asyncTest, fileContentEqual, setupDatabase, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId, objectsEqual, checkThrowAsync } = require('./test-utils.js');
|
||||
const Folder = require('@joplin/lib/models/Folder.js');
|
||||
const Note = require('@joplin/lib/models/Note.js');
|
||||
const BaseModel = require('@joplin/lib/BaseModel').default;
|
||||
const shim = require('@joplin/lib/shim').default;
|
||||
const { enexXmlToMd } = require('@joplin/lib/import-enex-md-gen.js');
|
||||
|
||||
process.on('unhandledRejection', (reason, p) => {
|
||||
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
|
||||
});
|
||||
|
||||
describe('EnexToMd', function() {
|
||||
|
||||
beforeEach(async (done) => {
|
||||
await setupDatabaseAndSynchronizer(1);
|
||||
await switchClient(1);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should convert from Enex to Markdown', asyncTest(async () => {
|
||||
const basePath = `${__dirname}/enex_to_md`;
|
||||
const files = await shim.fsDriver().readDirStats(basePath);
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const htmlFilename = files[i].path;
|
||||
if (htmlFilename.indexOf('.html') < 0) continue;
|
||||
|
||||
const htmlPath = `${basePath}/${htmlFilename}`;
|
||||
const mdPath = `${basePath}/${filename(htmlFilename)}.md`;
|
||||
|
||||
// if (htmlFilename !== 'multiline_inner_text.html') continue;
|
||||
|
||||
const html = await shim.fsDriver().readFile(htmlPath);
|
||||
let expectedMd = await shim.fsDriver().readFile(mdPath);
|
||||
|
||||
let actualMd = await enexXmlToMd(`<div>${html}</div>`, []);
|
||||
|
||||
if (os.EOL === '\r\n') {
|
||||
expectedMd = expectedMd.replace(/\r\n/g, '\n');
|
||||
actualMd = actualMd.replace(/\r\n/g, '\n');
|
||||
}
|
||||
|
||||
if (actualMd !== expectedMd) {
|
||||
console.info('');
|
||||
console.info(`Error converting file: ${htmlFilename}`);
|
||||
console.info('--------------------------------- Got:');
|
||||
console.info(actualMd.split('\n'));
|
||||
console.info('--------------------------------- Expected:');
|
||||
console.info(expectedMd.split('\n'));
|
||||
console.info('--------------------------------------------');
|
||||
console.info('');
|
||||
|
||||
expect(false).toBe(true);
|
||||
// return;
|
||||
} else {
|
||||
expect(true).toBe(true);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
});
|
||||
@@ -1,99 +0,0 @@
|
||||
import { NoteEntity, ResourceEntity, TagEntity } from '@joplin/lib/services/database/types';
|
||||
import shim from '@joplin/lib/shim';
|
||||
|
||||
const fs = require('fs-extra');
|
||||
const os = require('os');
|
||||
const { filename } = require('@joplin/lib/path-utils');
|
||||
const { setupDatabaseAndSynchronizer, switchClient } = require('./test-utils.js');
|
||||
const { enexXmlToMd } = require('@joplin/lib/import-enex-md-gen.js');
|
||||
const { importEnex } = require('@joplin/lib/import-enex');
|
||||
const Note = require('@joplin/lib/models/Note');
|
||||
const Tag = require('@joplin/lib/models/Tag');
|
||||
const Resource = require('@joplin/lib/models/Resource');
|
||||
|
||||
const enexSampleBaseDir = `${__dirname}/enex_to_md`;
|
||||
|
||||
describe('EnexToMd', function() {
|
||||
|
||||
beforeEach(async (done) => {
|
||||
await setupDatabaseAndSynchronizer(1);
|
||||
await switchClient(1);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should convert ENEX content to Markdown', async () => {
|
||||
const files = await shim.fsDriver().readDirStats(enexSampleBaseDir);
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const htmlFilename = files[i].path;
|
||||
if (htmlFilename.indexOf('.html') < 0) continue;
|
||||
|
||||
const htmlPath = `${enexSampleBaseDir}/${htmlFilename}`;
|
||||
const mdPath = `${enexSampleBaseDir}/${filename(htmlFilename)}.md`;
|
||||
|
||||
// if (htmlFilename !== 'multiline_inner_text.html') continue;
|
||||
|
||||
const html = await shim.fsDriver().readFile(htmlPath);
|
||||
let expectedMd = await shim.fsDriver().readFile(mdPath);
|
||||
|
||||
let actualMd = await enexXmlToMd(`<div>${html}</div>`, []);
|
||||
|
||||
if (os.EOL === '\r\n') {
|
||||
expectedMd = expectedMd.replace(/\r\n/g, '\n');
|
||||
actualMd = actualMd.replace(/\r\n/g, '\n');
|
||||
}
|
||||
|
||||
if (actualMd !== expectedMd) {
|
||||
console.info('');
|
||||
console.info(`Error converting file: ${htmlFilename}`);
|
||||
console.info('--------------------------------- Got:');
|
||||
console.info(actualMd.split('\n'));
|
||||
console.info('--------------------------------- Expected:');
|
||||
console.info(expectedMd.split('\n'));
|
||||
console.info('--------------------------------------------');
|
||||
console.info('');
|
||||
|
||||
expect(false).toBe(true);
|
||||
// return;
|
||||
} else {
|
||||
expect(true).toBe(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('should import ENEX metadata', async () => {
|
||||
const filePath = `${enexSampleBaseDir}/sample-enex.xml`;
|
||||
await importEnex('', filePath);
|
||||
|
||||
const note: NoteEntity = (await Note.all())[0];
|
||||
expect(note.title).toBe('Test Note for Export');
|
||||
expect(note.body).toBe([
|
||||
' Hello, World.',
|
||||
'',
|
||||
'',
|
||||
].join('\n'));
|
||||
expect(note.created_time).toBe(1375217524000);
|
||||
expect(note.updated_time).toBe(1376560800000);
|
||||
expect(note.latitude).toBe('33.88394692');
|
||||
expect(note.longitude).toBe('-117.91913551');
|
||||
expect(note.altitude).toBe('96.0000');
|
||||
expect(note.author).toBe('Brett Kelly');
|
||||
|
||||
const tag: TagEntity = (await Tag.tagsByNoteId(note.id))[0];
|
||||
expect(tag.title).toBe('fake-tag');
|
||||
|
||||
const resource: ResourceEntity = (await Resource.all())[0];
|
||||
expect(resource.id).toBe('3d0f4d01abc02cf8c4dc1c796df8c4b2');
|
||||
const stat = await fs.stat(Resource.fullPath(resource));
|
||||
expect(stat.size).toBe(277);
|
||||
});
|
||||
|
||||
it('should handle invalid dates', async () => {
|
||||
const filePath = `${enexSampleBaseDir}/invalid_date.enex`;
|
||||
await importEnex('', filePath);
|
||||
const note: NoteEntity = (await Note.all())[0];
|
||||
expect(note.created_time).toBe(1521822724000); // 20180323T163204Z
|
||||
expect(note.updated_time).toBe(1521822724000); // Because this date was invalid, it is set to the created time instead
|
||||
});
|
||||
|
||||
});
|
||||
@@ -9,7 +9,7 @@ const Folder = require('@joplin/lib/models/Folder.js');
|
||||
const Note = require('@joplin/lib/models/Note.js');
|
||||
const BaseModel = require('@joplin/lib/BaseModel').default;
|
||||
const shim = require('@joplin/lib/shim').default;
|
||||
const HtmlToHtml = require('@joplin/renderer/HtmlToHtml').default;
|
||||
const HtmlToHtml = require('@joplin/renderer/HtmlToHtml');
|
||||
const { enexXmlToMd } = require('@joplin/lib/import-enex-md-gen.js');
|
||||
|
||||
process.on('unhandledRejection', (reason, p) => {
|
||||
|
||||
@@ -147,27 +147,27 @@ describe('MdToHtml', function() {
|
||||
expect(result.html.trim()).toBe('<div id="rendered-md"><p>just <strong>testing</strong></p>\n</div>');
|
||||
}));
|
||||
|
||||
// it('should render links correctly', asyncTest(async () => {
|
||||
// const mdToHtml = newTestMdToHtml();
|
||||
it('should render links correctly', asyncTest(async () => {
|
||||
const mdToHtml = newTestMdToHtml();
|
||||
|
||||
// const testCases = [
|
||||
// // None of these should result in a link
|
||||
// ['https://example.com', 'https://example.com'],
|
||||
// ['file://C:\\AUTOEXEC.BAT', 'file://C:\\AUTOEXEC.BAT'],
|
||||
// ['example.com', 'example.com'],
|
||||
// ['oo.ps', 'oo.ps'],
|
||||
// ['test@example.com', 'test@example.com'],
|
||||
const testCases = [
|
||||
// None of these should result in a link
|
||||
['https://example.com', 'https://example.com'],
|
||||
['file://C:\\AUTOEXEC.BAT', 'file://C:\\AUTOEXEC.BAT'],
|
||||
['example.com', 'example.com'],
|
||||
['oo.ps', 'oo.ps'],
|
||||
['test@example.com', 'test@example.com'],
|
||||
|
||||
// // Those should be converted to links
|
||||
// ['<https://example.com>', '<a data-from-md title=\'https://example.com\' href=\'https://example.com\'>https://example.com</a>'],
|
||||
// ['[ok](https://example.com)', '<a data-from-md title=\'https://example.com\' href=\'https://example.com\'>ok</a>'],
|
||||
// ];
|
||||
// Those should be converted to links
|
||||
['<https://example.com>', '<a data-from-md title=\'https://example.com\' href=\'https://example.com\'>https://example.com</a>'],
|
||||
['[ok](https://example.com)', '<a data-from-md title=\'https://example.com\' href=\'https://example.com\'>ok</a>'],
|
||||
];
|
||||
|
||||
// for (const testCase of testCases) {
|
||||
// const [input, expected] = testCase;
|
||||
// const actual = await mdToHtml.render(input, null, { bodyOnly: true, plainResourceRendering: true });
|
||||
// expect(actual.html).toBe(expected);
|
||||
// }
|
||||
// }));
|
||||
for (const testCase of testCases) {
|
||||
const [input, expected] = testCase;
|
||||
const actual = await mdToHtml.render(input, null, { bodyOnly: true, plainResourceRendering: true });
|
||||
expect(actual.html).toBe(expected);
|
||||
}
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export3.dtd">
|
||||
<en-export export-date="20201223T053642Z" application="Evernote" version="10.4.3">
|
||||
<note>
|
||||
<title>Fruit Tree Assessment</title>
|
||||
<created>20180323T163204Z</created>
|
||||
<updated>10101T000000Z</updated>
|
||||
<content>
|
||||
<![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd"
|
||||
><en-note>Fruit Tree</en-note> ]]>
|
||||
</content>
|
||||
</note>
|
||||
</en-export>
|
||||
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export3.dtd">
|
||||
<en-export export-date="20130730T205637Z" application="Evernote" version="Evernote Mac">
|
||||
<note>
|
||||
<title>Test Note for Export</title>
|
||||
<content>
|
||||
<![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
|
||||
<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
|
||||
Hello, World.
|
||||
<div>
|
||||
<br/>
|
||||
</div>
|
||||
<div>
|
||||
<en-media alt="" type="image/jpeg" hash="dd7b6d285d09ec054e8cd6a3814ce093"/>
|
||||
</div>
|
||||
<div>
|
||||
<br/>
|
||||
</div>
|
||||
</en-note>
|
||||
]]>
|
||||
</content>
|
||||
<created>20130730T205204Z</created>
|
||||
<updated>20130815T100000Z</updated>
|
||||
<tag>fake-tag</tag>
|
||||
<note-attributes>
|
||||
<latitude>33.88394692352314</latitude>
|
||||
<longitude>-117.9191355110099</longitude>
|
||||
<altitude>96</altitude>
|
||||
<author>Brett Kelly</author>
|
||||
</note-attributes>
|
||||
<resource>
|
||||
<data encoding="base64">/9j/4AAQSkZJRgABAQAAAQABAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAABtbnRyUkdCIFhZ
|
||||
WiAHzgACAAkABgAxAABhY3NwTVNGVAAAAABJRUMgc1JHQgAAAAAAAAAAAAAAAAAA9tYAAQAAAADTLUhQ
|
||||
kfeIGT/+uufk8DpM0gyVjGfmzkgetesnUoTHJ+5Cxn86zmv4/wB75EW+QHAPUH/P9Ky+s1rtrr/wfvOm
|
||||
dBSamnq/xPKp/hpLKmS7x4OBjgn6elee6v4OuLJirRSHb/FtyG9s9u1fR0+oTiIRvGq7W4bpisfUGk1C
|
||||
GVWtkIyM57n1rfDY+uqigtU76ffZkUsA6iajHZ6v/P8A4B//2Q==</data>
|
||||
<mime>image/jpeg</mime>
|
||||
<width>1280</width>
|
||||
<height>720</height>
|
||||
<resource-attributes>
|
||||
<file-name>snapshot-DAE9FC15-88E3-46CF-B744-DA9B1B56EB57.jpg</file-name>
|
||||
</resource-attributes>
|
||||
</resource>
|
||||
</note>
|
||||
</en-export>
|
||||
|
||||
@@ -105,11 +105,7 @@ describe('models_BaseItem', function() {
|
||||
}));
|
||||
|
||||
it('should serialize and unserialize properties that contain new lines', asyncTest(async () => {
|
||||
const sourceUrl = `
|
||||
https://joplinapp.org/ \\n
|
||||
`;
|
||||
|
||||
const note = await Note.save({ title: 'note', source_url: sourceUrl });
|
||||
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);
|
||||
@@ -117,18 +113,4 @@ https://joplinapp.org/ \\n
|
||||
|
||||
expect(noteAfter).toEqual(noteBefore);
|
||||
}));
|
||||
|
||||
it('should not serialize the note title and body', asyncTest(async () => {
|
||||
const note = await Note.save({ title: 'my note', body: `one line
|
||||
two line
|
||||
three line \\n no escape` });
|
||||
|
||||
const noteBefore = await Note.load(note.id);
|
||||
const serialized = await Note.serialize(noteBefore);
|
||||
expect(serialized.indexOf(`my note
|
||||
|
||||
one line
|
||||
two line
|
||||
three line \\n no escape`)).toBe(0);
|
||||
}));
|
||||
});
|
||||
|
||||
@@ -262,14 +262,14 @@ describe('models_Note', function() {
|
||||
for (const testCase of testCases) {
|
||||
const [useAbsolutePaths, input, expected] = testCase;
|
||||
const internalToExternal = await Note.replaceResourceInternalToExternalLinks(input, { useAbsolutePaths });
|
||||
expect(internalToExternal).toBe(expected);
|
||||
expect(internalToExternal).toBe(expected, 'replaceResourceInternalToExternalLinks failed');
|
||||
|
||||
const externalToInternal = await Note.replaceResourceExternalToInternalLinks(internalToExternal, { useAbsolutePaths });
|
||||
expect(externalToInternal).toBe(input);
|
||||
expect(externalToInternal).toBe(input, 'replaceResourceExternalToInternalLinks failed');
|
||||
}
|
||||
|
||||
const result = await Note.replaceResourceExternalToInternalLinks(`[](joplin://${note1.id})`);
|
||||
expect(result).toBe(`[](:/${note1.id})`);
|
||||
expect(result).toBe(`[](:/${note1.id})`, 'replaceResourceExternalToInternalLinks failed (note link)');
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
@@ -28,7 +28,7 @@ async function recreateExportDir() {
|
||||
function fieldsEqual(model1: any, model2: any, fieldNames: string[]) {
|
||||
for (let i = 0; i < fieldNames.length; i++) {
|
||||
const f = fieldNames[i];
|
||||
expect(model1[f]).toBe(model2[f]);
|
||||
expect(model1[f]).toBe(model2[f], `For key ${f}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@ import PluginService from '@joplin/lib/services/plugins/PluginService';
|
||||
import { ContentScriptType } from '@joplin/lib/services/plugins/api/types';
|
||||
import MdToHtml from '@joplin/renderer/MdToHtml';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
|
||||
const fs = require('fs-extra');
|
||||
const { asyncTest, expectNotThrow, setupDatabaseAndSynchronizer, switchClient, expectThrow, createTempDir } = require('./test-utils.js');
|
||||
const Note = require('@joplin/lib/models/Note');
|
||||
const Folder = require('@joplin/lib/models/Folder');
|
||||
@@ -262,23 +260,4 @@ describe('services_PluginService', function() {
|
||||
}
|
||||
}));
|
||||
|
||||
it('should install a plugin', asyncTest(async () => {
|
||||
const service = newPluginService();
|
||||
const pluginPath = `${testPluginDir}/jpl_test/org.joplinapp.FirstJplPlugin.jpl`;
|
||||
await service.installPlugin(pluginPath);
|
||||
const installedPluginPath = `${Setting.value('pluginDir')}/org.joplinapp.FirstJplPlugin.jpl`;
|
||||
expect(await fs.existsSync(installedPluginPath)).toBe(true);
|
||||
}));
|
||||
|
||||
it('should rename the plugin archive to the right name', asyncTest(async () => {
|
||||
const tempDir = await createTempDir();
|
||||
const service = newPluginService();
|
||||
const pluginPath = `${testPluginDir}/jpl_test/org.joplinapp.FirstJplPlugin.jpl`;
|
||||
const tempPath = `${tempDir}/something.jpl`;
|
||||
await shim.fsDriver().copy(pluginPath, tempPath);
|
||||
const installedPluginPath = `${Setting.value('pluginDir')}/org.joplinapp.FirstJplPlugin.jpl`;
|
||||
await service.installPlugin(tempPath);
|
||||
expect(await fs.existsSync(installedPluginPath)).toBe(true);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
const time = require('@joplin/lib/time').default;
|
||||
const { fileContentEqual, setupDatabase, setupDatabaseAndSynchronizer, asyncTest, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId, objectsEqual, checkThrowAsync, restoreDate } = require('./test-utils.js');
|
||||
const { fileContentEqual, setupDatabase, setupDatabaseAndSynchronizer, asyncTest, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId, objectsEqual, checkThrowAsync, mockDate, restoreDate } = require('./test-utils.js');
|
||||
const SearchEngine = require('@joplin/lib/services/searchengine/SearchEngine');
|
||||
const Note = require('@joplin/lib/models/Note');
|
||||
const ItemChange = require('@joplin/lib/models/ItemChange');
|
||||
|
||||
@@ -23,6 +23,12 @@ let engine = null;
|
||||
|
||||
const ids = (array) => array.map(a => a.id);
|
||||
|
||||
// For pretty printing.
|
||||
// See https://stackoverflow.com/questions/23676459/karma-jasmine-pretty-printing-object-comparison/26324116
|
||||
// jasmine.pp = function(obj) {
|
||||
// return JSON.stringify(obj, undefined, 2);
|
||||
// };
|
||||
|
||||
describe('services_SearchFilter', function() {
|
||||
beforeEach(async (done) => {
|
||||
await setupDatabaseAndSynchronizer(1);
|
||||
|
||||
@@ -538,7 +538,7 @@ describe('services_rest_Api', function() {
|
||||
const r3 = await api.route(RequestMethod.GET, 'folders', { ...baseQuery, page: 3 });
|
||||
|
||||
expect(r3.items.length).toBe(0);
|
||||
expect(r3.has_more).toBe(false);
|
||||
expect(r3.has_more).toBe(undefined);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -560,7 +560,7 @@ describe('services_rest_Api', function() {
|
||||
|
||||
expect(r2.items.length).toBe(1);
|
||||
expect(r2.items[0].title).toBe('folder4');
|
||||
expect(r2.has_more).toBe(false);
|
||||
expect(r2.has_more).toBe(undefined);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,20 +21,6 @@ joplin.plugins.register({
|
||||
},
|
||||
});
|
||||
|
||||
await joplin.commands.register({
|
||||
name: 'contextMenuCommandExample',
|
||||
label: 'My Context Menu command',
|
||||
execute: async (noteIds:string[]) => {
|
||||
const notes = [];
|
||||
for (const noteId of noteIds) {
|
||||
notes.push(await joplin.data.get(['notes', noteId]));
|
||||
}
|
||||
|
||||
const noteTitles = notes.map((note:any) => note.title);
|
||||
alert('The following notes will be processed:\n\n' + noteTitles.join(', '));
|
||||
},
|
||||
});
|
||||
|
||||
// Commands that return a result and take argument can only be used
|
||||
// programmatically, so it's not necessary to set a label and icon.
|
||||
await joplin.commands.register({
|
||||
@@ -54,8 +40,6 @@ joplin.plugins.register({
|
||||
await joplin.views.menuItems.create('myMenuItem1', 'testCommand1', MenuItemLocation.Tools, { accelerator: 'CmdOrCtrl+Alt+Shift+B' });
|
||||
await joplin.views.menuItems.create('myMenuItem2', 'testCommand2', MenuItemLocation.Tools);
|
||||
|
||||
await joplin.views.menuItems.create('contextMenuItem1', 'contextMenuCommandExample', MenuItemLocation.NoteListContextMenu);
|
||||
|
||||
console.info('Running command with arguments...');
|
||||
const result = await joplin.commands.execute('commandWithResult', 'abcd', 123);
|
||||
console.info('Result was: ' + result);
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -20,4 +20,4 @@
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -23,4 +23,4 @@
|
||||
"dependencies": {
|
||||
"uslug": "^1.0.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
export default class Global {
|
||||
private joplin_;
|
||||
private requireWhiteList_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get joplin(): Joplin;
|
||||
private requireWhiteList;
|
||||
require(filePath: string): any;
|
||||
|
||||
@@ -7,6 +7,7 @@ import JoplinCommands from './JoplinCommands';
|
||||
import JoplinViews from './JoplinViews';
|
||||
import JoplinInterop from './JoplinInterop';
|
||||
import JoplinSettings from './JoplinSettings';
|
||||
import Logger from '../../../Logger';
|
||||
/**
|
||||
* This is the main entry point to the Joplin API. You can access various services using the provided accessors.
|
||||
*
|
||||
@@ -31,7 +32,7 @@ export default class Joplin {
|
||||
private views_;
|
||||
private interop_;
|
||||
private settings_;
|
||||
constructor(implementation: any, plugin: Plugin, store: any);
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any);
|
||||
get data(): JoplinData;
|
||||
get plugins(): JoplinPlugins;
|
||||
get workspace(): JoplinWorkspace;
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
private logger;
|
||||
private plugin;
|
||||
constructor(plugin: Plugin);
|
||||
constructor(logger: Logger, plugin: Plugin);
|
||||
/**
|
||||
* Registers a new plugin. This is the entry point when creating a plugin. You should pass a simple object with an `onStart` method to it.
|
||||
* That `onStart` method will be executed as soon as the plugin is loaded.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"dist": "webpack",
|
||||
"postinstall": "npm run dist"
|
||||
},
|
||||
"keywords": {},
|
||||
"keywords": [],
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.0.14",
|
||||
@@ -23,4 +23,4 @@
|
||||
"dependencies": {
|
||||
"left-pad": "^1.3.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,6 @@ function createPluginArchive(sourceDir, destPath) {
|
||||
const distFiles = glob.sync(`${sourceDir}/**/*`)
|
||||
.map(f => f.substr(sourceDir.length + 1));
|
||||
|
||||
if (!distFiles.length) {
|
||||
// Usually means there's an error, which is going to be printed by
|
||||
// webpack
|
||||
console.info('Plugin archive was not created because the "dist" directory is empty');
|
||||
return;
|
||||
}
|
||||
|
||||
fs.removeSync(destPath);
|
||||
|
||||
tar.create(
|
||||
@@ -45,8 +38,6 @@ const manifestPath = `${srcDir}/manifest.json`;
|
||||
const manifest = readManifest(manifestPath);
|
||||
const archiveFilePath = path.resolve(__dirname, `${manifest.id}.jpl`);
|
||||
|
||||
fs.removeSync(distDir);
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: './src/index.ts',
|
||||
|
||||
@@ -131,11 +131,9 @@ setSyncTargetName('memory');
|
||||
|
||||
const syncDir = `${__dirname}/../tests/sync`;
|
||||
|
||||
// TODO: Should probably update this for Jest?
|
||||
|
||||
// let defaultJasmineTimeout = 90 * 1000;
|
||||
// if (isNetworkSyncTarget_) defaultJasmineTimeout = 60 * 1000 * 10;
|
||||
// if (typeof jasmine !== 'undefined') jasmine.DEFAULT_TIMEOUT_INTERVAL = defaultJasmineTimeout;
|
||||
let defaultJasmineTimeout = 90 * 1000;
|
||||
if (isNetworkSyncTarget_) defaultJasmineTimeout = 60 * 1000 * 10;
|
||||
if (typeof jasmine !== 'undefined') jasmine.DEFAULT_TIMEOUT_INTERVAL = defaultJasmineTimeout;
|
||||
|
||||
const dbLogger = new Logger();
|
||||
dbLogger.addTarget('console');
|
||||
@@ -147,8 +145,6 @@ logger.addTarget('console');
|
||||
logger.addTarget('file', { path: `${logDir}/log.txt` });
|
||||
logger.setLevel(Logger.LEVEL_WARN); // Set to DEBUG to display sync process in console
|
||||
|
||||
Logger.initializeGlobalLogger(logger);
|
||||
|
||||
BaseItem.loadClass('Note', Note);
|
||||
BaseItem.loadClass('Folder', Folder);
|
||||
BaseItem.loadClass('Resource', Resource);
|
||||
@@ -216,7 +212,6 @@ async function switchClient(id, options = null) {
|
||||
await Setting.reset();
|
||||
Setting.setConstant('resourceDirName', resourceDirName(id));
|
||||
Setting.setConstant('resourceDir', resourceDir(id));
|
||||
Setting.setConstant('pluginDir', pluginDir(id));
|
||||
|
||||
await loadKeychainServiceAndSettings(options.keychainEnabled ? KeychainServiceDriver : KeychainServiceDriverDummy);
|
||||
|
||||
@@ -295,11 +290,6 @@ function resourceDir(id = null) {
|
||||
return `${__dirname}/data/${resourceDirName(id)}`;
|
||||
}
|
||||
|
||||
function pluginDir(id = null) {
|
||||
if (id === null) id = currentClient_;
|
||||
return `${__dirname}/data/plugins-${id}`;
|
||||
}
|
||||
|
||||
async function setupDatabaseAndSynchronizer(id = null, options = null) {
|
||||
if (id === null) id = currentClient_;
|
||||
|
||||
@@ -313,9 +303,6 @@ async function setupDatabaseAndSynchronizer(id = null, options = null) {
|
||||
await fs.remove(resourceDir(id));
|
||||
await fs.mkdirp(resourceDir(id), 0o755);
|
||||
|
||||
await fs.remove(pluginDir(id));
|
||||
await fs.mkdirp(pluginDir(id), 0o755);
|
||||
|
||||
if (!synchronizers_[id]) {
|
||||
const SyncTargetClass = SyncTargetRegistry.classById(syncTargetId_);
|
||||
const syncTarget = new SyncTargetClass(db(id));
|
||||
@@ -557,7 +544,7 @@ function asyncTest(callback) {
|
||||
await callback();
|
||||
} catch (error) {
|
||||
if (error.constructor && error.constructor.name === 'ExpectationFailed') {
|
||||
// OK - will be reported by Jest
|
||||
// OK - will be reported by Jasmine
|
||||
} else {
|
||||
// Better to rethrow exception as stack trace is more useful in this case
|
||||
throw error;
|
||||
@@ -669,17 +656,15 @@ async function createTempDir() {
|
||||
return tempDirPath;
|
||||
}
|
||||
|
||||
// TODO: Update for Jest
|
||||
function mockDate(year, month, day, tick) {
|
||||
const fixedDate = new Date(2020, 0, 1);
|
||||
jasmine.clock().install();
|
||||
jasmine.clock().mockDate(fixedDate);
|
||||
}
|
||||
|
||||
// function mockDate(year, month, day, tick) {
|
||||
// const fixedDate = new Date(2020, 0, 1);
|
||||
// jasmine.clock().install();
|
||||
// jasmine.clock().mockDate(fixedDate);
|
||||
// }
|
||||
|
||||
// function restoreDate() {
|
||||
// jasmine.clock().uninstall();
|
||||
// }
|
||||
function restoreDate() {
|
||||
jasmine.clock().uninstall();
|
||||
}
|
||||
|
||||
// Application for feature integration testing
|
||||
class TestApp extends BaseApplication {
|
||||
@@ -736,7 +721,7 @@ class TestApp extends BaseApplication {
|
||||
}
|
||||
|
||||
async profileDir() {
|
||||
return Setting.value('profileDir');
|
||||
return await Setting.value('profileDir');
|
||||
}
|
||||
|
||||
async destroy() {
|
||||
@@ -749,4 +734,4 @@ class TestApp extends BaseApplication {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { synchronizerStart, afterEachCleanUp, syncTargetName, setSyncTargetName, syncDir, createTempDir, isNetworkSyncTarget, kvStore, expectThrow, logger, expectNotThrow, resourceService, resourceFetcher, tempFilePath, allSyncTargetItemsEncrypted, msleep, setupDatabase, revisionService, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId, objectsEqual, checkThrowAsync, checkThrow, encryptionService, loadEncryptionMasterKey, fileContentEqual, decryptionWorker, asyncTest, currentClientId, id, ids, sortedIds, at, createNTestNotes, createNTestFolders, createNTestTags, TestApp };
|
||||
module.exports = { synchronizerStart, afterEachCleanUp, syncTargetName, setSyncTargetName, syncDir, createTempDir, isNetworkSyncTarget, kvStore, expectThrow, logger, expectNotThrow, resourceService, resourceFetcher, tempFilePath, allSyncTargetItemsEncrypted, msleep, setupDatabase, revisionService, setupDatabaseAndSynchronizer, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId, objectsEqual, checkThrowAsync, checkThrow, encryptionService, loadEncryptionMasterKey, fileContentEqual, decryptionWorker, asyncTest, currentClientId, id, ids, sortedIds, at, createNTestNotes, createNTestFolders, createNTestTags, mockDate, restoreDate, TestApp };
|
||||
|
||||
@@ -150,16 +150,8 @@ class Bridge {
|
||||
const folders = await this.folderTree();
|
||||
this.dispatch({ type: 'FOLDERS_SET', folders: folders.items ? folders.items : folders });
|
||||
|
||||
let tags = [];
|
||||
for (let page = 1; page < 10000; page++) {
|
||||
const result = await this.clipperApiExec('GET', 'tags', { page: page, order_by: 'title', order_dir: 'ASC' });
|
||||
const resultTags = result.items ? result.items : result;
|
||||
const hasMore = ('has_more' in result) && result.has_more;
|
||||
tags = tags.concat(resultTags);
|
||||
if (!hasMore) break;
|
||||
}
|
||||
|
||||
this.dispatch({ type: 'TAGS_SET', tags: tags });
|
||||
const tags = await this.clipperApiExec('GET', 'tags');
|
||||
this.dispatch({ type: 'TAGS_SET', tags: tags.items ? tags.items : tags });
|
||||
|
||||
bridge().restoreState();
|
||||
return;
|
||||
|
||||
@@ -87,7 +87,6 @@ export default class ElectronAppWrapper {
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
spellcheck: true,
|
||||
enableRemoteModule: true,
|
||||
},
|
||||
webviewTag: true,
|
||||
// We start with a hidden window, which is then made visible depending on the showTrayIcon setting
|
||||
|
||||
@@ -490,9 +490,15 @@ class Application extends BaseApplication {
|
||||
}
|
||||
|
||||
private async initPluginService() {
|
||||
const pluginLogger = new Logger();
|
||||
pluginLogger.addTarget(TargetType.File, { path: `${Setting.value('profileDir')}/log-plugins.txt` });
|
||||
pluginLogger.addTarget(TargetType.Console, { prefix: 'Plugin Service:' });
|
||||
pluginLogger.setLevel(Setting.value('env') == 'dev' ? Logger.LEVEL_DEBUG : Logger.LEVEL_INFO);
|
||||
|
||||
const service = PluginService.instance();
|
||||
|
||||
const pluginRunner = new PluginRunner();
|
||||
service.setLogger(pluginLogger);
|
||||
service.initialize(packageInfo.version, PlatformImplementation.instance(), pluginRunner, this.store());
|
||||
|
||||
const pluginSettings = service.unserializePluginSettings(Setting.value('plugins.states'));
|
||||
|
||||
@@ -119,7 +119,7 @@ export class Bridge {
|
||||
showConfirmMessageBox(message: string, options: any = null) {
|
||||
options = {
|
||||
buttons: [_('OK'), _('Cancel')],
|
||||
...options,
|
||||
...options
|
||||
};
|
||||
|
||||
const result = this.showMessageBox_(this.window(), Object.assign({}, {
|
||||
@@ -170,8 +170,8 @@ export class Bridge {
|
||||
return require('electron').shell.openExternal(url);
|
||||
}
|
||||
|
||||
async openItem(fullPath: string) {
|
||||
return require('electron').shell.openPath(fullPath);
|
||||
openItem(fullPath: string) {
|
||||
return require('electron').shell.openItem(fullPath);
|
||||
}
|
||||
|
||||
checkForUpdates(inBackground: boolean, window: any, logFilePath: string, options: any) {
|
||||
|
||||
@@ -16,12 +16,12 @@ import { MenuItem, MenuItemLocation } from '@joplin/lib/services/plugins/api/typ
|
||||
import SpellCheckerService from '@joplin/lib/services/spellChecker/SpellCheckerService';
|
||||
import menuCommandNames from './menuCommandNames';
|
||||
import stateToWhenClauseContext from '../services/commands/stateToWhenClauseContext';
|
||||
import bridge from '../services/bridge';
|
||||
|
||||
const { connect } = require('react-redux');
|
||||
const { reg } = require('@joplin/lib/registry.js');
|
||||
const packageInfo = require('../packageInfo.js');
|
||||
const { clipboard } = require('electron');
|
||||
const bridge = require('electron').remote.require('./bridge').default;
|
||||
const { shell, clipboard } = require('electron');
|
||||
const Menu = bridge().Menu;
|
||||
const PluginManager = require('@joplin/lib/services/PluginManager');
|
||||
const TemplateUtils = require('@joplin/lib/TemplateUtils');
|
||||
@@ -300,7 +300,7 @@ function useMenu(props: Props) {
|
||||
}, {
|
||||
label: _('Open template directory'),
|
||||
click: () => {
|
||||
bridge().openItem(Setting.value('templateDir'));
|
||||
shell.openItem(Setting.value('templateDir'));
|
||||
},
|
||||
}, {
|
||||
label: _('Refresh templates'),
|
||||
|
||||
@@ -22,7 +22,6 @@ import MenuUtils from '@joplin/lib/services/commands/MenuUtils';
|
||||
import CommandService from '@joplin/lib/services/CommandService';
|
||||
import { themeStyle } from '@joplin/lib/theme';
|
||||
import { ThemeAppearance } from '@joplin/lib/themes/type';
|
||||
import SpellCheckerService from '@joplin/lib/services/spellChecker/SpellCheckerService';
|
||||
import dialogs from '../../../dialogs';
|
||||
|
||||
const Note = require('@joplin/lib/models/Note.js');
|
||||
@@ -256,6 +255,54 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const onEditorContextMenu = useCallback(() => {
|
||||
const menu = new Menu();
|
||||
|
||||
const hasSelectedText = editorRef.current && !!editorRef.current.getSelection() ;
|
||||
const clipboardText = clipboard.readText();
|
||||
|
||||
menu.append(
|
||||
new MenuItem({
|
||||
label: _('Cut'),
|
||||
enabled: hasSelectedText,
|
||||
click: async () => {
|
||||
editorCutText();
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
menu.append(
|
||||
new MenuItem({
|
||||
label: _('Copy'),
|
||||
enabled: hasSelectedText,
|
||||
click: async () => {
|
||||
editorCopyText();
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
menu.append(
|
||||
new MenuItem({
|
||||
label: _('Paste'),
|
||||
enabled: true,
|
||||
click: async () => {
|
||||
if (clipboardText) {
|
||||
editorPasteText();
|
||||
} else {
|
||||
// To handle pasting images
|
||||
onEditorPaste();
|
||||
}
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
menuUtils.pluginContextMenuItems(props.plugins, MenuItemLocation.EditorContextMenu).forEach((item: any) => {
|
||||
menu.append(new MenuItem(item));
|
||||
});
|
||||
|
||||
menu.popup(bridge().window());
|
||||
}, [props.content, editorCutText, editorPasteText, editorCopyText, onEditorPaste, props.plugins]);
|
||||
|
||||
const loadScript = async (script: any) => {
|
||||
return new Promise((resolve) => {
|
||||
let element: any = document.createElement('script');
|
||||
@@ -362,12 +409,6 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
|
||||
padding-bottom: 400px !important;
|
||||
}
|
||||
|
||||
.CodeMirror-sizer {
|
||||
/* Add a fixed right padding to account for the appearance (and disappearance) */
|
||||
/* of the sidebar */
|
||||
padding-right: 10px !important;
|
||||
}
|
||||
|
||||
.cm-header-1 {
|
||||
font-size: 1.5em;
|
||||
}
|
||||
@@ -582,91 +623,6 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
|
||||
editorRef.current.refresh();
|
||||
}, [rootSize, styles.editor, props.visiblePanes]);
|
||||
|
||||
// The below code adds support for spellchecking when it is enabled
|
||||
// It might be buggy, refer to the below issue
|
||||
// https://github.com/laurent22/joplin/pull/3974#issuecomment-718936703
|
||||
useEffect(() => {
|
||||
function pointerInsideEditor(x: number, y: number) {
|
||||
const elements = document.getElementsByClassName('codeMirrorEditor');
|
||||
if (!elements.length) return null;
|
||||
const rect = elements[0].getBoundingClientRect();
|
||||
return rect.x < x && rect.y < y && rect.right > x && rect.bottom > y;
|
||||
}
|
||||
|
||||
function onContextMenu(_event: any, params: any) {
|
||||
if (!pointerInsideEditor(params.x, params.y)) return;
|
||||
|
||||
const menu = new Menu();
|
||||
|
||||
const hasSelectedText = editorRef.current && !!editorRef.current.getSelection() ;
|
||||
const clipboardText = clipboard.readText();
|
||||
|
||||
menu.append(
|
||||
new MenuItem({
|
||||
label: _('Cut'),
|
||||
enabled: hasSelectedText,
|
||||
click: async () => {
|
||||
editorCutText();
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
menu.append(
|
||||
new MenuItem({
|
||||
label: _('Copy'),
|
||||
enabled: hasSelectedText,
|
||||
click: async () => {
|
||||
editorCopyText();
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
menu.append(
|
||||
new MenuItem({
|
||||
label: _('Paste'),
|
||||
enabled: true,
|
||||
click: async () => {
|
||||
if (clipboardText) {
|
||||
editorPasteText();
|
||||
} else {
|
||||
// To handle pasting images
|
||||
onEditorPaste();
|
||||
}
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
const spellCheckerMenuItems = SpellCheckerService.instance().contextMenuItems(params.misspelledWord, params.dictionarySuggestions);
|
||||
|
||||
for (const item of spellCheckerMenuItems) {
|
||||
menu.append(new MenuItem(item));
|
||||
}
|
||||
|
||||
// Typically CodeMirror handles all interactions itself (highlighting etc.)
|
||||
// But in the case of clicking a mispelled word, we need electron to handle the click
|
||||
// The result is that CodeMirror doesn't know what's been selected and doesn't
|
||||
// move the cursor into the correct location.
|
||||
// and when the user selects a new spelling it will be inserted in the wrong location
|
||||
// So in this situation, we use must manually align the internal codemirror selection
|
||||
// to the contextmenu selection
|
||||
if (editorRef.current && spellCheckerMenuItems.length > 0) {
|
||||
editorRef.current.alignSelection(params);
|
||||
}
|
||||
|
||||
menuUtils.pluginContextMenuItems(props.plugins, MenuItemLocation.EditorContextMenu).forEach((item: any) => {
|
||||
menu.append(new MenuItem(item));
|
||||
});
|
||||
|
||||
menu.popup();
|
||||
}
|
||||
|
||||
bridge().window().webContents.on('context-menu', onContextMenu);
|
||||
|
||||
return () => {
|
||||
bridge().window().webContents.off('context-menu', onContextMenu);
|
||||
};
|
||||
}, []);
|
||||
|
||||
function renderEditor() {
|
||||
|
||||
return (
|
||||
@@ -684,6 +640,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
|
||||
plugins={props.plugins}
|
||||
onChange={codeMirror_change}
|
||||
onScroll={editor_scroll}
|
||||
onEditorContextMenu={onEditorContextMenu}
|
||||
onEditorPaste={onEditorPaste}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user