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

Compare commits

..

53 Commits

Author SHA1 Message Date
Hubert
4fc44cd952 Added a verification to avoid the error while quitting the app. 2023-08-03 15:45:07 -03:00
Milo Ivir
ea7c7f6447 Update Croatian translation file (#8608) 2023-08-03 15:51:06 +01:00
renovate[bot]
29931c05ad Update dependency sharp to v0.32.3 (#8606)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-03 13:06:41 +00:00
renovate[bot]
17c227024e Update dependency react-select to v5.7.4 (#8604)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-02 19:11:39 +00:00
renovate[bot]
406a1496db Update buildTools (major) (#8597)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
2023-08-02 11:24:54 +01:00
Laurent Cozic
c8180b91e0 fix CI 2023-08-02 11:22:23 +01:00
renovate[bot]
1978929114 Update dependency glob to v10.3.3 (#8599)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-01 22:26:37 +00:00
Joplin Bot
3e7debbcc5 Doc: Auto-update documentation
Auto-updated using release-website.sh
2023-08-01 18:15:52 +00:00
Henry Heino
a138b92b1b Desktop: Fixes #8541: Fix toggle external editing button always disabled in rich text editor (#8595) 2023-08-01 17:54:39 +01:00
renovate[bot]
28619f1786 Update dependency @react-native-community/datetimepicker to v7.2.0 (#8593)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-01 15:40:05 +01:00
renovate[bot]
e8f30b708b Update dependency glob to v10.3.0 (#8594)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-08-01 15:39:51 +01:00
renovate[bot]
39bc7ed397 Update buildTools (#8596)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Laurent Cozic <laurent22@users.noreply.github.com>
2023-08-01 15:38:59 +01:00
Joplin Bot
59852e252b Doc: Auto-update documentation
Auto-updated using release-website.sh
2023-08-01 00:46:55 +00:00
renovate[bot]
51764cc933 Update dependency sharp to v0.32.2 (#8590)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-31 18:06:24 +00:00
renovate[bot]
cb754604f1 Update dependency react-native-safe-area-context to v4.6.4 (#8589)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-31 15:44:33 +00:00
Laurent Cozic
2633bcef69 Doc: Shortened section about carbon neutrality and mentioned data being in France 2023-07-31 11:12:32 +01:00
renovate[bot]
772c8abdcf Update dependency react-native-safe-area-context to v4.6.0 (#8586)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-31 10:31:31 +01:00
Joplin Bot
ac098759ea Doc: Auto-update documentation
Auto-updated using release-website.sh
2023-07-31 00:44:28 +00:00
Naoki Kawamukai
349dda30b8 All: Translation: Update ja_JP.po (#8580) 2023-07-30 18:35:37 -04:00
renovate[bot]
cbbd9b9a61 Update dependency react-native-image-picker to v5.6.0 (#8582)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-07-30 15:22:23 +01:00
github-actions[bot]
14ef0d725b @kna has signed the CLA in laurent22/joplin#8580 2023-07-30 02:10:58 +00:00
Laurent Cozic
40b89f61bd Desktop release v2.12.10 2023-07-29 16:53:15 +01:00
Laurent Cozic
23c4020eea udpate 2023-07-29 16:52:24 +01:00
Laurent Cozic
5ba374c03b Doc: Change Reddit links to Lemmy 2023-07-29 16:47:46 +01:00
Henry Heino
f76ae86204 Chore: Mobile: Tests: Fix CodeMirror-related error messages (#8569) 2023-07-29 16:33:39 +01:00
Henry Heino
46ccd94514 Desktop: Fixes: #8370: Fix note drag-drop into markdown editor (#8571) 2023-07-29 16:32:52 +01:00
Henry Heino
7140675181 Chore: Desktop: Fixes #8572: Fix warning when pasting images with data URI srcs (#8574) 2023-07-29 16:31:36 +01:00
Laurent Cozic
31f8e725dd Fixed mobile build 2023-07-28 11:31:59 +01:00
Laurent Cozic
5edbdb2466 Fix tests 2023-07-28 10:46:40 +01:00
Joplin Bot
83cf5eb617 Doc: Auto-update documentation
Auto-updated using release-website.sh
2023-07-27 18:18:52 +00:00
Oleksandr Popov
5b0c332477 Translation: Updating Ukrainian translation file (#8565) 2023-07-27 16:35:42 +01:00
Oleksandr Popov
21a5feb322 Translation: Updating Russian translation file (#8560) 2023-07-27 16:35:30 +01:00
Laurent Cozic
16c87c36da Chore: Move Logger from lib to utils package 2023-07-27 16:08:11 +01:00
Henry Heino
a0ec928fca Merge pull request from GHSA-m59c-9rrj-c399
* Sanitize HTML in processPastedHtml

* Add test
2023-07-27 15:41:57 +01:00
Laurent Cozic
b9659bb9c1 Desktop: Fixes #8476: Text that is pasted in Rich Text editor had extra new lines 2023-07-27 14:48:41 +01:00
Henry Heino
35f375d756 Desktop: Fixes #6055: Preserve empty newlines created by pressing Enter repeatedly in the rich text editor (#8549) 2023-07-27 11:52:41 +01:00
Mr-Kanister
04c80fe00e Update de_DE.po (#8551) 2023-07-27 11:39:38 +01:00
Joplin Bot
06732d8b8a Doc: Auto-update documentation
Auto-updated using release-website.sh
2023-07-26 18:16:56 +00:00
pedr
8fc1e71fb3 Doc: Email to Note (#8527) 2023-07-26 18:07:29 +01:00
Henry Heino
aebfa6e96d Desktop: Fixes #8535: Fix CodeMirror context menu not containing correct items (#8543) 2023-07-26 18:07:00 +01:00
Henry Heino
3453abb670 Desktop: Fixes #8535: Upgrade to electron 25.3.1 (#8550) 2023-07-26 18:00:46 +01:00
Laurent Cozic
637a0eac7f Desktop: Fixes #8485: Note imported from Web Clipper is broken after being saved from the Rich Text editor 2023-07-26 17:37:24 +01:00
github-actions[bot]
abe479d03f @popovoleksandr has signed the CLA in laurent22/joplin#8560 2023-07-26 16:17:15 +00:00
Myst
d1558d84b1 Fix typo french translation (#8554) 2023-07-26 16:25:16 +01:00
Laurent Cozic
36e9e0a33c Server: Support setting an instance name 2023-07-26 14:42:35 +01:00
Laurent Cozic
d78ab16021 Server: Add support for separate admin instance 2023-07-26 14:36:50 +01:00
Laurent Cozic
c718706f9c Server: Remove event-based services 2023-07-26 10:40:56 +01:00
github-actions[bot]
f6586239c4 @LeMyst has signed the CLA in laurent22/joplin#8554 2023-07-25 20:11:08 +00:00
Joplin Bot
287d8fee73 Doc: Auto-update documentation
Auto-updated using release-website.sh
2023-07-25 18:16:50 +00:00
Laurent Cozic
5357b2b0dc Android: Fixes #8533: Trying to fix sharing issues 2023-07-25 16:45:57 +01:00
Laurent Cozic
0c4513838a Update manifestFromObject.ts 2023-07-25 16:26:00 +01:00
Laurent Cozic
d8a54da496 Chore: fix build 2023-07-25 15:48:07 +01:00
Hubert
672ef1fd7c Desktop: Resolves #8408: Adding support for plugin icons (#8499) 2023-07-25 15:47:43 +01:00
210 changed files with 1800 additions and 1565 deletions

View File

@@ -253,6 +253,7 @@ packages/app-desktop/gui/NoteEditor/utils/clipboardUtils.js
packages/app-desktop/gui/NoteEditor/utils/contextMenu.js
packages/app-desktop/gui/NoteEditor/utils/contextMenuUtils.js
packages/app-desktop/gui/NoteEditor/utils/index.js
packages/app-desktop/gui/NoteEditor/utils/resourceHandling.test.js
packages/app-desktop/gui/NoteEditor/utils/resourceHandling.js
packages/app-desktop/gui/NoteEditor/utils/types.js
packages/app-desktop/gui/NoteEditor/utils/useDropHandler.js
@@ -492,7 +493,6 @@ packages/lib/InMemoryCache.js
packages/lib/JoplinDatabase.js
packages/lib/JoplinError.js
packages/lib/JoplinServerApi.js
packages/lib/Logger.js
packages/lib/ObjectUtils.js
packages/lib/PoorManIntervals.js
packages/lib/RotatingLogs.test.js
@@ -845,6 +845,7 @@ packages/plugins/ToggleSidebars/api/index.js
packages/plugins/ToggleSidebars/api/types.js
packages/plugins/ToggleSidebars/src/index.js
packages/react-native-saf-x/src/index.js
packages/renderer/HtmlToHtml.test.js
packages/renderer/HtmlToHtml.js
packages/renderer/InMemoryCache.js
packages/renderer/MarkupToHtml.js

3
.gitignore vendored
View File

@@ -238,6 +238,7 @@ packages/app-desktop/gui/NoteEditor/utils/clipboardUtils.js
packages/app-desktop/gui/NoteEditor/utils/contextMenu.js
packages/app-desktop/gui/NoteEditor/utils/contextMenuUtils.js
packages/app-desktop/gui/NoteEditor/utils/index.js
packages/app-desktop/gui/NoteEditor/utils/resourceHandling.test.js
packages/app-desktop/gui/NoteEditor/utils/resourceHandling.js
packages/app-desktop/gui/NoteEditor/utils/types.js
packages/app-desktop/gui/NoteEditor/utils/useDropHandler.js
@@ -477,7 +478,6 @@ packages/lib/InMemoryCache.js
packages/lib/JoplinDatabase.js
packages/lib/JoplinError.js
packages/lib/JoplinServerApi.js
packages/lib/Logger.js
packages/lib/ObjectUtils.js
packages/lib/PoorManIntervals.js
packages/lib/RotatingLogs.test.js
@@ -830,6 +830,7 @@ packages/plugins/ToggleSidebars/api/index.js
packages/plugins/ToggleSidebars/api/types.js
packages/plugins/ToggleSidebars/src/index.js
packages/react-native-saf-x/src/index.js
packages/renderer/HtmlToHtml.test.js
packages/renderer/HtmlToHtml.js
packages/renderer/InMemoryCache.js
packages/renderer/MarkupToHtml.js

View File

@@ -789,7 +789,7 @@ footer .bottom-links-row p {
}
#menu-mobile .social-links .social-link-mastodon,
#menu-mobile .social-links .social-link-reddit,
#menu-mobile .social-links .social-link-lemmy,
#menu-mobile .social-links .social-link-linkedin,
#menu-mobile .social-links .social-link-patreon {
display: none;

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

View File

@@ -5,7 +5,7 @@
<a class="social-link-patreon" href="https://www.patreon.com/joplin" title="Joplin Patreon"><i class="fab fa-patreon"></i></a>
<a class="social-link-discord" href="https://discord.gg/VSj7AFHvpq" title="Joplin Discord chat"><i class="fab fa-discord"></i></a>
<a class="social-link-linkedin" href="https://www.linkedin.com/company/joplin" title="Joplin LinkedIn Feed"><i class="fab fa-linkedin"></i></a>
<a class="social-link-reddit" href="https://www.reddit.com/r/joplinapp/" title="Joplin Subreddit"><i class="fab fa-reddit"></i></a>
<a class="social-link-lemmy" href="https://sopuli.xyz/c/joplinapp" title="Joplin Lemmy Community"><i class="fas fa-otter"></i></a>
<a class="social-link-github" href="https://github.com/laurent22/joplin/" title="Joplin GitHub repository"><i class="fab fa-github"></i></a>
</div>
</div>

View File

@@ -107,6 +107,7 @@ A community maintained list of these distributions can be found here: [Unofficia
- [Sharing a notebook](https://github.com/laurent22/joplin/blob/dev/readme/share_notebook.md)
- [Publishing a note](https://github.com/laurent22/joplin/blob/dev/readme/publish_note.md)
- [Email to Note](https://github.com/laurent22/joplin/blob/dev/readme/email_to_note.md)
- Joplin API - Get Started
@@ -511,7 +512,7 @@ Name | Description
[Patreon page](https://www.patreon.com/joplin) |The latest news are often posted there
[Discord server](https://discord.gg/VSj7AFHvpq) | Our chat server
[LinkedIn](https://www.linkedin.com/company/joplin) | Our LinkedIn page
[Sub-reddit](https://www.reddit.com/r/joplinapp/) | Also a good place to get help
[Lemmy Community](https://sopuli.xyz/c/joplinapp) | Also a good place to get help
# Contributing

View File

@@ -66,25 +66,25 @@
"devDependencies": {
"@joplin/utils": "~2.11",
"@seiyab/eslint-plugin-react-hooks": "4.5.1-beta.0",
"@typescript-eslint/eslint-plugin": "5.59.0",
"@typescript-eslint/parser": "5.59.0",
"@typescript-eslint/eslint-plugin": "5.60.0",
"@typescript-eslint/parser": "5.60.0",
"cspell": "5.21.2",
"eslint": "8.39.0",
"eslint-interactive": "10.7.0",
"eslint": "8.43.0",
"eslint-interactive": "10.8.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jest": "27.2.1",
"eslint-plugin-jest": "27.2.2",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-react": "7.32.2",
"execa": "5.1.1",
"fs-extra": "11.1.1",
"glob": "10.2.7",
"glob": "10.3.3",
"gulp": "4.0.2",
"husky": "3.1.0",
"lerna": "3.22.1",
"lint-staged": "13.2.3",
"madge": "6.1.0",
"npm-package-json-lint": "6.4.0",
"typescript": "5.0.2"
"typescript": "5.1.3"
},
"dependencies": {
"@types/fs-extra": "11.0.1",
@@ -93,11 +93,12 @@
"node-gyp": "9.4.0",
"nodemon": "2.0.22"
},
"packageManager": "yarn@3.5.0",
"packageManager": "yarn@3.6.0",
"resolutions": {
"react-native-camera@4.2.1": "patch:react-native-camera@npm%3A4.2.1#./.yarn/patches/react-native-camera-npm-4.2.1-24b2600a7e.patch",
"react-native-vosk@0.1.12": "patch:react-native-vosk@npm%3A0.1.12#./.yarn/patches/react-native-vosk-npm-0.1.12-76b1caaae8.patch",
"eslint@8.39.0": "patch:eslint@npm%3A8.39.0#./.yarn/patches/eslint-npm-8.39.0-d92bace04d.patch",
"eslint@8.43.0": "patch:eslint@npm%3A8.39.0#./.yarn/patches/eslint-npm-8.39.0-d92bace04d.patch",
"eslint@^8.13.0": "patch:eslint@npm%3A8.39.0#./.yarn/patches/eslint-npm-8.39.0-d92bace04d.patch",
"app-builder-lib@24.4.0": "patch:app-builder-lib@npm%3A24.4.0#./.yarn/patches/app-builder-lib-npm-24.4.0-05322ff057.patch",
"react-native@0.71.10": "patch:react-native@npm%3A0.71.10#./.yarn/patches/react-native-animation-fix/react-native-npm-0.71.10-f9c32562d8.patch",

View File

@@ -1,4 +1,4 @@
const Logger = require('@joplin/lib/Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const { findAvailablePort } = require('@joplin/lib/net-utils');
const http = require('http');

View File

@@ -1,4 +1,4 @@
const Logger = require('@joplin/lib/Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const Folder = require('@joplin/lib/models/Folder').default;
const BaseItem = require('@joplin/lib/models/BaseItem').default;
const Tag = require('@joplin/lib/models/Tag').default;

View File

@@ -3,7 +3,7 @@
/* eslint-disable no-console */
const fs = require('fs-extra');
const Logger = require('@joplin/lib/Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const { dirname } = require('@joplin/lib/path-utils');
const { DatabaseDriverNode } = require('@joplin/lib/database-driver-node.js');
const JoplinDatabase = require('@joplin/lib/JoplinDatabase').default;

View File

@@ -2,7 +2,7 @@ const yargParser = require('yargs-parser');
const { _ } = require('@joplin/lib/locale');
const time = require('@joplin/lib/time').default;
const stringPadding = require('string-padding');
const Logger = require('@joplin/lib/Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const cliUtils = {};

View File

@@ -1,7 +1,7 @@
const BaseCommand = require('./base-command').default;
const { _ } = require('@joplin/lib/locale');
const Setting = require('@joplin/lib/models/Setting').default;
const Logger = require('@joplin/lib/Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const shim = require('@joplin/lib/shim').default;
class Command extends BaseCommand {

View File

@@ -1,7 +1,7 @@
'use strict';
const time = require('@joplin/lib/time').default;
const Logger = require('@joplin/lib/Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const Resource = require('@joplin/lib/models/Resource').default;
const { dirname } = require('@joplin/lib/path-utils');
const FsDriverNode = require('@joplin/lib/fs-driver-node').default;

View File

@@ -20,7 +20,7 @@ const NoteTag = require('@joplin/lib/models/NoteTag').default;
const MasterKey = require('@joplin/lib/models/MasterKey').default;
const Setting = require('@joplin/lib/models/Setting').default;
const Revision = require('@joplin/lib/models/Revision').default;
const Logger = require('@joplin/lib/Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const FsDriverNode = require('@joplin/lib/fs-driver-node').default;
const sharp = require('sharp');
const { shimInit } = require('@joplin/lib/shim-init-node.js');

View File

@@ -57,7 +57,7 @@
"proper-lockfile": "4.1.2",
"read-chunk": "2.1.0",
"server-destroy": "1.0.1",
"sharp": "0.32.1",
"sharp": "0.32.3",
"sprintf-js": "1.1.2",
"sqlite3": "5.1.6",
"string-padding": "1.0.2",
@@ -72,12 +72,12 @@
"devDependencies": {
"@joplin/tools": "~2.12",
"@types/fs-extra": "11.0.1",
"@types/jest": "29.5.1",
"@types/node": "18.15.13",
"@types/jest": "29.5.3",
"@types/node": "18.16.18",
"@types/proper-lockfile": "^4.1.2",
"gulp": "4.0.2",
"jest": "29.5.0",
"temp": "0.9.4",
"typescript": "5.0.2"
"typescript": "5.1.3"
}
}

View File

@@ -0,0 +1,3 @@
<p>Paragraphs with a single nonbreaking space should be preserved:</p>
<p>&nbsp;</p>
<p>&nbsp;</p>

View File

@@ -0,0 +1,5 @@
Paragraphs with a single nonbreaking space should be preserved:
&nbsp;
&nbsp;

View File

@@ -1,4 +1,4 @@
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import { PluginMessage } from './services/plugins/PluginRunner';
import shim from '@joplin/lib/shim';
import { isCallbackUrl } from '@joplin/lib/callbackUrlUtils';
@@ -174,7 +174,7 @@ export default class ElectronAppWrapper {
// so that it can tell us if we can really close the app or not.
// Search for "appClose" event for closing logic on renderer side.
event.preventDefault();
this.win_.webContents.send('appClose');
if (this.win_) this.win_.webContents.send('appClose');
} else {
// If the renderer process has responded, check if we can close or not
if (this.rendererProcessQuitReply_.canClose) {

View File

@@ -4,7 +4,7 @@ import { defaultState, State } from '@joplin/lib/reducer';
import iterateItems from './gui/ResizableLayout/utils/iterateItems';
import { LayoutItem } from './gui/ResizableLayout/utils/types';
import validateLayout from './gui/ResizableLayout/utils/validateLayout';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
const logger = Logger.create('app.reducer');

View File

@@ -8,7 +8,7 @@ import PlatformImplementation from './services/plugins/PlatformImplementation';
import shim from '@joplin/lib/shim';
import AlarmService from '@joplin/lib/services/AlarmService';
import AlarmServiceDriverNode from '@joplin/lib/services/AlarmServiceDriverNode';
import Logger, { TargetType } from '@joplin/lib/Logger';
import Logger, { TargetType } from '@joplin/utils/Logger';
import Setting from '@joplin/lib/models/Setting';
import actionApi from '@joplin/lib/services/rest/actionApi.desktop';
import BaseApplication from '@joplin/lib/BaseApplication';

View File

@@ -96,11 +96,7 @@ export class Bridge {
electronApp: this.electronApp(),
shouldShowMenu: (_event: any, params: any) => {
// params.inputFieldType === 'none' when right-clicking the text
// editor. This is a bit of a hack to detect it because in this
// case we don't want to use the built-in context menu but a
// custom one.
return params.isEditable && params.inputFieldType !== 'none';
return params.isEditable;
},
// menu: (actions: any, props: any) => {

View File

@@ -1,5 +1,5 @@
import shim from '@joplin/lib/shim';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import { _ } from '@joplin/lib/locale';
import bridge from './services/bridge';
import KvStore from '@joplin/lib/services/KvStore';

View File

@@ -2,7 +2,6 @@ import CommandService, { CommandRuntime, CommandDeclaration } from '@joplin/lib/
import { _ } from '@joplin/lib/locale';
import { stateUtils } from '@joplin/lib/reducer';
import { DesktopCommandContext } from '../services/commands/types';
import { enabledCondition } from '../gui/NoteEditor/editorCommandDeclarations';
export const declaration: CommandDeclaration = {
name: 'toggleExternalEditing',
@@ -23,7 +22,7 @@ export const runtime = (): CommandRuntime => {
void CommandService.instance().execute('startExternalEditing', noteId);
}
},
enabledCondition: enabledCondition(declaration.name),
enabledCondition: 'oneNoteSelected && !noteIsReadOnly && (!modalDialogVisible || gotoAnythingVisible)',
mapStateToTitle: (state: any) => {
const noteId = stateUtils.selectedNoteId(state);
return state.watchedNoteFiles.includes(noteId) ? _('Stop') : '';

View File

@@ -13,7 +13,7 @@ import { PluginItem } from './PluginBox';
import RepositoryApi from '@joplin/lib/services/plugins/RepositoryApi';
import Setting from '@joplin/lib/models/Setting';
import useOnInstallHandler, { OnPluginSettingChangeEvent } from './useOnInstallHandler';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import StyledMessage from '../../../style/StyledMessage';
import StyledLink from '../../../style/StyledLink';
const { space } = require('styled-system');

View File

@@ -2,7 +2,7 @@ import { useCallback } from 'react';
import PluginService, { defaultPluginSetting, PluginSettings } from '@joplin/lib/services/plugins/PluginService';
import produce from 'immer';
import { _ } from '@joplin/lib/locale';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import { ItemEvent } from './PluginBox';
const logger = Logger.create('useOnInstallHandler');

View File

@@ -26,6 +26,7 @@ interface State {
interface Props {
message?: string;
children: any;
}
export default class ErrorBoundary extends React.Component<Props, State> {

View File

@@ -38,6 +38,7 @@ export const runtime = (): CommandRuntime => {
menuItem.click();
});
}
return null;
},
};
};

View File

@@ -1,7 +1,7 @@
import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/services/CommandService';
import { _ } from '@joplin/lib/locale';
import ShareService from '@joplin/lib/services/share/ShareService';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
const logger = Logger.create('leaveSharedFolder');

View File

@@ -40,6 +40,7 @@ import ErrorBoundary from '../../../ErrorBoundary';
import { MarkupToHtmlOptions } from '../../utils/useMarkupToHtml';
import eventManager from '@joplin/lib/eventManager';
import { EditContextMenuFilterObject } from '@joplin/lib/services/plugins/api/JoplinWorkspace';
import type { ContextMenuEvent, ContextMenuParams } from 'electron';
const menuUtils = new MenuUtils(CommandService.instance());
@@ -98,7 +99,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
}
}, []);
const addListItem = useCallback((string1, defaultText = '') => {
const addListItem = useCallback((string1: string, defaultText = '') => {
if (editorRef.current) {
if (editorRef.current.somethingSelected()) {
editorRef.current.wrapSelectionsByLine(string1);
@@ -782,20 +783,50 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
// It might be buggy, refer to the below issue
// https://github.com/laurent22/joplin/pull/3974#issuecomment-718936703
useEffect(() => {
function pointerInsideEditor(params: any) {
const x = params.x, y = params.y, isEditable = params.isEditable, inputFieldType = params.inputFieldType;
const isAncestorOfCodeMirrorEditor = (elem: HTMLElement) => {
for (; elem.parentElement; elem = elem.parentElement) {
if (elem.classList.contains('codeMirrorEditor')) {
return true;
}
}
return false;
};
let lastInCodeMirrorContextMenuTimestamp = 0;
// The browser's contextmenu event provides additional information about the
// target of the event, not provided by the Electron context-menu event.
const onBrowserContextMenu = (event: Event) => {
if (isAncestorOfCodeMirrorEditor(event.target as HTMLElement)) {
lastInCodeMirrorContextMenuTimestamp = Date.now();
}
};
function pointerInsideEditor(params: ContextMenuParams) {
const x = params.x, y = params.y, isEditable = params.isEditable;
const elements = document.getElementsByClassName('codeMirrorEditor');
// inputFieldType: The input field type of CodeMirror is "textarea" so the inputFieldType = "none",
// and any single-line input above codeMirror has inputFieldType value according to the type of input e.g.(text = plainText, password = password, ...).
if (!elements.length || !isEditable || inputFieldType !== 'none') return null;
// Note: We can't check inputFieldType here. When spellcheck is enabled,
// params.inputFieldType is "none". When spellcheck is disabled,
// params.inputFieldType is "plainText". Thus, such a check would be inconsistent.
if (!elements.length || !isEditable) return false;
const maximumMsSinceBrowserEvent = 100;
if (Date.now() - lastInCodeMirrorContextMenuTimestamp > maximumMsSinceBrowserEvent) {
return false;
}
const rect = convertToScreenCoordinates(Setting.value('windowContentZoomFactor'), elements[0].getBoundingClientRect());
return rect.x < x && rect.y < y && rect.right > x && rect.bottom > y;
}
async function onContextMenu(_event: any, params: any) {
async function onContextMenu(event: ContextMenuEvent, params: ContextMenuParams) {
if (!pointerInsideEditor(params)) return;
// Don't show the default menu.
event.preventDefault();
const menu = new Menu();
const hasSelectedText = editorRef.current && !!editorRef.current.getSelection() ;
@@ -872,10 +903,15 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
menu.popup();
}
bridge().window().webContents.on('context-menu', onContextMenu);
// Prepend the event listener so that it gets called before
// the listener that shows the default menu.
bridge().window().webContents.prependListener('context-menu', onContextMenu);
window.addEventListener('contextmenu', onBrowserContextMenu);
return () => {
bridge().window().webContents.off('context-menu', onContextMenu);
window.removeEventListener('contextmenu', onBrowserContextMenu);
};
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
}, [props.plugins]);

View File

@@ -1,6 +1,6 @@
import { useEffect, useRef, useState } from 'react';
import shim from '@joplin/lib/shim';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
const logger = Logger.create('useEditorSearch');

View File

@@ -141,7 +141,7 @@ export default function useScrollHandler(editorRef: any, webviewRef: any, onScro
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
}, []);
const editor_resize = useCallback((cm) => {
const editor_resize = useCallback((cm: any) => {
if (isCodeMirrorReady(cm)) {
// This handler is called when resized and refreshed.
// Only when resized, the scroll position is restored.

View File

@@ -91,7 +91,7 @@ let dispatchDidUpdateIID_: any = null;
let changeId_ = 1;
const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
const [editor, setEditor] = useState(null);
const [editor, setEditor] = useState<Editor|null>(null);
const [scriptLoaded, setScriptLoaded] = useState(false);
const [editorReady, setEditorReady] = useState(false);
const [draggingStarted, setDraggingStarted] = useState(false);
@@ -578,7 +578,12 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
icons_url: 'gui/NoteEditor/NoteBody/TinyMCE/icons.js',
plugins: 'noneditable link joplinLists hr searchreplace codesample table',
noneditable_noneditable_class: 'joplin-editable', // Can be a regex too
valid_elements: '*[*]', // We already filter in sanitize_html
// #p: Pad empty paragraphs with &nbsp; to prevent them from being removed.
// *[*]: Allow all elements and attributes -- we already filter in sanitize_html
// See https://www.tiny.cloud/docs/configure/content-filtering/#controlcharacters
valid_elements: '#p,*[*]',
menubar: false,
relative_urls: false,
branding: false,

View File

@@ -324,7 +324,7 @@ function NoteEditor(props: NoteEditorProps) {
const onMessage = useMessageHandler(scrollWhenReady, setScrollWhenReady, editorRef, setLocalSearchResultCount, props.dispatch, formNote);
const externalEditWatcher_noteChange = useCallback((event) => {
const externalEditWatcher_noteChange = useCallback((event: any) => {
if (event.id === formNote.id) {
const newFormNote = {
...formNote,
@@ -337,7 +337,7 @@ function NoteEditor(props: NoteEditorProps) {
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
}, [formNote]);
const onNotePropertyChange = useCallback((event) => {
const onNotePropertyChange = useCallback((event: any) => {
setFormNote(formNote => {
if (formNote.id !== event.note.id) return formNote;

View File

@@ -1,5 +1,5 @@
import Resource from '@joplin/lib/models/Resource';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
const logger = Logger.create('contextMenuUtils');
export enum ContextMenuItemType {
None = '',

View File

@@ -0,0 +1,20 @@
import { processPastedHtml } from './resourceHandling';
describe('resourceHandling', () => {
it('should sanitize pasted HTML', async () => {
const testCases = [
['Test: <style onload="evil()"></style>', 'Test: <style></style>'],
['<a href="javascript: alert()">test</a>', '<a href="#">test</a>'],
['<script >evil()</script>', ''],
['<script>evil()</script>', ''],
[
'<img onload="document.body.innerHTML = evil;" src="data:image/svg+xml;base64,=="/>',
'<img src="data:image/svg+xml;base64,=="/>',
],
];
for (const [html, expected] of testCases) {
expect(await processPastedHtml(html)).toBe(expected);
}
});
});

View File

@@ -6,7 +6,8 @@ import Resource from '@joplin/lib/models/Resource';
const bridge = require('@electron/remote').require('./bridge').default;
import ResourceFetcher from '@joplin/lib/services/ResourceFetcher';
import htmlUtils from '@joplin/lib/htmlUtils';
import Logger from '@joplin/lib/Logger';
import rendererHtmlUtils from '@joplin/renderer/htmlUtils';
import Logger from '@joplin/utils/Logger';
const { fileUriToPath } = require('@joplin/lib/urlUtils');
const joplinRendererUtils = require('@joplin/renderer').utils;
const { clipboard } = require('electron');
@@ -159,6 +160,8 @@ export async function processPastedHtml(html: string) {
const createdResource = await shim.createResourceFromPath(imageFilePath);
mappedResources[imageSrc] = `file://${encodeURI(Resource.fullPath(createdResource))}`;
}
} else if (imageSrc.startsWith('data:')) { // Data URIs
mappedResources[imageSrc] = imageSrc;
} else {
const filePath = `${Setting.value('tempDir')}/${md5(Date.now() + Math.random())}`;
await shim.fetchBlob(imageSrc, { path: filePath });
@@ -173,7 +176,9 @@ export async function processPastedHtml(html: string) {
}
}
return htmlUtils.replaceImageUrls(html, (src: string) => {
return mappedResources[src];
});
return rendererHtmlUtils.sanitizeHtml(
htmlUtils.replaceImageUrls(html, (src: string) => {
return mappedResources[src];
})
);
}

View File

@@ -3,7 +3,7 @@ import { FormNote, defaultFormNote, ResourceInfos } from './types';
import { clearResourceCache, attachedResources } from './resourceHandling';
import AsyncActionQueue from '@joplin/lib/AsyncActionQueue';
import { handleResourceDownloadMode } from './resourceHandling';
import HtmlToHtml from '@joplin/renderer/HtmlToHtml';
import { splitHtml } from '@joplin/renderer/HtmlToHtml';
import Setting from '@joplin/lib/models/Setting';
import usePrevious from '../../hooks/usePrevious';
import ResourceEditWatcher from '@joplin/lib/services/ResourceEditWatcher/index';
@@ -73,8 +73,7 @@ export default function useFormNote(dependencies: HookDependencies) {
let originalCss = '';
if (n.markup_language === MarkupToHtml.MARKUP_LANGUAGE_HTML) {
const htmlToHtml = new HtmlToHtml();
const splitted = htmlToHtml.splitHtml(n.body);
const splitted = splitHtml(n.body);
originalCss = splitted.css;
}

View File

@@ -1,5 +1,5 @@
import { useState, useCallback, MutableRefObject, useEffect } from 'react';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import { SearchMarkers } from './useSearchMarkers';
const CommandService = require('@joplin/lib/services/CommandService').default;

View File

@@ -246,7 +246,10 @@ const NoteListComponent = (props: Props) => {
event.dataTransfer.setDragImage(new Image(), 1, 1);
event.dataTransfer.clearData();
event.dataTransfer.setData('text/x-jop-note-ids', JSON.stringify(noteIds));
event.dataTransfer.effectAllowed = 'move';
// While setting
// event.dataTransfer.effectAllowed = 'move';
// causes the drag cursor to have a "move", rather than an "add", icon,
// this breaks note drag and drop into the markdown editor.
return true;
}, [props.parentFolderIsReadOnly, props.selectedNoteIds]);

View File

@@ -84,11 +84,11 @@ function NoteListItem(props: NoteListItemProps, ref: any) {
dragItemPosition = 'bottom';
}
const onTitleClick = useCallback((event) => {
const onTitleClick = useCallback((event: any) => {
props.onTitleClick(event, props.item);
}, [props.onTitleClick, props.item]);
const onCheckboxClick = useCallback((event) => {
const onCheckboxClick = useCallback((event: any) => {
props.onCheckboxClick(event, props.item);
}, [props.onCheckboxClick, props.item]);

View File

@@ -210,7 +210,7 @@ class NotePropertiesDialog extends React.Component<Props, State> {
}
public async saveProperty() {
if (!this.state.editedKey) return;
if (!this.state.editedKey) return null;
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
return new Promise((resolve: Function) => {

View File

@@ -10,7 +10,7 @@ import styled from 'styled-components';
import StyledFormLabel from '../style/StyledFormLabel';
import StyledInput from '../style/StyledInput';
import Button, { ButtonSize } from '../Button/Button';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import StyledMessage from '../style/StyledMessage';
import { SharePermissions, ShareUserStatus, StateShare, StateShareUser } from '@joplin/lib/services/share/reducer';
import { State } from '@joplin/lib/reducer';

View File

@@ -19,7 +19,7 @@ import BaseModel from '@joplin/lib/BaseModel';
import Folder from '@joplin/lib/models/Folder';
import Note from '@joplin/lib/models/Note';
import Tag from '@joplin/lib/models/Tag';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import { FolderEntity, FolderIcon, FolderIconType } from '@joplin/lib/services/database/types';
import stateToWhenClauseContext from '../../services/commands/stateToWhenClauseContext';
import { store } from '@joplin/lib/reducer';

View File

@@ -1,4 +1,4 @@
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
// Can't upgrade beyond 2.x because it doesn't work with Electron. If trying to
// upgrade again, check that adding a link from the CodeMirror editor works/

View File

@@ -1,4 +1,4 @@
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
const logger = Logger.create('loadScript');

View File

@@ -116,7 +116,7 @@ module.exports = {
// setupFiles: [],
// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],
setupFilesAfterEnv: [`${__dirname}/jest.setup.js`],
// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,

View File

@@ -0,0 +1,19 @@
const { default: Logger, TargetType } = require('@joplin/utils/Logger');
// TODO: Some libraries required by test-utils.js seem to fail to import with the
// jsdom environment.
//
// Thus, require('@joplin/lib/testing/test-utils.js') fails and some setup must be
// copied.
const logger = new Logger();
logger.addTarget(TargetType.Console);
logger.setLevel(Logger.LEVEL_WARN);
Logger.initializeGlobalLogger(logger);
// @electron/remote requires electron to be running. Mock it.
jest.mock('@electron/remote', () => {
return { require };
});

View File

@@ -20,7 +20,7 @@ const NoteTag = require('@joplin/lib/models/NoteTag').default;
const MasterKey = require('@joplin/lib/models/MasterKey').default;
const Setting = require('@joplin/lib/models/Setting').default;
const Revision = require('@joplin/lib/models/Revision').default;
const Logger = require('@joplin/lib/Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const FsDriverNode = require('@joplin/lib/fs-driver-node').default;
const shim = require('@joplin/lib/shim').default;
const { shimInit } = require('@joplin/lib/shim-init-node.js');

View File

@@ -4,7 +4,7 @@ const electronApp = require('electron').app;
require('@electron/remote/main').initialize();
const ElectronAppWrapper = require('./ElectronAppWrapper').default;
const { initBridge } = require('./bridge');
const Logger = require('@joplin/lib/Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const FsDriverNode = require('@joplin/lib/fs-driver-node').default;
const envFromArgs = require('@joplin/lib/envFromArgs');
const packageInfo = require('./packageInfo.js');

View File

@@ -1,6 +1,6 @@
{
"name": "@joplin/app-desktop",
"version": "2.12.9",
"version": "2.12.10",
"description": "Joplin for Desktop",
"main": "main.js",
"private": true,
@@ -110,21 +110,21 @@
"@electron/rebuild": "3.2.13",
"@joplin/tools": "~2.12",
"@testing-library/react-hooks": "8.0.1",
"@types/jest": "29.5.1",
"@types/node": "18.15.13",
"@types/react": "16.14.41",
"@types/jest": "29.5.3",
"@types/node": "18.16.18",
"@types/react": "18.0.24",
"@types/react-redux": "7.1.25",
"@types/styled-components": "5.1.26",
"electron": "25.2.0",
"electron": "25.3.1",
"electron-builder": "24.4.0",
"glob": "10.2.7",
"glob": "10.3.3",
"gulp": "4.0.2",
"jest": "29.5.0",
"jest-environment-jsdom": "29.5.0",
"js-sha512": "0.8.0",
"nan": "2.17.0",
"react-test-renderer": "18.2.0",
"typescript": "5.0.2"
"typescript": "5.1.3"
},
"optionalDependencies": {
"7zip-bin-linux": "^1.0.1",
@@ -138,6 +138,7 @@
"@joeattardi/emoji-button": "4.6.4",
"@joplin/lib": "~2.12",
"@joplin/renderer": "~2.12",
"@joplin/utils": "~2.12",
"async-mutex": "0.4.0",
"codemirror": "5.65.9",
"color": "3.2.1",
@@ -162,7 +163,7 @@
"react-datetime": "3.2.0",
"react-dom": "18.2.0",
"react-redux": "8.1.1",
"react-select": "5.7.3",
"react-select": "5.7.4",
"react-toggle-button": "2.2.0",
"react-tooltip": "4.5.1",
"redux": "4.2.1",

View File

@@ -18,7 +18,7 @@ const { surroundKeywords, nextWhitespaceIndex, removeDiacritics } = require('@jo
import { mergeOverlappingIntervals } from '@joplin/lib/ArrayUtils';
import markupLanguageUtils from '../utils/markupLanguageUtils';
import focusEditorIfEditorCommand from '@joplin/lib/services/commands/focusEditorIfEditorCommand';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import { MarkupToHtml } from '@joplin/renderer';
const logger = Logger.create('GotoAnything');

View File

@@ -42,6 +42,11 @@ const create = (win, options) => {
return;
}
// If another listener has called .preventDefault, don't show the default context menu.
if (event.defaultPrevented) {
return;
}
const { editFlags } = props;
const hasText = props.selectionText.trim().length > 0;
const isLink = Boolean(props.linkURL);

View File

@@ -1,4 +1,4 @@
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import time from '@joplin/lib/time';
const logger = Logger.create('BackOffHandler');

View File

@@ -6,7 +6,7 @@ import bridge from '../bridge';
import Setting from '@joplin/lib/models/Setting';
import { EventHandlers } from '@joplin/lib/services/plugins/utils/mapEventHandlersToIds';
import shim from '@joplin/lib/shim';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
// import BackOffHandler from './BackOffHandler';
const ipcRenderer = require('electron').ipcRenderer;

View File

@@ -7,7 +7,7 @@ import useSubmitHandler from './hooks/useSubmitHandler';
import useHtmlLoader from './hooks/useHtmlLoader';
import useWebviewToPluginMessages from './hooks/useWebviewToPluginMessages';
import useScriptLoader from './hooks/useScriptLoader';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import styled from 'styled-components';
const logger = Logger.create('UserWebview');

View File

@@ -1,5 +1,5 @@
import ShareService from '@joplin/lib/services/share/ShareService';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import Folder from '@joplin/lib/models/Folder';
import { reg } from '@joplin/lib/registry';
import { _ } from '@joplin/lib/locale';

View File

@@ -2,7 +2,7 @@
import SpellCheckerServiceDriverBase from '@joplin/lib/services/spellChecker/SpellCheckerServiceDriverBase';
import bridge from '../bridge';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import { languageCodeOnly, localesFromLanguageCode } from '@joplin/lib/locale';
const logger = Logger.create('SpellCheckerServiceDriverNative');

View File

@@ -73,7 +73,7 @@ export default async (params: Params) => {
teamId: process.env.APPLE_ASC_PROVIDER,
tool: 'notarytool',
});
} as any);
} catch (error) {
console.error(error);
process.exit(1);

View File

@@ -8,6 +8,8 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
<uses-permission android:name="android.permission.POST_NOTIFICATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<!-- Make these features optional to enable Chromebooks -->
<!-- https://github.com/laurent22/joplin/issues/37 -->

View File

@@ -3,7 +3,7 @@ import shim from '@joplin/lib/shim';
import Setting from '@joplin/lib/models/Setting';
const { themeStyle } = require('../../global-style.js');
import markupLanguageUtils from '@joplin/lib/markupLanguageUtils';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
const { assetsToHeaders } = require('@joplin/renderer');
const logger = Logger.create('NoteBodyViewer/useSource');

View File

@@ -1,7 +1,3 @@
/**
* @jest-environment jsdom
*/
import { EditorSelection } from '@codemirror/state';
import { ListType } from '../types';
import createEditor from './testUtil/createEditor';

View File

@@ -1,7 +1,3 @@
/**
* @jest-environment jsdom
*/
import { EditorSelection } from '@codemirror/state';
import {
toggleBolded, toggleCode, toggleHeaderLevel, toggleItalicized, toggleMath, updateLink,

View File

@@ -1,7 +1,3 @@
/**
* @jest-environment jsdom
*/
import { EditorSelection, EditorState } from '@codemirror/state';
import {
increaseIndent, toggleList,

View File

@@ -1,6 +1,3 @@
/**
* @jest-environment jsdom
*/
import { syntaxTree } from '@codemirror/language';
import { SyntaxNode } from '@lezer/common';
import { EditorSelection, EditorState } from '@codemirror/state';

View File

@@ -4,7 +4,7 @@ import { useEffect, useMemo, useState } from 'react';
import { View, Dimensions, Alert, Button } from 'react-native';
import { SensorInfo } from './sensorInfo';
import { _ } from '@joplin/lib/locale';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import biometricAuthenticate from './biometricAuthenticate';
const logger = Logger.create('BiometricPopup');

View File

@@ -1,4 +1,4 @@
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import FingerprintScanner, { Errors } from 'react-native-fingerprint-scanner';
import { _ } from '@joplin/lib/locale';

View File

@@ -1,4 +1,4 @@
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import Setting from '@joplin/lib/models/Setting';
import FingerprintScanner from 'react-native-fingerprint-scanner';
const logger = Logger.create('sensorInfo');

View File

@@ -1,12 +1,4 @@
/**
* @jest-environment jsdom
*/
import * as React from 'react';
import { setImmediate } from 'timers';
// Required by some libraries (setImmediate is not supported in most browsers,
// so is removed by jsdom).
window.setImmediate = setImmediate;
import { _ } from '@joplin/lib/locale';
import { act, fireEvent, render, waitFor } from '@testing-library/react-native';

View File

@@ -1,7 +1,7 @@
import * as React from 'react';
import { Text, Alert, View } from 'react-native';
import { _ } from '@joplin/lib/locale';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import { ProgressBar } from 'react-native-paper';
import { FunctionComponent, useCallback, useState } from 'react';
import shim from '@joplin/lib/shim';

View File

@@ -43,7 +43,7 @@ import SelectDateTimeDialog from '../SelectDateTimeDialog';
import ShareExtension from '../../utils/ShareExtension.js';
import CameraView from '../CameraView';
import { NoteEntity } from '@joplin/lib/services/database/types';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import VoiceTypingDialog from '../voiceTyping/VoiceTypingDialog';
import { voskEnabled } from '../../services/voiceTyping/vosk';
import { isSupportedLanguage } from '../../services/voiceTyping/vosk.android';

View File

@@ -6,7 +6,7 @@ const { reg } = require('@joplin/lib/registry.js');
const { ScreenHeader } = require('../ScreenHeader');
const time = require('@joplin/lib/time').default;
const { themeStyle } = require('../global-style.js');
const Logger = require('@joplin/lib/Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const { BaseScreenComponent } = require('../base-screen.js');
const { _ } = require('@joplin/lib/locale');

View File

@@ -351,7 +351,7 @@ PODS:
- React-Core
- react-native-get-random-values (1.9.0):
- React-Core
- react-native-image-picker (5.4.2):
- react-native-image-picker (5.6.0):
- React-Core
- react-native-image-resizer (1.4.5):
- React-Core
@@ -361,7 +361,7 @@ PODS:
- React
- react-native-saf-x (2.12.0):
- React-Core
- react-native-safe-area-context (4.5.5):
- react-native-safe-area-context (4.6.4):
- RCT-Folly
- RCTRequired
- RCTTypeSafety
@@ -465,7 +465,7 @@ PODS:
- React-Core
- RNCPushNotificationIOS (1.11.0):
- React-Core
- RNDateTimePicker (7.1.0):
- RNDateTimePicker (7.2.0):
- React-Core
- RNDeviceInfo (10.6.1):
- React-Core
@@ -475,9 +475,9 @@ PODS:
- React-Core
- RNFS (2.20.0):
- React-Core
- RNGestureHandler (2.11.0):
- RNGestureHandler (2.12.0):
- React-Core
- RNLocalize (3.0.1):
- RNLocalize (3.0.2):
- React-Core
- RNQuickAction (0.3.13):
- React
@@ -823,12 +823,12 @@ SPEC CHECKSUMS:
react-native-fingerprint-scanner: ac6656f18c8e45a7459302b84da41a44ad96dbbe
react-native-geolocation: 0f7fe8a4c2de477e278b0365cce27d089a8c5903
react-native-get-random-values: dee677497c6a740b71e5612e8dbd83e7539ed5bb
react-native-image-picker: 77f552291e993f3fdcdf48cc3c280ef7f11789c8
react-native-image-picker: db60857e03d63721f19b6f4027de20429ddd9cba
react-native-image-resizer: d9fb629a867335bdc13230ac2a58702bb8c8828f
react-native-netinfo: 3a48f51c18dbd9253440621955e11de71bc51b32
react-native-rsa-native: 12132eb627797529fdb1f0d22fd0f8f9678df64a
react-native-saf-x: 129cd2ddf120a1f6164c724b2846d172666b33de
react-native-safe-area-context: 33e71d7408dffe148b08968d97a524009634ccc8
react-native-safe-area-context: 68b07eabfb0d14547d36f6929c0e98d818064f02
react-native-slider: 33b8d190b59d4f67a541061bb91775d53d617d9d
react-native-sqlite-storage: f6d515e1c446d1e6d026aa5352908a25d4de3261
react-native-version-info: a106f23009ac0db4ee00de39574eb546682579b9
@@ -849,13 +849,13 @@ SPEC CHECKSUMS:
rn-fetch-blob: f065bb7ab7fb48dd002629f8bdcb0336602d3cba
RNCClipboard: 41d8d918092ae8e676f18adada19104fa3e68495
RNCPushNotificationIOS: 64218f3c776c03d7408284a819b2abfda1834bc8
RNDateTimePicker: 7ecd54a97fc3749f38c3c89a171f6cbd52f3c142
RNDateTimePicker: 3942382593f104af226ad9c56e16166960c7ae30
RNDeviceInfo: ab292735ad4fccc5f2aec0c773f7a7f03c7073ae
RNExitApp: c4e052df2568b43bec8a37c7cd61194d4cfee2c3
RNFileViewer: ce7ca3ac370e18554d35d6355cffd7c30437c592
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNGestureHandler: 026038a97d4c8649ce397a22e162ca58b4e6c230
RNLocalize: 6dd9226886fa61bf0cefc7644e3f9620770b1a31
RNGestureHandler: dec4645026e7401a0899f2846d864403478ff6a5
RNLocalize: dbea38dcb344bf80ff18a1757b1becf11f70cae4
RNQuickAction: 6d404a869dc872cde841ad3147416a670d13fa93
RNReanimated: 9976fbaaeb8a188c36026154c844bf374b3b7eeb
RNSecureRandom: 07efbdf2cd99efe13497433668e54acd7df49fef

View File

@@ -12,6 +12,7 @@ module.exports = {
'\\.(ts|tsx)$': 'ts-jest',
},
testEnvironment: 'jsdom',
testMatch: ['**/*.test.(ts|tsx)'],
testPathIgnorePatterns: ['<rootDir>/node_modules/'],

View File

@@ -8,6 +8,29 @@ const { tmpdir } = require('os');
const uuid = require('@joplin/lib/uuid').default;
const sqlite3 = require('sqlite3');
import { setImmediate } from 'timers';
// Required by some libraries (setImmediate is not supported in most browsers,
// so is removed by jsdom).
window.setImmediate = setImmediate;
// Prevents the CodeMirror error "getClientRects is undefined".
// See https://github.com/jsdom/jsdom/issues/3002#issue-652790925
document.createRange = () => {
const range = new Range();
range.getBoundingClientRect = jest.fn();
range.getClientRects = () => {
return {
length: 0,
item: () => null,
[Symbol.iterator]: jest.fn(),
};
};
return range;
};
shimInit({ nodeSqlite: sqlite3 });

View File

@@ -16,11 +16,11 @@ const localPackages = {
'@joplin/lib': path.resolve(__dirname, '../lib/'),
'@joplin/renderer': path.resolve(__dirname, '../renderer/'),
'@joplin/tools': path.resolve(__dirname, '../tools/'),
'@joplin/utils': path.resolve(__dirname, '../utils/'),
'@joplin/fork-htmlparser2': path.resolve(__dirname, '../fork-htmlparser2/'),
'@joplin/fork-uslug': path.resolve(__dirname, '../fork-uslug/'),
'@joplin/react-native-saf-x': path.resolve(__dirname, '../react-native-saf-x/'),
'@joplin/react-native-alarm-notification': path.resolve(__dirname, '../react-native-alarm-notification/'),
'@joplin/fork-sax': path.resolve(__dirname, '../fork-sax/'),
};

View File

@@ -22,8 +22,9 @@
"@joplin/react-native-alarm-notification": "~2.12",
"@joplin/react-native-saf-x": "~2.12",
"@joplin/renderer": "~2.12",
"@joplin/utils": "~2.12",
"@react-native-community/clipboard": "1.5.1",
"@react-native-community/datetimepicker": "7.1.0",
"@react-native-community/datetimepicker": "7.2.0",
"@react-native-community/geolocation": "3.0.6",
"@react-native-community/netinfo": "9.3.11",
"@react-native-community/push-notification-ios": "1.11.0",
@@ -55,7 +56,7 @@
"react-native-fs": "2.20.0",
"react-native-gesture-handler": "2.12.0",
"react-native-get-random-values": "1.9.0",
"react-native-image-picker": "5.4.2",
"react-native-image-picker": "5.6.0",
"react-native-image-resizer": "1.4.5",
"react-native-localize": "3.0.2",
"react-native-modal-datetime-picker": "15.0.1",
@@ -64,7 +65,7 @@
"react-native-quick-actions": "0.3.13",
"react-native-reanimated": "3.3.0",
"react-native-rsa-native": "2.0.5",
"react-native-safe-area-context": "4.5.5",
"react-native-safe-area-context": "4.6.4",
"react-native-securerandom": "1.0.1",
"react-native-share": "8.2.2",
"react-native-sqlite-storage": "6.0.1",
@@ -107,12 +108,12 @@
"@testing-library/react-native": "12.1.2",
"@tsconfig/react-native": "2.0.2",
"@types/fs-extra": "11.0.1",
"@types/jest": "29.5.1",
"@types/jest": "29.5.3",
"@types/react": "18.0.24",
"@types/react-native": "0.70.6",
"@types/react-redux": "7.1.25",
"@types/tar-stream": "2.2.2",
"babel-jest": "29.2.1",
"babel-jest": "29.5.0",
"babel-plugin-module-resolver": "4.1.0",
"execa": "4.1.0",
"fs-extra": "11.1.1",
@@ -126,10 +127,10 @@
"nodemon": "2.0.22",
"react-test-renderer": "18.2.0",
"sqlite3": "5.1.6",
"ts-jest": "29.1.0",
"ts-jest": "29.1.1",
"ts-loader": "9.4.4",
"ts-node": "10.9.1",
"typescript": "5.0.2",
"typescript": "5.1.3",
"uglify-js": "3.17.4",
"webpack": "5.74.0"
}

View File

@@ -7,7 +7,7 @@ import PluginAssetsLoader from './PluginAssetsLoader';
import AlarmService from '@joplin/lib/services/AlarmService';
import Alarm from '@joplin/lib/models/Alarm';
import time from '@joplin/lib/time';
import Logger, { TargetType } from '@joplin/lib/Logger';
import Logger, { TargetType } from '@joplin/utils/Logger';
import BaseModel from '@joplin/lib/BaseModel';
import BaseService from '@joplin/lib/services/BaseService';
import ResourceService from '@joplin/lib/services/ResourceService';

View File

@@ -1,4 +1,4 @@
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import { Notification } from '@joplin/lib/models/Alarm';
const ReactNativeAN = require('@joplin/react-native-alarm-notification').default;

View File

@@ -1,5 +1,5 @@
import { Notification } from '@joplin/lib/models/Alarm';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
const PushNotificationIOS = require('@react-native-community/push-notification-ios').default;
export default class AlarmServiceDriver {

View File

@@ -1,5 +1,5 @@
import { languageCodeOnly } from '@joplin/lib/locale';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import Setting from '@joplin/lib/models/Setting';
import { rtrimSlashes } from '@joplin/lib/path-utils';
import shim from '@joplin/lib/shim';

View File

@@ -1,4 +1,4 @@
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
import Setting from '@joplin/lib/models/Setting';
import { Appearance, ColorSchemeName } from 'react-native';

View File

@@ -1,4 +1,4 @@
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
const { Platform, PermissionsAndroid } = require('react-native');
const logger = Logger.create('checkPermissions');

View File

@@ -8,7 +8,7 @@ import { Platform } from 'react-native';
import * as tar from 'tar-stream';
import { resolve } from 'path';
import { Buffer } from 'buffer';
import Logger from '@joplin/lib/Logger';
import Logger from '@joplin/utils/Logger';
const logger = Logger.create('fs-driver-rn');

View File

@@ -15,7 +15,11 @@ export default async (sharedData: SharedData, folderId: string, dispatch: Functi
if (Platform.OS === 'android') {
const response = await checkPermissions(PermissionsAndroid.PERMISSIONS.READ_EXTERNAL_STORAGE);
if (response !== PermissionsAndroid.RESULTS.GRANTED) {
// Note that if the permission is NEVER_ASK_AGAIN, it might still
// work because of the way Android permissions work after Android
// 10. So it means in that case we give it a try anyway.
// https://stackoverflow.com/a/73630987/561309
if (response === PermissionsAndroid.RESULTS.DENIED) {
ToastAndroid.show('Cannot receive shared data - permission denied', ToastAndroid.SHORT);
ShareExtension.close();
return;

View File

@@ -45,16 +45,16 @@
"entities": "2.2.0"
},
"devDependencies": {
"@types/jest": "29.5.1",
"@types/node": "18.15.13",
"@typescript-eslint/eslint-plugin": "5.59.0",
"@typescript-eslint/parser": "5.59.0",
"@types/jest": "29.5.3",
"@types/node": "18.16.18",
"@typescript-eslint/eslint-plugin": "5.60.0",
"@typescript-eslint/parser": "5.60.0",
"coveralls": "3.1.1",
"eslint": "8.39.0",
"eslint": "8.43.0",
"jest": "29.5.0",
"prettier": "2.8.8",
"ts-jest": "29.1.0",
"typescript": "5.0.2"
"ts-jest": "29.1.1",
"typescript": "5.1.3"
},
"jest": {
"preset": "ts-jest",

View File

@@ -1,11 +1,11 @@
{
"name": "generate-plugin-doc",
"packageManager": "yarn@3.3.1",
"packageManager": "yarn@3.6.0",
"scripts": {
"buildPluginDoc_": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme '../../Assets/PluginDocTheme/' --readme '../../Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out ../../../joplin-website/docs/api/references/plugin_api ../lib/services/plugins/api/"
},
"dependencies": {
"typedoc": "0.17.8",
"typescript": "4.7.4"
"typescript": "5.0.4"
}
}

View File

@@ -1,5 +1,5 @@
import Setting, { Env } from './models/Setting';
import Logger, { TargetType, LoggerWrapper } from './Logger';
import Logger, { TargetType, LoggerWrapper } from '@joplin/utils/Logger';
import shim from './shim';
const { setupProxySettings } = require('./shim-init-node');
import BaseService from './services/BaseService';

View File

@@ -1,4 +1,4 @@
import Logger from './Logger';
import Logger from '@joplin/utils/Logger';
import Synchronizer from './Synchronizer';
import EncryptionService from './services/e2ee/EncryptionService';
import shim from './shim';

View File

@@ -1,5 +1,5 @@
import Setting from './models/Setting';
import Logger from './Logger';
import Logger from '@joplin/utils/Logger';
import Api, { RequestFile } from './services/rest/Api';
import ApiResponse from './services/rest/ApiResponse';
const urlParser = require('url');
@@ -114,7 +114,7 @@ export default class ClipperServer {
} catch (error) {
this.setStartState(StartState.Idle);
this.logger().error(error);
return;
return null;
}
this.server_ = require('http').createServer();

View File

@@ -1,4 +1,4 @@
const Logger = require('./Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const shim = require('./shim').default;
const JoplinError = require('./JoplinError').default;
const time = require('./time').default;

View File

@@ -3,7 +3,7 @@ import { _ } from './locale';
const { rtrimSlashes } = require('./path-utils.js');
import JoplinError from './JoplinError';
import { Env } from './models/Setting';
import Logger from './Logger';
import Logger from '@joplin/utils/Logger';
import personalizedUserContentBaseUrl from './services/joplinServer/personalizedUserContentBaseUrl';
import { getHttpStatusMessage } from './net-utils';
const { stringify } = require('query-string');

View File

@@ -5,7 +5,7 @@ import { _ } from './locale.js';
import JoplinServerApi from './JoplinServerApi';
import BaseSyncTarget from './BaseSyncTarget';
import { FileApi } from './file-api';
import Logger from './Logger';
import Logger from '@joplin/utils/Logger';
const staticLogger = Logger.create('SyncTargetJoplinServer');

View File

@@ -1,4 +1,4 @@
import Logger from './Logger';
import Logger from '@joplin/utils/Logger';
import LockHandler, { appTypeToLockType, hasActiveLock, LockClientType, LockType } from './services/synchronizer/LockHandler';
import Setting, { AppType } from './models/Setting';
import shim from './shim';
@@ -272,7 +272,7 @@ export default class Synchronizer {
}
public async cancel() {
if (this.cancelling_ || this.state() === 'idle') return;
if (this.cancelling_ || this.state() === 'idle') return null;
// Stop queue but don't set it to null as it may be used to
// retrieve the last few downloads.

View File

@@ -1,6 +1,6 @@
import time from './time';
import Setting from './models/Setting';
import Logger from './Logger';
import Logger from '@joplin/utils/Logger';
interface Task {
id: string;

View File

@@ -1,4 +1,4 @@
const Logger = require('./Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const shim = require('./shim').default;
const parseXmlString = require('xml2js').parseString;
const JoplinError = require('./JoplinError').default;

View File

@@ -3,7 +3,7 @@ const SyncTargetRegistry = require('../../SyncTargetRegistry').default;
const ObjectUtils = require('../../ObjectUtils');
const { _ } = require('../../locale');
const { createSelector } = require('reselect');
const Logger = require('../../Logger').default;
const Logger = require('@joplin/utils/Logger').default;
const logger = Logger.create('config-shared');

View File

@@ -1,4 +1,4 @@
import Logger from './Logger';
import Logger from '@joplin/utils/Logger';
import time from './time';
import shim from './shim';

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