You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2026-01-11 00:21:45 +02:00
Compare commits
16 Commits
plugin_gui
...
electron_1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
817931f4cf | ||
|
|
3eda7d1c26 | ||
|
|
592b9d95c6 | ||
|
|
4abdab5cdb | ||
|
|
858508bfa9 | ||
|
|
116413e78d | ||
|
|
031a26116c | ||
|
|
65962e26ce | ||
|
|
30913a5d58 | ||
|
|
61618fb37c | ||
|
|
a40ab434ca | ||
|
|
dbbd930f81 | ||
|
|
ff3ae3860e | ||
|
|
e1c4d1a417 | ||
|
|
e1180a1d84 | ||
|
|
e57444dc32 |
@@ -15,7 +15,8 @@ module.exports = {
|
||||
'Atomics': 'readonly',
|
||||
'SharedArrayBuffer': 'readonly',
|
||||
|
||||
// Jasmine variables
|
||||
// Jest variables
|
||||
'test': 'readonly',
|
||||
'expect': 'readonly',
|
||||
'describe': 'readonly',
|
||||
'it': 'readonly',
|
||||
@@ -23,10 +24,6 @@ module.exports = {
|
||||
'afterAll': 'readonly',
|
||||
'beforeEach': 'readonly',
|
||||
'afterEach': 'readonly',
|
||||
'jasmine': 'readonly',
|
||||
|
||||
// Jest variables
|
||||
'test': 'readonly',
|
||||
|
||||
// React Native variables
|
||||
'__DEV__': 'readonly',
|
||||
|
||||
22
package-lock.json
generated
22
package-lock.json
generated
@@ -1227,12 +1227,6 @@
|
||||
"@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",
|
||||
@@ -6439,22 +6433,6 @@
|
||||
"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",
|
||||
|
||||
14
package.json
14
package.json
@@ -7,6 +7,12 @@
|
||||
},
|
||||
"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/",
|
||||
@@ -26,11 +32,11 @@
|
||||
"releaseDesktop": "node packages/tools/release-electron.js",
|
||||
"releasePluginGenerator": "node packages/tools/release-plugin-generator.js",
|
||||
"setupNewRelease": "node ./packages/tools/setupNewRelease",
|
||||
"updatePluginTypes": "./packages/generator-joplin/updateTypes.sh",
|
||||
"tsc": "lerna run tsc --stream --parallel",
|
||||
"test": "lerna run test --stream",
|
||||
"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",
|
||||
"watch": "lerna run watch --stream --parallel"
|
||||
},
|
||||
"husky": {
|
||||
@@ -39,7 +45,6 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jasmine": "^3.6.0",
|
||||
"@typescript-eslint/eslint-plugin": "^4.6.0",
|
||||
"@typescript-eslint/parser": "^4.6.0",
|
||||
"eslint": "^7.6.0",
|
||||
@@ -50,7 +55,6 @@
|
||||
"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
|
||||
|
||||
@@ -35,7 +35,7 @@ module.exports = {
|
||||
'/build/',
|
||||
'test-utils.js',
|
||||
'file_api_driver.js',
|
||||
'/tests\\/tmp/',
|
||||
'<rootDir>/tests/tmp/',
|
||||
],
|
||||
|
||||
// To avoid this warning:
|
||||
|
||||
46
packages/app-cli/package-lock.json
generated
46
packages/app-cli/package-lock.json
generated
@@ -898,11 +898,15 @@
|
||||
"@types/istanbul-lib-report": "*"
|
||||
}
|
||||
},
|
||||
"@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/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/node": {
|
||||
"version": "14.14.6",
|
||||
@@ -4511,38 +4515,6 @@
|
||||
"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",
|
||||
|
||||
@@ -66,10 +66,9 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@joplin/tools": "^1.0.9",
|
||||
"@types/jasmine": "^3.6.0",
|
||||
"@types/jest": "^26.0.15",
|
||||
"@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"
|
||||
|
||||
@@ -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, 'replaceResourceInternalToExternalLinks failed');
|
||||
expect(internalToExternal).toBe(expected);
|
||||
|
||||
const externalToInternal = await Note.replaceResourceExternalToInternalLinks(internalToExternal, { useAbsolutePaths });
|
||||
expect(externalToInternal).toBe(input, 'replaceResourceExternalToInternalLinks failed');
|
||||
expect(externalToInternal).toBe(input);
|
||||
}
|
||||
|
||||
const result = await Note.replaceResourceExternalToInternalLinks(`[](joplin://${note1.id})`);
|
||||
expect(result).toBe(`[](:/${note1.id})`, 'replaceResourceExternalToInternalLinks failed (note link)');
|
||||
expect(result).toBe(`[](:/${note1.id})`);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
@@ -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], `For key ${f}`);
|
||||
expect(model1[f]).toBe(model2[f]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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, mockDate, restoreDate } = require('./test-utils.js');
|
||||
const { fileContentEqual, setupDatabase, setupDatabaseAndSynchronizer, asyncTest, db, synchronizer, fileApi, sleep, clearDatabase, switchClient, syncTargetId, objectsEqual, checkThrowAsync, 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,12 +23,6 @@ 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(undefined);
|
||||
expect(r3.has_more).toBe(false);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -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(undefined);
|
||||
expect(r2.has_more).toBe(false);
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
@@ -131,9 +131,11 @@ setSyncTargetName('memory');
|
||||
|
||||
const syncDir = `${__dirname}/../tests/sync`;
|
||||
|
||||
let defaultJasmineTimeout = 90 * 1000;
|
||||
if (isNetworkSyncTarget_) defaultJasmineTimeout = 60 * 1000 * 10;
|
||||
if (typeof jasmine !== 'undefined') jasmine.DEFAULT_TIMEOUT_INTERVAL = defaultJasmineTimeout;
|
||||
// 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;
|
||||
|
||||
const dbLogger = new Logger();
|
||||
dbLogger.addTarget('console');
|
||||
@@ -145,6 +147,8 @@ 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);
|
||||
@@ -544,7 +548,7 @@ function asyncTest(callback) {
|
||||
await callback();
|
||||
} catch (error) {
|
||||
if (error.constructor && error.constructor.name === 'ExpectationFailed') {
|
||||
// OK - will be reported by Jasmine
|
||||
// OK - will be reported by Jest
|
||||
} else {
|
||||
// Better to rethrow exception as stack trace is more useful in this case
|
||||
throw error;
|
||||
@@ -656,15 +660,17 @@ async function createTempDir() {
|
||||
return tempDirPath;
|
||||
}
|
||||
|
||||
function mockDate(year, month, day, tick) {
|
||||
const fixedDate = new Date(2020, 0, 1);
|
||||
jasmine.clock().install();
|
||||
jasmine.clock().mockDate(fixedDate);
|
||||
}
|
||||
// TODO: Update for Jest
|
||||
|
||||
function restoreDate() {
|
||||
jasmine.clock().uninstall();
|
||||
}
|
||||
// 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();
|
||||
// }
|
||||
|
||||
// Application for feature integration testing
|
||||
class TestApp extends BaseApplication {
|
||||
@@ -734,4 +740,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, mockDate, restoreDate, 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, TestApp };
|
||||
|
||||
@@ -87,6 +87,7 @@ 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,15 +490,9 @@ 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);
|
||||
}
|
||||
|
||||
openItem(fullPath: string) {
|
||||
return require('electron').shell.openItem(fullPath);
|
||||
async openItem(fullPath: string) {
|
||||
return require('electron').shell.openPath(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 bridge = require('electron').remote.require('./bridge').default;
|
||||
const { shell, clipboard } = require('electron');
|
||||
const { 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: () => {
|
||||
shell.openItem(Setting.value('templateDir'));
|
||||
bridge().openItem(Setting.value('templateDir'));
|
||||
},
|
||||
}, {
|
||||
label: _('Refresh templates'),
|
||||
|
||||
@@ -22,6 +22,7 @@ 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');
|
||||
@@ -255,54 +256,6 @@ 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');
|
||||
@@ -409,6 +362,12 @@ 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;
|
||||
}
|
||||
@@ -623,6 +582,91 @@ 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 (
|
||||
@@ -640,7 +684,6 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
|
||||
plugins={props.plugins}
|
||||
onChange={codeMirror_change}
|
||||
onScroll={editor_scroll}
|
||||
onEditorContextMenu={onEditorContextMenu}
|
||||
onEditorPaste={onEditorPaste}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -27,6 +27,8 @@ import 'codemirror/keymap/sublime'; // Used for swapLineUp and swapLineDown
|
||||
|
||||
import 'codemirror/mode/meta';
|
||||
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
|
||||
// import eventManager from '@joplin/lib/eventManager';
|
||||
|
||||
const { reg } = require('@joplin/lib/registry.js');
|
||||
@@ -77,19 +79,18 @@ for (let i = 0; i < topLanguages.length; i++) {
|
||||
}
|
||||
|
||||
export interface EditorProps {
|
||||
value: string,
|
||||
searchMarkers: any,
|
||||
mode: string,
|
||||
style: any,
|
||||
codeMirrorTheme: any,
|
||||
readOnly: boolean,
|
||||
autoMatchBraces: boolean,
|
||||
keyMap: string,
|
||||
plugins: PluginStates,
|
||||
onChange: any,
|
||||
onScroll: any,
|
||||
onEditorContextMenu: any,
|
||||
onEditorPaste: any,
|
||||
value: string;
|
||||
searchMarkers: any;
|
||||
mode: string;
|
||||
style: any;
|
||||
codeMirrorTheme: any;
|
||||
readOnly: boolean;
|
||||
autoMatchBraces: boolean;
|
||||
keyMap: string;
|
||||
plugins: PluginStates;
|
||||
onChange: any;
|
||||
onScroll: any;
|
||||
onEditorPaste: any;
|
||||
}
|
||||
|
||||
function Editor(props: EditorProps, ref: any) {
|
||||
@@ -122,13 +123,6 @@ function Editor(props: EditorProps, ref: any) {
|
||||
props.onScroll();
|
||||
}, [props.onScroll]);
|
||||
|
||||
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
||||
const editor_mousedown = useCallback((_cm: any, event: any) => {
|
||||
if (event && event.button === 2) {
|
||||
props.onEditorContextMenu();
|
||||
}
|
||||
}, [props.onEditorContextMenu]);
|
||||
|
||||
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
|
||||
const editor_paste = useCallback((_cm: any, _event: any) => {
|
||||
props.onEditorPaste();
|
||||
@@ -163,7 +157,7 @@ function Editor(props: EditorProps, ref: any) {
|
||||
mode: props.mode,
|
||||
readOnly: props.readOnly,
|
||||
autoCloseBrackets: props.autoMatchBraces,
|
||||
inputStyle: 'textarea', // contenteditable loses cursor position on focus change, use textarea instead
|
||||
inputStyle: Setting.value('editor.spellcheckBeta') ? 'contenteditable' : 'textarea',
|
||||
lineWrapping: true,
|
||||
lineNumbers: false,
|
||||
indentWithTabs: true,
|
||||
@@ -177,7 +171,6 @@ function Editor(props: EditorProps, ref: any) {
|
||||
setEditor(cm);
|
||||
cm.on('change', editor_change);
|
||||
cm.on('scroll', editor_scroll);
|
||||
cm.on('mousedown', editor_mousedown);
|
||||
cm.on('paste', editor_paste);
|
||||
cm.on('drop', editor_drop);
|
||||
cm.on('dragover', editor_drag);
|
||||
@@ -191,7 +184,6 @@ function Editor(props: EditorProps, ref: any) {
|
||||
// Clean up codemirror
|
||||
cm.off('change', editor_change);
|
||||
cm.off('scroll', editor_scroll);
|
||||
cm.off('mousedown', editor_mousedown);
|
||||
cm.off('paste', editor_paste);
|
||||
cm.off('drop', editor_drop);
|
||||
cm.off('dragover', editor_drag);
|
||||
@@ -250,7 +242,7 @@ function Editor(props: EditorProps, ref: any) {
|
||||
}
|
||||
}, [pluginOptions, editor]);
|
||||
|
||||
return <div style={props.style} ref={editorParent} />;
|
||||
return <div className='codeMirrorEditor' style={props.style} ref={editorParent} />;
|
||||
}
|
||||
|
||||
export default forwardRef(Editor);
|
||||
|
||||
@@ -100,5 +100,33 @@ export default function useCursorUtils(CodeMirror: any) {
|
||||
});
|
||||
});
|
||||
|
||||
// params are the oncontextmenu params
|
||||
CodeMirror.defineExtension('alignSelection', function(params: any) {
|
||||
// The below is a HACK that uses the selectionText from electron and the coordinates of
|
||||
// the click to determine what the codemirror selection should be
|
||||
const alignStrings = (s1: string, s2: string) => {
|
||||
for (let i = 0; i < s1.length; i++) {
|
||||
if (s1.substr(i, s2.length) === s2) { return i; }
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
const selectionText = params.selectionText;
|
||||
const coords = this.coordsChar({ left: params.x, top: params.y });
|
||||
const { anchor, head } = this.findWordAt(coords);
|
||||
const selectedWord = this.getRange(anchor, head);
|
||||
|
||||
if (selectionText.length > selectedWord.length) {
|
||||
const offset = alignStrings(selectionText, selectedWord);
|
||||
anchor.ch -= offset;
|
||||
head.ch = anchor.ch + selectionText.length;
|
||||
} else if (selectionText.length < selectedWord.length) {
|
||||
const offset = alignStrings(selectedWord, selectionText);
|
||||
anchor.ch += offset;
|
||||
head.ch = anchor.ch + selectionText.length;
|
||||
}
|
||||
|
||||
this.setSelection(anchor, head);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ const { render } = require('react-dom');
|
||||
const { connect, Provider } = require('react-redux');
|
||||
const Setting = require('@joplin/lib/models/Setting').default;
|
||||
const shim = require('@joplin/lib/shim').default;
|
||||
shim.setReact(React);
|
||||
const { ImportScreen } = require('./ImportScreen.min.js');
|
||||
const { ResourceScreen } = require('./ResourceScreen.js');
|
||||
const { Navigator } = require('./Navigator.min.js');
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
const smalltalk = require('smalltalk');
|
||||
|
||||
class Dialogs {
|
||||
async alert(message:string, title = '') {
|
||||
async alert(message: string, title = '') {
|
||||
await smalltalk.alert(title, message);
|
||||
}
|
||||
|
||||
async confirm(message:string, title = '', options:any = {}) {
|
||||
async confirm(message: string, title = '', options: any = {}) {
|
||||
try {
|
||||
await smalltalk.confirm(title, message, options);
|
||||
return true;
|
||||
@@ -14,7 +14,7 @@ class Dialogs {
|
||||
}
|
||||
}
|
||||
|
||||
async prompt(message:string, title = '', defaultValue = '', options:any = null) {
|
||||
async prompt(message: string, title = '', defaultValue = '', options: any = null) {
|
||||
if (options === null) options = {};
|
||||
|
||||
try {
|
||||
|
||||
@@ -9,7 +9,7 @@ interface Props {
|
||||
themeId: number;
|
||||
}
|
||||
|
||||
export default function(props:Props) {
|
||||
export default function(props: Props) {
|
||||
const theme = themeStyle(props.themeId);
|
||||
|
||||
return (
|
||||
@@ -18,10 +18,10 @@ export default function(props:Props) {
|
||||
onToggle={props.onToggle}
|
||||
colors={{
|
||||
activeThumb: {
|
||||
base: Color(theme.color5).rgb().string(),
|
||||
base: Color(theme.color5).rgb().string(),
|
||||
},
|
||||
active: {
|
||||
base: Color(theme.backgroundColor5).alpha(0.7).rgb().string(),
|
||||
base: Color(theme.backgroundColor5).alpha(0.7).rgb().string(),
|
||||
},
|
||||
}}
|
||||
trackStyle={{
|
||||
@@ -34,4 +34,4 @@ export default function(props:Props) {
|
||||
activeLabel=""
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ const { shimInit } = require('@joplin/lib/shim-init-node.js');
|
||||
const EncryptionService = require('@joplin/lib/services/EncryptionService');
|
||||
const bridge = require('electron').remote.require('./bridge').default;
|
||||
const { FileApiDriverLocal } = require('@joplin/lib/file-api-driver-local.js');
|
||||
const React = require('react');
|
||||
|
||||
if (bridge().env() === 'dev') {
|
||||
const newConsole = function(oldConsole) {
|
||||
@@ -86,7 +87,7 @@ try {
|
||||
keytar = null;
|
||||
}
|
||||
|
||||
shimInit(null, keytar);
|
||||
shimInit(null, keytar, React);
|
||||
|
||||
// Disable drag and drop of links inside application (which would
|
||||
// open it as if the whole app was a browser)
|
||||
|
||||
2098
packages/app-desktop/package-lock.json
generated
2098
packages/app-desktop/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -89,7 +89,6 @@
|
||||
"devDependencies": {
|
||||
"@joplin/tools": "^1.0.9",
|
||||
"@testing-library/react-hooks": "^3.4.2",
|
||||
"@types/jasmine": "^3.5.11",
|
||||
"@types/jest": "^26.0.15",
|
||||
"@types/node": "^14.14.6",
|
||||
"@types/react": "16.9.55",
|
||||
@@ -98,9 +97,9 @@
|
||||
"app-builder-bin": "^1.9.11",
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"electron": "^8.2.5",
|
||||
"electron-builder": "22.3.2",
|
||||
"electron-rebuild": "^1.10.1",
|
||||
"electron": "^10.1.6",
|
||||
"electron-builder": "22.9.1",
|
||||
"electron-rebuild": "^2.3.2",
|
||||
"glob": "^7.1.6",
|
||||
"gulp": "^4.0.2",
|
||||
"jest": "^26.6.3",
|
||||
|
||||
@@ -399,6 +399,8 @@ async function initialize(dispatch) {
|
||||
mainLogger.setLevel(Logger.LEVEL_DEBUG);
|
||||
}
|
||||
|
||||
Logger.initializeGlobalLogger(mainLogger);
|
||||
|
||||
reg.setLogger(mainLogger);
|
||||
reg.setShowErrorMessageBoxHandler((message) => { alert(message); });
|
||||
|
||||
|
||||
@@ -4,6 +4,29 @@ const Generator = require('yeoman-generator');
|
||||
const chalk = require('chalk');
|
||||
const yosay = require('yosay');
|
||||
|
||||
function mergePackageKey(parentKey, source, dest) {
|
||||
const output = Object.assign({}, dest);
|
||||
|
||||
for (const k in source) {
|
||||
if (!(k in output)) {
|
||||
// If the key doesn't exist in the destination, add it
|
||||
output[k] = source[k];
|
||||
} else if (parentKey === 'devDependencies') {
|
||||
// If we are dealing with the dependencies, overwrite with the
|
||||
// version from source.
|
||||
output[k] = source[k];
|
||||
} else if (typeof source[k] === 'object' && !Array.isArray(k) && source[k] !== null) {
|
||||
// If it's an object, recursively process it
|
||||
output[k] = mergePackageKey(k, source[k], output[k]);
|
||||
} else {
|
||||
// Otherwise, the default is to preserve the destination key
|
||||
output[k] = dest[k];
|
||||
}
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
module.exports = class extends Generator {
|
||||
|
||||
constructor(args, opts) {
|
||||
@@ -18,8 +41,6 @@ module.exports = class extends Generator {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
async prompting() {
|
||||
this.log(yosay(`Welcome to the fine ${chalk.red('generator-joplin')} generator!`));
|
||||
|
||||
@@ -110,12 +131,28 @@ module.exports = class extends Generator {
|
||||
if (this.options.update && noUpdateFiles.includes(file)) continue;
|
||||
|
||||
const destFile = file.replace(/_TEMPLATE/, '');
|
||||
const destFilePath = this.destinationPath(destFile);
|
||||
|
||||
this.fs.copyTpl(
|
||||
this.templatePath(file),
|
||||
this.destinationPath(destFile),
|
||||
this.props
|
||||
);
|
||||
if (this.options.update && destFile === 'package.json' && this.fs.exists(destFilePath)) {
|
||||
const destContent = this.fs.readJSON(destFilePath);
|
||||
|
||||
this.fs.copy(
|
||||
this.templatePath(file),
|
||||
destFilePath, {
|
||||
process: (sourceBuffer) => {
|
||||
const sourceContent = JSON.parse(sourceBuffer.toString());
|
||||
const newContent = mergePackageKey(null, sourceContent, destContent);
|
||||
return JSON.stringify(newContent, null, 2);
|
||||
},
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.fs.copyTpl(
|
||||
this.templatePath(file),
|
||||
destFilePath,
|
||||
this.props
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.fs.copy(
|
||||
|
||||
@@ -46,13 +46,13 @@ const MigrationService = require('./services/MigrationService');
|
||||
const { toSystemSlashes } = require('./path-utils');
|
||||
const { setAutoFreeze } = require('immer');
|
||||
|
||||
const appLogger = Logger.create('App');
|
||||
|
||||
// const ntpClient = require('./vendor/ntp-client');
|
||||
// ntpClient.dgram = require('dgram');
|
||||
|
||||
export default class BaseApplication {
|
||||
|
||||
private logger_: Logger;
|
||||
private dbLogger_: Logger;
|
||||
private eventEmitter_: any;
|
||||
private scheduleAutoAddResourcesIID_: any = null;
|
||||
private database_: any = null;
|
||||
@@ -68,10 +68,7 @@ export default class BaseApplication {
|
||||
protected store_: any = null;
|
||||
|
||||
constructor() {
|
||||
this.logger_ = new Logger();
|
||||
this.dbLogger_ = new Logger();
|
||||
this.eventEmitter_ = new EventEmitter();
|
||||
|
||||
this.decryptionWorker_resourceMetadataButNotBlobDecrypted = this.decryptionWorker_resourceMetadataButNotBlobDecrypted.bind(this);
|
||||
}
|
||||
|
||||
@@ -101,15 +98,13 @@ export default class BaseApplication {
|
||||
EncryptionService.instance_ = null;
|
||||
DecryptionWorker.instance_ = null;
|
||||
|
||||
this.logger_.info('Base application terminated...');
|
||||
this.logger_ = null;
|
||||
this.dbLogger_ = null;
|
||||
appLogger.info('Base application terminated...');
|
||||
this.eventEmitter_ = null;
|
||||
this.decryptionWorker_resourceMetadataButNotBlobDecrypted = null;
|
||||
}
|
||||
|
||||
logger() {
|
||||
return this.logger_;
|
||||
return appLogger;
|
||||
}
|
||||
|
||||
public store() {
|
||||
@@ -289,7 +284,7 @@ export default class BaseApplication {
|
||||
parentType = BaseModel.TYPE_SMART_FILTER;
|
||||
}
|
||||
|
||||
this.logger().debug('Refreshing notes:', parentType, parentId);
|
||||
appLogger.debug('Refreshing notes:', parentType, parentId);
|
||||
|
||||
const options = {
|
||||
order: stateUtils.notesOrder(state.settings),
|
||||
@@ -460,7 +455,7 @@ export default class BaseApplication {
|
||||
}
|
||||
|
||||
async generalMiddleware(store: any, next: any, action: any) {
|
||||
// this.logger().debug('Reducer action', this.reducerActionToString(action));
|
||||
// appLogger.debug('Reducer action', this.reducerActionToString(action));
|
||||
|
||||
const result = next(action);
|
||||
const newState = store.getState();
|
||||
@@ -547,7 +542,11 @@ export default class BaseApplication {
|
||||
}
|
||||
|
||||
if (action.type === 'NOTE_UPDATE_ONE') {
|
||||
if (!action.changedFields.length || action.changedFields.includes('parent_id') || action.changedFields.includes('encryption_applied')) {
|
||||
if (!action.changedFields.length ||
|
||||
action.changedFields.includes('parent_id') ||
|
||||
action.changedFields.includes('encryption_applied') ||
|
||||
action.changedFields.includes('is_conflict')
|
||||
) {
|
||||
refreshFolders = true;
|
||||
}
|
||||
}
|
||||
@@ -701,35 +700,30 @@ export default class BaseApplication {
|
||||
const extraFlags = await this.readFlagsFromFile(`${profileDir}/flags.txt`);
|
||||
initArgs = Object.assign(initArgs, extraFlags);
|
||||
|
||||
this.logger_.addTarget(TargetType.File, { path: `${profileDir}/log.txt` });
|
||||
if (Setting.value('env') === 'dev' && !shim.isTestingEnv()) {
|
||||
// this.logger_.addTarget(TargetType.Console, { level: Logger.LEVEL_DEBUG });
|
||||
}
|
||||
this.logger_.setLevel(initArgs.logLevel);
|
||||
|
||||
reg.setLogger(this.logger_);
|
||||
|
||||
|
||||
const globalLogger = new Logger();
|
||||
globalLogger.addTarget(TargetType.File, { path: `${profileDir}/log.txt` });
|
||||
if (Setting.value('appType') === 'desktop') {
|
||||
globalLogger.addTarget(TargetType.Console);
|
||||
}
|
||||
globalLogger.setLevel(initArgs.logLevel);
|
||||
Logger.initializeGlobalLogger(globalLogger);
|
||||
|
||||
|
||||
|
||||
reg.setLogger(Logger.create(''));
|
||||
reg.dispatch = () => {};
|
||||
|
||||
BaseService.logger_ = this.logger_;
|
||||
// require('lib/ntpDate').setLogger(reg.logger());
|
||||
BaseService.logger_ = globalLogger;
|
||||
|
||||
this.dbLogger_.addTarget(TargetType.File, { path: `${profileDir}/log-database.txt` });
|
||||
this.dbLogger_.setLevel(initArgs.logLevel);
|
||||
|
||||
if (Setting.value('appType') === 'desktop') {
|
||||
this.logger_.addTarget(TargetType.Console, { level: Logger.LEVEL_WARN });
|
||||
this.dbLogger_.addTarget(TargetType.Console, { level: Logger.LEVEL_WARN });
|
||||
}
|
||||
|
||||
if (Setting.value('env') === 'dev') {
|
||||
this.dbLogger_.setLevel(Logger.LEVEL_INFO);
|
||||
}
|
||||
|
||||
this.logger_.info(`Profile directory: ${profileDir}`);
|
||||
appLogger.info(`Profile directory: ${profileDir}`);
|
||||
|
||||
this.database_ = new JoplinDatabase(new DatabaseDriverNode());
|
||||
this.database_.setLogExcludedQueryTypes(['SELECT']);
|
||||
this.database_.setLogger(this.dbLogger_);
|
||||
this.database_.setLogger(globalLogger);
|
||||
|
||||
// if (Setting.value('env') === 'dev') {
|
||||
// if (shim.isElectron()) {
|
||||
@@ -756,7 +750,7 @@ export default class BaseApplication {
|
||||
|
||||
await loadKeychainServiceAndSettings(KeychainServiceDriver);
|
||||
|
||||
this.logger_.info(`Client ID: ${Setting.value('clientId')}`);
|
||||
appLogger.info(`Client ID: ${Setting.value('clientId')}`);
|
||||
|
||||
if (Setting.value('firstStart')) {
|
||||
const locale = shim.detectAndSetLocale(Setting);
|
||||
@@ -817,9 +811,9 @@ export default class BaseApplication {
|
||||
|
||||
KvStore.instance().setDb(reg.db());
|
||||
|
||||
EncryptionService.instance().setLogger(this.logger_);
|
||||
EncryptionService.instance().setLogger(globalLogger);
|
||||
BaseItem.encryptionService_ = EncryptionService.instance();
|
||||
DecryptionWorker.instance().setLogger(this.logger_);
|
||||
DecryptionWorker.instance().setLogger(globalLogger);
|
||||
DecryptionWorker.instance().setEncryptionService(EncryptionService.instance());
|
||||
DecryptionWorker.instance().setKvStore(KvStore.instance());
|
||||
await EncryptionService.instance().loadMasterKeysFromSettings();
|
||||
@@ -828,7 +822,7 @@ export default class BaseApplication {
|
||||
ResourceFetcher.instance().setFileApi(() => {
|
||||
return reg.syncTarget().fileApi();
|
||||
});
|
||||
ResourceFetcher.instance().setLogger(this.logger_);
|
||||
ResourceFetcher.instance().setLogger(globalLogger);
|
||||
ResourceFetcher.instance().on('downloadComplete', this.resourceFetcher_downloadComplete);
|
||||
ResourceFetcher.instance().start();
|
||||
|
||||
|
||||
@@ -26,6 +26,13 @@ interface Target {
|
||||
source?: string;
|
||||
}
|
||||
|
||||
interface LoggerWrapper {
|
||||
debug: Function;
|
||||
info: Function;
|
||||
warn: Function;
|
||||
error: Function;
|
||||
}
|
||||
|
||||
class Logger {
|
||||
|
||||
// For backward compatibility
|
||||
@@ -36,6 +43,7 @@ class Logger {
|
||||
public static LEVEL_DEBUG = LogLevel.Debug;
|
||||
|
||||
public static fsDriver_: any = null;
|
||||
private static globalLogger_: Logger = null;
|
||||
|
||||
private targets_: Target[] = [];
|
||||
private level_: LogLevel = LogLevel.Info;
|
||||
@@ -46,6 +54,24 @@ class Logger {
|
||||
return Logger.fsDriver_;
|
||||
}
|
||||
|
||||
public static initializeGlobalLogger(logger: Logger) {
|
||||
this.globalLogger_ = logger;
|
||||
}
|
||||
|
||||
private static get globalLogger(): Logger {
|
||||
if (!this.globalLogger_) throw new Error('Global logger has not been initialized!!');
|
||||
return this.globalLogger_;
|
||||
}
|
||||
|
||||
static create(prefix: string): LoggerWrapper {
|
||||
return {
|
||||
debug: (...object: any[]) => this.globalLogger.log(LogLevel.Debug, prefix, ...object),
|
||||
info: (...object: any[]) => this.globalLogger.log(LogLevel.Info, prefix, ...object),
|
||||
warn: (...object: any[]) => this.globalLogger.log(LogLevel.Warn, prefix, ...object),
|
||||
error: (...object: any[]) => this.globalLogger.log(LogLevel.Error, prefix, ...object),
|
||||
};
|
||||
}
|
||||
|
||||
setLevel(level: LogLevel) {
|
||||
this.level_ = level;
|
||||
}
|
||||
@@ -132,14 +158,12 @@ class Logger {
|
||||
return this.level();
|
||||
}
|
||||
|
||||
log(level: LogLevel, ...object: any[]) {
|
||||
public log(level: LogLevel, prefix: string, ...object: any[]) {
|
||||
if (!this.targets_.length) return;
|
||||
|
||||
const timestamp = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
const line = `${timestamp}: `;
|
||||
|
||||
for (let i = 0; i < this.targets_.length; i++) {
|
||||
const target = this.targets_[i];
|
||||
const targetPrefix = prefix ? prefix : target.prefix;
|
||||
|
||||
if (this.targetLevel(target) < level) continue;
|
||||
|
||||
@@ -149,26 +173,30 @@ class Logger {
|
||||
if (level == LogLevel.Warn) fn = 'warn';
|
||||
if (level == LogLevel.Info) fn = 'info';
|
||||
const consoleObj = target.console ? target.console : console;
|
||||
let items = [moment().format('HH:mm:ss')];
|
||||
if (target.prefix) {
|
||||
items.push(target.prefix);
|
||||
}
|
||||
items = items.concat(...object);
|
||||
const prefixItems = [moment().format('HH:mm:ss')];
|
||||
if (targetPrefix) prefixItems.push(targetPrefix);
|
||||
const items = [`${prefixItems.join(': ')}:`].concat(...object);
|
||||
consoleObj[fn](...items);
|
||||
} else if (target.type == 'file') {
|
||||
const serializedObject = this.objectsToString(...object);
|
||||
const timestamp = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
const line = [timestamp];
|
||||
if (targetPrefix) line.push(targetPrefix);
|
||||
line.push(this.objectsToString(...object));
|
||||
try {
|
||||
Logger.fsDriver().appendFileSync(target.path, `${line + serializedObject}\n`);
|
||||
// TODO: Should log async
|
||||
Logger.fsDriver().appendFileSync(target.path, `${line.join(': ')}\n`);
|
||||
} catch (error) {
|
||||
console.error('Cannot write to log file:', error);
|
||||
}
|
||||
} else if (target.type == 'database') {
|
||||
const msg = this.objectsToString(...object);
|
||||
const msg = [];
|
||||
if (targetPrefix) msg.push(targetPrefix);
|
||||
msg.push(this.objectsToString(...object));
|
||||
|
||||
const queries = [
|
||||
{
|
||||
sql: 'INSERT INTO logs (`source`, `level`, `message`, `timestamp`) VALUES (?, ?, ?, ?)',
|
||||
params: [target.source, level, msg, time.unixMs()],
|
||||
params: [target.source, level, msg.join(': '), time.unixMs()],
|
||||
},
|
||||
];
|
||||
|
||||
@@ -188,16 +216,16 @@ class Logger {
|
||||
}
|
||||
|
||||
error(...object: any[]) {
|
||||
return this.log(LogLevel.Error, ...object);
|
||||
return this.log(LogLevel.Error, null, ...object);
|
||||
}
|
||||
warn(...object: any[]) {
|
||||
return this.log(LogLevel.Warn, ...object);
|
||||
return this.log(LogLevel.Warn, null, ...object);
|
||||
}
|
||||
info(...object: any[]) {
|
||||
return this.log(LogLevel.Info, ...object);
|
||||
return this.log(LogLevel.Info, null, ...object);
|
||||
}
|
||||
debug(...object: any[]) {
|
||||
return this.log(LogLevel.Debug, ...object);
|
||||
return this.log(LogLevel.Debug, null, ...object);
|
||||
}
|
||||
|
||||
static levelStringToId(s: string) {
|
||||
|
||||
@@ -97,9 +97,9 @@ shared.scheduleSaveSettings = function(comp) {
|
||||
|
||||
shared.scheduleSaveSettingsIID = setTimeout(() => {
|
||||
shared.scheduleSaveSettingsIID = null;
|
||||
shared.saveSettings(comp);
|
||||
shared.saveSettings(comp);
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
shared.saveSettings = function(comp) {
|
||||
for (const key in comp.state.settings) {
|
||||
|
||||
@@ -6,6 +6,7 @@ const shim = require('./shim').default;
|
||||
class Database {
|
||||
constructor(driver) {
|
||||
this.debugMode_ = false;
|
||||
this.sqlQueryLogEnabled_ = false;
|
||||
this.driver_ = driver;
|
||||
this.logger_ = new Logger();
|
||||
this.logExcludedQueryTypes_ = [];
|
||||
@@ -238,6 +239,8 @@ class Database {
|
||||
}
|
||||
|
||||
logQuery(sql, params = null) {
|
||||
if (!this.sqlQueryLogEnabled_) return;
|
||||
|
||||
if (this.logExcludedQueryTypes_.length) {
|
||||
const temp = sql.toLowerCase();
|
||||
for (let i = 0; i < this.logExcludedQueryTypes_.length; i++) {
|
||||
|
||||
@@ -276,7 +276,7 @@ class Note extends BaseItem {
|
||||
includeTimestamps: true,
|
||||
}, options);
|
||||
|
||||
const output = ['id', 'title', 'is_todo', 'todo_completed', 'todo_due', 'parent_id', 'encryption_applied', 'order', 'markup_language'];
|
||||
const output = ['id', 'title', 'is_todo', 'todo_completed', 'todo_due', 'parent_id', 'encryption_applied', 'order', 'markup_language', 'is_conflict'];
|
||||
|
||||
if (options.includeTimestamps) {
|
||||
output.push('updated_time');
|
||||
|
||||
@@ -44,9 +44,9 @@ export interface SettingItem {
|
||||
maximum?: number;
|
||||
step?: number;
|
||||
onClick?(): void;
|
||||
unitLabel?:Function;
|
||||
unitLabel?: Function;
|
||||
needRestart?: boolean;
|
||||
autoSave?:boolean;
|
||||
autoSave?: boolean;
|
||||
}
|
||||
|
||||
interface SettingItems {
|
||||
@@ -715,7 +715,7 @@ class Setting extends BaseModel {
|
||||
description: () => 'CSS file support is provided for your convenience, but they are advanced settings, and styles you define may break from one version to the next. If you want to use them, please know that it might require regular development work from you to keep them working. The Joplin team cannot make a commitment to keep the application HTML structure stable.',
|
||||
},
|
||||
|
||||
autoUpdateEnabled: { value: false, type: SettingItemType.Bool, section: 'application', public: true, appTypes: ['desktop'], label: () => _('Automatically update the application') },
|
||||
autoUpdateEnabled: { value: false, type: SettingItemType.Bool, section: 'application', public: platform !== 'linux', appTypes: ['desktop'], label: () => _('Automatically update the application') },
|
||||
'autoUpdate.includePreReleases': { value: false, type: SettingItemType.Bool, section: 'application', public: true, appTypes: ['desktop'], label: () => _('Get pre-releases when checking for updates'), description: () => _('See the pre-release page for more details: %s', 'https://joplinapp.org/prereleases') },
|
||||
'clipperServer.autoStart': { value: false, type: SettingItemType.Bool, public: false },
|
||||
'sync.interval': {
|
||||
@@ -775,6 +775,16 @@ class Setting extends BaseModel {
|
||||
},
|
||||
},
|
||||
|
||||
'editor.spellcheckBeta': {
|
||||
value: false,
|
||||
type: SettingItemType.Bool,
|
||||
public: true,
|
||||
appTypes: ['desktop'],
|
||||
advanced: true,
|
||||
label: () => 'Enable spell checking in Markdown editor? (WARNING BETA feature)',
|
||||
description: () => 'Spell checker in the Markdown editor was previously unstable (cursor location was not stable, sometimes edits would not be saved or reflected in the viewer, etc.) however it appears to be more reliable now. If you notice any issue, please report it on GitHub or the Joplin Forum (Help -> Joplin Forum)',
|
||||
},
|
||||
|
||||
'net.customCertificates': {
|
||||
value: '',
|
||||
type: SettingItemType.String,
|
||||
@@ -829,7 +839,7 @@ class Setting extends BaseModel {
|
||||
minimum: 1,
|
||||
maximum: 365 * 2,
|
||||
step: 1,
|
||||
unitLabel: (value:number = null) => {
|
||||
unitLabel: (value: number = null) => {
|
||||
return value === null ? _('days') : _('%d days', value);
|
||||
},
|
||||
label: () => _('Keep note history for'),
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Pagination, PaginationOrder } from './types';
|
||||
|
||||
export interface ModelFeedPage {
|
||||
items: any[];
|
||||
has_more?: boolean;
|
||||
has_more: boolean;
|
||||
total?: number;
|
||||
}
|
||||
|
||||
@@ -52,9 +52,8 @@ export default async function(db: any, tableName: string, pagination: Pagination
|
||||
|
||||
const rows = await db.selectAll(sql, sqlParams);
|
||||
|
||||
const output: ModelFeedPage = { items: rows };
|
||||
|
||||
if (rows.length >= pagination.limit) output.has_more = true;
|
||||
|
||||
return output;
|
||||
return {
|
||||
items: rows,
|
||||
has_more: rows.length >= pagination.limit,
|
||||
};
|
||||
}
|
||||
|
||||
202
packages/lib/package-lock.json
generated
202
packages/lib/package-lock.json
generated
@@ -98,35 +98,6 @@
|
||||
"requires": {
|
||||
"delegates": "^1.0.0",
|
||||
"readable-stream": "^2.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"readable-stream": {
|
||||
"version": "2.3.7",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"argparse": {
|
||||
@@ -270,6 +241,15 @@
|
||||
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz",
|
||||
"integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ=="
|
||||
},
|
||||
"block-stream": {
|
||||
"version": "0.0.9",
|
||||
"resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz",
|
||||
"integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"inherits": "~2.0.0"
|
||||
}
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
@@ -531,6 +511,14 @@
|
||||
"whatwg-url": "^7.0.0"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
|
||||
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"decode-uri-component": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz",
|
||||
@@ -753,6 +741,18 @@
|
||||
"integrity": "sha512-Auw9a4AxqWpa9GUfj370BMPzzyncfBABW8Mab7BGWBYDj4Isgq+cDKtx0i6u9jcX9pQDnswsaaOTgTmA5pEjuQ==",
|
||||
"optional": true
|
||||
},
|
||||
"fstream": {
|
||||
"version": "1.0.12",
|
||||
"resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz",
|
||||
"integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"graceful-fs": "^4.1.2",
|
||||
"inherits": "~2.0.0",
|
||||
"mkdirp": ">=0.5 0",
|
||||
"rimraf": "2"
|
||||
}
|
||||
},
|
||||
"gauge": {
|
||||
"version": "2.7.4",
|
||||
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
|
||||
@@ -1512,6 +1512,11 @@
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
},
|
||||
"multiparty": {
|
||||
"version": "4.2.2",
|
||||
"resolved": "https://registry.npmjs.org/multiparty/-/multiparty-4.2.2.tgz",
|
||||
@@ -1527,11 +1532,6 @@
|
||||
"resolved": "https://registry.npmjs.org/mustache/-/mustache-4.0.1.tgz",
|
||||
"integrity": "sha512-yL5VE97+OXn4+Er3THSmTdCFCtx5hHWzrolvH+JObZnUYwuaG7XV+Ch4fR2cIrcYI0tFHxS7iyFYl14bW8y2sA=="
|
||||
},
|
||||
"nan": {
|
||||
"version": "2.14.1",
|
||||
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
|
||||
"integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw=="
|
||||
},
|
||||
"nanoid": {
|
||||
"version": "3.1.16",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.16.tgz",
|
||||
@@ -1545,21 +1545,6 @@
|
||||
"debug": "^3.2.6",
|
||||
"iconv-lite": "^0.4.4",
|
||||
"sax": "^1.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": {
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz",
|
||||
"integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==",
|
||||
"requires": {
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
|
||||
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"no-case": {
|
||||
@@ -1570,6 +1555,11 @@
|
||||
"lower-case": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"node-addon-api": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.0.tgz",
|
||||
"integrity": "sha512-ASCL5U13as7HhOExbT6OlWJJUV/lLzL2voOSP1UVehpRD8FbSrSDjfScK/KwAvVTI5AS6r4VwbOMlIqtvRidnA=="
|
||||
},
|
||||
"node-emoji": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/node-emoji/-/node-emoji-1.10.0.tgz",
|
||||
@@ -1587,6 +1577,39 @@
|
||||
"is-stream": "^1.0.1"
|
||||
}
|
||||
},
|
||||
"node-gyp": {
|
||||
"version": "3.8.0",
|
||||
"resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-3.8.0.tgz",
|
||||
"integrity": "sha512-3g8lYefrRRzvGeSowdJKAKyks8oUpLEd/DyPV4eMhVlhJ0aNaZqIrNUIPuEWWTAoPqyFkfGrM67MC69baqn6vA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"fstream": "^1.0.0",
|
||||
"glob": "^7.0.3",
|
||||
"graceful-fs": "^4.1.2",
|
||||
"mkdirp": "^0.5.0",
|
||||
"nopt": "2 || 3",
|
||||
"npmlog": "0 || 1 || 2 || 3 || 4",
|
||||
"osenv": "0",
|
||||
"request": "^2.87.0",
|
||||
"rimraf": "2",
|
||||
"semver": "~5.3.0",
|
||||
"tar": "^2.0.0",
|
||||
"which": "1"
|
||||
},
|
||||
"dependencies": {
|
||||
"tar": {
|
||||
"version": "2.2.2",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-2.2.2.tgz",
|
||||
"integrity": "sha512-FCEhQ/4rE1zYv9rYXJw/msRqsnmlje5jHP6huWeBZ704jUTy02c5AZyWujpMR1ax6mVw9NyJMfuK2CMDWVIfgA==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"block-stream": "*",
|
||||
"fstream": "^1.0.12",
|
||||
"inherits": "2"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"node-notifier": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-8.0.0.tgz",
|
||||
@@ -1645,15 +1668,26 @@
|
||||
"rimraf": "^2.6.1",
|
||||
"semver": "^5.3.0",
|
||||
"tar": "^4"
|
||||
},
|
||||
"dependencies": {
|
||||
"nopt": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz",
|
||||
"integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==",
|
||||
"requires": {
|
||||
"abbrev": "1",
|
||||
"osenv": "^0.1.4"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"nopt": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.3.tgz",
|
||||
"integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==",
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
|
||||
"integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"abbrev": "1",
|
||||
"osenv": "^0.1.4"
|
||||
"abbrev": "1"
|
||||
}
|
||||
},
|
||||
"normalize-path": {
|
||||
@@ -1947,6 +1981,27 @@
|
||||
"safe-buffer": "^5.1.1"
|
||||
}
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "2.3.7",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
|
||||
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
|
||||
"requires": {
|
||||
"core-util-is": "~1.0.0",
|
||||
"inherits": "~2.0.3",
|
||||
"isarray": "~1.0.0",
|
||||
"process-nextick-args": "~2.0.0",
|
||||
"safe-buffer": "~5.1.1",
|
||||
"string_decoder": "~1.1.1",
|
||||
"util-deprecate": "~1.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"readdirp": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz",
|
||||
@@ -2098,9 +2153,9 @@
|
||||
}
|
||||
},
|
||||
"semver": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
|
||||
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ=="
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
|
||||
"integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8="
|
||||
},
|
||||
"server-destroy": {
|
||||
"version": "1.0.1",
|
||||
@@ -2168,11 +2223,12 @@
|
||||
"integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug=="
|
||||
},
|
||||
"sqlite3": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-4.2.0.tgz",
|
||||
"integrity": "sha512-roEOz41hxui2Q7uYnWsjMOTry6TcNUNmp8audCx18gF10P2NknwdpF+E+HKvz/F2NvPKGGBF4NGc+ZPQ+AABwg==",
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/sqlite3/-/sqlite3-5.0.0.tgz",
|
||||
"integrity": "sha512-rjvqHFUaSGnzxDy2AHCwhHy6Zp6MNJzCPGYju4kD8yi6bze4d1/zMTg6C7JI49b7/EM7jKMTvyfN/4ylBKdwfw==",
|
||||
"requires": {
|
||||
"nan": "^2.12.1",
|
||||
"node-addon-api": "2.0.0",
|
||||
"node-gyp": "3.x",
|
||||
"node-pre-gyp": "^0.11.0"
|
||||
}
|
||||
},
|
||||
@@ -2275,6 +2331,21 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
|
||||
"requires": {
|
||||
"safe-buffer": "~5.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"safe-buffer": {
|
||||
"version": "5.1.2",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
|
||||
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"stringify-parameters": {
|
||||
"version": "0.0.4",
|
||||
"resolved": "https://registry.npmjs.org/stringify-parameters/-/stringify-parameters-0.0.4.tgz",
|
||||
@@ -2644,6 +2715,15 @@
|
||||
"webidl-conversions": "^4.0.2"
|
||||
}
|
||||
},
|
||||
"which": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
|
||||
"integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"isexe": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"wide-align": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
"reselect": "^4.0.0",
|
||||
"server-destroy": "^1.0.1",
|
||||
"sprintf-js": "^1.1.2",
|
||||
"sqlite3": "^4.1.1",
|
||||
"sqlite3": "^5.0.0",
|
||||
"string-padding": "^1.0.2",
|
||||
"string-to-stream": "^1.1.0",
|
||||
"tar": "^4.4.10",
|
||||
|
||||
@@ -787,8 +787,14 @@ const reducer = produce((draft: Draft<State> = defaultState, action: any) => {
|
||||
for (let i = 0; i < newNotes.length; i++) {
|
||||
const n = newNotes[i];
|
||||
if (n.id == modNote.id) {
|
||||
// Note is still in the same folder
|
||||
if (isViewingAllNotes || noteIsInFolder(modNote, n.parent_id)) {
|
||||
if (n.is_conflict && !modNote.is_conflict) {
|
||||
// Note was a conflict but was moved outside of
|
||||
// the conflict folder
|
||||
newNotes.splice(i, 1);
|
||||
noteFolderHasChanged = true;
|
||||
movedNotePreviousIndex = i;
|
||||
} else if (isViewingAllNotes || noteIsInFolder(modNote, n.parent_id)) {
|
||||
// Note is still in the same folder
|
||||
// Merge the properties that have changed (in modNote) into
|
||||
// the object we already have.
|
||||
newNotes[i] = Object.assign({}, newNotes[i]);
|
||||
|
||||
@@ -6,6 +6,8 @@ import { ContentScriptType } from './api/types';
|
||||
import Logger from '../../Logger';
|
||||
const EventEmitter = require('events');
|
||||
|
||||
const logger = Logger.create('Plugin');
|
||||
|
||||
interface ViewControllers {
|
||||
[key: string]: ViewController;
|
||||
}
|
||||
@@ -24,18 +26,16 @@ export default class Plugin {
|
||||
private baseDir_: string;
|
||||
private manifest_: PluginManifest;
|
||||
private scriptText_: string;
|
||||
private logger_: Logger = null;
|
||||
private viewControllers_: ViewControllers = {};
|
||||
private contentScripts_: ContentScripts = {};
|
||||
private dispatch_: Function;
|
||||
private eventEmitter_: any;
|
||||
private devMode_: boolean = false;
|
||||
|
||||
constructor(baseDir: string, manifest: PluginManifest, scriptText: string, logger: Logger, dispatch: Function) {
|
||||
constructor(baseDir: string, manifest: PluginManifest, scriptText: string, dispatch: Function) {
|
||||
this.baseDir_ = shim.fsDriver().resolve(baseDir);
|
||||
this.manifest_ = manifest;
|
||||
this.scriptText_ = scriptText;
|
||||
this.logger_ = logger;
|
||||
this.dispatch_ = dispatch;
|
||||
this.eventEmitter_ = new EventEmitter();
|
||||
}
|
||||
@@ -89,7 +89,7 @@ export default class Plugin {
|
||||
|
||||
this.contentScripts_[type].push({ id, path: absolutePath });
|
||||
|
||||
this.logger_.debug(`Plugin: ${this.id}: Registered content script: ${type}: ${id}: ${absolutePath}`);
|
||||
logger.debug(`"${this.id}": Registered content script: ${type}: ${id}: ${absolutePath}`);
|
||||
|
||||
this.dispatch_({
|
||||
type: 'PLUGIN_CONTENT_SCRIPTS_ADD',
|
||||
@@ -117,7 +117,7 @@ export default class Plugin {
|
||||
}
|
||||
|
||||
public deprecationNotice(goneInVersion: string, message: string) {
|
||||
this.logger_.warn(`Plugin: ${this.id}: DEPRECATION NOTICE: ${message} This will stop working in version ${goneInVersion}.`);
|
||||
logger.warn(`"${this.id}": DEPRECATION NOTICE: ${message} This will stop working in version ${goneInVersion}.`);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,10 +6,13 @@ import BaseService from '../BaseService';
|
||||
import shim from '../../shim';
|
||||
import { filename, dirname, rtrimSlashes, basename } from '../../path-utils';
|
||||
import Setting from '../../models/Setting';
|
||||
import Logger from '../../Logger';
|
||||
const compareVersions = require('compare-versions');
|
||||
const uslug = require('uslug');
|
||||
const md5File = require('md5-file/promise');
|
||||
|
||||
const logger = Logger.create('PluginService');
|
||||
|
||||
// Plugin data is split into two:
|
||||
//
|
||||
// - First there's the service `plugins` property, which contains the
|
||||
@@ -213,7 +216,7 @@ export default class PluginService extends BaseService {
|
||||
distPath = `${path}/dist`;
|
||||
}
|
||||
|
||||
this.logger().info(`PluginService: Loading plugin from ${path}`);
|
||||
logger.info(`Loading plugin from ${path}`);
|
||||
|
||||
const scriptText = await fsDriver.readFile(`${distPath}/index.js`);
|
||||
const manifestText = await fsDriver.readFile(`${distPath}/manifest.json`);
|
||||
@@ -242,7 +245,7 @@ export default class PluginService extends BaseService {
|
||||
|
||||
const manifest = manifestFromObject(manifestObj);
|
||||
|
||||
const plugin = new Plugin(baseDir, manifest, scriptText, this.logger(), (action: any) => this.store_.dispatch(action));
|
||||
const plugin = new Plugin(baseDir, manifest, scriptText, (action: any) => this.store_.dispatch(action));
|
||||
|
||||
for (const msg of deprecationNotices) {
|
||||
plugin.deprecationNotice('1.5', msg);
|
||||
@@ -274,7 +277,7 @@ export default class PluginService extends BaseService {
|
||||
|
||||
for (const pluginPath of pluginPaths) {
|
||||
if (pluginPath.indexOf('_') === 0) {
|
||||
this.logger().info(`PluginService: Plugin name starts with "_" and has not been loaded: ${pluginPath}`);
|
||||
logger.info(`Plugin name starts with "_" and has not been loaded: ${pluginPath}`);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -289,7 +292,7 @@ export default class PluginService extends BaseService {
|
||||
this.setPluginAt(plugin.id, plugin);
|
||||
|
||||
if (!this.pluginEnabled(settings, plugin.id)) {
|
||||
this.logger().info(`PluginService: Not running disabled plugin: "${plugin.id}"`);
|
||||
logger.info(`Not running disabled plugin: "${plugin.id}"`);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -297,14 +300,14 @@ export default class PluginService extends BaseService {
|
||||
|
||||
await this.runPlugin(plugin);
|
||||
} catch (error) {
|
||||
this.logger().error(`PluginService: Could not load plugin: ${pluginPath}`, error);
|
||||
logger.error(`Could not load plugin: ${pluginPath}`, error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async runPlugin(plugin: Plugin) {
|
||||
if (compareVersions(this.appVersion_, plugin.manifest.app_min_version) < 0) {
|
||||
throw new Error(`PluginService: Plugin "${plugin.id}" was disabled because it requires Joplin version ${plugin.manifest.app_min_version} and current version is ${this.appVersion_}.`);
|
||||
throw new Error(`Plugin "${plugin.id}" was disabled because it requires Joplin version ${plugin.manifest.app_min_version} and current version is ${this.appVersion_}.`);
|
||||
} else {
|
||||
this.store_.dispatch({
|
||||
type: 'PLUGIN_ADD',
|
||||
@@ -316,12 +319,12 @@ export default class PluginService extends BaseService {
|
||||
});
|
||||
}
|
||||
|
||||
const pluginApi = new Global(this.logger(), this.platformImplementation_, plugin, this.store_);
|
||||
const pluginApi = new Global(this.platformImplementation_, plugin, this.store_);
|
||||
return this.runner_.run(plugin, pluginApi);
|
||||
}
|
||||
|
||||
public async installPlugin(jplPath: string): Promise<Plugin> {
|
||||
this.logger().info(`PluginService: Installing plugin: "${jplPath}"`);
|
||||
logger.info(`Installing plugin: "${jplPath}"`);
|
||||
|
||||
const destPath = `${Setting.value('pluginDir')}/${basename(jplPath)}`;
|
||||
await shim.fsDriver().copy(jplPath, destPath);
|
||||
@@ -343,12 +346,12 @@ export default class PluginService extends BaseService {
|
||||
}
|
||||
|
||||
public async uninstallPlugin(pluginId: string) {
|
||||
this.logger().info(`PluginService: Uninstalling plugin: "${pluginId}"`);
|
||||
logger.info(`Uninstalling plugin: "${pluginId}"`);
|
||||
|
||||
const path = await this.pluginPath(pluginId);
|
||||
if (!path) {
|
||||
// Plugin might have already been deleted
|
||||
this.logger().error(`PluginService: Could not find plugin path to uninstall - nothing will be done: ${pluginId}`);
|
||||
logger.error(`Could not find plugin path to uninstall - nothing will be done: ${pluginId}`);
|
||||
} else {
|
||||
await shim.fsDriver().remove(path);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import Plugin from '../Plugin';
|
||||
import Joplin from './Joplin';
|
||||
import Logger from '../../../Logger';
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
@@ -16,8 +15,8 @@ export default class Global {
|
||||
private requireWhiteList_: string[] = null;
|
||||
// private consoleWrapper_:any = null;
|
||||
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any) {
|
||||
this.joplin_ = new Joplin(logger, implementation.joplin, plugin, store);
|
||||
constructor(implementation: any, plugin: Plugin, store: any) {
|
||||
this.joplin_ = new Joplin(implementation.joplin, plugin, store);
|
||||
// this.consoleWrapper_ = this.createConsoleWrapper(plugin.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ 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.
|
||||
@@ -35,9 +34,9 @@ export default class Joplin {
|
||||
private interop_: JoplinInterop = null;
|
||||
private settings_: JoplinSettings = null;
|
||||
|
||||
constructor(logger: Logger, implementation: any, plugin: Plugin, store: any) {
|
||||
constructor(implementation: any, plugin: Plugin, store: any) {
|
||||
this.data_ = new JoplinData();
|
||||
this.plugins_ = new JoplinPlugins(logger, plugin);
|
||||
this.plugins_ = new JoplinPlugins(plugin);
|
||||
this.workspace_ = new JoplinWorkspace(implementation.workspace, store);
|
||||
this.filters_ = new JoplinFilters();
|
||||
this.commands_ = new JoplinCommands();
|
||||
|
||||
@@ -2,16 +2,16 @@ import Plugin from '../Plugin';
|
||||
import Logger from '../../../Logger';
|
||||
import { ContentScriptType, Script } from './types';
|
||||
|
||||
const logger = Logger.create('joplin.plugins');
|
||||
|
||||
/**
|
||||
* This class provides access to plugin-related features.
|
||||
*/
|
||||
export default class JoplinPlugins {
|
||||
|
||||
private logger: Logger;
|
||||
private plugin: Plugin;
|
||||
|
||||
public constructor(logger: Logger, plugin: Plugin) {
|
||||
this.logger = logger;
|
||||
public constructor(plugin: Plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ export default class JoplinPlugins {
|
||||
if (script.onStart) {
|
||||
const startTime = Date.now();
|
||||
|
||||
this.logger.info(`Starting plugin: ${this.plugin.id}`);
|
||||
logger.info(`Starting plugin: ${this.plugin.id}`);
|
||||
|
||||
// We don't use `await` when calling onStart because the plugin might be awaiting
|
||||
// in that call too (for example, when opening a dialog on startup) so we don't
|
||||
@@ -42,9 +42,9 @@ export default class JoplinPlugins {
|
||||
// be handled correctly by loggers, etc.
|
||||
const newError: Error = new Error(error.message);
|
||||
newError.stack = error.stack;
|
||||
this.logger.error(`Uncaught exception in plugin "${this.plugin.id}":`, newError);
|
||||
logger.error(`Uncaught exception in plugin "${this.plugin.id}":`, newError);
|
||||
}).then(() => {
|
||||
this.logger.info(`Finished running onStart handler: ${this.plugin.id} (Took ${Date.now() - startTime}ms)`);
|
||||
logger.info(`Finished running onStart handler: ${this.plugin.id} (Took ${Date.now() - startTime}ms)`);
|
||||
this.plugin.emit('started');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ const gunzipFile = function(source, destination) {
|
||||
});
|
||||
};
|
||||
|
||||
function shimInit(sharp = null, keytar = null) {
|
||||
function shimInit(sharp = null, keytar = null, React = null) {
|
||||
keytar = (shim.isWindows() || shim.isMac()) && !shim.isPortable() ? keytar : null;
|
||||
|
||||
shim.fsDriver = () => {
|
||||
@@ -67,6 +67,12 @@ function shimInit(sharp = null, keytar = null) {
|
||||
return shim.fsDriver_;
|
||||
};
|
||||
|
||||
if (React) {
|
||||
shim.react = () => {
|
||||
return React;
|
||||
};
|
||||
}
|
||||
|
||||
shim.randomBytes = async count => {
|
||||
const buffer = require('crypto').randomBytes(count);
|
||||
return Array.from(buffer);
|
||||
|
||||
@@ -1,6 +1,21 @@
|
||||
import { ResourceEntity } from './services/database/types';
|
||||
|
||||
let isTestingEnv_ = false;
|
||||
|
||||
// We need to ensure that there's only one instance of React being used by
|
||||
// all the packages. In particular, the lib might need React to define
|
||||
// generic hooks, but it shouldn't have React in its dependencies as that
|
||||
// would cause the following error:
|
||||
//
|
||||
// https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react
|
||||
//
|
||||
// So instead, the **applications** include React as a dependency, then
|
||||
// pass it to any other packages using the shim. Essentially, only one
|
||||
// package should require React, and in our case that should be one of the
|
||||
// applications (app-desktop, app-mobile, etc.) since we are sure they
|
||||
// won't be dependency to other packages (unlike the lib which can be
|
||||
// included anywhere).
|
||||
|
||||
let react_: any = null;
|
||||
|
||||
const shim = {
|
||||
|
||||
@@ -68,9 +68,9 @@ function slugify(s: string): string {
|
||||
const inMemoryCache = new InMemoryCache(20);
|
||||
|
||||
export interface ExtraRendererRule {
|
||||
id: string,
|
||||
module: any,
|
||||
assetPath: string,
|
||||
id: string;
|
||||
module: any;
|
||||
assetPath: string;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
|
||||
104
packages/renderer/package-lock.json
generated
104
packages/renderer/package-lock.json
generated
@@ -144,22 +144,6 @@
|
||||
"resolve": "^1.12.0"
|
||||
}
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
|
||||
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
|
||||
"dev": true
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
|
||||
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
}
|
||||
},
|
||||
"buffer-from": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz",
|
||||
@@ -222,12 +206,6 @@
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
|
||||
"integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ=="
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
|
||||
"dev": true
|
||||
},
|
||||
"crypt": {
|
||||
"version": "0.0.2",
|
||||
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
|
||||
@@ -568,26 +546,6 @@
|
||||
"universalify": "^0.1.0"
|
||||
}
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"dev": true
|
||||
},
|
||||
"glob": {
|
||||
"version": "7.1.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
|
||||
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"globals": {
|
||||
"version": "11.12.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
|
||||
@@ -648,43 +606,11 @@
|
||||
"safer-buffer": ">= 2.1.2 < 3"
|
||||
}
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||
"dev": true
|
||||
},
|
||||
"is-buffer": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
|
||||
"integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
|
||||
},
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"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
|
||||
},
|
||||
"js-tokens": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||
@@ -894,15 +820,6 @@
|
||||
"try-to-catch": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
"integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"moment-mini": {
|
||||
"version": "2.24.0",
|
||||
"resolved": "https://registry.npmjs.org/moment-mini/-/moment-mini-2.24.0.tgz",
|
||||
@@ -929,15 +846,6 @@
|
||||
"lodash.toarray": "^4.4.0"
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"param-case": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/param-case/-/param-case-2.1.1.tgz",
|
||||
@@ -946,12 +854,6 @@
|
||||
"no-case": "^2.2.0"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
"dev": true
|
||||
},
|
||||
"path-parse": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
|
||||
@@ -1089,12 +991,6 @@
|
||||
"node-emoji": "^1.10.0",
|
||||
"unorm": ">= 1.0.0"
|
||||
}
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.14.6",
|
||||
"jasmine": "^3.5.0",
|
||||
"typescript": "^4.0.5"
|
||||
},
|
||||
"dependencies": {
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
// Dependencies:
|
||||
//
|
||||
// sudo apt install gettext
|
||||
// sudo apt install translate-toolkit
|
||||
// sudo apt install gettext sudo apt install translate-toolkit
|
||||
//
|
||||
// gettext v21+ is required as versions before that have bugs when parsing
|
||||
// JavaScript template strings which means we would lose translations.
|
||||
|
||||
const rootDir = `${__dirname}/../..`;
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ With plugins you can directly modify Joplin by adding new features to the applic
|
||||
- Create a module to export or import data into Joplin
|
||||
- Define new settings and setting sections, and get/set them from the plugin
|
||||
- Create a new Markdown plugin to render custom markup.
|
||||
- Create an editor plugin to modify low-level the behaviour of the Markdown editor (CodeMirror)
|
||||
- Create an editor plugin to modify, at a low-level, the behaviour of the Markdown editor (CodeMirror)
|
||||
|
||||
To get started with the plugin API, check the [Get Started](https://github.com/laurent22/joplin/blob/dev/readme/api/get_started/plugins.md) page or have a look at the [TOC tutorial](https://github.com/laurent22/joplin/blob/dev/readme/api/tutorials/toc_plugin.md).
|
||||
|
||||
Once you are familiar with the API, you can have a look at the [plugin API reference](https://github.com/laurent22/joplin/blob/dev/readme/api/get_started/plugins.md) for a detailed documentation about each supported feature.
|
||||
Once you are familiar with the API, you can have a look at the [plugin API reference](https://joplinapp.org/api/references/plugin_api/classes/joplin.html) for a detailed documentation about each supported feature.
|
||||
|
||||
Reference in New Issue
Block a user