You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-08-27 20:29:45 +02:00
Compare commits
117 Commits
server-v2.
...
linux-fold
Author | SHA1 | Date | |
---|---|---|---|
|
c7299cf679 | ||
|
ad0f0414c4 | ||
|
405c528ef0 | ||
|
a176216374 | ||
|
8d0b090f66 | ||
|
337c5ed61c | ||
|
b32d39860b | ||
|
a091608f72 | ||
|
9686ee7833 | ||
|
3b55dcac65 | ||
|
d524d11d8a | ||
|
9c080ec631 | ||
|
da11476fd7 | ||
|
d157b9cfc7 | ||
|
bc8c61748a | ||
|
3ad727889b | ||
|
8df128bb7a | ||
|
5a4568f4db | ||
|
170295919a | ||
|
2262cbfdfd | ||
|
43e40bcf5a | ||
|
e60595f0de | ||
|
527a7c115d | ||
|
c22f910500 | ||
|
667b7969ff | ||
|
1bbf065142 | ||
|
606cad3c3a | ||
|
c9612dc8b8 | ||
|
6ee30e22a6 | ||
|
a6536e1ef9 | ||
|
92cf5abd08 | ||
|
d1e545ac2c | ||
|
ec6567c68d | ||
|
3b236307f7 | ||
|
14ac54bf3d | ||
|
e53b796523 | ||
|
9d189b2b34 | ||
|
84545cf26d | ||
|
c427a6d0a5 | ||
|
42dc6e1ea6 | ||
|
431b95ff7b | ||
|
041fb731a6 | ||
|
5289f80394 | ||
|
6c12ce0e04 | ||
|
46982c7d64 | ||
|
359448eb69 | ||
|
32bb256cca | ||
|
219585bbcf | ||
|
1a9dbcbd1d | ||
|
6a9848ebe7 | ||
|
9e73d3590b | ||
|
08c9a25182 | ||
|
5b9a45dc1d | ||
|
9dd2fb9674 | ||
|
234b5c8363 | ||
|
1dc7ec3701 | ||
|
72773caf58 | ||
|
094249d074 | ||
|
c324f17453 | ||
|
25a31b0689 | ||
|
f2995dd196 | ||
|
ca575162f7 | ||
|
f0ade02435 | ||
|
b13c02017a | ||
|
716c8c1ce4 | ||
|
30a49b84ad | ||
|
b8e4150bfd | ||
|
ed0edcb36c | ||
|
e93046e8e2 | ||
|
18a0ca0881 | ||
|
21dbc800d5 | ||
|
5c1eda3392 | ||
|
1139317788 | ||
|
a24ccb8da9 | ||
|
0aaa396315 | ||
|
f9dc19e1c4 | ||
|
1839724d7c | ||
|
a5aeb3a2f8 | ||
|
d5d57aa360 | ||
|
9aa5df7790 | ||
|
a7697465a8 | ||
|
aeb7e5ce47 | ||
|
42cef1e918 | ||
|
b832930512 | ||
|
057ac550bd | ||
|
3a14b76a61 | ||
|
e1a8c76598 | ||
|
b62e6552cd | ||
|
ca6e50e80c | ||
|
ad8947a85d | ||
|
fb562210b2 | ||
|
34940d1c4f | ||
|
7fa1459dc3 | ||
|
625689dbb1 | ||
|
dc976047d2 | ||
|
a014e830e7 | ||
|
1e828bfdca | ||
|
60309ec6a3 | ||
|
aabba090b1 | ||
|
6ae903ef4d | ||
|
dd86940c6b | ||
|
7d7b7ed6f3 | ||
|
8de904cd3c | ||
|
c706b8dd2f | ||
|
d55d4d42e5 | ||
|
bbfeffec69 | ||
|
3c471dc120 | ||
|
be0fa69b3b | ||
|
bf1bdf0951 | ||
|
a1a10a6c55 | ||
|
02e8307093 | ||
|
285a3a211e | ||
|
80cb1471fc | ||
|
a7a194f835 | ||
|
41a0b3359a | ||
|
1f70357d37 | ||
|
107f2e128e |
@@ -79,6 +79,8 @@ packages/app-cli/app/LinkSelector.js
|
||||
packages/app-cli/app/base-command.js
|
||||
packages/app-cli/app/command-done.test.js
|
||||
packages/app-cli/app/command-e2ee.js
|
||||
packages/app-cli/app/command-mkbook.js
|
||||
packages/app-cli/app/command-mkbook.test.js
|
||||
packages/app-cli/app/command-settingschema.js
|
||||
packages/app-cli/app/command-sync.js
|
||||
packages/app-cli/app/command-testing.js
|
||||
@@ -177,6 +179,7 @@ packages/app-desktop/gui/MainScreen/commands/openTag.js
|
||||
packages/app-desktop/gui/MainScreen/commands/print.js
|
||||
packages/app-desktop/gui/MainScreen/commands/renameFolder.js
|
||||
packages/app-desktop/gui/MainScreen/commands/renameTag.js
|
||||
packages/app-desktop/gui/MainScreen/commands/resetLayout.js
|
||||
packages/app-desktop/gui/MainScreen/commands/revealResourceFile.js
|
||||
packages/app-desktop/gui/MainScreen/commands/search.js
|
||||
packages/app-desktop/gui/MainScreen/commands/setTags.js
|
||||
@@ -221,6 +224,7 @@ packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/openEditDialog.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupToolbarButtons.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/types.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteEditor.js
|
||||
@@ -228,6 +232,7 @@ packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/index.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/pasteAsText.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/showRevisions.js
|
||||
packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.js
|
||||
@@ -404,6 +409,7 @@ packages/app-mobile/components/getResponsiveValue.js
|
||||
packages/app-mobile/components/getResponsiveValue.test.js
|
||||
packages/app-mobile/components/screens/ConfigScreen.js
|
||||
packages/app-mobile/components/screens/Note.js
|
||||
packages/app-mobile/components/screens/Notes.js
|
||||
packages/app-mobile/components/screens/UpgradeSyncTargetScreen.js
|
||||
packages/app-mobile/components/screens/encryption-config.js
|
||||
packages/app-mobile/components/screens/search.js
|
||||
@@ -479,6 +485,7 @@ packages/lib/commands/index.js
|
||||
packages/lib/commands/openMasterPasswordDialog.js
|
||||
packages/lib/commands/synchronize.js
|
||||
packages/lib/components/EncryptionConfigScreen/utils.js
|
||||
packages/lib/components/shared/note-screen-shared.js
|
||||
packages/lib/database-driver-better-sqlite.js
|
||||
packages/lib/database.js
|
||||
packages/lib/debug/DebugService.js
|
||||
@@ -508,6 +515,7 @@ packages/lib/markdownUtils.js
|
||||
packages/lib/markdownUtils.test.js
|
||||
packages/lib/markdownUtils2.test.js
|
||||
packages/lib/markupLanguageUtils.js
|
||||
packages/lib/migrations/42.js
|
||||
packages/lib/models/Alarm.js
|
||||
packages/lib/models/BaseItem.js
|
||||
packages/lib/models/Folder.js
|
||||
@@ -754,6 +762,8 @@ packages/lib/themes/type.js
|
||||
packages/lib/time.js
|
||||
packages/lib/utils/credentialFiles.js
|
||||
packages/lib/utils/joplinCloud.js
|
||||
packages/lib/utils/webDAVUtils.js
|
||||
packages/lib/utils/webDAVUtils.test.js
|
||||
packages/lib/uuid.js
|
||||
packages/lib/versionInfo.js
|
||||
packages/lib/versionInfo.test.js
|
||||
@@ -797,6 +807,8 @@ packages/renderer/HtmlToHtml.js
|
||||
packages/renderer/InMemoryCache.js
|
||||
packages/renderer/MarkupToHtml.js
|
||||
packages/renderer/MdToHtml.js
|
||||
packages/renderer/MdToHtml/createEventHandlingAttrs.js
|
||||
packages/renderer/MdToHtml/createEventHandlingAttrs.test.js
|
||||
packages/renderer/MdToHtml/linkReplacement.js
|
||||
packages/renderer/MdToHtml/linkReplacement.test.js
|
||||
packages/renderer/MdToHtml/renderMedia.js
|
||||
|
21
.eslintrc.js
21
.eslintrc.js
@@ -77,6 +77,7 @@ module.exports = {
|
||||
'no-array-constructor': ['error'],
|
||||
'radix': ['error'],
|
||||
'eqeqeq': ['error', 'always'],
|
||||
'no-console': ['error', { 'allow': ['warn', 'error'] }],
|
||||
|
||||
// Warn only for now because fixing everything would take too much
|
||||
// refactoring, but new code should try to stick to it.
|
||||
@@ -91,6 +92,7 @@ module.exports = {
|
||||
// "react-hooks/exhaustive-deps": "warn",
|
||||
|
||||
'promise/prefer-await-to-then': 'error',
|
||||
'no-unneeded-ternary': 'error',
|
||||
|
||||
// -------------------------------
|
||||
// Formatting
|
||||
@@ -135,6 +137,14 @@ module.exports = {
|
||||
'spaced-comment': ['error', 'always'],
|
||||
'keyword-spacing': ['error', { 'before': true, 'after': true }],
|
||||
'no-multi-spaces': ['error'],
|
||||
|
||||
// Regarding the keyword blacklist:
|
||||
// - err: We generally avoid using too many abbreviations, so it should
|
||||
// be "error", not "err"
|
||||
// - notebook: In code, it should always be "folder" (not "notebook").
|
||||
// In user-facing text, it should be "notebook".
|
||||
'id-denylist': ['error', 'err', 'notebook', 'notebooks'],
|
||||
'prefer-arrow-callback': ['error'],
|
||||
},
|
||||
'plugins': [
|
||||
'react',
|
||||
@@ -147,6 +157,16 @@ module.exports = {
|
||||
'promise',
|
||||
],
|
||||
'overrides': [
|
||||
{
|
||||
'files': [
|
||||
'packages/tools/**',
|
||||
'packages/app-mobile/tools/**',
|
||||
'packages/app-desktop/tools/**',
|
||||
],
|
||||
'rules': {
|
||||
'no-console': 'off',
|
||||
},
|
||||
},
|
||||
{
|
||||
// enable the rule specifically for TypeScript files
|
||||
'files': ['*.ts', '*.tsx'],
|
||||
@@ -170,6 +190,7 @@ module.exports = {
|
||||
'tuples': 'always-multiline',
|
||||
'functions': 'never',
|
||||
}],
|
||||
'@typescript-eslint/object-curly-spacing': ['error', 'always'],
|
||||
'@typescript-eslint/semi': ['error', 'always'],
|
||||
'@typescript-eslint/member-delimiter-style': ['error', {
|
||||
'multiline': {
|
||||
|
12
.gitignore
vendored
12
.gitignore
vendored
@@ -67,6 +67,8 @@ packages/app-cli/app/LinkSelector.js
|
||||
packages/app-cli/app/base-command.js
|
||||
packages/app-cli/app/command-done.test.js
|
||||
packages/app-cli/app/command-e2ee.js
|
||||
packages/app-cli/app/command-mkbook.js
|
||||
packages/app-cli/app/command-mkbook.test.js
|
||||
packages/app-cli/app/command-settingschema.js
|
||||
packages/app-cli/app/command-sync.js
|
||||
packages/app-cli/app/command-testing.js
|
||||
@@ -165,6 +167,7 @@ packages/app-desktop/gui/MainScreen/commands/openTag.js
|
||||
packages/app-desktop/gui/MainScreen/commands/print.js
|
||||
packages/app-desktop/gui/MainScreen/commands/renameFolder.js
|
||||
packages/app-desktop/gui/MainScreen/commands/renameTag.js
|
||||
packages/app-desktop/gui/MainScreen/commands/resetLayout.js
|
||||
packages/app-desktop/gui/MainScreen/commands/revealResourceFile.js
|
||||
packages/app-desktop/gui/MainScreen/commands/search.js
|
||||
packages/app-desktop/gui/MainScreen/commands/setTags.js
|
||||
@@ -209,6 +212,7 @@ packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/TinyMCE.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/styles/index.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/openEditDialog.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/setupToolbarButtons.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/types.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useContextMenu.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/useScroll.js
|
||||
packages/app-desktop/gui/NoteEditor/NoteEditor.js
|
||||
@@ -216,6 +220,7 @@ packages/app-desktop/gui/NoteEditor/NoteTitle/NoteTitleBar.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteBody.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/focusElementNoteTitle.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/index.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/pasteAsText.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/showLocalSearch.js
|
||||
packages/app-desktop/gui/NoteEditor/commands/showRevisions.js
|
||||
packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.js
|
||||
@@ -392,6 +397,7 @@ packages/app-mobile/components/getResponsiveValue.js
|
||||
packages/app-mobile/components/getResponsiveValue.test.js
|
||||
packages/app-mobile/components/screens/ConfigScreen.js
|
||||
packages/app-mobile/components/screens/Note.js
|
||||
packages/app-mobile/components/screens/Notes.js
|
||||
packages/app-mobile/components/screens/UpgradeSyncTargetScreen.js
|
||||
packages/app-mobile/components/screens/encryption-config.js
|
||||
packages/app-mobile/components/screens/search.js
|
||||
@@ -467,6 +473,7 @@ packages/lib/commands/index.js
|
||||
packages/lib/commands/openMasterPasswordDialog.js
|
||||
packages/lib/commands/synchronize.js
|
||||
packages/lib/components/EncryptionConfigScreen/utils.js
|
||||
packages/lib/components/shared/note-screen-shared.js
|
||||
packages/lib/database-driver-better-sqlite.js
|
||||
packages/lib/database.js
|
||||
packages/lib/debug/DebugService.js
|
||||
@@ -496,6 +503,7 @@ packages/lib/markdownUtils.js
|
||||
packages/lib/markdownUtils.test.js
|
||||
packages/lib/markdownUtils2.test.js
|
||||
packages/lib/markupLanguageUtils.js
|
||||
packages/lib/migrations/42.js
|
||||
packages/lib/models/Alarm.js
|
||||
packages/lib/models/BaseItem.js
|
||||
packages/lib/models/Folder.js
|
||||
@@ -742,6 +750,8 @@ packages/lib/themes/type.js
|
||||
packages/lib/time.js
|
||||
packages/lib/utils/credentialFiles.js
|
||||
packages/lib/utils/joplinCloud.js
|
||||
packages/lib/utils/webDAVUtils.js
|
||||
packages/lib/utils/webDAVUtils.test.js
|
||||
packages/lib/uuid.js
|
||||
packages/lib/versionInfo.js
|
||||
packages/lib/versionInfo.test.js
|
||||
@@ -785,6 +795,8 @@ packages/renderer/HtmlToHtml.js
|
||||
packages/renderer/InMemoryCache.js
|
||||
packages/renderer/MarkupToHtml.js
|
||||
packages/renderer/MdToHtml.js
|
||||
packages/renderer/MdToHtml/createEventHandlingAttrs.js
|
||||
packages/renderer/MdToHtml/createEventHandlingAttrs.test.js
|
||||
packages/renderer/MdToHtml/linkReplacement.js
|
||||
packages/renderer/MdToHtml/linkReplacement.test.js
|
||||
packages/renderer/MdToHtml/renderMedia.js
|
||||
|
20
.yarn/patches/react-native-camera-npm-4.2.1-24b2600a7e.patch
Normal file
20
.yarn/patches/react-native-camera-npm-4.2.1-24b2600a7e.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
diff --git a/src/RNCamera.js b/src/RNCamera.js
|
||||
index b7a271ad64771c0f654dbd5fe3c0d9e0d2e2c4ef..1182a40ace081a32fbaefe2bc4a499b79c2e7dac 100644
|
||||
--- a/src/RNCamera.js
|
||||
+++ b/src/RNCamera.js
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
findNodeHandle,
|
||||
Platform,
|
||||
NativeModules,
|
||||
- ViewPropTypes,
|
||||
requireNativeComponent,
|
||||
View,
|
||||
ActivityIndicator,
|
||||
@@ -14,6 +13,7 @@ import {
|
||||
PermissionsAndroid,
|
||||
} from 'react-native';
|
||||
|
||||
+import ViewPropTypes from 'deprecated-react-native-prop-types';
|
||||
import type { FaceFeature } from './FaceDetector';
|
||||
|
||||
const Rationale = PropTypes.shape({
|
60
README.md
60
README.md
@@ -530,47 +530,47 @@ Current translations:
|
||||
<!-- LOCALE-TABLE-AUTO-GENERATED -->
|
||||
| Language | Po File | Last translator | Percent done
|
||||
---|---|---|---|---
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/arableague.png" width="16px"/> | Arabic | [ar](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/ar.po) | [Whaell O](mailto:Whaell@protonmail.com) | 81%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/arableague.png" width="16px"/> | Arabic | [ar](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/ar.po) | [Whaell O](mailto:Whaell@protonmail.com) | 80%
|
||||
<img src="https://joplinapp.org/images/flags/es/basque_country.png" width="16px"/> | Basque | [eu](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/eu.po) | juan.abasolo@ehu.eus | 23%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/ba.png" width="16px"/> | Bosnian (Bosna i Hercegovina) | [bs_BA](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/bs_BA.po) | [Derviš T.](mailto:dervis.t@pm.me) | 58%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/bg.png" width="16px"/> | Bulgarian (България) | [bg_BG](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/bg_BG.po) | | 45%
|
||||
<img src="https://joplinapp.org/images/flags/es/catalonia.png" width="16px"/> | Catalan | [ca](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/ca.po) | [Xavi Ivars](mailto:xavi.ivars@gmail.com) | 90%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/hr.png" width="16px"/> | Croatian (Hrvatska) | [hr_HR](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/hr_HR.po) | [Milo Ivir](mailto:mail@milotype.de) | 90%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/cz.png" width="16px"/> | Czech (Česká republika) | [cs_CZ](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/cs_CZ.po) | [Michal Stanke](mailto:michal@stanke.cz) | 78%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/dk.png" width="16px"/> | Dansk (Danmark) | [da_DK](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/da_DK.po) | ERYpTION | 97%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/de.png" width="16px"/> | Deutsch (Deutschland) | [de_DE](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/de_DE.po) | [MrKanister](mailto:pueblos_spatulas@aleeas.com) | 98%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/ee.png" width="16px"/> | Eesti Keel (Eesti) | [et_EE](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/et_EE.po) | | 45%
|
||||
<img src="https://joplinapp.org/images/flags/es/catalonia.png" width="16px"/> | Catalan | [ca](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/ca.po) | [Xavi Ivars](mailto:xavi.ivars@gmail.com) | 89%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/hr.png" width="16px"/> | Croatian (Hrvatska) | [hr_HR](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/hr_HR.po) | [Milo Ivir](mailto:mail@milotype.de) | 89%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/cz.png" width="16px"/> | Czech (Česká republika) | [cs_CZ](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/cs_CZ.po) | [Michal Stanke](mailto:michal@stanke.cz) | 77%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/dk.png" width="16px"/> | Dansk (Danmark) | [da_DK](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/da_DK.po) | ERYpTION | 99%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/de.png" width="16px"/> | Deutsch (Deutschland) | [de_DE](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/de_DE.po) | [MrKanister](mailto:pueblos_spatulas@aleeas.com) | 99%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/ee.png" width="16px"/> | Eesti Keel (Eesti) | [et_EE](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/et_EE.po) | | 44%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/gb.png" width="16px"/> | English (United Kingdom) | [en_GB](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/en_GB.po) | | 100%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/us.png" width="16px"/> | English (United States of America) | [en_US](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/en_US.po) | | 100%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/es.png" width="16px"/> | Español (España) | [es_ES](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/es_ES.po) | [Francisco Mora](mailto:francisco.m.collao@gmail.com) | 89%
|
||||
<img src="https://joplinapp.org/images/flags/esperanto.png" width="16px"/> | Esperanto | [eo](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/eo.po) | Marton Paulo | 26%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/fi.png" width="16px"/> | Finnish (Suomi) | [fi_FI](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/fi_FI.po) | mrkaato0 | 96%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/fr.png" width="16px"/> | Français (France) | [fr_FR](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/fr_FR.po) | Laurent Cozic | 100%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/es.png" width="16px"/> | Español (España) | [es_ES](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/es_ES.po) | [Francisco Villaverde](mailto:teko.gr@gmail.com) | 99%
|
||||
<img src="https://joplinapp.org/images/flags/esperanto.png" width="16px"/> | Esperanto | [eo](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/eo.po) | Marton Paulo | 25%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/fi.png" width="16px"/> | Finnish (Suomi) | [fi_FI](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/fi_FI.po) | mrkaato0 | 95%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/fr.png" width="16px"/> | Français (France) | [fr_FR](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/fr_FR.po) | Laurent Cozic | 99%
|
||||
<img src="https://joplinapp.org/images/flags/es/galicia.png" width="16px"/> | Galician (España) | [gl_ES](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/gl_ES.po) | [Marcos Lans](mailto:marcoslansgarza@gmail.com) | 29%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/id.png" width="16px"/> | Indonesian (Indonesia) | [id_ID](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/id_ID.po) | [Wisnu Adi Santoso](mailto:waditos@gmail.com) | 90%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/id.png" width="16px"/> | Indonesian (Indonesia) | [id_ID](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/id_ID.po) | [Wisnu Adi Santoso](mailto:waditos@gmail.com) | 89%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/it.png" width="16px"/> | Italiano (Italia) | [it_IT](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/it_IT.po) | [Manuel Tassi](mailto:mannivuwiki@gmail.com) | 81%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/hu.png" width="16px"/> | Magyar (Magyarország) | [hu_HU](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/hu_HU.po) | [Magyari Balázs](mailto:balmag@gmail.com) | 78%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/be.png" width="16px"/> | Nederlands (België, Belgique, Belgien) | [nl_BE](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/nl_BE.po) | | 79%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/nl.png" width="16px"/> | Nederlands (Nederland) | [nl_NL](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/nl_NL.po) | [MHolkamp](mailto:mholkamp@users.noreply.github.com) | 89%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/no.png" width="16px"/> | Norwegian (Norge, Noreg) | [nb_NO](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/nb_NO.po) | [Mats Estensen](mailto:code@mxe.no) | 89%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/ir.png" width="16px"/> | Persian | [fa](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/fa.po) | [Kourosh Firoozbakht](mailto:kourox@protonmail.com) | 56%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/pl.png" width="16px"/> | Polski (Polska) | [pl_PL](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/pl_PL.po) | [X3NO](mailto:X3NO@disroot.org) | 90%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/br.png" width="16px"/> | Português (Brasil) | [pt_BR](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/pt_BR.po) | [Renato Nunes Bastos](mailto:rnbastos@gmail.com) | 89%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/nl.png" width="16px"/> | Nederlands (Nederland) | [nl_NL](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/nl_NL.po) | [MHolkamp](mailto:mholkamp@users.noreply.github.com) | 88%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/no.png" width="16px"/> | Norwegian (Norge, Noreg) | [nb_NO](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/nb_NO.po) | [Mats Estensen](mailto:code@mxe.no) | 88%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/ir.png" width="16px"/> | Persian | [fa](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/fa.po) | [Kourosh Firoozbakht](mailto:kourox@protonmail.com) | 55%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/pl.png" width="16px"/> | Polski (Polska) | [pl_PL](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/pl_PL.po) | [X3NO](mailto:X3NO@disroot.org) | 91%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/br.png" width="16px"/> | Português (Brasil) | [pt_BR](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/pt_BR.po) | [Renato Nunes Bastos](mailto:rnbastos@gmail.com) | 88%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/pt.png" width="16px"/> | Português (Portugal) | [pt_PT](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/pt_PT.po) | [Diogo Caveiro](mailto:dcaveiro@yahoo.com) | 73%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/ro.png" width="16px"/> | Română | [ro](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/ro.po) | [Cristi Duluta](mailto:cristi.duluta@gmail.com) | 51%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/si.png" width="16px"/> | Slovenian (Slovenija) | [sl_SI](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/sl_SI.po) | [Martin Korelič](mailto:martin.korelic@protonmail.com) | 81%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/se.png" width="16px"/> | Svenska | [sv](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/sv.po) | [Jonatan Nyberg](mailto:jonatan@autistici.org) | 97%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/th.png" width="16px"/> | Thai (ประเทศไทย) | [th_TH](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/th_TH.po) | | 37%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/vn.png" width="16px"/> | Tiếng Việt | [vi](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/vi.po) | | 79%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/tr.png" width="16px"/> | Türkçe (Türkiye) | [tr_TR](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/tr_TR.po) | [Arda Kılıçdağı](mailto:arda@kilicdagi.com) | 90%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/ua.png" width="16px"/> | Ukrainian (Україна) | [uk_UA](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/uk_UA.po) | [Vyacheslav Andreykiv](mailto:vandreykiv@gmail.com) | 73%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/gr.png" width="16px"/> | Ελληνικά (Ελλάδα) | [el_GR](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/el_GR.po) | [Harris Arvanitis](mailto:xaris@tuta.io) | 89%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/ru.png" width="16px"/> | Русский (Россия) | [ru_RU](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/ru_RU.po) | [Sergey Segeda](mailto:thesermanarm@gmail.com) | 81%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/rs.png" width="16px"/> | српски језик (Србија) | [sr_RS](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/sr_RS.po) | | 66%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/cn.png" width="16px"/> | 中文 (简体) | [zh_CN](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/zh_CN.po) | [KaneGreen](mailto:737445366KG@Gmail.com) | 95%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/tw.png" width="16px"/> | 中文 (繁體) | [zh_TW](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/zh_TW.po) | [Kevin Hsu](mailto:kevin.hsu.hws@gmail.com) | 90%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/jp.png" width="16px"/> | 日本語 (日本) | [ja_JP](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/ja_JP.po) | [genneko](mailto:genneko217@gmail.com) | 90%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/kr.png" width="16px"/> | 한국어 | [ko](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/ko.po) | [Ji-Hyeon Gim](mailto:potatogim@potatogim.net) | 90%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/si.png" width="16px"/> | Slovenian (Slovenija) | [sl_SI](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/sl_SI.po) | [Martin Korelič](mailto:martin.korelic@protonmail.com) | 80%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/se.png" width="16px"/> | Svenska | [sv](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/sv.po) | [Jonatan Nyberg](mailto:jonatan@autistici.org) | 96%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/th.png" width="16px"/> | Thai (ประเทศไทย) | [th_TH](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/th_TH.po) | | 36%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/vn.png" width="16px"/> | Tiếng Việt | [vi](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/vi.po) | | 78%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/tr.png" width="16px"/> | Türkçe (Türkiye) | [tr_TR](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/tr_TR.po) | [Arda Kılıçdağı](mailto:arda@kilicdagi.com) | 89%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/ua.png" width="16px"/> | Ukrainian (Україна) | [uk_UA](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/uk_UA.po) | [Vyacheslav Andreykiv](mailto:vandreykiv@gmail.com) | 72%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/gr.png" width="16px"/> | Ελληνικά (Ελλάδα) | [el_GR](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/el_GR.po) | [Harris Arvanitis](mailto:xaris@tuta.io) | 88%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/ru.png" width="16px"/> | Русский (Россия) | [ru_RU](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/ru_RU.po) | [Dmitriy Q](mailto:krotesk@mail.ru) | 99%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/rs.png" width="16px"/> | српски језик (Србија) | [sr_RS](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/sr_RS.po) | | 65%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/cn.png" width="16px"/> | 中文 (简体) | [zh_CN](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/zh_CN.po) | [wh201906](mailto:wh201906@yandex.com) | 97%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/tw.png" width="16px"/> | 中文 (繁體) | [zh_TW](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/zh_TW.po) | [Kevin Hsu](mailto:kevin.hsu.hws@gmail.com) | 89%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/jp.png" width="16px"/> | 日本語 (日本) | [ja_JP](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/ja_JP.po) | [genneko](mailto:genneko217@gmail.com) | 89%
|
||||
<img src="https://joplinapp.org/images/flags/country-4x3/kr.png" width="16px"/> | 한국어 | [ko](https://github.com/laurent22/joplin/blob/dev/packages/tools/locales/ko.po) | [Ji-Hyeon Gim](mailto:potatogim@potatogim.net) | 89%
|
||||
<!-- LOCALE-TABLE-AUTO-GENERATED -->
|
||||
|
||||
# Contributors
|
||||
|
@@ -6,7 +6,6 @@ const tasks = {
|
||||
buildCommandIndex: require('./packages/tools/gulp/tasks/buildCommandIndex'),
|
||||
completePublishAll: {
|
||||
fn: async () => {
|
||||
|
||||
await utils.execCommandVerbose('git', ['add', '-A']);
|
||||
await utils.execCommandVerbose('git', ['commit', '-m', 'Releasing sub-packages']);
|
||||
|
||||
@@ -17,6 +16,10 @@ const tasks = {
|
||||
// https://github.com/lerna/lerna/issues/2788
|
||||
await utils.execCommandVerbose('lerna', ['publish', 'from-package', '-y', '--no-verify-access']);
|
||||
|
||||
await utils.execCommandVerbose('yarn', ['install']);
|
||||
await utils.execCommandVerbose('git', ['add', '-A']);
|
||||
await utils.execCommandVerbose('git', ['commit', '-m', 'Lock file']);
|
||||
|
||||
await utils.execCommandVerbose('git', ['push']);
|
||||
},
|
||||
},
|
||||
|
@@ -78,8 +78,8 @@
|
||||
"gulp": "4.0.2",
|
||||
"husky": "3.1.0",
|
||||
"lerna": "3.22.1",
|
||||
"lint-staged": "13.1.0",
|
||||
"madge": "5.0.2",
|
||||
"lint-staged": "13.1.2",
|
||||
"madge": "6.0.0",
|
||||
"npm-package-json-lint": "6.4.0",
|
||||
"typedoc": "0.17.8",
|
||||
"typescript": "4.9.4"
|
||||
@@ -90,5 +90,8 @@
|
||||
"node-gyp": "9.3.1",
|
||||
"nodemon": "2.0.20"
|
||||
},
|
||||
"packageManager": "yarn@3.3.1"
|
||||
"packageManager": "yarn@3.3.1",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
@@ -246,6 +246,7 @@ class Application extends BaseApplication {
|
||||
showConsole: () => {},
|
||||
maximizeConsole: () => {},
|
||||
stdout: text => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(text);
|
||||
},
|
||||
fullScreen: () => {},
|
||||
@@ -407,6 +408,7 @@ class Application extends BaseApplication {
|
||||
if (this.showStackTraces_) {
|
||||
console.error(error);
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(error.message);
|
||||
}
|
||||
process.exit(1);
|
||||
|
@@ -125,14 +125,14 @@ async function handleAutocompletionPromise(line) {
|
||||
}
|
||||
function handleAutocompletion(str, callback) {
|
||||
// eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied
|
||||
handleAutocompletionPromise(str).then(function(res) {
|
||||
handleAutocompletionPromise(str).then((res) => {
|
||||
callback(undefined, res);
|
||||
});
|
||||
}
|
||||
function toCommandLine(args) {
|
||||
if (Array.isArray(args)) {
|
||||
return args
|
||||
.map(function(a) {
|
||||
.map((a) => {
|
||||
if (a.indexOf('"') !== -1 || a.indexOf(' ') !== -1) {
|
||||
return `'${a}'`;
|
||||
} else if (a.indexOf('\'') !== -1) {
|
||||
|
@@ -1,97 +0,0 @@
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const locale_1 = require("@joplin/lib/locale");
|
||||
const registry_js_1 = require("@joplin/lib/registry.js");
|
||||
class BaseCommand {
|
||||
constructor() {
|
||||
this.stdout_ = null;
|
||||
this.prompt_ = null;
|
||||
}
|
||||
usage() {
|
||||
throw new Error('Usage not defined');
|
||||
}
|
||||
encryptionCheck(item) {
|
||||
if (item && item.encryption_applied)
|
||||
throw new Error((0, locale_1._)('Cannot change encrypted item'));
|
||||
}
|
||||
description() {
|
||||
throw new Error('Description not defined');
|
||||
}
|
||||
action(_args) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
throw new Error('Action not defined');
|
||||
});
|
||||
}
|
||||
compatibleUis() {
|
||||
return ['cli', 'gui'];
|
||||
}
|
||||
supportsUi(ui) {
|
||||
return this.compatibleUis().indexOf(ui) >= 0;
|
||||
}
|
||||
options() {
|
||||
return [];
|
||||
}
|
||||
hidden() {
|
||||
return false;
|
||||
}
|
||||
enabled() {
|
||||
return true;
|
||||
}
|
||||
cancellable() {
|
||||
return false;
|
||||
}
|
||||
cancel() {
|
||||
return __awaiter(this, void 0, void 0, function* () { });
|
||||
}
|
||||
name() {
|
||||
const r = this.usage().split(' ');
|
||||
return r[0];
|
||||
}
|
||||
setDispatcher(fn) {
|
||||
this.dispatcher_ = fn;
|
||||
}
|
||||
dispatch(action) {
|
||||
if (!this.dispatcher_)
|
||||
throw new Error('Dispatcher not defined');
|
||||
return this.dispatcher_(action);
|
||||
}
|
||||
setStdout(fn) {
|
||||
this.stdout_ = fn;
|
||||
}
|
||||
stdout(text) {
|
||||
if (this.stdout_)
|
||||
this.stdout_(text);
|
||||
}
|
||||
setPrompt(fn) {
|
||||
this.prompt_ = fn;
|
||||
}
|
||||
prompt(message, options = null) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!this.prompt_)
|
||||
throw new Error('Prompt is undefined');
|
||||
return yield this.prompt_(message, options);
|
||||
});
|
||||
}
|
||||
metadata() {
|
||||
return {
|
||||
name: this.name(),
|
||||
usage: this.usage(),
|
||||
options: this.options(),
|
||||
hidden: this.hidden(),
|
||||
};
|
||||
}
|
||||
logger() {
|
||||
return registry_js_1.reg.logger();
|
||||
}
|
||||
}
|
||||
exports.default = BaseCommand;
|
||||
//# sourceMappingURL=base-command.js.map
|
@@ -131,6 +131,7 @@ async function main() {
|
||||
const commandsText = commandBlocks.join('\n\n');
|
||||
const footerText = getFooter();
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(`${headerText}\n\n` + 'USAGE' + `\n\n${commandsText}\n\n${footerText}`);
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint-disable no-console */
|
||||
|
||||
const fs = require('fs-extra');
|
||||
const Logger = require('@joplin/lib/Logger').default;
|
||||
const { dirname } = require('@joplin/lib/path-utils');
|
||||
|
@@ -82,6 +82,7 @@ cliUtils.makeCommandArgs = function(cmd, argv) {
|
||||
const options = cmd.options();
|
||||
const booleanFlags = [];
|
||||
const aliases = {};
|
||||
const flagSpecs = [];
|
||||
for (let i = 0; i < options.length; i++) {
|
||||
if (options[i].length !== 2) throw new Error(`Invalid options: ${options[i]}`);
|
||||
let flags = options[i][0];
|
||||
@@ -96,6 +97,8 @@ cliUtils.makeCommandArgs = function(cmd, argv) {
|
||||
if (flags.short && flags.long) {
|
||||
aliases[flags.long] = [flags.short];
|
||||
}
|
||||
|
||||
flagSpecs.push(flags);
|
||||
}
|
||||
|
||||
const args = yargParser(argv, {
|
||||
@@ -121,6 +124,19 @@ cliUtils.makeCommandArgs = function(cmd, argv) {
|
||||
argOptions[key] = args[key];
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(argOptions)) {
|
||||
const flagSpec = flagSpecs.find(s => {
|
||||
return s.short === key || s.long === key;
|
||||
});
|
||||
if (flagSpec?.arg?.required) {
|
||||
// If a flag is required, and no value is provided for it, Yargs
|
||||
// sets the value to `true`.
|
||||
if (value === true) {
|
||||
throw new Error(_('Missing required flag value: %s', `-${flagSpec.short} <${flagSpec.arg.name}>`));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
output.options = argOptions;
|
||||
|
||||
return output;
|
||||
|
@@ -39,9 +39,9 @@ class Command extends BaseCommand {
|
||||
let settingsObj;
|
||||
try {
|
||||
settingsObj = JSON.parse(json);
|
||||
} catch (err) {
|
||||
} catch (error) {
|
||||
isSettled = true;
|
||||
return reject(new Error(`Invalid JSON passed to config --import: \n${err.message}.`));
|
||||
return reject(new Error(`Invalid JSON passed to config --import: \n${error.message}.`));
|
||||
}
|
||||
if (settingsObj) {
|
||||
Object.entries(settingsObj)
|
||||
|
@@ -1,21 +0,0 @@
|
||||
const BaseCommand = require('./base-command').default;
|
||||
const { app } = require('./app.js');
|
||||
const { _ } = require('@joplin/lib/locale');
|
||||
const Folder = require('@joplin/lib/models/Folder').default;
|
||||
|
||||
class Command extends BaseCommand {
|
||||
usage() {
|
||||
return 'mkbook <new-notebook>';
|
||||
}
|
||||
|
||||
description() {
|
||||
return _('Creates a new notebook.');
|
||||
}
|
||||
|
||||
async action(args) {
|
||||
const folder = await Folder.save({ title: args['new-notebook'] }, { userSideValidation: true });
|
||||
app().switchCurrentFolder(folder);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Command;
|
50
packages/app-cli/app/command-mkbook.test.ts
Normal file
50
packages/app-cli/app/command-mkbook.test.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
|
||||
import { setupCommandForTesting, setupApplication } from './utils/testUtils';
|
||||
import Folder from '@joplin/lib/models/Folder';
|
||||
const Command = require('./command-mkbook');
|
||||
|
||||
|
||||
describe('command-mkbook', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await setupDatabaseAndSynchronizer(1);
|
||||
await switchClient(1);
|
||||
await setupApplication();
|
||||
});
|
||||
|
||||
|
||||
it('should create a subfolder in first folder', async () => {
|
||||
const command = setupCommandForTesting(Command);
|
||||
await command.action({ 'new-notebook': 'folder1', options: {} });
|
||||
await command.action({ 'new-notebook': 'folder1_1', options: { parent: 'folder1' } });
|
||||
|
||||
const folder1 = await Folder.loadByTitle('folder1');
|
||||
const folder1_1 = await Folder.loadByTitle('folder1_1');
|
||||
|
||||
expect(folder1.title).toBe('folder1');
|
||||
expect(folder1_1.parent_id).toBe(folder1.id);
|
||||
});
|
||||
|
||||
it('should not be possible to create a subfolder without an argument.', async () => {
|
||||
const command = setupCommandForTesting(Command);
|
||||
await command.action({ 'new-notebook': 'folder2', options: {} });
|
||||
await expect(command.action({ 'new-notebook': 'folder2_1', options: { parent: true } })).rejects.toThrowError();
|
||||
});
|
||||
|
||||
it('should not be possible to create subfolder in ambiguous destination folder', async () => {
|
||||
const command = setupCommandForTesting(Command);
|
||||
await command.action({ 'new-notebook': 'folder3', options: {} });
|
||||
await command.action({ 'new-notebook': 'folder3', options: {} }); // ambiguous folder
|
||||
await expect(command.action({ 'new-notebook': 'folder3_1', options: { parent: 'folder3' } })).rejects.toThrowError();
|
||||
|
||||
// check if duplicate entries have been created.
|
||||
const folderAll = await Folder.all();
|
||||
const folders3 = folderAll.filter(x => x.title === 'folder3');
|
||||
expect(folders3.length).toBe(2);
|
||||
|
||||
// check if something has been created in one of the duplicate entries.
|
||||
expect(await Folder.childrenIds(folders3[0].id)).toEqual([]);
|
||||
expect(await Folder.childrenIds(folders3[1].id)).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
65
packages/app-cli/app/command-mkbook.ts
Normal file
65
packages/app-cli/app/command-mkbook.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
const BaseCommand = require('./base-command').default;
|
||||
const { app } = require('./app.js');
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import BaseModel from '@joplin/lib/BaseModel';
|
||||
import Folder from '@joplin/lib/models/Folder';
|
||||
import { FolderEntity } from '@joplin/lib/services/database/types';
|
||||
|
||||
class Command extends BaseCommand {
|
||||
usage() {
|
||||
return 'mkbook <new-notebook>';
|
||||
}
|
||||
|
||||
description() {
|
||||
return _('Creates a new notebook.');
|
||||
}
|
||||
|
||||
options() {
|
||||
return [
|
||||
['-p, --parent <parent-notebook>', _('Create a new notebook under a parent notebook.')],
|
||||
];
|
||||
}
|
||||
|
||||
// validDestinationFolder check for presents and ambiguous folders
|
||||
async validDestinationFolder(targetFolder: string) {
|
||||
|
||||
const destinationFolder = await app().loadItem(BaseModel.TYPE_FOLDER, targetFolder);
|
||||
if (!destinationFolder) {
|
||||
throw new Error(_('Cannot find: "%s"', targetFolder));
|
||||
}
|
||||
|
||||
const destinationDups = await Folder.search({ titlePattern: targetFolder, limit: 2 });
|
||||
if (destinationDups.length > 1) {
|
||||
throw new Error(_('Ambiguous notebook "%s". Please use short notebook id instead - press "ti" to see the short notebook id', targetFolder));
|
||||
}
|
||||
|
||||
return destinationFolder;
|
||||
}
|
||||
|
||||
async saveAndSwitchFolder(newFolder: FolderEntity) {
|
||||
|
||||
const folder = await Folder.save(newFolder, { userSideValidation: true });
|
||||
app().switchCurrentFolder(folder);
|
||||
|
||||
}
|
||||
|
||||
async action(args: any) {
|
||||
const targetFolder = args.options.parent;
|
||||
|
||||
const newFolder: FolderEntity = {
|
||||
title: args['new-notebook'],
|
||||
};
|
||||
|
||||
if (targetFolder) {
|
||||
|
||||
const destinationFolder = await this.validDestinationFolder(targetFolder);
|
||||
newFolder.parent_id = destinationFolder.id;
|
||||
await this.saveAndSwitchFolder(newFolder);
|
||||
|
||||
} else {
|
||||
await this.saveAndSwitchFolder(newFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Command;
|
@@ -9,11 +9,11 @@ import { appTypeToLockType } from '@joplin/lib/services/synchronizer/LockHandler
|
||||
const BaseCommand = require('./base-command').default;
|
||||
const { app } = require('./app.js');
|
||||
const { OneDriveApiNodeUtils } = require('@joplin/lib/onedrive-api-node-utils.js');
|
||||
const { reg } = require('@joplin/lib/registry.js');
|
||||
import { reg } from '@joplin/lib/registry';
|
||||
const { cliUtils } = require('./cli-utils.js');
|
||||
const md5 = require('md5');
|
||||
const locker = require('proper-lockfile');
|
||||
const fs = require('fs-extra');
|
||||
import * as locker from 'proper-lockfile';
|
||||
import { pathExists, writeFile } from 'fs-extra';
|
||||
|
||||
class Command extends BaseCommand {
|
||||
|
||||
@@ -37,21 +37,12 @@ class Command extends BaseCommand {
|
||||
];
|
||||
}
|
||||
|
||||
static async lockFile(filePath: string): Promise<Function> {
|
||||
private static async lockFile(filePath: string) {
|
||||
return locker.lock(filePath, { stale: 1000 * 60 * 5 });
|
||||
}
|
||||
|
||||
static isLocked(filePath: string) {
|
||||
return new Promise((resolve, reject) => {
|
||||
locker.check(filePath, (error: any, isLocked: boolean) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
|
||||
resolve(isLocked);
|
||||
});
|
||||
});
|
||||
private static async isLocked(filePath: string) {
|
||||
return locker.check(filePath);
|
||||
}
|
||||
|
||||
async doAuth() {
|
||||
@@ -114,7 +105,7 @@ class Command extends BaseCommand {
|
||||
|
||||
// Lock is unique per profile/database
|
||||
const lockFilePath = `${require('os').tmpdir()}/synclock_${md5(escape(Setting.value('profileDir')))}`; // https://github.com/pvorb/node-md5/issues/41
|
||||
if (!(await fs.pathExists(lockFilePath))) await fs.writeFile(lockFilePath, 'synclock');
|
||||
if (!(await pathExists(lockFilePath))) await writeFile(lockFilePath, 'synclock');
|
||||
|
||||
const useLock = args.options.useLock !== 0;
|
||||
|
||||
|
@@ -118,6 +118,7 @@ class Command extends BaseCommand {
|
||||
}
|
||||
await Promise.all(promises);
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(await api.exec('GET', 'api/items/root:/testing:'));
|
||||
}
|
||||
|
||||
|
@@ -75,14 +75,14 @@ if (process.platform === 'win32') {
|
||||
output: process.stdout,
|
||||
});
|
||||
|
||||
rl.on('SIGINT', function() {
|
||||
rl.on('SIGINT', () => {
|
||||
process.emit('SIGINT');
|
||||
});
|
||||
}
|
||||
|
||||
process.stdout.on('error', function(err) {
|
||||
process.stdout.on('error', (error) => {
|
||||
// https://stackoverflow.com/questions/12329816/error-write-epipe-when-piping-node-output-to-head#15884508
|
||||
if (err.code === 'EPIPE') {
|
||||
if (error.code === 'EPIPE') {
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
|
@@ -11,6 +11,7 @@ function createConsoleWrapper(pluginId: string) {
|
||||
const wrapper: any = {};
|
||||
|
||||
for (const n in console) {
|
||||
// eslint-disable-next-line no-console
|
||||
if (!console.hasOwnProperty(n)) continue;
|
||||
wrapper[n] = (...args: any[]) => {
|
||||
const newArgs = args.slice();
|
||||
|
@@ -34,7 +34,7 @@
|
||||
],
|
||||
"owner": "Laurent Cozic"
|
||||
},
|
||||
"version": "2.10.0",
|
||||
"version": "2.10.3",
|
||||
"bin": "./main.js",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
@@ -51,7 +51,7 @@
|
||||
"keytar": "7.9.0",
|
||||
"md5": "2.3.0",
|
||||
"node-rsa": "1.1.1",
|
||||
"open": "8.4.0",
|
||||
"open": "8.4.1",
|
||||
"proper-lockfile": "4.1.2",
|
||||
"read-chunk": "2.1.0",
|
||||
"server-destroy": "1.0.1",
|
||||
@@ -72,8 +72,9 @@
|
||||
"@types/fs-extra": "9.0.13",
|
||||
"@types/jest": "29.2.6",
|
||||
"@types/node": "18.11.18",
|
||||
"@types/proper-lockfile": "^4.1.2",
|
||||
"gulp": "4.0.2",
|
||||
"jest": "29.3.1",
|
||||
"jest": "29.4.3",
|
||||
"temp": "0.9.4",
|
||||
"typescript": "4.9.4"
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ const shim = require('@joplin/lib/shim').default;
|
||||
const HtmlToHtml = require('@joplin/renderer/HtmlToHtml').default;
|
||||
const { enexXmlToMd } = require('@joplin/lib/import-enex-md-gen.js');
|
||||
|
||||
describe('HtmlToHtml', function() {
|
||||
describe('HtmlToHtml', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await setupDatabaseAndSynchronizer(1);
|
||||
@@ -49,6 +49,7 @@ describe('HtmlToHtml', function() {
|
||||
}
|
||||
|
||||
if (actualHtml !== expectedHtml) {
|
||||
/* eslint-disable no-console */
|
||||
console.info('');
|
||||
console.info(`Error converting file: ${htmlSourceFilename}`);
|
||||
console.info('--------------------------------- Got:');
|
||||
@@ -59,6 +60,7 @@ describe('HtmlToHtml', function() {
|
||||
console.info(expectedHtml.split('\n'));
|
||||
console.info('--------------------------------------------');
|
||||
console.info('');
|
||||
/* eslint-enable */
|
||||
|
||||
expect(false).toBe(true);
|
||||
// return;
|
||||
|
@@ -3,7 +3,7 @@ const os = require('os');
|
||||
const { filename } = require('@joplin/lib/path-utils');
|
||||
import HtmlToMd from '@joplin/lib/HtmlToMd';
|
||||
|
||||
describe('HtmlToMd', function() {
|
||||
describe('HtmlToMd', () => {
|
||||
|
||||
it('should convert from Html to Markdown', (async () => {
|
||||
const basePath = `${__dirname}/html_to_md`;
|
||||
@@ -57,6 +57,7 @@ describe('HtmlToMd', function() {
|
||||
result.push('--------------------------------------------');
|
||||
result.push('');
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(result.join('\n'));
|
||||
|
||||
// console.info('');
|
||||
|
@@ -1,7 +1,7 @@
|
||||
|
||||
const MarkupToHtml = require('@joplin/renderer/MarkupToHtml').default;
|
||||
|
||||
describe('MarkupToHtml', function() {
|
||||
describe('MarkupToHtml', () => {
|
||||
|
||||
it('should strip markup', (async () => {
|
||||
const service = new MarkupToHtml();
|
||||
|
@@ -16,7 +16,7 @@ function newTestMdToHtml(options: any = null) {
|
||||
return new MdToHtml(options);
|
||||
}
|
||||
|
||||
describe('MdToHtml', function() {
|
||||
describe('MdToHtml', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await setupDatabaseAndSynchronizer(1);
|
||||
@@ -72,6 +72,7 @@ describe('MdToHtml', function() {
|
||||
'',
|
||||
];
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(msg.join('\n'));
|
||||
|
||||
expect(false).toBe(true);
|
||||
|
@@ -22,7 +22,7 @@ const goToNote = (testApp, note) => {
|
||||
testApp.dispatch({ type: 'NOTE_SELECT', id: note.id });
|
||||
};
|
||||
|
||||
describe('feature_NoteHistory', function() {
|
||||
describe('feature_NoteHistory', () => {
|
||||
beforeEach(async () => {
|
||||
testApp = new TestApp();
|
||||
await testApp.start(['--no-welcome']);
|
||||
|
@@ -8,7 +8,7 @@ const time = require('@joplin/lib/time').default;
|
||||
|
||||
let testApp = null;
|
||||
|
||||
describe('integration_NoteList', function() {
|
||||
describe('integration_NoteList', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
testApp = new TestApp();
|
||||
|
@@ -22,7 +22,7 @@ const { ALL_NOTES_FILTER_ID } = require('@joplin/lib/reserved-ids.js');
|
||||
|
||||
let testApp = null;
|
||||
|
||||
describe('integration_ShowAllNotes', function() {
|
||||
describe('integration_ShowAllNotes', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
testApp = new TestApp();
|
||||
|
@@ -8,7 +8,7 @@ const time = require('@joplin/lib/time').default;
|
||||
|
||||
let testApp = null;
|
||||
|
||||
describe('integration_TagList', function() {
|
||||
describe('integration_TagList', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
testApp = new TestApp();
|
||||
|
@@ -11,7 +11,7 @@ function describeIfCompatible(name: string, fn: any, elseFn: any) {
|
||||
}
|
||||
}
|
||||
|
||||
describeIfCompatible('services_KeychainService', function() {
|
||||
describeIfCompatible('services_KeychainService', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await setupDatabaseAndSynchronizer(1, { keychainEnabled: true });
|
||||
|
@@ -29,7 +29,7 @@ function newPluginService(appVersion: string = '1.4') {
|
||||
return service;
|
||||
}
|
||||
|
||||
describe('services_PluginService', function() {
|
||||
describe('services_PluginService', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await setupDatabaseAndSynchronizer(1);
|
||||
|
@@ -8,7 +8,7 @@ async function newRepoApi(): Promise<RepositoryApi> {
|
||||
return repo;
|
||||
}
|
||||
|
||||
describe('services_plugins_RepositoryApi', function() {
|
||||
describe('services_plugins_RepositoryApi', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await setupDatabaseAndSynchronizer(1);
|
||||
|
@@ -24,7 +24,7 @@ function newPluginService(appVersion: string = '1.4') {
|
||||
return service;
|
||||
}
|
||||
|
||||
describe('defaultPluginsUtils', function() {
|
||||
describe('defaultPluginsUtils', () => {
|
||||
|
||||
const pluginsId = ['joplin.plugin.ambrt.backlinksToNote', 'org.joplinapp.plugins.ToggleSidebars'];
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
const sandboxProxy = require('@joplin/lib/services/plugins/sandboxProxy');
|
||||
import { setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
|
||||
|
||||
describe('services_plugins_sandboxProxy', function() {
|
||||
describe('services_plugins_sandboxProxy', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await setupDatabaseAndSynchronizer(1);
|
||||
|
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
// This script can be used to simulate a running production environment, by
|
||||
// having multiple users in parallel changing notes and synchronising.
|
||||
//
|
||||
|
@@ -50,7 +50,7 @@ async function browserGetZoom(tabId) {
|
||||
});
|
||||
}
|
||||
|
||||
browser_.runtime.onInstalled.addListener(function() {
|
||||
browser_.runtime.onInstalled.addListener(() => {
|
||||
if (window.joplinEnv() === 'dev') {
|
||||
browser_.browserAction.setIcon({
|
||||
path: 'icons/32-dev.png',
|
||||
@@ -165,7 +165,7 @@ async function sendClipMessage(clipType) {
|
||||
}
|
||||
}
|
||||
|
||||
browser_.commands.onCommand.addListener(function(command) {
|
||||
browser_.commands.onCommand.addListener((command) => {
|
||||
// We could enumerate these twice, but since we're in here first,
|
||||
// why not save ourselves the trouble with this convention
|
||||
if (command.startsWith('clip')) {
|
||||
|
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
(function() {
|
||||
|
||||
if (window.jopext_hasRun) return;
|
||||
|
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
/* eslint-disable no-console */
|
||||
|
||||
// Do this as the first thing so that any code reading it knows the right env.
|
||||
process.env.BABEL_ENV = 'development';
|
||||
process.env.NODE_ENV = 'development';
|
||||
@@ -104,9 +106,9 @@ checkBrowsers(paths.appPath, isInteractive)
|
||||
);
|
||||
const devServer = new WebpackDevServer(compiler, serverConfig);
|
||||
// Launch WebpackDevServer.
|
||||
devServer.listen(port, HOST, err => {
|
||||
if (err) {
|
||||
return console.log(err);
|
||||
devServer.listen(port, HOST, error => {
|
||||
if (error) {
|
||||
return console.log(error);
|
||||
}
|
||||
if (isInteractive) {
|
||||
clearConsole();
|
||||
@@ -128,16 +130,16 @@ checkBrowsers(paths.appPath, isInteractive)
|
||||
openBrowser(urls.localUrlForBrowser);
|
||||
});
|
||||
|
||||
['SIGINT', 'SIGTERM'].forEach(function(sig) {
|
||||
process.on(sig, function() {
|
||||
['SIGINT', 'SIGTERM'].forEach((sig) => {
|
||||
process.on(sig, () => {
|
||||
devServer.close();
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
if (err && err.message) {
|
||||
console.log(err.message);
|
||||
.catch(error => {
|
||||
if (error && error.message) {
|
||||
console.log(error.message);
|
||||
}
|
||||
process.exit(1);
|
||||
});
|
||||
|
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
const { randomClipperPort } = require('./randomClipperPort');
|
||||
|
||||
function msleep(ms) {
|
||||
|
@@ -1,3 +1,5 @@
|
||||
/* eslint-disable no-console */
|
||||
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
@@ -114,7 +116,13 @@ async function main() {
|
||||
|
||||
console.info('Popup: Creating React app...');
|
||||
|
||||
ReactDOM.render(<Provider store={store}><App /></Provider>, document.getElementById('root'));
|
||||
ReactDOM.render(
|
||||
<div style = {{ maxHeight: screen.height * 0.65, overflowY: 'scroll' }}>
|
||||
<Provider store={store}>
|
||||
<App />
|
||||
</Provider>
|
||||
</div>,
|
||||
document.getElementById('root'));
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
|
@@ -3,7 +3,7 @@ import { PluginMessage } from './services/plugins/PluginRunner';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import { isCallbackUrl } from '@joplin/lib/callbackUrlUtils';
|
||||
|
||||
const { BrowserWindow, Tray, screen } = require('electron');
|
||||
import { BrowserWindow, Tray, screen } from 'electron';
|
||||
const url = require('url');
|
||||
const path = require('path');
|
||||
const { dirname } = require('@joplin/lib/path-utils');
|
||||
@@ -25,7 +25,7 @@ export default class ElectronAppWrapper {
|
||||
private env_: string;
|
||||
private isDebugMode_: boolean;
|
||||
private profilePath_: string;
|
||||
private win_: any = null;
|
||||
private win_: BrowserWindow = null;
|
||||
private willQuitApp_: boolean = false;
|
||||
private tray_: any = null;
|
||||
private buildDir_: string = null;
|
||||
@@ -117,7 +117,7 @@ export default class ElectronAppWrapper {
|
||||
this.win_.setPosition(primaryDisplayWidth / 2 - windowWidth, primaryDisplayHeight / 2 - windowHeight);
|
||||
}
|
||||
|
||||
this.win_.loadURL(url.format({
|
||||
void this.win_.loadURL(url.format({
|
||||
pathname: path.join(__dirname, 'index.html'),
|
||||
protocol: 'file:',
|
||||
slashes: true,
|
||||
|
@@ -40,6 +40,7 @@ export default class InteropServiceHelper {
|
||||
const service = InteropService.instance();
|
||||
|
||||
const result = await service.export(fullExportOptions);
|
||||
// eslint-disable-next-line no-console
|
||||
console.info('Export HTML result: ', result);
|
||||
return tempFile;
|
||||
}
|
||||
@@ -190,6 +191,7 @@ export default class InteropServiceHelper {
|
||||
|
||||
try {
|
||||
const result = await service.export(exportOptions);
|
||||
// eslint-disable-next-line no-console
|
||||
console.info('Export result: ', result);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { AppState } from './app.reducer';
|
||||
import appReducer, { createAppDefaultState } from './app.reducer';
|
||||
|
||||
describe('app.reducer', function() {
|
||||
describe('app.reducer', () => {
|
||||
|
||||
it('DIALOG_OPEN', async () => {
|
||||
const state: AppState = createAppDefaultState({}, {});
|
||||
|
@@ -38,6 +38,7 @@ export interface AppState extends State {
|
||||
watchedResources: any;
|
||||
mainLayout: LayoutItem;
|
||||
dialogs: AppStateDialog[];
|
||||
isResettingLayout: boolean;
|
||||
}
|
||||
|
||||
export function createAppDefaultState(windowContentSize: any, resourceEditWatcherDefaultState: any): AppState {
|
||||
@@ -60,6 +61,7 @@ export function createAppDefaultState(windowContentSize: any, resourceEditWatche
|
||||
mainLayout: null,
|
||||
startupPluginsLoaded: false,
|
||||
dialogs: [],
|
||||
isResettingLayout: false,
|
||||
...resourceEditWatcherDefaultState,
|
||||
};
|
||||
}
|
||||
@@ -308,7 +310,15 @@ export default function(state: AppState, action: any) {
|
||||
};
|
||||
break;
|
||||
|
||||
|
||||
case 'RESET_LAYOUT':
|
||||
newState = {
|
||||
...state,
|
||||
isResettingLayout: action.value,
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
error.message = `In reducer: ${error.message} Action: ${JSON.stringify(action)}`;
|
||||
throw error;
|
||||
|
@@ -55,7 +55,7 @@ export interface PluginItem {
|
||||
hasBeenUpdated: boolean;
|
||||
}
|
||||
|
||||
const CellRoot = styled.div<{isCompatible: boolean}>`
|
||||
const CellRoot = styled.div<{ isCompatible: boolean }>`
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
background-color: ${props => props.theme.backgroundColor};
|
||||
@@ -104,7 +104,7 @@ const DevModeLabel = styled.div`
|
||||
color: ${props => props.theme.color};
|
||||
`;
|
||||
|
||||
const StyledNameAndVersion = styled.div<{mb: any}>`
|
||||
const StyledNameAndVersion = styled.div<{ mb: any }>`
|
||||
font-family: ${props => props.theme.fontFamily};
|
||||
color: ${props => props.theme.color};
|
||||
font-size: ${props => props.theme.fontSize}px;
|
||||
|
@@ -225,7 +225,7 @@ export default function(props: Props) {
|
||||
];
|
||||
|
||||
const menu = bridge().Menu.buildFromTemplate(template);
|
||||
menu.popup(bridge().window());
|
||||
menu.popup({ window: bridge().window() });
|
||||
}, [onInstall, onBrowsePlugins]);
|
||||
|
||||
const onSearchQueryChange = useCallback((event: OnChangeEvent) => {
|
||||
|
@@ -8,6 +8,7 @@ interface Props {
|
||||
onKeyDown?: Function;
|
||||
itemRenderer: Function;
|
||||
className?: string;
|
||||
onNoteDrop?: Function;
|
||||
}
|
||||
|
||||
interface State {
|
||||
@@ -29,6 +30,7 @@ class ItemList extends React.Component<Props, State> {
|
||||
|
||||
this.onScroll = this.onScroll.bind(this);
|
||||
this.onKeyDown = this.onKeyDown.bind(this);
|
||||
this.onDrop = this.onDrop.bind(this);
|
||||
}
|
||||
|
||||
visibleItemCount(props: Props = undefined) {
|
||||
@@ -76,6 +78,10 @@ class ItemList extends React.Component<Props, State> {
|
||||
if (this.props.onKeyDown) this.props.onKeyDown(event);
|
||||
}
|
||||
|
||||
onDrop(event: any) {
|
||||
if (this.props.onNoteDrop) this.props.onNoteDrop(event);
|
||||
}
|
||||
|
||||
makeItemIndexVisible(itemIndex: number) {
|
||||
const top = Math.min(this.props.items.length - 1, this.state.topItemIndex);
|
||||
const bottom = Math.max(0, this.state.bottomItemIndex);
|
||||
@@ -141,7 +147,7 @@ class ItemList extends React.Component<Props, State> {
|
||||
if (this.props.className) classes.push(this.props.className);
|
||||
|
||||
return (
|
||||
<div ref={this.listRef} className={classes.join(' ')} style={style} onScroll={this.onScroll} onKeyDown={this.onKeyDown}>
|
||||
<div ref={this.listRef} className={classes.join(' ')} style={style} onScroll={this.onScroll} onKeyDown={this.onKeyDown} onDrop={this.onDrop}>
|
||||
{itemComps}
|
||||
</div>
|
||||
);
|
||||
|
@@ -61,8 +61,8 @@ export const KeymapConfigScreen = ({ themeId }: KeymapConfigScreenProps) => {
|
||||
try {
|
||||
const keymapFile = await shim.fsDriver().readFile(actualFilePath, 'utf-8');
|
||||
overrideKeymapItems(JSON.parse(keymapFile));
|
||||
} catch (err) {
|
||||
bridge().showErrorMessageBox(_('Error: %s', err.message));
|
||||
} catch (error) {
|
||||
bridge().showErrorMessageBox(_('Error: %s', error.message));
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -77,8 +77,8 @@ export const KeymapConfigScreen = ({ themeId }: KeymapConfigScreenProps) => {
|
||||
try {
|
||||
// KeymapService is already synchronized with the in-state keymap
|
||||
await keymapService.saveCustomKeymap(filePath);
|
||||
} catch (err) {
|
||||
bridge().showErrorMessageBox(err.message);
|
||||
} catch (error) {
|
||||
bridge().showerrororMessageBox(error.message);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -62,11 +62,11 @@ const useKeymap = (): [
|
||||
// Then, update the state with the data from KeymapService
|
||||
// Side-effect: Changes will also be saved to the disk
|
||||
setKeymapItems(keymapService.getKeymapItems());
|
||||
} catch (err) {
|
||||
} catch (error) {
|
||||
// oldKeymapItems includes even the unchanged keymap items
|
||||
// However, it is not an issue because the logic accounts for such scenarios
|
||||
keymapService.overrideKeymap(oldKeymapItems);
|
||||
throw err;
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -80,8 +80,8 @@ const useKeymap = (): [
|
||||
keymapService.overrideKeymap(keymapItems);
|
||||
await keymapService.saveCustomKeymap();
|
||||
setKeymapError(null);
|
||||
} catch (err) {
|
||||
const error = new Error(`Could not save file: ${err.message}`);
|
||||
} catch (error) {
|
||||
error.message = `Could not save file: ${error.message}`;
|
||||
setKeymapError(error);
|
||||
}
|
||||
}
|
||||
|
@@ -78,6 +78,7 @@ interface Props {
|
||||
isSafeMode: boolean;
|
||||
needApiAuth: boolean;
|
||||
processingShareInvitationResponse: boolean;
|
||||
isResettingLayout: boolean;
|
||||
}
|
||||
|
||||
interface ShareFolderDialogOptions {
|
||||
@@ -172,7 +173,6 @@ class MainScreenComponent extends React.Component<Props, State> {
|
||||
}
|
||||
|
||||
private openCallbackUrl(url: string) {
|
||||
console.log(`openUrl ${url}`);
|
||||
const { command, params } = parseCallbackUrl(url);
|
||||
void CommandService.instance().execute(command.toString(), params.id);
|
||||
}
|
||||
@@ -372,6 +372,15 @@ class MainScreenComponent extends React.Component<Props, State> {
|
||||
name: 'promptDialog',
|
||||
});
|
||||
}
|
||||
|
||||
if (this.props.isResettingLayout) {
|
||||
Setting.setValue('ui.layout', null);
|
||||
this.updateMainLayout(this.buildLayout(this.props.plugins));
|
||||
this.props.dispatch({
|
||||
type: 'RESET_LAYOUT',
|
||||
value: false,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
layoutModeListenerKeyDown(event: any) {
|
||||
@@ -393,6 +402,7 @@ class MainScreenComponent extends React.Component<Props, State> {
|
||||
|
||||
async waitForNoteToSaved(noteId: string) {
|
||||
while (noteId && this.props.editorNoteStatuses[noteId] === 'saving') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info('Waiting for note to be saved...', this.props.editorNoteStatuses);
|
||||
await time.msleep(100);
|
||||
}
|
||||
@@ -401,6 +411,7 @@ class MainScreenComponent extends React.Component<Props, State> {
|
||||
async printTo_(target: string, options: any) {
|
||||
// Concurrent print calls are disallowed to avoid incorrect settings being restored upon completion
|
||||
if (this.isPrinting_) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(`Printing ${options.path} to ${target} disallowed, already printing.`);
|
||||
return;
|
||||
}
|
||||
@@ -879,6 +890,7 @@ const mapStateToProps = (state: AppState) => {
|
||||
isSafeMode: state.settings.isSafeMode,
|
||||
needApiAuth: state.needApiAuth,
|
||||
showInstallTemplatesPlugin: state.hasLegacyTemplates && !state.pluginService.plugins['joplin.plugin.templates'],
|
||||
isResettingLayout: state.isResettingLayout,
|
||||
};
|
||||
};
|
||||
|
||||
|
@@ -20,6 +20,7 @@ import * as openTag from './openTag';
|
||||
import * as print from './print';
|
||||
import * as renameFolder from './renameFolder';
|
||||
import * as renameTag from './renameTag';
|
||||
import * as resetLayout from './resetLayout';
|
||||
import * as revealResourceFile from './revealResourceFile';
|
||||
import * as search from './search';
|
||||
import * as setTags from './setTags';
|
||||
@@ -61,6 +62,7 @@ const index:any[] = [
|
||||
print,
|
||||
renameFolder,
|
||||
renameTag,
|
||||
resetLayout,
|
||||
revealResourceFile,
|
||||
search,
|
||||
setTags,
|
||||
|
@@ -14,7 +14,6 @@ export const runtime = (): CommandRuntime => {
|
||||
const resource = await Resource.load(resourceId);
|
||||
if (!resource) throw new Error(`No such resource: ${resourceId}`);
|
||||
if (resource.mime !== 'application/pdf') throw new Error(`Not a PDF: ${resource.mime}`);
|
||||
console.log('Opening PDF', resource);
|
||||
context.dispatch({
|
||||
type: 'DIALOG_OPEN',
|
||||
name: 'pdfViewer',
|
||||
|
25
packages/app-desktop/gui/MainScreen/commands/resetLayout.ts
Normal file
25
packages/app-desktop/gui/MainScreen/commands/resetLayout.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/services/CommandService';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import dialogs from '../../dialogs';
|
||||
|
||||
export const declaration: CommandDeclaration = {
|
||||
name: 'resetLayout',
|
||||
label: () => _('Reset application layout'),
|
||||
};
|
||||
|
||||
export const runtime = (): CommandRuntime => {
|
||||
return {
|
||||
execute: async (context: CommandContext) => {
|
||||
|
||||
const message = _('Are you sure you want to return to the default layout? The current layout configuration will be lost.');
|
||||
const isConfirmed = await dialogs.confirm(message);
|
||||
|
||||
if (!isConfirmed) return;
|
||||
|
||||
context.dispatch({
|
||||
type: 'RESET_LAYOUT',
|
||||
value: true,
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
@@ -20,7 +20,7 @@ export const runtime = (): CommandRuntime => {
|
||||
|
||||
const menuItems = SpellCheckerService.instance().spellCheckerConfigMenuItems(selectedLanguages, useSpellChecker);
|
||||
const menu = Menu.buildFromTemplate(menuItems as any);
|
||||
menu.popup(bridge().window());
|
||||
menu.popup({ window: bridge().window() });
|
||||
},
|
||||
|
||||
mapStateToTitle(state: AppState): string {
|
||||
|
@@ -271,6 +271,7 @@ function useMenu(props: Props) {
|
||||
const service = InteropService.instance();
|
||||
try {
|
||||
const result = await service.import(importOptions);
|
||||
// eslint-disable-next-line no-console
|
||||
console.info('Import result: ', result);
|
||||
} catch (error) {
|
||||
bridge().showErrorMessageBox(error.message);
|
||||
@@ -511,14 +512,14 @@ function useMenu(props: Props) {
|
||||
// Issue: https://github.com/laurent22/joplin/issues/934
|
||||
submenu: [{
|
||||
label: _('About Joplin'),
|
||||
visible: shim.isMac() ? true : false,
|
||||
visible: !!shim.isMac(),
|
||||
click: () => _showAbout(),
|
||||
}, {
|
||||
type: 'separator',
|
||||
visible: shim.isMac() ? true : false,
|
||||
visible: !!shim.isMac(),
|
||||
}, {
|
||||
label: _('Preferences...'),
|
||||
visible: shim.isMac() ? true : false,
|
||||
visible: !!shim.isMac(),
|
||||
accelerator: shim.isMac() && keymapService.getAccelerator('config'),
|
||||
click: () => {
|
||||
props.dispatch({
|
||||
@@ -528,11 +529,11 @@ function useMenu(props: Props) {
|
||||
},
|
||||
}, {
|
||||
label: _('Check for updates...'),
|
||||
visible: shim.isMac() ? true : false,
|
||||
visible: !!shim.isMac(),
|
||||
click: () => _checkForUpdates(),
|
||||
}, {
|
||||
type: 'separator',
|
||||
visible: shim.isMac() ? true : false,
|
||||
visible: !!shim.isMac(),
|
||||
},
|
||||
shim.isMac() ? noItem : newNoteItem,
|
||||
shim.isMac() ? noItem : newTodoItem,
|
||||
@@ -540,14 +541,14 @@ function useMenu(props: Props) {
|
||||
shim.isMac() ? noItem : newSubFolderItem,
|
||||
{
|
||||
type: 'separator',
|
||||
visible: shim.isMac() ? false : true,
|
||||
visible: !shim.isMac(),
|
||||
}, {
|
||||
label: _('Import'),
|
||||
visible: shim.isMac() ? false : true,
|
||||
visible: !shim.isMac(),
|
||||
submenu: importItems,
|
||||
}, {
|
||||
label: _('Export all'),
|
||||
visible: shim.isMac() ? false : true,
|
||||
visible: !shim.isMac(),
|
||||
submenu: exportItems,
|
||||
}, {
|
||||
type: 'separator',
|
||||
@@ -585,7 +586,7 @@ function useMenu(props: Props) {
|
||||
|
||||
const rootMenuFileMacOs = {
|
||||
label: _('&File'),
|
||||
visible: shim.isMac() ? true : false,
|
||||
visible: !!shim.isMac(),
|
||||
submenu: [
|
||||
newNoteItem,
|
||||
newTodoItem,
|
||||
@@ -634,6 +635,7 @@ function useMenu(props: Props) {
|
||||
menuItemDic.textCopy,
|
||||
menuItemDic.textCut,
|
||||
menuItemDic.textPaste,
|
||||
menuItemDic.pasteAsText,
|
||||
menuItemDic.textSelectAll,
|
||||
separator(),
|
||||
// Using the generic "undo"/"redo" roles mean the menu
|
||||
@@ -673,6 +675,7 @@ function useMenu(props: Props) {
|
||||
label: _('&View'),
|
||||
submenu: [
|
||||
menuItemDic.toggleLayoutMoveMode,
|
||||
menuItemDic.resetLayout,
|
||||
separator(),
|
||||
menuItemDic.toggleSideBar,
|
||||
menuItemDic.toggleNoteList,
|
||||
@@ -785,12 +788,15 @@ function useMenu(props: Props) {
|
||||
}, {
|
||||
label: _('Joplin Forum'),
|
||||
click() { void bridge().openExternal('https://discourse.joplinapp.org'); },
|
||||
}, {
|
||||
label: _('Join us on Twitter'),
|
||||
click() { void bridge().openExternal('https://twitter.com/joplinapp'); },
|
||||
}, {
|
||||
label: _('Make a donation'),
|
||||
click() { void bridge().openExternal('https://joplinapp.org/donate/'); },
|
||||
}, {
|
||||
label: _('Check for updates...'),
|
||||
visible: shim.isMac() ? false : true,
|
||||
visible: !shim.isMac(),
|
||||
click: () => _checkForUpdates(),
|
||||
},
|
||||
separator(),
|
||||
@@ -812,10 +818,10 @@ function useMenu(props: Props) {
|
||||
|
||||
{
|
||||
type: 'separator',
|
||||
visible: shim.isMac() ? false : true,
|
||||
visible: !shim.isMac(),
|
||||
}, {
|
||||
label: _('About Joplin'),
|
||||
visible: shim.isMac() ? false : true,
|
||||
visible: !shim.isMac(),
|
||||
click: () => _showAbout(),
|
||||
}],
|
||||
},
|
||||
|
@@ -42,7 +42,7 @@ export default function MultiNoteActions(props: MultiNoteActionsProps) {
|
||||
|
||||
const multiNotesButton_click = (item: any) => {
|
||||
if (item.submenu) {
|
||||
item.submenu.popup(bridge().window());
|
||||
item.submenu.popup({ window: bridge().window() });
|
||||
} else {
|
||||
item.click();
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ import convertToScreenCoordinates from '../../../utils/convertToScreenCoordinate
|
||||
import { MarkupToHtml } from '@joplin/renderer';
|
||||
const { clipboard } = require('electron');
|
||||
const debounce = require('debounce');
|
||||
const shared = require('@joplin/lib/components/shared/note-screen-shared.js');
|
||||
import shared from '@joplin/lib/components/shared/note-screen-shared';
|
||||
const Menu = bridge().Menu;
|
||||
const MenuItem = bridge().MenuItem;
|
||||
import { reg } from '@joplin/lib/registry';
|
||||
@@ -276,11 +276,22 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
|
||||
const editorCutText = useCallback(() => {
|
||||
if (editorRef.current) {
|
||||
const selections = editorRef.current.getSelections();
|
||||
if (selections.length > 0) {
|
||||
if (selections.length > 0 && selections[0]) {
|
||||
clipboard.writeText(selections[0]);
|
||||
// Easy way to wipe out just the first selection
|
||||
selections[0] = '';
|
||||
editorRef.current.replaceSelections(selections);
|
||||
} else {
|
||||
const cursor = editorRef.current.getCursor();
|
||||
const line = editorRef.current.getLine(cursor.line);
|
||||
clipboard.writeText(`${line}\n`);
|
||||
const startLine = editorRef.current.getCursor('head');
|
||||
startLine.ch = 0;
|
||||
const endLine = {
|
||||
line: startLine.line + 1,
|
||||
ch: 0,
|
||||
};
|
||||
editorRef.current.replaceRange('', startLine, endLine);
|
||||
}
|
||||
}
|
||||
}, []);
|
||||
@@ -352,7 +363,7 @@ function CodeMirror(props: NoteBodyEditorProps, ref: any) {
|
||||
let cancelled = false;
|
||||
|
||||
async function loadScripts() {
|
||||
const scriptsToLoad: {src: string; id: string; loaded: boolean}[] = [
|
||||
const scriptsToLoad: { src: string; id: string; loaded: boolean }[] = [
|
||||
{
|
||||
src: `${bridge().vendorDir()}/lib/codemirror/addon/dialog/dialog.css`,
|
||||
id: 'codemirrorDialogStyle',
|
||||
|
@@ -128,8 +128,18 @@ export default function useEditorSearch(CodeMirror: any) {
|
||||
// We only want to scroll the first keyword into view in the case of a multi keyword search
|
||||
const scrollTo = i === 0 && (previousKeywordValue !== keyword.value || previousIndex !== options.selectedIndex || options.searchTimestamp !== previousSearchTimestamp);
|
||||
|
||||
const match = highlightSearch(this, searchTerm, options.selectedIndex, scrollTo, !!options.withSelection);
|
||||
if (match) marks.push(match);
|
||||
try {
|
||||
const match = highlightSearch(this, searchTerm, options.selectedIndex, scrollTo, !!options.withSelection);
|
||||
if (match) marks.push(match);
|
||||
} catch (error) {
|
||||
if (error.name !== 'SyntaxError') {
|
||||
throw error;
|
||||
}
|
||||
// An error of 'Regular expression too large' might occour in the markJs library
|
||||
// when the input is really big, this catch is here to avoid the application crashing
|
||||
// https://github.com/laurent22/joplin/issues/7634
|
||||
console.error('Error while trying to highlight words from search: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
setMarkers(marks);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// Helper commands added to the the CodeMirror instance
|
||||
export default function useJoplinCommands(CodeMirror: any) {
|
||||
|
||||
CodeMirror.defineExtension('commandExists', function(name: string) {
|
||||
CodeMirror.defineExtension('commandExists', (name: string) => {
|
||||
return !!CodeMirror.commands[name];
|
||||
});
|
||||
}
|
||||
|
@@ -93,7 +93,7 @@ export default function useKeymap(CodeMirror: any) {
|
||||
}
|
||||
|
||||
|
||||
CodeMirror.defineExtension('supportsCommand', function(cmd: EditorCommand) {
|
||||
CodeMirror.defineExtension('supportsCommand', (cmd: EditorCommand) => {
|
||||
return isEditorCommand(cmd.name) && editorCommandToCodeMirror(cmd.name) in CodeMirror.commands;
|
||||
});
|
||||
|
||||
|
@@ -24,6 +24,7 @@ import { MarkupToHtmlOptions } from '../../utils/useMarkupToHtml';
|
||||
import { themeStyle } from '@joplin/lib/theme';
|
||||
import { loadScript } from '../../../utils/loadScript';
|
||||
import bridge from '../../../../services/bridge';
|
||||
import { TinyMceEditorEvents } from './utils/types';
|
||||
const { clipboard } = require('electron');
|
||||
const supportedLocales = require('./supportedLocales');
|
||||
|
||||
@@ -76,6 +77,16 @@ function stripMarkup(markupLanguage: number, markup: string, options: any = null
|
||||
return markupToHtml_.stripMarkup(markupLanguage, markup, options);
|
||||
}
|
||||
|
||||
function createSyntheticClipboardEventWithoutHTML(): ClipboardEvent {
|
||||
const clipboardData = new DataTransfer();
|
||||
for (const format of clipboard.availableFormats()) {
|
||||
if (format !== 'text/html') {
|
||||
clipboardData.setData(format, clipboard.read(format));
|
||||
}
|
||||
}
|
||||
return new ClipboardEvent('paste', { clipboardData });
|
||||
}
|
||||
|
||||
interface TinyMceCommand {
|
||||
name: string;
|
||||
value?: any;
|
||||
@@ -159,7 +170,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
||||
const nodeName = event.target ? event.target.nodeName : '';
|
||||
|
||||
if (nodeName === 'INPUT' && event.target.getAttribute('type') === 'checkbox') {
|
||||
editor.fire('joplinChange');
|
||||
editor.fire(TinyMceEditorEvents.JoplinChange);
|
||||
dispatchDidUpdate(editor);
|
||||
}
|
||||
|
||||
@@ -251,7 +262,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
||||
},
|
||||
replaceSelection: (value: any) => {
|
||||
editor.selection.setContent(value);
|
||||
editor.fire('joplinChange');
|
||||
editor.fire(TinyMceEditorEvents.JoplinChange);
|
||||
dispatchDidUpdate(editor);
|
||||
|
||||
// It doesn't make sense but it seems calling setContent
|
||||
@@ -260,6 +271,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
||||
// https://github.com/tinymce/tinymce/issues/3745
|
||||
window.requestAnimationFrame(() => editor.undoManager.add());
|
||||
},
|
||||
pasteAsText: () => editor.fire(TinyMceEditorEvents.PasteAsText),
|
||||
};
|
||||
|
||||
if (additionalCommands[cmd.name]) {
|
||||
@@ -339,6 +351,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
||||
continue;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.info('Loading script', s.src);
|
||||
|
||||
await loadScript(s);
|
||||
@@ -661,9 +674,9 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
||||
props_onDrop.current(event);
|
||||
});
|
||||
|
||||
editor.on('ObjectResized', function(event: any) {
|
||||
editor.on('ObjectResized', (event: any) => {
|
||||
if (event.target.nodeName === 'IMG') {
|
||||
editor.fire('joplinChange');
|
||||
editor.fire(TinyMceEditorEvents.JoplinChange);
|
||||
dispatchDidUpdate(editor);
|
||||
}
|
||||
});
|
||||
@@ -972,6 +985,15 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
const onSetAttrib = (event: any) => {
|
||||
// Dispatch onChange when a link is edited
|
||||
if (event.attrElm[0].nodeName === 'A') {
|
||||
if (event.attrName === 'title' || event.attrName === 'href' || event.attrName === 'rel') {
|
||||
onChangeHandler();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Keypress means that a printable key (letter, digit, etc.) has been
|
||||
// pressed so we want to always trigger onChange in this case
|
||||
function onKeypress() {
|
||||
@@ -992,7 +1014,7 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
async function onPaste(event: any) {
|
||||
async function onPaste(event: ClipboardEvent) {
|
||||
// We do not use the default pasting behaviour because the input has
|
||||
// to be processed in various ways.
|
||||
event.preventDefault();
|
||||
@@ -1070,33 +1092,41 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
editor.on('keyup', onKeyUp);
|
||||
editor.on('keydown', onKeyDown);
|
||||
editor.on('keypress', onKeypress);
|
||||
editor.on('paste', onPaste);
|
||||
editor.on('copy', onCopy);
|
||||
async function onPasteAsText() {
|
||||
await onPaste(createSyntheticClipboardEventWithoutHTML());
|
||||
}
|
||||
|
||||
editor.on(TinyMceEditorEvents.KeyUp, onKeyUp);
|
||||
editor.on(TinyMceEditorEvents.KeyDown, onKeyDown);
|
||||
editor.on(TinyMceEditorEvents.KeyPress, onKeypress);
|
||||
editor.on(TinyMceEditorEvents.Paste, onPaste);
|
||||
editor.on(TinyMceEditorEvents.PasteAsText, onPasteAsText);
|
||||
editor.on(TinyMceEditorEvents.Copy, onCopy);
|
||||
// `compositionend` means that a user has finished entering a Chinese
|
||||
// (or other languages that require IME) character.
|
||||
editor.on('compositionend', onChangeHandler);
|
||||
editor.on('cut', onCut);
|
||||
editor.on('joplinChange', onChangeHandler);
|
||||
editor.on('Undo', onChangeHandler);
|
||||
editor.on('Redo', onChangeHandler);
|
||||
editor.on('ExecCommand', onExecCommand);
|
||||
editor.on(TinyMceEditorEvents.CompositionEnd, onChangeHandler);
|
||||
editor.on(TinyMceEditorEvents.Cut, onCut);
|
||||
editor.on(TinyMceEditorEvents.JoplinChange, onChangeHandler);
|
||||
editor.on(TinyMceEditorEvents.Undo, onChangeHandler);
|
||||
editor.on(TinyMceEditorEvents.Redo, onChangeHandler);
|
||||
editor.on(TinyMceEditorEvents.ExecCommand, onExecCommand);
|
||||
editor.on(TinyMceEditorEvents.SetAttrib, onSetAttrib);
|
||||
|
||||
return () => {
|
||||
try {
|
||||
editor.off('keyup', onKeyUp);
|
||||
editor.off('keydown', onKeyDown);
|
||||
editor.off('keypress', onKeypress);
|
||||
editor.off('paste', onPaste);
|
||||
editor.off('copy', onCopy);
|
||||
editor.off('compositionend', onChangeHandler);
|
||||
editor.off('cut', onCut);
|
||||
editor.off('joplinChange', onChangeHandler);
|
||||
editor.off('Undo', onChangeHandler);
|
||||
editor.off('Redo', onChangeHandler);
|
||||
editor.off('ExecCommand', onExecCommand);
|
||||
editor.off(TinyMceEditorEvents.KeyUp, onKeyUp);
|
||||
editor.off(TinyMceEditorEvents.KeyDown, onKeyDown);
|
||||
editor.off(TinyMceEditorEvents.KeyPress, onKeypress);
|
||||
editor.off(TinyMceEditorEvents.Paste, onPaste);
|
||||
editor.off(TinyMceEditorEvents.PasteAsText, onPasteAsText);
|
||||
editor.off(TinyMceEditorEvents.Copy, onCopy);
|
||||
editor.off(TinyMceEditorEvents.CompositionEnd, onChangeHandler);
|
||||
editor.off(TinyMceEditorEvents.Cut, onCut);
|
||||
editor.off(TinyMceEditorEvents.JoplinChange, onChangeHandler);
|
||||
editor.off(TinyMceEditorEvents.Undo, onChangeHandler);
|
||||
editor.off(TinyMceEditorEvents.Redo, onChangeHandler);
|
||||
editor.off(TinyMceEditorEvents.ExecCommand, onExecCommand);
|
||||
editor.off(TinyMceEditorEvents.SetAttrib, onSetAttrib);
|
||||
} catch (error) {
|
||||
console.warn('Error removing events', error);
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
import { MarkupToHtml } from '@joplin/renderer';
|
||||
import { TinyMceEditorEvents } from './types';
|
||||
const taboverride = require('taboverride');
|
||||
|
||||
interface SourceInfo {
|
||||
@@ -102,7 +103,7 @@ export default function openEditDialog(editor: any, markupToHtml: any, dispatchD
|
||||
}
|
||||
|
||||
dialogApi.close();
|
||||
editor.fire('joplinChange');
|
||||
editor.fire(TinyMceEditorEvents.JoplinChange);
|
||||
dispatchDidUpdate(editor);
|
||||
},
|
||||
onClose: () => {
|
||||
|
@@ -51,7 +51,7 @@ export default function(editor: any) {
|
||||
editor.execCommand('mceToggleFormat', false, def.name);
|
||||
},
|
||||
onSetup: function(api: any) {
|
||||
editor.formatter.formatChanged(def.name, function(state: boolean) {
|
||||
editor.formatter.formatChanged(def.name, (state: boolean) => {
|
||||
api.setActive(state);
|
||||
});
|
||||
},
|
||||
|
@@ -0,0 +1,16 @@
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export enum TinyMceEditorEvents {
|
||||
KeyUp = 'keyup',
|
||||
KeyDown = 'keydown',
|
||||
KeyPress = 'keypress',
|
||||
Paste = 'paste',
|
||||
PasteAsText = 'pasteAsText',
|
||||
Copy = 'copy',
|
||||
CompositionEnd = 'compositionend',
|
||||
Cut = 'cut',
|
||||
JoplinChange = 'joplinChange',
|
||||
Undo = 'Undo',
|
||||
Redo = 'Redo',
|
||||
ExecCommand = 'ExecCommand',
|
||||
SetAttrib = 'SetAttrib',
|
||||
}
|
@@ -11,6 +11,7 @@ import convertToScreenCoordinates from '../../../../utils/convertToScreenCoordin
|
||||
import Setting from '@joplin/lib/models/Setting';
|
||||
|
||||
import Resource from '@joplin/lib/models/Resource';
|
||||
import { TinyMceEditorEvents } from './types';
|
||||
|
||||
const menuUtils = new MenuUtils(CommandService.instance());
|
||||
|
||||
@@ -77,6 +78,9 @@ export default function(editor: any, plugins: PluginStates, dispatch: Function)
|
||||
editor.insertContent(content);
|
||||
},
|
||||
isReadOnly: false,
|
||||
fireEditorEvent: (event: TinyMceEditorEvents) => {
|
||||
editor.fire(event);
|
||||
},
|
||||
};
|
||||
|
||||
let template = [];
|
||||
@@ -103,7 +107,7 @@ export default function(editor: any, plugins: PluginStates, dispatch: Function)
|
||||
template = template.concat(menuUtils.pluginContextMenuItems(plugins, MenuItemLocation.EditorContextMenu));
|
||||
|
||||
const menu = bridge().Menu.buildFromTemplate(template);
|
||||
menu.popup(bridge().window());
|
||||
menu.popup({ window: bridge().window() });
|
||||
}
|
||||
|
||||
bridge().window().webContents.on('context-menu', onContextMenu);
|
||||
|
@@ -1,12 +1,14 @@
|
||||
// AUTO-GENERATED using `gulp buildCommandIndex`
|
||||
import * as focusElementNoteBody from './focusElementNoteBody';
|
||||
import * as focusElementNoteTitle from './focusElementNoteTitle';
|
||||
import * as pasteAsText from './pasteAsText';
|
||||
import * as showLocalSearch from './showLocalSearch';
|
||||
import * as showRevisions from './showRevisions';
|
||||
|
||||
const index:any[] = [
|
||||
focusElementNoteBody,
|
||||
focusElementNoteTitle,
|
||||
pasteAsText,
|
||||
showLocalSearch,
|
||||
showRevisions,
|
||||
];
|
||||
|
16
packages/app-desktop/gui/NoteEditor/commands/pasteAsText.ts
Normal file
16
packages/app-desktop/gui/NoteEditor/commands/pasteAsText.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { CommandRuntime, CommandDeclaration } from '@joplin/lib/services/CommandService';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
|
||||
export const declaration: CommandDeclaration = {
|
||||
name: 'pasteAsText',
|
||||
label: () => _('Paste as text'),
|
||||
};
|
||||
|
||||
export const runtime = (comp: any): CommandRuntime => {
|
||||
return {
|
||||
execute: async () => {
|
||||
comp.editorRef.current.execCommand({ name: 'pasteAsText' });
|
||||
},
|
||||
enabledCondition: 'oneNoteSelected && richTextEditorVisible',
|
||||
};
|
||||
};
|
@@ -10,6 +10,7 @@ import BaseItem from '@joplin/lib/models/BaseItem';
|
||||
import BaseModel from '@joplin/lib/BaseModel';
|
||||
import { processPastedHtml } from './resourceHandling';
|
||||
import { NoteEntity, ResourceEntity } from '@joplin/lib/services/database/types';
|
||||
import { TinyMceEditorEvents } from '../NoteBody/TinyMCE/utils/types';
|
||||
const fs = require('fs-extra');
|
||||
const { writeFile } = require('fs-extra');
|
||||
const { clipboard } = require('electron');
|
||||
@@ -176,6 +177,13 @@ export function menuItems(dispatch: Function): ContextMenuItems {
|
||||
},
|
||||
isActive: (_itemType: ContextMenuItemType, options: ContextMenuOptions) => !options.isReadOnly && (!!clipboard.readText() || !!clipboard.readHTML()),
|
||||
},
|
||||
pasteAsText: {
|
||||
label: _('Paste as text'),
|
||||
onAction: async (options: ContextMenuOptions) => {
|
||||
options.fireEditorEvent(TinyMceEditorEvents.PasteAsText);
|
||||
},
|
||||
isActive: (_itemType: ContextMenuItemType, options: ContextMenuOptions) => !options.isReadOnly && (!!clipboard.readText() || !!clipboard.readHTML()),
|
||||
},
|
||||
copyLinkUrl: {
|
||||
label: _('Copy Link Address'),
|
||||
onAction: async (options: ContextMenuOptions) => {
|
||||
|
@@ -19,6 +19,7 @@ export interface ContextMenuOptions {
|
||||
htmlToCopy: string;
|
||||
insertContent: Function;
|
||||
isReadOnly?: boolean;
|
||||
fireEditorEvent: Function;
|
||||
}
|
||||
|
||||
export interface ContextMenuItem {
|
||||
@@ -106,8 +107,8 @@ export const svgUriToPng = (document: Document, svg: string, width: number, heig
|
||||
canvas.remove();
|
||||
img.remove();
|
||||
resolve(buff);
|
||||
} catch (err) {
|
||||
cleanUpAndReject(err);
|
||||
} catch (error) {
|
||||
cleanUpAndReject(error);
|
||||
}
|
||||
};
|
||||
img.onerror = function(e) {
|
||||
|
@@ -9,7 +9,7 @@ export default function(dependencies: HookDependencies) {
|
||||
const { folderId } = dependencies;
|
||||
const [folder, setFolder] = useState(null);
|
||||
|
||||
useEffect(function() {
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
|
||||
async function loadFolder() {
|
||||
|
@@ -192,7 +192,7 @@ export default function useFormNote(dependencies: HookDependencies) {
|
||||
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
|
||||
}, [noteId, isProvisional, formNote]);
|
||||
|
||||
const onResourceChange = useCallback(async function(event: any = null) {
|
||||
const onResourceChange = useCallback(async (event: any = null) => {
|
||||
const resourceIds = await Note.linkedResourceIds(formNote.body);
|
||||
if (!event || resourceIds.indexOf(event.id) >= 0) {
|
||||
clearResourceCache();
|
||||
|
@@ -13,6 +13,7 @@ export default function useMessageHandler(scrollWhenReady: any, setScrollWhenRea
|
||||
const args = event.args;
|
||||
const arg0 = args && args.length >= 1 ? args[0] : null;
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
if (msg !== 'percentScroll') console.info(`Got ipc-message: ${msg}`, arg0);
|
||||
|
||||
if (msg.indexOf('error:') === 0) {
|
||||
@@ -41,9 +42,10 @@ export default function useMessageHandler(scrollWhenReady: any, setScrollWhenRea
|
||||
linkToCopy: arg0.linkToCopy || null,
|
||||
htmlToCopy: '',
|
||||
insertContent: () => { console.warn('insertContent() not implemented'); },
|
||||
fireEditorEvent: () => { console.warn('fireEditorEvent() not implemented'); },
|
||||
}, dispatch);
|
||||
|
||||
menu.popup(bridge().window());
|
||||
menu.popup({ window: bridge().window() });
|
||||
} else if (msg.indexOf('#') === 0) {
|
||||
// This is an internal anchor, which is handled by the WebView so skip this case
|
||||
} else if (msg === 'contentScriptExecuteCommand') {
|
||||
|
@@ -9,6 +9,7 @@ const commandsWithDependencies = [
|
||||
require('../commands/showLocalSearch'),
|
||||
require('../commands/focusElementNoteTitle'),
|
||||
require('../commands/focusElementNoteBody'),
|
||||
require('../commands/pasteAsText'),
|
||||
];
|
||||
|
||||
interface HookDependencies {
|
||||
|
@@ -123,7 +123,7 @@ const NoteListComponent = (props: Props) => {
|
||||
customCss: props.customCss,
|
||||
});
|
||||
|
||||
menu.popup(bridge().window());
|
||||
menu.popup({ window: bridge().window() });
|
||||
}, [props.selectedNoteIds, props.notes, props.dispatch, props.watchedNoteFiles, props.plugins, props.selectedFolderId, props.customCss]);
|
||||
|
||||
const onGlobalDrop_ = () => {
|
||||
@@ -160,21 +160,27 @@ const NoteListComponent = (props: Props) => {
|
||||
}
|
||||
};
|
||||
|
||||
const noteItem_noteDrop = async (event: any) => {
|
||||
if (props.notesParentType !== 'Folder') return;
|
||||
const canManuallySortNotes = async () => {
|
||||
if (props.notesParentType !== 'Folder') return false;
|
||||
|
||||
if (props.noteSortOrder !== 'order') {
|
||||
const doIt = await bridge().showConfirmMessageBox(_('To manually sort the notes, the sort order must be changed to "%s" in the menu "%s" > "%s"', _('Custom order'), _('View'), _('Sort notes by')), {
|
||||
buttons: [_('Do it now'), _('Cancel')],
|
||||
});
|
||||
if (!doIt) return;
|
||||
if (!doIt) return false;
|
||||
|
||||
Setting.setValue('notes.sortOrder.field', 'order');
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const noteItem_noteDrop = async (event: any) => {
|
||||
|
||||
// TODO: check that parent type is folder
|
||||
|
||||
if (!canManuallySortNotes()) {
|
||||
return;
|
||||
}
|
||||
const dt = event.dataTransfer;
|
||||
unregisterGlobalDragEndEvent_();
|
||||
setDragOverTargetNoteIndex(null);
|
||||
@@ -182,7 +188,7 @@ const NoteListComponent = (props: Props) => {
|
||||
const targetNoteIndex = dragTargetNoteIndex_(event);
|
||||
const noteIds = JSON.parse(dt.getData('text/x-jop-note-ids'));
|
||||
|
||||
void Note.insertNotesAt(props.selectedFolderId, noteIds, targetNoteIndex);
|
||||
void Note.insertNotesAt(props.selectedFolderId, noteIds, targetNoteIndex, props.uncompletedTodosOnTop, props.showCompletedTodos);
|
||||
};
|
||||
|
||||
|
||||
@@ -269,7 +275,6 @@ const NoteListComponent = (props: Props) => {
|
||||
onCheckboxClick={noteItem_checkboxClick}
|
||||
onDragStart={noteItem_dragStart}
|
||||
onNoteDragOver={noteItem_noteDragOver}
|
||||
onNoteDrop={noteItem_noteDrop}
|
||||
onTitleClick={noteItem_titleClick}
|
||||
onContextMenu={itemContextMenu}
|
||||
/>;
|
||||
@@ -340,11 +345,31 @@ const NoteListComponent = (props: Props) => {
|
||||
return noteIndex;
|
||||
};
|
||||
|
||||
const noteItem_noteMove = async (direction: number) => {
|
||||
if (!canManuallySortNotes()) {
|
||||
return;
|
||||
}
|
||||
const noteIds = props.selectedNoteIds;
|
||||
const noteId = noteIds[0];
|
||||
let targetNoteIndex = BaseModel.modelIndexById(props.notes, noteId);
|
||||
if ((direction === 1)) {
|
||||
targetNoteIndex += 2;
|
||||
}
|
||||
if ((direction === -1)) {
|
||||
targetNoteIndex -= 1;
|
||||
}
|
||||
void Note.insertNotesAt(props.selectedFolderId, noteIds, targetNoteIndex, props.uncompletedTodosOnTop, props.showCompletedTodos);
|
||||
};
|
||||
|
||||
const onKeyDown = async (event: any) => {
|
||||
const keyCode = event.keyCode;
|
||||
const noteIds = props.selectedNoteIds;
|
||||
|
||||
if (noteIds.length > 0 && (keyCode === 40 || keyCode === 38 || keyCode === 33 || keyCode === 34 || keyCode === 35 || keyCode === 36)) {
|
||||
if ((keyCode === 40 || keyCode === 38) && event.altKey) {
|
||||
// (DOWN / UP) & ALT
|
||||
await noteItem_noteMove(keyCode === 40 ? 1 : -1);
|
||||
event.preventDefault();
|
||||
} else if (noteIds.length > 0 && (keyCode === 40 || keyCode === 38 || keyCode === 33 || keyCode === 34 || keyCode === 35 || keyCode === 36)) {
|
||||
// DOWN / UP / PAGEDOWN / PAGEUP / END / HOME
|
||||
const noteId = noteIds[0];
|
||||
let noteIndex = BaseModel.modelIndexById(props.notes, noteId);
|
||||
@@ -500,6 +525,7 @@ const NoteListComponent = (props: Props) => {
|
||||
style={props.size}
|
||||
itemRenderer={renderItem}
|
||||
onKeyDown={onKeyDown}
|
||||
onNoteDrop={noteItem_noteDrop}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@@ -528,6 +554,8 @@ const mapStateToProps = (state: AppState) => {
|
||||
provisionalNoteIds: state.provisionalNoteIds,
|
||||
isInsertingNotes: state.isInsertingNotes,
|
||||
noteSortOrder: state.settings['notes.sortOrder.field'],
|
||||
uncompletedTodosOnTop: state.settings.uncompletedTodosOnTop,
|
||||
showCompletedTodos: state.settings.showCompletedTodos,
|
||||
highlightedWords: state.highlightedWords,
|
||||
plugins: state.pluginService.plugins,
|
||||
customCss: state.customCss,
|
||||
|
@@ -12,6 +12,8 @@ export interface Props {
|
||||
customCss: string;
|
||||
notesParentType: string;
|
||||
noteSortOrder: string;
|
||||
uncompletedTodosOnTop: boolean;
|
||||
showCompletedTodos: boolean;
|
||||
resizableLayoutEventEmitter: any;
|
||||
isInsertingNotes: boolean;
|
||||
folders: FolderEntity[];
|
||||
|
@@ -7,6 +7,7 @@ import CommandService from '@joplin/lib/services/CommandService';
|
||||
import { runtime as focusSearchRuntime } from './commands/focusSearch';
|
||||
import Note from '@joplin/lib/models/Note';
|
||||
import { notesSortOrderNextField } from '../../services/sortOrder/notesSortOrderUtils';
|
||||
import { _ } from '@joplin/lib/locale';
|
||||
const { connect } = require('react-redux');
|
||||
const styled = require('styled-components').default;
|
||||
|
||||
@@ -23,21 +24,24 @@ const StyledRoot = styled.div`
|
||||
box-sizing: border-box;
|
||||
height: ${(props: any) => props.height}px;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-direction: column;
|
||||
padding: ${(props: any) => props.theme.mainPadding}px;
|
||||
background-color: ${(props: any) => props.theme.backgroundColor3};
|
||||
gap: 5px;
|
||||
`;
|
||||
|
||||
const StyledButton = styled(Button)`
|
||||
margin-left: 8px;
|
||||
width: 26px;
|
||||
width: auto;
|
||||
height: 26px;
|
||||
min-width: 26px;
|
||||
min-height: 26px;
|
||||
flex: 1 0 auto;
|
||||
|
||||
.fa, .fas {
|
||||
font-size: 11px;
|
||||
}
|
||||
`;
|
||||
|
||||
const StyledPairButtonL = styled(Button)`
|
||||
margin-left: 8px;
|
||||
border-radius: 3px 0 0 3px;
|
||||
min-width: ${(props: any) => buttonSizePx(props)}px;
|
||||
max-width: ${(props: any) => buttonSizePx(props)}px;
|
||||
@@ -45,21 +49,28 @@ const StyledPairButtonL = styled(Button)`
|
||||
|
||||
const StyledPairButtonR = styled(Button)`
|
||||
min-width: 8px;
|
||||
margin-left: 0px;
|
||||
border-radius: 0 3px 3px 0;
|
||||
border-width: 1px 1px 1px 0;
|
||||
width: auto;
|
||||
`;
|
||||
|
||||
const ButtonContainer = styled.div`
|
||||
const RowContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex: 1 1 auto;
|
||||
gap: 8px;
|
||||
`;
|
||||
|
||||
const SortOrderButtonsContainer = styled.div`
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex: 1 1 auto;
|
||||
`;
|
||||
|
||||
function NoteListControls(props: Props) {
|
||||
const searchBarRef = useRef(null);
|
||||
|
||||
useEffect(function() {
|
||||
useEffect(() => {
|
||||
CommandService.instance().registerRuntime('focusSearch', focusSearchRuntime(searchBarRef));
|
||||
|
||||
return function() {
|
||||
@@ -116,8 +127,36 @@ function NoteListControls(props: Props) {
|
||||
if (!props.showNewNoteButtons) return null;
|
||||
|
||||
return (
|
||||
<ButtonContainer>
|
||||
{showsSortOrderButtons() &&
|
||||
<RowContainer>
|
||||
<StyledButton
|
||||
className="new-note-button"
|
||||
tooltip={CommandService.instance().label('newNote')}
|
||||
iconName="fas fa-plus"
|
||||
title={_('%s', 'New note')}
|
||||
level={ButtonLevel.Primary}
|
||||
size={ButtonSize.Small}
|
||||
onClick={onNewNoteButtonClick}
|
||||
/>
|
||||
<StyledButton
|
||||
className="new-todo-button"
|
||||
tooltip={CommandService.instance().label('newTodo')}
|
||||
iconName="fas fa-plus"
|
||||
title={_('%s', 'New to-do')}
|
||||
level={ButtonLevel.Secondary}
|
||||
size={ButtonSize.Small}
|
||||
onClick={onNewTodoButtonClick}
|
||||
/>
|
||||
</RowContainer>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledRoot>
|
||||
{renderNewNoteButtons()}
|
||||
<RowContainer>
|
||||
<SearchBar inputRef={searchBarRef}/>
|
||||
<SortOrderButtonsContainer>
|
||||
{showsSortOrderButtons() &&
|
||||
<StyledPairButtonL
|
||||
className="sort-order-field-button"
|
||||
tooltip={sortOrderFieldTooltip()}
|
||||
@@ -126,8 +165,8 @@ function NoteListControls(props: Props) {
|
||||
size={ButtonSize.Small}
|
||||
onClick={onSortOrderFieldButtonClick}
|
||||
/>
|
||||
}
|
||||
{showsSortOrderButtons() &&
|
||||
}
|
||||
{showsSortOrderButtons() &&
|
||||
<StyledPairButtonR
|
||||
className="sort-order-reverse-button"
|
||||
tooltip={CommandService.instance().label('toggleNotesSortOrderReverse')}
|
||||
@@ -136,31 +175,9 @@ function NoteListControls(props: Props) {
|
||||
size={ButtonSize.Small}
|
||||
onClick={onSortOrderReverseButtonClick}
|
||||
/>
|
||||
}
|
||||
<StyledButton
|
||||
className="new-todo-button"
|
||||
tooltip={CommandService.instance().label('newTodo')}
|
||||
iconName="far fa-check-square"
|
||||
level={ButtonLevel.Primary}
|
||||
size={ButtonSize.Small}
|
||||
onClick={onNewTodoButtonClick}
|
||||
/>
|
||||
<StyledButton
|
||||
className="new-note-button"
|
||||
tooltip={CommandService.instance().label('newNote')}
|
||||
iconName="icon-note"
|
||||
level={ButtonLevel.Primary}
|
||||
size={ButtonSize.Small}
|
||||
onClick={onNewNoteButtonClick}
|
||||
/>
|
||||
</ButtonContainer>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledRoot height={props.height}>
|
||||
<SearchBar inputRef={searchBarRef}/>
|
||||
{renderNewNoteButtons()}
|
||||
}
|
||||
</SortOrderButtonsContainer>
|
||||
</RowContainer>
|
||||
</StyledRoot>
|
||||
);
|
||||
}
|
||||
|
@@ -56,7 +56,6 @@ interface NoteListItemProps {
|
||||
onCheckboxClick: any;
|
||||
onDragStart: any;
|
||||
onNoteDragOver: any;
|
||||
onNoteDrop: any;
|
||||
onTitleClick: any;
|
||||
onContextMenu(event: React.MouseEvent<HTMLAnchorElement, MouseEvent>): void;
|
||||
}
|
||||
@@ -127,13 +126,21 @@ function NoteListItem(props: NoteListItemProps, ref: any) {
|
||||
|
||||
mark.unmark();
|
||||
|
||||
for (let i = 0; i < props.highlightedWords.length; i++) {
|
||||
const w = props.highlightedWords[i];
|
||||
|
||||
markJsUtils.markKeyword(mark, w, {
|
||||
pregQuote: pregQuote,
|
||||
replaceRegexDiacritics: replaceRegexDiacritics,
|
||||
});
|
||||
try {
|
||||
for (const wordToBeHighlighted of props.highlightedWords) {
|
||||
markJsUtils.markKeyword(mark, wordToBeHighlighted, {
|
||||
pregQuote: pregQuote,
|
||||
replaceRegexDiacritics: replaceRegexDiacritics,
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.name !== 'SyntaxError') {
|
||||
throw error;
|
||||
}
|
||||
// An error of 'Regular expression too large' might occour in the markJs library
|
||||
// when the input is really big, this catch is here to avoid the application crashing
|
||||
// https://github.com/laurent22/joplin/issues/7634
|
||||
console.error('Error while trying to highlight words from search: ', error);
|
||||
}
|
||||
|
||||
// Note: in this case it is safe to use dangerouslySetInnerHTML because titleElement
|
||||
@@ -167,7 +174,6 @@ function NoteListItem(props: NoteListItemProps, ref: any) {
|
||||
<StyledRoot
|
||||
className={classNames}
|
||||
onDragOver={props.onNoteDragOver}
|
||||
onDrop={props.onNoteDrop}
|
||||
width={props.width}
|
||||
height={props.height}
|
||||
isProvisional={props.isProvisional}
|
||||
|
@@ -33,7 +33,7 @@ export default function NoteListWrapper(props: Props) {
|
||||
|
||||
return (
|
||||
<StyledRoot>
|
||||
<NoteListControls height={controlHeight} />
|
||||
<NoteListControls height={controlHeight}/>
|
||||
<NoteList resizableLayoutEventEmitter={props.resizableLayoutEventEmitter} size={noteListSize} visible={props.visible}/>
|
||||
</StyledRoot>
|
||||
);
|
||||
|
@@ -17,7 +17,7 @@ const urlUtils = require('@joplin/lib/urlUtils');
|
||||
const ReactTooltip = require('react-tooltip');
|
||||
const { urlDecode } = require('@joplin/lib/string-utils');
|
||||
const { connect } = require('react-redux');
|
||||
const shared = require('@joplin/lib/components/shared/note-screen-shared.js');
|
||||
import shared from '@joplin/lib/components/shared/note-screen-shared';
|
||||
|
||||
interface Props {
|
||||
themeId: number;
|
||||
|
@@ -59,9 +59,10 @@ export default function PdfViewer(props: Props) {
|
||||
linkToCopy: null,
|
||||
htmlToCopy: '',
|
||||
insertContent: () => { console.warn('insertContent() not implemented'); },
|
||||
fireEditorEvent: () => { console.warn('fireEditorEvent() not implemented'); },
|
||||
} as ContextMenuOptions, props.dispatch);
|
||||
|
||||
menu.popup(bridge().window());
|
||||
menu.popup({ window: bridge().window() });
|
||||
}, [props.dispatch]);
|
||||
|
||||
const onMessage_ = useCallback(async (event: any) => {
|
||||
|
@@ -98,7 +98,7 @@ const GlobalStyle = createGlobalStyle`
|
||||
let wcsTimeoutId_: any = null;
|
||||
|
||||
async function initialize() {
|
||||
bridge().window().on('resize', function() {
|
||||
bridge().window().on('resize', () => {
|
||||
if (wcsTimeoutId_) shim.clearTimeout(wcsTimeoutId_);
|
||||
|
||||
wcsTimeoutId_ = shim.setTimeout(() => {
|
||||
|
@@ -8,7 +8,7 @@ import Setting from '@joplin/lib/models/Setting';
|
||||
import restart from '../services/restart';
|
||||
|
||||
function useAppCloseHandler(upgradeResult: SyncTargetUpgradeResult) {
|
||||
useEffect(function() {
|
||||
useEffect(() => {
|
||||
async function onAppClose() {
|
||||
let canClose = true;
|
||||
|
||||
@@ -38,7 +38,7 @@ function useAppCloseHandler(upgradeResult: SyncTargetUpgradeResult) {
|
||||
}
|
||||
|
||||
function useStyle() {
|
||||
useEffect(function() {
|
||||
useEffect(() => {
|
||||
const element = document.createElement('style');
|
||||
element.appendChild(document.createTextNode(`
|
||||
body {
|
||||
@@ -62,7 +62,7 @@ function useStyle() {
|
||||
}
|
||||
|
||||
function useRestartOnDone(upgradeResult: SyncTargetUpgradeResult) {
|
||||
useEffect(function() {
|
||||
useEffect(() => {
|
||||
if (upgradeResult.done && !upgradeResult.error) {
|
||||
void restart();
|
||||
}
|
||||
|
@@ -68,8 +68,6 @@ function styles_(props: Props) {
|
||||
}
|
||||
|
||||
export function ShareNoteDialog(props: Props) {
|
||||
console.info('Render ShareNoteDialog');
|
||||
|
||||
const [notes, setNotes] = useState<NoteEntity[]>([]);
|
||||
const [recursiveShare, setRecursiveShare] = useState<boolean>(false);
|
||||
const [sharesState, setSharesState] = useState<string>('unknown');
|
||||
|
@@ -1,5 +1,7 @@
|
||||
import * as React from 'react';
|
||||
import { useEffect, useRef, useCallback, useMemo } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import { StyledRoot, StyledAddButton, StyledShareIcon, StyledHeader, StyledHeaderIcon, StyledAllNotesIcon, StyledHeaderLabel, StyledListItem, StyledListItemAnchor, StyledExpandLink, StyledNoteCount, StyledSyncReportText, StyledSyncReport, StyledSynchronizeButton } from './styles';
|
||||
import { ButtonLevel } from '../Button/Button';
|
||||
import CommandService from '@joplin/lib/services/CommandService';
|
||||
@@ -38,6 +40,15 @@ const { clipboard } = require('electron');
|
||||
|
||||
const logger = Logger.create('Sidebar');
|
||||
|
||||
const StyledFoldersHolder = styled.div`
|
||||
// linux bug: https://github.com/laurent22/joplin/issues/7506#issuecomment-1447101057
|
||||
& a.list-item {
|
||||
${shim.isLinux() && {
|
||||
opacity: 1,
|
||||
}}
|
||||
}
|
||||
`;
|
||||
|
||||
interface Props {
|
||||
themeId: number;
|
||||
dispatch: Function;
|
||||
@@ -271,7 +282,7 @@ const SidebarComponent = (props: Props) => {
|
||||
new MenuItem(menuUtils.commandToStatefulMenuItem('newFolder'))
|
||||
);
|
||||
|
||||
menu.popup(bridge().window());
|
||||
menu.popup({ window: bridge().window() });
|
||||
}, []);
|
||||
|
||||
const itemContextMenu = useCallback(async (event: any) => {
|
||||
@@ -423,7 +434,7 @@ const SidebarComponent = (props: Props) => {
|
||||
}
|
||||
}
|
||||
|
||||
menu.popup(bridge().window());
|
||||
menu.popup({ window: bridge().window() });
|
||||
}, [props.folders, props.dispatch, pluginsRef]);
|
||||
|
||||
const folderItem_click = useCallback((folderId: string) => {
|
||||
@@ -705,13 +716,13 @@ const SidebarComponent = (props: Props) => {
|
||||
const folderItems = [renderAllNotesItem(theme, allNotesSelected)].concat(result.items);
|
||||
folderItemsOrder_.current = result.order;
|
||||
items.push(
|
||||
<div
|
||||
<StyledFoldersHolder
|
||||
className={`folders ${props.folderHeaderIsExpanded ? 'expanded' : ''}`}
|
||||
key="folder_items"
|
||||
style={foldersStyle}
|
||||
>
|
||||
{folderItems}
|
||||
</div>
|
||||
</StyledFoldersHolder>
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -24,7 +24,7 @@ const StyledRoot = styled.div`
|
||||
max-width: 1200px;
|
||||
`;
|
||||
|
||||
const SyncTargetDescription = styled.div<{height: number}>`
|
||||
const SyncTargetDescription = styled.div<{ height: number }>`
|
||||
${props => props.height ? `height: ${props.height}px` : ''};
|
||||
margin-bottom: 1.3em;
|
||||
line-height: ${props => props.theme.lineHeight};
|
||||
@@ -69,7 +69,7 @@ const SyncTargetLogo = styled.img`
|
||||
margin-right: 0.4em;
|
||||
`;
|
||||
|
||||
const SyncTargetBox = styled.div<{faded: boolean}>`
|
||||
const SyncTargetBox = styled.div<{ faded: boolean }>`
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
@@ -96,7 +96,7 @@ const FeatureIcon = styled.i`
|
||||
position: absolute;
|
||||
`;
|
||||
|
||||
const FeatureLine = styled.div<{enabled: boolean}>`
|
||||
const FeatureLine = styled.div<{ enabled: boolean }>`
|
||||
margin-bottom: .5em;
|
||||
opacity: ${props => props.enabled ? 1 : 0.5};
|
||||
position: relative;
|
||||
|
@@ -20,6 +20,7 @@ export default function useEffectDebugger(effectHook: any, dependencies: any, de
|
||||
}, {});
|
||||
|
||||
if (Object.keys(changedDeps).length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('[use-effet-debugger] ', changedDeps);
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,7 @@ export default function useImperativeHandleDebugger(ref: any, effectHook: any, d
|
||||
}, {});
|
||||
|
||||
if (Object.keys(changedDeps).length) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('[use-imperativeHandler-debugger] ', changedDeps);
|
||||
}
|
||||
|
||||
|
@@ -32,6 +32,7 @@ export default function() {
|
||||
'textBulletedList',
|
||||
'toggleExternalEditing',
|
||||
'toggleLayoutMoveMode',
|
||||
'resetLayout',
|
||||
'toggleNoteList',
|
||||
'toggleNotesSortOrderField',
|
||||
'toggleNotesSortOrderReverse',
|
||||
@@ -65,5 +66,6 @@ export default function() {
|
||||
'switchProfile1',
|
||||
'switchProfile2',
|
||||
'switchProfile3',
|
||||
'pasteAsText',
|
||||
];
|
||||
}
|
||||
|
@@ -154,34 +154,66 @@
|
||||
setPercentScroll(percentScroll_);
|
||||
}
|
||||
|
||||
// Note that this function keeps track of what's been added so as not to add the same CSS files multiple times
|
||||
// It also means that once an asset has been added it is never removed from the view, which in many case is
|
||||
// desirable, but still something to keep in mind.
|
||||
// Note that this function keeps track of what's been added so as not to
|
||||
// add the same CSS files multiple times.
|
||||
function addPluginAssets(assets) {
|
||||
if (!assets) return;
|
||||
|
||||
const pluginAssetsContainer = document.getElementById('joplin-container-pluginAssetsContainer');
|
||||
|
||||
const processedAssetIds = [];
|
||||
|
||||
for (let i = 0; i < assets.length; i++) {
|
||||
const asset = assets[i];
|
||||
|
||||
// # and ? can be used in valid paths and shouldn't be treated as the start of a query or fragment
|
||||
const encodedPath = asset.path
|
||||
.replaceAll('#','%23')
|
||||
.replaceAll('?','%3F')
|
||||
|
||||
const assetId = asset.name ? asset.name : encodedPath;
|
||||
|
||||
processedAssetIds.push(assetId);
|
||||
|
||||
if (pluginAssetsAdded_[assetId]) continue;
|
||||
pluginAssetsAdded_[assetId] = true;
|
||||
|
||||
let element = null;
|
||||
|
||||
if (asset.mime === 'application/javascript') {
|
||||
const script = document.createElement('script');
|
||||
script.src = encodedPath;
|
||||
pluginAssetsContainer.appendChild(script);
|
||||
element = document.createElement('script');
|
||||
element.src = encodedPath;
|
||||
pluginAssetsContainer.appendChild(element);
|
||||
} else if (asset.mime === 'text/css') {
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = encodedPath
|
||||
pluginAssetsContainer.appendChild(link);
|
||||
element = document.createElement('link');
|
||||
element.rel = 'stylesheet';
|
||||
element.href = encodedPath
|
||||
pluginAssetsContainer.appendChild(element);
|
||||
}
|
||||
|
||||
pluginAssetsAdded_[assetId] = {
|
||||
element,
|
||||
}
|
||||
}
|
||||
|
||||
// Once we have added the relevant assets, we also remove those that
|
||||
// are no longer needed. It's necessary in particular for the CSS
|
||||
// generated by noteStyle - if we don't remove it, we might end up
|
||||
// with two or more stylesheet and that will create conflicts.
|
||||
//
|
||||
// It was happening for example when automatically switching from
|
||||
// light to dark theme, and then back to light theme - in that case
|
||||
// the viewer would remain dark because it would use the dark
|
||||
// stylesheet that would still be in the DOM.
|
||||
for (const [assetId, asset] of Object.entries(pluginAssetsAdded_)) {
|
||||
if (!processedAssetIds.includes(assetId)) {
|
||||
try {
|
||||
asset.element.remove();
|
||||
} catch (error) {
|
||||
// We don't throw an exception but we log it since
|
||||
// it shouldn't happen
|
||||
console.warn('Tried to remove an asset but got an error', error);
|
||||
}
|
||||
pluginAssetsAdded_[assetId] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -423,13 +455,21 @@
|
||||
|
||||
if ('separateWordSearch' in options) markKeywordOptions.separateWordSearch = options.separateWordSearch;
|
||||
|
||||
for (let i = 0; i < keywords.length; i++) {
|
||||
let keyword = keywords[i];
|
||||
|
||||
markJsUtils.markKeyword(mark_, keyword, {
|
||||
pregQuote: pregQuote,
|
||||
replaceRegexDiacritics: replaceRegexDiacritics,
|
||||
}, markKeywordOptions);
|
||||
try {
|
||||
for (const keyword of keywords) {
|
||||
markJsUtils.markKeyword(mark_, keyword, {
|
||||
pregQuote: pregQuote,
|
||||
replaceRegexDiacritics: replaceRegexDiacritics,
|
||||
}, markKeywordOptions);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error.name !== 'SyntaxError') {
|
||||
throw error;
|
||||
}
|
||||
// An error of 'Regular expression too large' might occour in the markJs library
|
||||
// when the input is really big, this catch is here to avoid the application crashing
|
||||
// https://github.com/laurent22/joplin/issues/7634
|
||||
console.error('Error while trying to highlight words from search: ', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -188,7 +188,7 @@ webviewLib.initialize = function(options) {
|
||||
webviewLib.options_ = options;
|
||||
};
|
||||
|
||||
document.addEventListener('click', function(event) {
|
||||
document.addEventListener('click', (event) => {
|
||||
const anchor = webviewLib.getParentAnchorElement(event.target);
|
||||
if (!anchor) return;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import styled from 'styled-components';
|
||||
|
||||
const StyledMessage = styled.div<{type: string}>`
|
||||
const StyledMessage = styled.div<{ type: string }>`
|
||||
border-radius: 3px;
|
||||
background-color: ${props => props.type === 'error' ? props.theme.warningBackgroundColor : 'transparent'};
|
||||
font-size: ${props => props.theme.fontSize}px;
|
||||
|
@@ -10,6 +10,7 @@ export interface Script {
|
||||
|
||||
export const loadScript = async (script: Script) => {
|
||||
return new Promise((resolve) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info('Loading script:', script);
|
||||
|
||||
let element: any = document.getElementById(script.id);
|
||||
|
@@ -56,6 +56,7 @@ if (bridge().env() === 'dev') {
|
||||
window.console = newConsole;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(`Environment: ${bridge().env()}`);
|
||||
|
||||
const fsDriver = new FsDriverNode();
|
||||
@@ -77,7 +78,9 @@ BaseItem.loadClass('Revision', Revision);
|
||||
Setting.setConstant('appId', `net.cozic.joplin${bridge().env() === 'dev' ? 'dev' : ''}-desktop`);
|
||||
Setting.setConstant('appType', 'desktop');
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(`appId: ${Setting.value('appId')}`);
|
||||
// eslint-disable-next-line no-console
|
||||
console.info(`appType: ${Setting.value('appType')}`);
|
||||
|
||||
let keytar;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@joplin/app-desktop",
|
||||
"version": "2.10.5",
|
||||
"version": "2.10.8",
|
||||
"description": "Joplin for Desktop",
|
||||
"main": "main.js",
|
||||
"private": true,
|
||||
@@ -120,8 +120,8 @@
|
||||
"electron-rebuild": "3.2.9",
|
||||
"glob": "8.1.0",
|
||||
"gulp": "4.0.2",
|
||||
"jest": "29.3.1",
|
||||
"jest-environment-jsdom": "29.3.1",
|
||||
"jest": "29.4.3",
|
||||
"jest-environment-jsdom": "29.4.3",
|
||||
"js-sha512": "0.8.0",
|
||||
"nan": "2.17.0",
|
||||
"react-test-renderer": "18.2.0",
|
||||
|
@@ -233,7 +233,7 @@ const create = (win, options) => {
|
||||
// When this is being called from a web view, we can't use `win` as this
|
||||
// would refer to the web view which is not allowed to render a popup menu.
|
||||
//
|
||||
menu.popup(electronRemote ? electronRemote.getCurrentWindow() : win);
|
||||
menu.popup({ window: electronRemote ? electronRemote.getCurrentWindow() : win });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@@ -28,7 +28,7 @@ export interface Props {
|
||||
onReady?: Function;
|
||||
}
|
||||
|
||||
const StyledFrame = styled.iframe<{fitToContent: boolean; borderBottom: boolean}>`
|
||||
const StyledFrame = styled.iframe<{ fitToContent: boolean; borderBottom: boolean }>`
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: ${(props: any) => props.fitToContent ? `${props.width}px` : '100%'};
|
||||
|
@@ -87,6 +87,7 @@ const webviewApi = {
|
||||
// console.debug('UserWebviewIndex: setting html to', args.html);
|
||||
|
||||
window.requestAnimationFrame(() => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('UserWebviewIndex: setting html callback', args.hash);
|
||||
window.postMessage({ target: 'UserWebview', message: 'htmlIsSet', hash: args.hash }, '*');
|
||||
});
|
||||
@@ -155,6 +156,7 @@ const webviewApi = {
|
||||
if (!ipc[callName]) {
|
||||
console.warn('Missing IPC function:', event.data);
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('UserWebviewIndex: Got message', callName, args);
|
||||
ipc[callName](args);
|
||||
}
|
||||
@@ -166,6 +168,7 @@ const webviewApi = {
|
||||
// Need to send it with a delay to make sure all listeners are
|
||||
// ready when the message is sent.
|
||||
window.requestAnimationFrame(() => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('UserWebViewIndex: calling isReady');
|
||||
window.postMessage({ target: 'UserWebview', message: 'ready' }, '*');
|
||||
});
|
||||
|
@@ -16,6 +16,7 @@ export default function(frameWindow: any, isReady: boolean, postMessage: Functio
|
||||
|
||||
if (!data || data.target !== 'UserWebview') return;
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.info('useHtmlLoader: message', data);
|
||||
|
||||
// We only update if the HTML that was loaded is the same as
|
||||
@@ -35,10 +36,12 @@ export default function(frameWindow: any, isReady: boolean, postMessage: Functio
|
||||
}, [frameWindow, htmlHash]);
|
||||
|
||||
useEffect(() => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.info('useHtmlLoader: isReady', isReady);
|
||||
|
||||
if (!isReady) return;
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.info('useHtmlLoader: setHtml', htmlHash);
|
||||
|
||||
postMessage('setHtml', {
|
||||
|
@@ -9,9 +9,11 @@ export default function useViewIsReady(viewRef: any) {
|
||||
const [iframeContentReady, setIFrameContentReady] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('useViewIsReady ============== Setup Listeners');
|
||||
|
||||
function onIFrameReady() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('useViewIsReady: onIFrameReady');
|
||||
setIFrameReady(true);
|
||||
}
|
||||
@@ -21,6 +23,7 @@ export default function useViewIsReady(viewRef: any) {
|
||||
|
||||
if (!data || data.target !== 'UserWebview') return;
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('useViewIsReady: message', data);
|
||||
|
||||
if (data.message === 'ready') {
|
||||
@@ -30,6 +33,7 @@ export default function useViewIsReady(viewRef: any) {
|
||||
|
||||
const iframeDocument = viewRef.current.contentWindow.document;
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.debug('useViewIsReady readyState', iframeDocument.readyState);
|
||||
|
||||
if (iframeDocument.readyState === 'complete') {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user