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

Compare commits

..

7 Commits

Author SHA1 Message Date
palerdot
2ea412331b Merge remote-tracking branch 'origin/dev' into note-list-display-fix 2023-03-09 12:45:24 +05:30
palerdot
0bf4da3cf5 refactor: logger.warn for ItemList notelist blank space fixes 2023-03-09 11:08:21 +05:30
palerdot
016311a0ae refactor: comments 2023-03-08 20:05:47 +05:30
palerdot
8d592ac1e0 refactor: comments 2023-03-08 19:13:59 +05:30
palerdot
93f4928ea8 Merge remote-tracking branch 'origin/dev' into note-list-display-fix 2023-03-08 19:12:02 +05:30
palerdot
ea855602b9 fix(desktop): handle bottom blank space due to scroll position mismatch 2023-03-08 19:07:50 +05:30
palerdot
45da775649 fix(desktop): handle blank top spacing when toggling note list 2023-03-08 14:48:00 +05:30
150 changed files with 2051 additions and 4034 deletions

View File

@@ -66,7 +66,6 @@ packages/lib/welcomeAssets.js
packages/plugins/**/api
packages/plugins/**/dist
packages/server/dist/
packages/utils/dist/
packages/tools/node_modules
packages/tools/PortableAppsLauncher
packages/turndown-plugin-gfm/
@@ -405,7 +404,6 @@ packages/app-mobile/components/SideMenu.js
packages/app-mobile/components/TextInput.js
packages/app-mobile/components/app-nav.js
packages/app-mobile/components/biometrics/BiometricPopup.js
packages/app-mobile/components/biometrics/biometricAuthenticate.js
packages/app-mobile/components/biometrics/sensorInfo.js
packages/app-mobile/components/getResponsiveValue.js
packages/app-mobile/components/getResponsiveValue.test.js
@@ -848,7 +846,6 @@ packages/tools/convertThemesToCss.js
packages/tools/generate-database-types.js
packages/tools/generate-images.js
packages/tools/git-changelog.js
packages/tools/git-changelog.test.js
packages/tools/licenseChecker.js
packages/tools/release-android.js
packages/tools/release-cli.js
@@ -864,7 +861,6 @@ packages/tools/update-readme-download.js
packages/tools/update-readme-sponsors.js
packages/tools/updateMarkdownDoc.js
packages/tools/utils/discourse.js
packages/tools/utils/loadSponsors.js
packages/tools/utils/translation.js
packages/tools/website/build.js
packages/tools/website/buildTranslations.js

View File

@@ -91,10 +91,6 @@ module.exports = {
// Disable because of this: https://github.com/facebook/react/issues/16265
// "react-hooks/exhaustive-deps": "warn",
'jest/require-top-level-describe': ['error', { 'maxNumberOfTopLevelDescribes': 1 }],
'jest/no-identical-title': ['error'],
'jest/prefer-lowercase-title': ['error', { 'ignoreTopLevelDescribe': true }],
'promise/prefer-await-to-then': 'error',
'no-unneeded-ternary': 'error',
@@ -159,7 +155,6 @@ module.exports = {
// 'react-hooks',
'import',
'promise',
'jest',
],
'overrides': [
{

View File

@@ -180,6 +180,9 @@ cd "$ROOT_DIR/packages/app-desktop"
if [[ $GIT_TAG_NAME = v* ]]; then
echo "Step: Building and publishing desktop application..."
# cd "$ROOT_DIR/packages/tools"
# node bundleDefaultPlugins.js
cd "$ROOT_DIR/packages/app-desktop"
USE_HARD_LINKS=false yarn run dist
elif [[ $IS_LINUX = 1 ]] && [[ $GIT_TAG_NAME = $SERVER_TAG_PREFIX-* ]]; then
echo "Step: Building Docker Image..."

View File

@@ -6,7 +6,6 @@ on: [push, pull_request]
jobs:
pre_job:
if: github.repository == 'laurent22/joplin'
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
@@ -17,7 +16,6 @@ jobs:
concurrent_skipping: 'same_content_newer'
BuildAndroidDebug:
if: github.repository == 'laurent22/joplin'
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest

View File

@@ -7,7 +7,6 @@ on:
jobs:
CLAAssistant:
if: github.repository == 'laurent22/joplin'
runs-on: ubuntu-latest
steps:
- name: "CLA Assistant"

View File

@@ -6,7 +6,6 @@ permissions:
issues: write
jobs:
ProcessStaleIssues:
if: github.repository == 'laurent22/joplin'
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4

View File

@@ -2,7 +2,6 @@ name: Joplin Continuous Integration
on: [push, pull_request]
jobs:
pre_job:
if: github.repository == 'laurent22/joplin'
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
@@ -15,7 +14,7 @@ jobs:
Main:
needs: pre_job
# We always process server or desktop release tags, because they also publish the release
if: github.repository == 'laurent22/joplin' && (needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/server-v') || startsWith(github.ref, 'refs/tags/v'))
if: needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/server-v') || startsWith(github.ref, 'refs/tags/v')
runs-on: ${{ matrix.os }}
strategy:
matrix:
@@ -93,7 +92,6 @@ jobs:
APPLE_ASC_PROVIDER: ${{ secrets.APPLE_ASC_PROVIDER }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.APPLE_CSC_LINK }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
@@ -131,7 +129,7 @@ jobs:
ServerDockerImage:
needs: pre_job
if: github.repository == 'laurent22/joplin' && needs.pre_job.outputs.should_skip != 'true'
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ${{ matrix.os }}
strategy:
matrix:

3
.gitignore vendored
View File

@@ -392,7 +392,6 @@ packages/app-mobile/components/SideMenu.js
packages/app-mobile/components/TextInput.js
packages/app-mobile/components/app-nav.js
packages/app-mobile/components/biometrics/BiometricPopup.js
packages/app-mobile/components/biometrics/biometricAuthenticate.js
packages/app-mobile/components/biometrics/sensorInfo.js
packages/app-mobile/components/getResponsiveValue.js
packages/app-mobile/components/getResponsiveValue.test.js
@@ -835,7 +834,6 @@ packages/tools/convertThemesToCss.js
packages/tools/generate-database-types.js
packages/tools/generate-images.js
packages/tools/git-changelog.js
packages/tools/git-changelog.test.js
packages/tools/licenseChecker.js
packages/tools/release-android.js
packages/tools/release-cli.js
@@ -851,7 +849,6 @@ packages/tools/update-readme-download.js
packages/tools/update-readme-sponsors.js
packages/tools/updateMarkdownDoc.js
packages/tools/utils/discourse.js
packages/tools/utils/loadSponsors.js
packages/tools/utils/translation.js
packages/tools/website/build.js
packages/tools/website/buildTranslations.js

View File

@@ -14,8 +14,7 @@
"@joplin/turndown-plugin-gfm",
"@joplin/tools",
"@joplin/react-native-saf-x",
"@joplin/react-native-alarm-notification",
"@joplin/utils"
"@joplin/react-native-alarm-notification"
]
}
]

View File

@@ -1,30 +0,0 @@
diff --git a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java
index a8abd71833879201e3438b2fa51d712a311c4551..ffe9c2c6dfa5c703ba76b65d94d5dd6784102c19 100644
--- a/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java
+++ b/android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java
@@ -591,7 +591,7 @@ public class RNFetchBlobReq extends BroadcastReceiver implements Runnable {
// ignored.printStackTrace();
}
- RNFetchBlobFileResp rnFetchBlobFileResp = (RNFetchBlobFileResp) responseBody;
+ RNFetchBlobFileResp rnFetchBlobFileResp = new RNFetchBlobFileResp(responseBody);
if(rnFetchBlobFileResp != null && !rnFetchBlobFileResp.isDownloadComplete()){
callback.invoke("Download interrupted.", null);
diff --git a/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java b/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java
index 2470eef612308c15a89dfea5a1f16937469be29f..965f8becc195965907699182c764ec9e51811450 100644
--- a/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java
+++ b/android/src/main/java/com/RNFetchBlob/Response/RNFetchBlobFileResp.java
@@ -35,6 +35,12 @@ public class RNFetchBlobFileResp extends ResponseBody {
FileOutputStream ofStream;
boolean isEndMarkerReceived;
+ // ref: https://github.com/joltup/rn-fetch-blob/issues/490#issuecomment-990899440
+ public RNFetchBlobFileResp(ResponseBody body) {
+ super();
+ this.originalBody = body;
+ }
+
public RNFetchBlobFileResp(ReactApplicationContext ctx, String taskId, ResponseBody body, String path, boolean overwrite) throws IOException {
super();
this.rctContext = ctx;

View File

@@ -780,7 +780,6 @@ footer .bottom-links-row p {
#menu-mobile .social-links .social-link-mastodon,
#menu-mobile .social-links .social-link-reddit,
#menu-mobile .social-links .social-link-linkedin,
#menu-mobile .social-links .social-link-patreon {
display: none;
}
@@ -948,41 +947,6 @@ footer .bottom-links-row p {
}
}
/*****************************************************************
MORE NARROW VIEW
eg for Galaxy S9
*****************************************************************/
@media (max-width: 580px) {
#nav-section .plans-button {
display: none;
}
}
/*****************************************************************
MORE NARROW VIEW
eg for Galaxy S9
*****************************************************************/
@media (max-width: 400px) {
#nav-section .navbar-mobile-content a.sponsor-button .sponsor-button-label {
font-size: 12px;
}
#nav-section .navbar-mobile-content a.sponsor-button {
padding: 2px 6px;
margin-right: 0.2em;
}
#nav-section a {
margin-left: 5px;
}
}
/*****************************************************************
VERY NARROW VIEW
eg for Galaxy Fold
@@ -1004,15 +968,6 @@ footer .bottom-links-row p {
margin-left: 4px;
}
div.navbar-mobile-content a.sponsor-button {
margin-right: 10px;
}
#nav-section .button-link {
padding-left: 0;
padding-right: 0;
}
}
/*****************************************************************

View File

@@ -24,8 +24,7 @@
</div>
<div class="col-9 text-right d-block d-md-none navbar-mobile-content">
{{> twitterLink}}
<a href="{{baseUrl}}/cn/" class="fw500 chinese-page-link">中文</a>
{{> joplinCloudButton}}
<a href="{{baseUrl}}/cn/" class="fw500">中文</a>
{{> supportButton}}
<span class="pointer"

View File

@@ -4,7 +4,6 @@
<a class="social-link-mastodon" href="https://mastodon.social/@joplinapp" title="Joplin Mastodon feed"><i class="fab fa-mastodon"></i></a>
<a class="social-link-patreon" href="https://www.patreon.com/joplin" title="Joplin Patreon"><i class="fab fa-patreon"></i></a>
<a class="social-link-discord" href="https://discord.gg/VSj7AFHvpq" title="Joplin Discord chat"><i class="fab fa-discord"></i></a>
<a class="social-link-linkedin" href="https://www.linkedin.com/company/joplin" title="Joplin LinkedIn Feed"><i class="fab fa-linkedin"></i></a>
<a class="social-link-reddit" href="https://www.reddit.com/r/joplinapp/" title="Joplin Subreddit"><i class="fab fa-reddit"></i></a>
<a class="social-link-github" href="https://github.com/laurent22/joplin/" title="Joplin GitHub repository"><i class="fab fa-github"></i></a>
</div>

View File

@@ -1 +1 @@
<a href="https://twitter.com/joplinapp" title="Joplin Twitter feed" class="fw500 twitter-link"><i class="fab fa-twitter"></i></a>
<a href="https://twitter.com/joplinapp" title="Joplin Twitter feed" class="fw500"><i class="fab fa-twitter"></i></a>

View File

@@ -30,7 +30,6 @@ COPY packages/fork-uslug ./packages/fork-uslug
COPY packages/htmlpack ./packages/htmlpack
COPY packages/renderer ./packages/renderer
COPY packages/tools ./packages/tools
COPY packages/utils ./packages/utils
COPY packages/lib ./packages/lib
COPY packages/server ./packages/server

View File

@@ -64,7 +64,7 @@ A community maintained list of these distributions can be found here: [Unofficia
# Sponsors
<!-- SPONSORS-ORG -->
<a href="https://seirei.ne.jp"><img title="Serei Network" width="256" src="https://joplinapp.org/images/sponsors/SeireiNetwork.png"/></a> <a href="https://www.hosting.de/nextcloud/?mtm_campaign=managed-nextcloud&amp;mtm_kwd=joplinapp&amp;mtm_source=joplinapp-webseite&amp;mtm_medium=banner"><img title="Hosting.de" width="256" src="https://joplinapp.org/images/sponsors/HostingDe.png"/></a> <a href="https://residence-greece.com/"><img title="Greece Golden Visa" width="256" src="https://joplinapp.org/images/sponsors/ResidenceGreece.jpg"/></a> <a href="https://grundstueckspreise.info/"><img title="SP Software GmbH" width="256" src="https://joplinapp.org/images/sponsors/Grundstueckspreise.png"/></a>
<a href="https://seirei.ne.jp"><img title="Serei Network" width="256" src="https://joplinapp.org/images/sponsors/SeireiNetwork.png"/></a> <a href="https://usrigging.com/"><img title="U.S. Ringing Supply" width="256" src="https://joplinapp.org/images/sponsors/RingingSupply.svg"/></a> <a href="https://www.hosting.de/nextcloud/?mtm_campaign=managed-nextcloud&amp;mtm_kwd=joplinapp&amp;mtm_source=joplinapp-github&amp;mtm_medium=banner"><img title="Hosting.de" width="256" src="https://joplinapp.org/images/sponsors/HostingDe.png"/></a> <a href="https://residence-greece.com/"><img title="Greece Golden Visa" width="256" src="https://joplinapp.org/images/sponsors/ResidenceGreece.jpg"/></a> <a href="https://grundstueckspreise.info/"><img title="SP Software GmbH" width="256" src="https://joplinapp.org/images/sponsors/Grundstueckspreise.png"/></a>
<!-- SPONSORS-ORG -->
* * *
@@ -72,11 +72,14 @@ A community maintained list of these distributions can be found here: [Unofficia
<!-- SPONSORS-GITHUB -->
| | | | |
| :---: | :---: | :---: | :---: |
| <img width="50" src="https://avatars2.githubusercontent.com/u/215668?s=96&v=4"/></br>[avanderberg](https://github.com/avanderberg) | <img width="50" src="https://avatars2.githubusercontent.com/u/67130?s=96&v=4"/></br>[chr15m](https://github.com/chr15m) | <img width="50" src="https://avatars2.githubusercontent.com/u/2793530?s=96&v=4"/></br>[CyberXZT](https://github.com/CyberXZT) | <img width="50" src="https://avatars2.githubusercontent.com/u/1307332?s=96&v=4"/></br>[dbrandonjohnson](https://github.com/dbrandonjohnson) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/49439044?s=96&v=4"/></br>[fourstepper](https://github.com/fourstepper) | <img width="50" src="https://avatars2.githubusercontent.com/u/64712218?s=96&v=4"/></br>[Hegghammer](https://github.com/Hegghammer) | <img width="50" src="https://avatars2.githubusercontent.com/u/3266447?s=96&v=4"/></br>[iamwillbar](https://github.com/iamwillbar) | <img width="50" src="https://avatars2.githubusercontent.com/u/1310474?s=96&v=4"/></br>[jknowles](https://github.com/jknowles) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/11947658?s=96&v=4"/></br>[KentBrockman](https://github.com/KentBrockman) | <img width="50" src="https://avatars2.githubusercontent.com/u/5588131?s=96&v=4"/></br>[kianenigma](https://github.com/kianenigma) | <img width="50" src="https://avatars2.githubusercontent.com/u/24908652?s=96&v=4"/></br>[konishi-t](https://github.com/konishi-t) | <img width="50" src="https://avatars2.githubusercontent.com/u/42319182?s=96&v=4"/></br>[marcdw1289](https://github.com/marcdw1289) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/126279083?s=96&v=4"/></br>[matmoly](https://github.com/matmoly) | <img width="50" src="https://avatars2.githubusercontent.com/u/1788010?s=96&v=4"/></br>[maxtruxa](https://github.com/maxtruxa) | <img width="50" src="https://avatars2.githubusercontent.com/u/29300939?s=96&v=4"/></br>[mcejp](https://github.com/mcejp) | <img width="50" src="https://avatars2.githubusercontent.com/u/31054972?s=96&v=4"/></br>[saarantras](https://github.com/saarantras) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/327998?s=96&v=4"/></br>[sif](https://github.com/sif) | <img width="50" src="https://avatars2.githubusercontent.com/u/765564?s=96&v=4"/></br>[taskcruncher](https://github.com/taskcruncher) | <img width="50" src="https://avatars2.githubusercontent.com/u/333944?s=96&v=4"/></br>[tateisu](https://github.com/tateisu) | |
| <img width="50" src="https://avatars2.githubusercontent.com/u/215668?s=96&v=4"/></br>[avanderberg](https://github.com/avanderberg) | <img width="50" src="https://avatars2.githubusercontent.com/u/3061769?s=96&v=4"/></br>[c-nagy](https://github.com/c-nagy) | <img width="50" src="https://avatars2.githubusercontent.com/u/70780798?s=96&v=4"/></br>[cabottech](https://github.com/cabottech) | <img width="50" src="https://avatars2.githubusercontent.com/u/67130?s=96&v=4"/></br>[chr15m](https://github.com/chr15m) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/4862947?s=96&v=4"/></br>[chrootlogin](https://github.com/chrootlogin) | <img width="50" src="https://avatars2.githubusercontent.com/u/82579431?s=96&v=4"/></br>[clmntsl](https://github.com/clmntsl) | <img width="50" src="https://avatars2.githubusercontent.com/u/808091?s=96&v=4"/></br>[cuongtransc](https://github.com/cuongtransc) | <img width="50" src="https://avatars2.githubusercontent.com/u/1307332?s=96&v=4"/></br>[dbrandonjohnson](https://github.com/dbrandonjohnson) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/1439535?s=96&v=4"/></br>[fbloise](https://github.com/fbloise) | <img width="50" src="https://avatars2.githubusercontent.com/u/49439044?s=96&v=4"/></br>[fourstepper](https://github.com/fourstepper) | <img width="50" src="https://avatars2.githubusercontent.com/u/38898566?s=96&v=4"/></br>[h4sh5](https://github.com/h4sh5) | <img width="50" src="https://avatars2.githubusercontent.com/u/3266447?s=96&v=4"/></br>[iamwillbar](https://github.com/iamwillbar) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/37297218?s=96&v=4"/></br>[Jesssullivan](https://github.com/Jesssullivan) | <img width="50" src="https://avatars2.githubusercontent.com/u/1310474?s=96&v=4"/></br>[jknowles](https://github.com/jknowles) | <img width="50" src="https://avatars2.githubusercontent.com/u/1248504?s=96&v=4"/></br>[joesfer](https://github.com/joesfer) | <img width="50" src="https://avatars2.githubusercontent.com/u/5588131?s=96&v=4"/></br>[kianenigma](https://github.com/kianenigma) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/24908652?s=96&v=4"/></br>[konishi-t](https://github.com/konishi-t) | <img width="50" src="https://avatars2.githubusercontent.com/u/42319182?s=96&v=4"/></br>[marcdw1289](https://github.com/marcdw1289) | <img width="50" src="https://avatars2.githubusercontent.com/u/1788010?s=96&v=4"/></br>[maxtruxa](https://github.com/maxtruxa) | <img width="50" src="https://avatars2.githubusercontent.com/u/29300939?s=96&v=4"/></br>[mcejp](https://github.com/mcejp) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/1168659?s=96&v=4"/></br>[nicholashead](https://github.com/nicholashead) | <img width="50" src="https://avatars2.githubusercontent.com/u/5782817?s=96&v=4"/></br>[piccobit](https://github.com/piccobit) | <img width="50" src="https://avatars2.githubusercontent.com/u/77214738?s=96&v=4"/></br>[Polymathic-Company](https://github.com/Polymathic-Company) | <img width="50" src="https://avatars2.githubusercontent.com/u/47742?s=96&v=4"/></br>[ravenscroftj](https://github.com/ravenscroftj) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/327998?s=96&v=4"/></br>[sif](https://github.com/sif) | <img width="50" src="https://avatars2.githubusercontent.com/u/54626606?s=96&v=4"/></br>[skyrunner15](https://github.com/skyrunner15) | <img width="50" src="https://avatars2.githubusercontent.com/u/765564?s=96&v=4"/></br>[taskcruncher](https://github.com/taskcruncher) | <img width="50" src="https://avatars2.githubusercontent.com/u/73081837?s=96&v=4"/></br>[thismarty](https://github.com/thismarty) |
| <img width="50" src="https://avatars2.githubusercontent.com/u/15859362?s=96&v=4"/></br>[thomasbroussard](https://github.com/thomasbroussard) | | | |
<!-- SPONSORS-GITHUB -->
<!-- TOC -->
@@ -126,7 +129,6 @@ A community maintained list of these distributions can be found here: [Unofficia
- [Writing a technical spec](https://github.com/laurent22/joplin/blob/dev/readme/technical_spec.md)
- [Desktop application styling](https://github.com/laurent22/joplin/blob/dev/readme/spec/desktop_styling.md)
- [Note History spec](https://github.com/laurent22/joplin/blob/dev/readme/spec/history.md)
- [Synchronisation spec](https://github.com/laurent22/joplin/blob/dev/readme/spec/sync.md)
- [Sync Lock spec](https://github.com/laurent22/joplin/blob/dev/readme/spec/sync_lock.md)
- [Synchronous Scroll spec](https://github.com/laurent22/joplin/blob/dev/readme/spec/sync_scroll.md)
- [Plugin Architecture spec](https://github.com/laurent22/joplin/blob/dev/readme/spec/plugins.md)
@@ -503,7 +505,6 @@ Name | Description
[Mastodon feed](https://mastodon.social/@joplinapp) | Follow us on Mastodon
[Patreon page](https://www.patreon.com/joplin) |The latest news are often posted there
[Discord server](https://discord.gg/VSj7AFHvpq) | Our chat server
[LinkedIn](https://www.linkedin.com/company/joplin) | Our LinkedIn page
[Sub-reddit](https://www.reddit.com/r/joplinapp/) | Also a good place to get help
# Contributing

View File

@@ -1,52 +1,26 @@
const gulp = require('gulp');
const execa = require('execa');
const { stdout } = require('process');
const execCommand = async (executableName, args, options = null) => {
options = {
showInput: true,
showStdout: true,
showStderr: true,
quiet: false,
...options,
};
if (options.quiet) {
options.showInput = false;
options.showStdout = false;
options.showStderr = false;
}
if (options.showInput) {
stdout.write(`> ${executableName} ${args.join(' ')}\n`);
}
const promise = execa(executableName, args);
if (options.showStdout && promise.stdout) promise.stdout.pipe(process.stdout);
if (options.showStderr && promise.stderr) promise.stderr.pipe(process.stderr);
const result = await promise;
return result.stdout.trim();
};
const utils = require('./packages/tools/gulp/utils');
const tasks = {
updateIgnoredTypeScriptBuild: require('./packages/tools/gulp/tasks/updateIgnoredTypeScriptBuild'),
buildCommandIndex: require('./packages/tools/gulp/tasks/buildCommandIndex'),
completePublishAll: {
fn: async () => {
await execCommand('git', ['add', '-A']);
await execCommand('git', ['commit', '-m', 'Releasing sub-packages']);
await utils.execCommandVerbose('git', ['add', '-A']);
await utils.execCommandVerbose('git', ['commit', '-m', 'Releasing sub-packages']);
// Lerna does some unnecessary auth check that doesn't work with
// automation tokens, thus the --no-verify-access. Automation token
// is still used for access when publishing even with this flag
// (publishing would fail otherwise).
// https://github.com/lerna/lerna/issues/2788
await execCommand('lerna', ['publish', 'from-package', '-y', '--no-verify-access']);
await utils.execCommandVerbose('lerna', ['publish', 'from-package', '-y', '--no-verify-access']);
await execCommand('yarn', ['install']);
await execCommand('git', ['add', '-A']);
await execCommand('git', ['commit', '-m', 'Lock file']);
await utils.execCommandVerbose('yarn', ['install']);
await utils.execCommandVerbose('git', ['add', '-A']);
await utils.execCommandVerbose('git', ['commit', '-m', 'Lock file']);
await execCommand('git', ['push']);
await utils.execCommandVerbose('git', ['push']);
},
},
build: {
@@ -59,14 +33,12 @@ const tasks = {
// faster, especially when having to rebuild after adding a
// dependency.
if (process.env.BUILD_SEQUENCIAL === '1') {
await execCommand('yarn', ['run', 'buildSequential']);
await utils.execCommandVerbose('yarn', ['run', 'buildSequential']);
} else {
await execCommand('yarn', ['run', 'buildParallel']);
await utils.execCommandVerbose('yarn', ['run', 'buildParallel']);
}
},
},
};
for (const taskName in tasks) {
gulp.task(taskName, tasks[taskName].fn);
}
utils.registerGulpTasks(gulp, tasks);

View File

@@ -329,7 +329,6 @@
"packages/renderer/MdToHtml/rules/sanitize_html.js": true,
"packages/server/db-*.sqlite": true,
"packages/server/dist/": true,
"packages/utils/dist/": true,
"packages/server/temp": true,
"packages/server/test.pid": true,
"phpunit.xml": true,

View File

@@ -15,7 +15,7 @@
"buildParallel": "yarn workspaces foreach --verbose --interlaced --parallel --jobs 2 --topological run build && yarn run tsc",
"buildSequential": "yarn workspaces foreach --verbose --interlaced --topological run build && yarn run tsc",
"buildApiDoc": "yarn workspace joplin start apidoc ../../readme/api/references/rest_api.md",
"buildCommandIndex": "node packages/tools/gulp/tasks/buildCommandIndexRun.js",
"buildCommandIndex": "gulp buildCommandIndex",
"buildPluginDoc": "typedoc --name 'Joplin Plugin API Documentation' --mode file -theme './Assets/PluginDocTheme/' --readme './Assets/PluginDocTheme/index.md' --excludeNotExported --excludeExternals --excludePrivate --excludeProtected --out ../joplin-website/docs/api/references/plugin_api packages/lib/services/plugins/api/",
"updateMarkdownDoc": "node ./packages/tools/updateMarkdownDoc",
"updateNews": "node ./packages/tools/website/updateNews",
@@ -53,7 +53,7 @@
"test-ci": "yarn workspaces foreach --parallel --verbose --interlaced --jobs 2 run test-ci",
"test": "yarn workspaces foreach --parallel --verbose --interlaced --jobs 2 run test",
"tsc": "yarn workspaces foreach --parallel --verbose --interlaced run tsc",
"updateIgnored": "node packages/tools/gulp/tasks/updateIgnoredTypeScriptBuildRun.js",
"updateIgnored": "gulp updateIgnoredTypeScriptBuild",
"updatePluginTypes": "./packages/generator-joplin/updateTypes.sh",
"watch": "yarn workspaces foreach --parallel --verbose --interlaced --jobs 999 run watch",
"watchWebsite": "nodemon --verbose --watch Assets/WebsiteAssets --watch packages/tools/website --watch packages/tools/website/utils --ext md,ts,js,mustache,css,tsx,gif,png,svg --exec \"node packages/tools/website/build.js && http-server --port 8077 ../joplin-website/docs -a localhost\""
@@ -64,7 +64,6 @@
}
},
"devDependencies": {
"@joplin/utils": "~2.11",
"@seiyab/eslint-plugin-react-hooks": "4.5.1-beta.0",
"@typescript-eslint/eslint-plugin": "5.48.2",
"@typescript-eslint/parser": "5.48.2",
@@ -72,16 +71,14 @@
"eslint": "8.31.0",
"eslint-interactive": "10.3.0",
"eslint-plugin-import": "2.27.4",
"eslint-plugin-jest": "27.2.1",
"eslint-plugin-promise": "6.1.1",
"eslint-plugin-react": "7.32.0",
"execa": "5.1.1",
"fs-extra": "11.1.1",
"fs-extra": "11.1.0",
"glob": "8.1.0",
"gulp": "4.0.2",
"husky": "3.1.0",
"lerna": "3.22.1",
"lint-staged": "13.2.0",
"lint-staged": "13.1.2",
"madge": "6.0.0",
"npm-package-json-lint": "6.4.0",
"typedoc": "0.17.8",
@@ -91,11 +88,10 @@
"@types/fs-extra": "9.0.13",
"http-server": "14.1.1",
"node-gyp": "9.3.1",
"nodemon": "2.0.22"
"nodemon": "2.0.20"
},
"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",
"rn-fetch-blob@0.12.0": "patch:rn-fetch-blob@npm%3A0.12.0#./.yarn/patches/rn-fetch-blob-npm-0.12.0-cf02e3c544.patch"
"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"
}
}

View File

@@ -8,7 +8,7 @@ const Resource = require('@joplin/lib/models/Resource').default;
const Setting = require('@joplin/lib/models/Setting').default;
const reducer = require('@joplin/lib/reducer').default;
const { defaultState } = require('@joplin/lib/reducer');
const { splitCommandString } = require('@joplin/utils');
const { splitCommandString } = require('@joplin/lib/string-utils.js');
const { reg } = require('@joplin/lib/registry.js');
const { _ } = require('@joplin/lib/locale');
const shim = require('@joplin/lib/shim').default;

View File

@@ -9,8 +9,7 @@ const Tag = require('@joplin/lib/models/Tag').default;
const Setting = require('@joplin/lib/models/Setting').default;
const { reg } = require('@joplin/lib/registry.js');
const { fileExtension } = require('@joplin/lib/path-utils');
const { splitCommandString } = require('@joplin/utils');
const { splitCommandBatch } = require('@joplin/lib/string-utils');
const { splitCommandString, splitCommandBatch } = require('@joplin/lib/string-utils');
const { _ } = require('@joplin/lib/locale');
const fs = require('fs-extra');
const { cliUtils } = require('./cli-utils.js');

View File

@@ -1,6 +1,6 @@
const fs = require('fs-extra');
const BaseCommand = require('./base-command').default;
const { splitCommandString } = require('@joplin/utils');
const { splitCommandString } = require('@joplin/lib/string-utils.js');
const uuid = require('@joplin/lib/uuid').default;
const { app } = require('./app.js');
const { _ } = require('@joplin/lib/locale');

View File

@@ -30,24 +30,22 @@
2019,
2020,
2021,
2022,
2023
2022
],
"owner": "Laurent Cozic"
},
"version": "2.11.0",
"version": "2.10.3",
"bin": "./main.js",
"engines": {
"node": ">=10.0.0"
},
"dependencies": {
"@joplin/lib": "~2.11",
"@joplin/renderer": "~2.11",
"@joplin/utils": "~2.11",
"@joplin/lib": "~2.10",
"@joplin/renderer": "~2.10",
"aws-sdk": "2.1290.0",
"chalk": "4.1.2",
"compare-version": "0.1.2",
"fs-extra": "11.1.1",
"fs-extra": "11.1.0",
"html-entities": "1.4.0",
"image-type": "3.1.0",
"keytar": "7.9.0",
@@ -59,7 +57,7 @@
"server-destroy": "1.0.1",
"sharp": "0.31.3",
"sprintf-js": "1.1.2",
"sqlite3": "5.1.6",
"sqlite3": "5.1.4",
"string-padding": "1.0.2",
"strip-ansi": "6.0.1",
"tcp-port-used": "1.0.2",
@@ -70,7 +68,7 @@
"yargs-parser": "21.1.1"
},
"devDependencies": {
"@joplin/tools": "~2.11",
"@joplin/tools": "~2.10",
"@types/fs-extra": "9.0.13",
"@types/jest": "29.2.6",
"@types/node": "18.11.18",

View File

@@ -1,5 +1,3 @@
/* eslint-disable jest/require-top-level-describe */
import KeychainService from '@joplin/lib/services/keychain/KeychainService';
import shim from '@joplin/lib/shim';
import Setting from '@joplin/lib/models/Setting';

View File

@@ -47,11 +47,9 @@ describe('services_plugins_RepositoryApi', () => {
it('should tell if a plugin can be updated', (async () => {
const api = await newRepoApi();
expect(await api.pluginCanBeUpdated('org.joplinapp.plugins.ToggleSidebars', '1.0.0', '3.0.0')).toBe(true);
expect(await api.pluginCanBeUpdated('org.joplinapp.plugins.ToggleSidebars', '1.0.0', '1.0.0')).toBe(false);
expect(await api.pluginCanBeUpdated('org.joplinapp.plugins.ToggleSidebars', '1.0.2', '3.0.0')).toBe(false);
expect(await api.pluginCanBeUpdated('does.not.exist', '1.0.0', '3.0.0')).toBe(false);
expect(await api.pluginCanBeUpdated('org.joplinapp.plugins.ToggleSidebars', '1.0.0')).toBe(true);
expect(await api.pluginCanBeUpdated('org.joplinapp.plugins.ToggleSidebars', '1.0.2')).toBe(false);
expect(await api.pluginCanBeUpdated('does.not.exist', '1.0.0')).toBe(false);
}));
});

View File

@@ -19,7 +19,7 @@
import * as fs from 'fs-extra';
import { homedir } from 'os';
import { execCommand } from '@joplin/utils';
import { execCommand2 } from '@joplin/tools/tool-utils';
import { chdir } from 'process';
const minUserNum = 1;
@@ -66,7 +66,7 @@ const processUser = async (userNum: number) => {
await chdir(cliDir);
await execCommand(['yarn', 'run', 'start-no-build', '--', '--profile', profileDir, 'batch', commandFile]);
await execCommand2(['yarn', 'run', 'start-no-build', '--', '--profile', profileDir, 'batch', commandFile]);
} catch (error) {
console.error(`Could not process user ${userNum}:`, error);
} finally {
@@ -90,7 +90,7 @@ const main = async () => {
// Build the app once before starting, because we'll use start-no-build to
// run the scripts (faster)
await execCommand(['yarn', 'run', 'build']);
await execCommand2(['yarn', 'run', 'build']);
const focusUserNum = 0;

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Joplin Web Clipper [DEV]",
"version": "2.11.2",
"version": "2.10.0",
"description": "Capture and save web pages and screenshots from your browser to Joplin.",
"homepage_url": "https://joplinapp.org",
"content_security_policy": "script-src 'self'; object-src 'self'",

View File

@@ -126,4 +126,4 @@
"react-app"
]
}
}
}

View File

@@ -3,7 +3,7 @@ import appReducer, { createAppDefaultState } from './app.reducer';
describe('app.reducer', () => {
it('should handle DIALOG_OPEN', async () => {
it('DIALOG_OPEN', async () => {
const state: AppState = createAppDefaultState({}, {});
let newState = appReducer(state, {

View File

@@ -143,7 +143,7 @@ export default function(props: Props) {
let cancelled = false;
async function fetchPluginIds() {
const pluginIds = await repoApi().canBeUpdatedPlugins(pluginItems.map(p => p.manifest), pluginService.appVersion);
const pluginIds = await repoApi().canBeUpdatedPlugins(pluginItems.map(p => p.manifest));
if (cancelled) return;
const conv: Record<string, boolean> = {};
pluginIds.forEach(id => conv[id] = true);
@@ -155,7 +155,7 @@ export default function(props: Props) {
return () => {
cancelled = true;
};
}, [manifestsLoaded, pluginItems, pluginService.appVersion]);
}, [manifestsLoaded, pluginItems]);
const onDelete = useCallback(async (event: ItemEvent) => {
const item = event.item;

View File

@@ -21,7 +21,7 @@ import checkForUpdates from '../checkForUpdates';
const { connect } = require('react-redux');
import { reg } from '@joplin/lib/registry';
import { ProfileConfig } from '@joplin/lib/services/profileConfig/types';
import PluginService, { PluginSettings } from '@joplin/lib/services/plugins/PluginService';
import PluginService from '@joplin/lib/services/plugins/PluginService';
const packageInfo = require('../packageInfo.js');
const { clipboard } = require('electron');
const Menu = bridge().Menu;
@@ -128,7 +128,6 @@ interface Props {
customCss: string;
locale: string;
profileConfig: ProfileConfig;
pluginSettings: PluginSettings;
}
const commandNames: string[] = menuCommandNames();
@@ -488,7 +487,8 @@ function useMenu(props: Props) {
}
function _showAbout() {
const v = versionInfo(packageInfo, PluginService.instance().enabledPlugins(props.pluginSettings));
const v = versionInfo(packageInfo, PluginService.instance().plugins);
const copyToClipboard = bridge().showMessageBox(v.message, {
icon: `${bridge().electronApp().buildDir()}/icons/128x128.png`,
@@ -931,7 +931,6 @@ function useMenu(props: Props) {
props['spellChecker.languages'],
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
props['spellChecker.enabled'],
props.pluginSettings,
props.customCss,
props.locale,
props.profileConfig,
@@ -987,7 +986,6 @@ const mapStateToProps = (state: AppState) => {
['folders.sortOrder.field']: state.settings['folders.sortOrder.field'],
['notes.sortOrder.reverse']: state.settings['notes.sortOrder.reverse'],
['folders.sortOrder.reverse']: state.settings['folders.sortOrder.reverse'],
pluginSettings: state.settings['plugins.states'],
showNoteCounts: state.settings.showNoteCounts,
uncompletedTodosOnTop: state.settings.uncompletedTodosOnTop,
showCompletedTodos: state.settings.showCompletedTodos,

View File

@@ -77,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;
@@ -1066,24 +1076,24 @@ const TinyMCE = (props: NoteBodyEditorProps, ref: any) => {
}
}
async function onKeyDown(event: any) {
function onKeyDown(event: any) {
// It seems "paste as text" is handled automatically on Windows and Linux,
// so we need to run the below code only on macOS. If we were to run this
// on Windows/Linux, we would have this double-paste issue:
// https://github.com/laurent22/joplin/issues/4243
// While "paste as text" functionality is handled by Windows and Linux, if we
// want to allow the user to customize the shortcut we need to prevent when it
// has the default value so it doesn't paste the content twice
// (one by the system and the other by our code)
if ((event.metaKey || event.ctrlKey) && event.shiftKey && event.code === 'KeyV') {
event.preventDefault();
pasteAsPlainText(null);
// Handle "paste as text". Note that when pressing CtrlOrCmd+Shift+V it's going
// to trigger the "keydown" event but not the "paste" event, so it's ok to process
// it here and we don't need to do anything special in onPaste
if (!shim.isWindows() && !shim.isLinux()) {
if ((event.metaKey || event.ctrlKey) && event.shiftKey && event.code === 'KeyV') {
pasteAsPlainText();
}
}
}
function onPasteAsText() {
pasteAsPlainText(null);
async function onPasteAsText() {
await onPaste(createSyntheticClipboardEventWithoutHTML());
}
editor.on(TinyMceEditorEvents.KeyUp, onKeyUp);

View File

@@ -3,7 +3,6 @@ import { useCallback, useMemo } from 'react';
import { ResourceInfos } from './types';
import markupLanguageUtils from '../../../utils/markupLanguageUtils';
import Setting from '@joplin/lib/models/Setting';
import shim from '@joplin/lib/shim';
const { themeStyle } = require('@joplin/lib/theme');
import Note from '@joplin/lib/models/Note';
@@ -24,7 +23,6 @@ export interface MarkupToHtmlOptions {
useCustomPdfViewer?: boolean;
noteId?: string;
vendorDir?: string;
platformName?: string;
}
export default function useMarkupToHtml(deps: HookDependencies) {
@@ -42,7 +40,6 @@ export default function useMarkupToHtml(deps: HookDependencies) {
options = {
replaceResourceInternalToExternalLinks: false,
resourceInfos: {},
platformName: shim.platformName(),
...options,
};

View File

@@ -241,7 +241,6 @@ const NoteListComponent = (props: Props) => {
event.dataTransfer.setDragImage(new Image(), 1, 1);
event.dataTransfer.clearData();
event.dataTransfer.setData('text/x-jop-note-ids', JSON.stringify(noteIds));
event.dataTransfer.effectAllowed = 'move';
};
const renderItem = useCallback((item: any, index: number) => {
@@ -295,7 +294,7 @@ const NoteListComponent = (props: Props) => {
useEffect(() => {
if (previousSelectedNoteIds !== props.selectedNoteIds && props.selectedNoteIds.length === 1) {
const id = props.selectedNoteIds[0];
const doRefocus = props.notes.length < previousNotes.length && !props.focusedField;
const doRefocus = props.notes.length < previousNotes.length;
for (let i = 0; i < props.notes.length; i++) {
if (props.notes[i].id === id) {
@@ -312,7 +311,8 @@ const NoteListComponent = (props: Props) => {
if (previousVisible !== props.visible) {
updateSizeState();
}
}, [previousSelectedNoteIds, previousNotes, previousVisible, props.selectedNoteIds, props.notes, props.focusedField, props.visible]);
// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied
}, [previousSelectedNoteIds, previousNotes, previousVisible, props.selectedNoteIds, props.notes]);
const scrollNoteIndex_ = (keyCode: any, ctrlKey: any, metaKey: any, noteIndex: any) => {
@@ -559,7 +559,6 @@ const mapStateToProps = (state: AppState) => {
highlightedWords: state.highlightedWords,
plugins: state.pluginService.plugins,
customCss: state.customCss,
focusedField: state.focusedField,
};
};

View File

@@ -23,5 +23,4 @@ export interface Props {
highlightedWords: string[];
provisionalNoteIds: string[];
visible: boolean;
focusedField: string;
}

View File

@@ -1,6 +1,6 @@
import { AppState } from '../../app.reducer';
import * as React from 'react';
import { useEffect, useRef, useMemo, useState } from 'react';
import { useEffect, useRef } from 'react';
import SearchBar from '../SearchBar/SearchBar';
import Button, { ButtonLevel, ButtonSize, buttonSizePx } from '../Button/Button';
import CommandService from '@joplin/lib/services/CommandService';
@@ -11,13 +11,6 @@ import { _ } from '@joplin/lib/locale';
const { connect } = require('react-redux');
const styled = require('styled-components').default;
enum BaseBreakpoint {
Sm = 75,
Md = 80,
Lg = 120,
Xl = 474,
}
interface Props {
showNewNoteButtons: boolean;
sortOrderButtonsVisible: boolean;
@@ -25,15 +18,6 @@ interface Props {
sortOrderReverse: boolean;
notesParentType: string;
height: number;
width: number;
onContentHeightChange: (sameRow: boolean)=> void;
}
interface Breakpoints {
Sm: number;
Md: number;
Lg: number;
Xl: number;
}
const StyledRoot = styled.div`
@@ -50,9 +34,7 @@ const StyledButton = styled(Button)`
width: auto;
height: 26px;
min-height: 26px;
min-width: 37px;
max-width: none;
white-space: nowrap;
flex: 1 0 auto;
.fa, .fas {
font-size: 11px;
@@ -72,13 +54,7 @@ const StyledPairButtonR = styled(Button)`
width: auto;
`;
const TopRow = styled.div`
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
`;
const BottomRow = styled.div`
const RowContainer = styled.div`
display: flex;
flex-direction: row;
flex: 1 1 auto;
@@ -92,102 +68,7 @@ const SortOrderButtonsContainer = styled.div`
`;
function NoteListControls(props: Props) {
const [dynamicBreakpoints, setDynamicBreakpoints] = useState<Breakpoints>({ Sm: BaseBreakpoint.Sm, Md: BaseBreakpoint.Md, Lg: BaseBreakpoint.Lg, Xl: BaseBreakpoint.Xl });
const searchBarRef = useRef(null);
const newNoteRef = useRef(null);
const newTodoRef = useRef(null);
const noteControlsRef = useRef(null);
const searchAndSortRef = useRef(null);
const getTextWidth = (text: string): number => {
const canvas = document.createElement('canvas');
if (!canvas) throw new Error('Failed to create canvas element');
const ctx = canvas.getContext('2d');
if (!ctx) throw new Error('Failed to get context');
const fontWeight = getComputedStyle(newNoteRef.current).getPropertyValue('font-weight');
const fontSize = getComputedStyle(newNoteRef.current).getPropertyValue('font-size');
const fontFamily = getComputedStyle(newNoteRef.current).getPropertyValue('font-family');
ctx.font = `${fontWeight} ${fontSize} ${fontFamily}`;
return ctx.measureText(text).width;
};
// Initialize language-specific breakpoints
useEffect(() => {
// Use the longest string to calculate the amount of extra width needed
const smAdditional = getTextWidth(_('note')) > getTextWidth(_('to-do')) ? getTextWidth(_('note')) : getTextWidth(_('to-do'));
const mdAdditional = getTextWidth(_('New note')) > getTextWidth(_('New to-do')) ? getTextWidth(_('New note')) : getTextWidth(_('New to-do'));
const Sm = BaseBreakpoint.Sm + smAdditional * 2;
const Md = BaseBreakpoint.Md + mdAdditional * 2;
const Lg = BaseBreakpoint.Lg + Md;
const Xl = BaseBreakpoint.Xl;
setDynamicBreakpoints({ Sm, Md, Lg, Xl });
}, []);
const breakpoint = useMemo(() => {
// Find largest breakpoint that width is less than
const index = Object.values(dynamicBreakpoints).findIndex(x => props.width < x);
return index === -1 ? dynamicBreakpoints.Xl : Object.values(dynamicBreakpoints)[index];
}, [props.width, dynamicBreakpoints]);
const noteButtonText = useMemo(() => {
if (breakpoint === dynamicBreakpoints.Sm) {
return '';
} else if (breakpoint === dynamicBreakpoints.Md) {
return _('note');
} else {
return _('New note');
}
}, [breakpoint, dynamicBreakpoints]);
const todoButtonText = useMemo(() => {
if (breakpoint === dynamicBreakpoints.Sm) {
return '';
} else if (breakpoint === dynamicBreakpoints.Md) {
return _('to-do');
} else {
return _('New to-do');
}
}, [breakpoint, dynamicBreakpoints]);
const noteIcon = useMemo(() => {
if (breakpoint === dynamicBreakpoints.Sm) {
return 'icon-note';
} else {
return 'fas fa-plus';
}
}, [breakpoint, dynamicBreakpoints]);
const todoIcon = useMemo(() => {
if (breakpoint === dynamicBreakpoints.Sm) {
return 'far fa-check-square';
} else {
return 'fas fa-plus';
}
}, [breakpoint, dynamicBreakpoints]);
const showTooltip = useMemo(() => {
if (breakpoint === dynamicBreakpoints.Sm) {
return true;
} else {
return false;
}
}, [breakpoint, dynamicBreakpoints.Sm]);
useEffect(() => {
if (breakpoint === dynamicBreakpoints.Xl) {
noteControlsRef.current.style.flexDirection = 'row';
searchAndSortRef.current.style.flex = '2 1 auto';
props.onContentHeightChange(true);
} else {
noteControlsRef.current.style.flexDirection = 'column';
props.onContentHeightChange(false);
}
}, [breakpoint, dynamicBreakpoints, props.onContentHeightChange]);
useEffect(() => {
CommandService.instance().registerRuntime('focusSearch', focusSearchRuntime(searchBarRef));
@@ -246,33 +127,33 @@ function NoteListControls(props: Props) {
if (!props.showNewNoteButtons) return null;
return (
<TopRow className="new-note-todo-buttons">
<StyledButton ref={newNoteRef}
<RowContainer>
<StyledButton
className="new-note-button"
tooltip={ showTooltip ? CommandService.instance().label('newNote') : '' }
iconName={noteIcon}
title={_('%s', noteButtonText)}
tooltip={CommandService.instance().label('newNote')}
iconName="fas fa-plus"
title={_('%s', 'New note')}
level={ButtonLevel.Primary}
size={ButtonSize.Small}
onClick={onNewNoteButtonClick}
/>
<StyledButton ref={newTodoRef}
<StyledButton
className="new-todo-button"
tooltip={ showTooltip ? CommandService.instance().label('newTodo') : '' }
iconName={todoIcon}
title={_('%s', todoButtonText)}
tooltip={CommandService.instance().label('newTodo')}
iconName="fas fa-plus"
title={_('%s', 'New to-do')}
level={ButtonLevel.Secondary}
size={ButtonSize.Small}
onClick={onNewTodoButtonClick}
/>
</TopRow>
</RowContainer>
);
}
return (
<StyledRoot ref={noteControlsRef}>
<StyledRoot>
{renderNewNoteButtons()}
<BottomRow ref={searchAndSortRef} className="search-and-sort">
<RowContainer>
<SearchBar inputRef={searchBarRef}/>
{showsSortOrderButtons() &&
<SortOrderButtonsContainer>
@@ -294,7 +175,7 @@ function NoteListControls(props: Props) {
/>
</SortOrderButtonsContainer>
}
</BottomRow>
</RowContainer>
</StyledRoot>
);
}

View File

@@ -1,6 +1,6 @@
import { themeStyle } from '@joplin/lib/theme';
import * as React from 'react';
import { useMemo, useState } from 'react';
import { useMemo } from 'react';
import NoteList from '../NoteList/NoteList';
import NoteListControls from '../NoteListControls/NoteListControls';
import { Size } from '../ResizableLayout/utils/types';
@@ -22,15 +22,7 @@ const StyledRoot = styled.div`
export default function NoteListWrapper(props: Props) {
const theme = themeStyle(props.themeId);
const [controlHeight, setControlHeight] = useState(theme.topRowHeight);
const onContentHeightChange = (sameRow: boolean) => {
if (sameRow) {
setControlHeight(theme.topRowHeight);
} else {
setControlHeight(theme.topRowHeight * 2);
}
};
const controlHeight = theme.topRowHeight;
const noteListSize = useMemo(() => {
return {
@@ -41,7 +33,7 @@ export default function NoteListWrapper(props: Props) {
return (
<StyledRoot>
<NoteListControls height={controlHeight} width={noteListSize.width} onContentHeightChange={onContentHeightChange}/>
<NoteListControls height={controlHeight}/>
<NoteList resizableLayoutEventEmitter={props.resizableLayoutEventEmitter} size={noteListSize} visible={props.visible}/>
</StyledRoot>
);

View File

@@ -147,7 +147,7 @@ describe('movements', () => {
expect(canMove(MoveDirection.Right, findItemByKey(layout, 'col2'), findItemByKey(layout, 'root'))).toBe(false);
});
test('container with only one child should take the width of its parent', () => {
test('Container with only one child should take the width of its parent', () => {
let layout: LayoutItem = validateLayout({
key: 'root',
width: 100,
@@ -170,7 +170,7 @@ describe('movements', () => {
expect(layout.children[0].children[0].width).toBe(undefined);
});
test('temp container should take the width of the child it replaces', () => {
test('Temp container should take the width of the child it replaces', () => {
let layout: LayoutItem = validateLayout({
key: 'root',
width: 100,
@@ -198,7 +198,7 @@ describe('movements', () => {
expect(layout.children[0].children[1].width).toBe(undefined);
});
test('last child should have flexible width if all siblings have fixed width', () => {
test('Last child should have flexible width if all siblings have fixed width', () => {
let layout: LayoutItem = validateLayout({
key: 'root',
width: 100,

View File

@@ -260,6 +260,10 @@ describe('useLayoutItemSizes', () => {
expect(sizes.col4.width).toBe(50);
});
});
describe('calculateMaxSizeAvailableForItem', () => {
test('should give maximum available space this item can take up during resizing', () => {
const layout: LayoutItem = validateLayout({
key: 'root',

View File

@@ -1,7 +1,5 @@
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';
@@ -40,24 +38,6 @@ 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,
}}
}
`;
const TagsHolder = styled.div`
// linux bug: https://github.com/laurent22/joplin/issues/8000
// solution ref: https://github.com/laurent22/joplin/issues/7506#issuecomment-1447101057
& a.list-item {
${shim.isLinux() && {
opacity: 1,
}}
}
`;
interface Props {
themeId: number;
dispatch: Function;
@@ -725,13 +705,13 @@ const SidebarComponent = (props: Props) => {
const folderItems = [renderAllNotesItem(theme, allNotesSelected)].concat(result.items);
folderItemsOrder_.current = result.order;
items.push(
<StyledFoldersHolder
<div
className={`folders ${props.folderHeaderIsExpanded ? 'expanded' : ''}`}
key="folder_items"
style={foldersStyle}
>
{folderItems}
</StyledFoldersHolder>
</div>
);
}
@@ -747,9 +727,9 @@ const SidebarComponent = (props: Props) => {
tagItemsOrder_.current = result.order;
items.push(
<TagsHolder className="tags" key="tag_items" style={{ display: props.tagHeaderIsExpanded ? 'block' : 'none' }}>
<div className="tags" key="tag_items" style={{ display: props.tagHeaderIsExpanded ? 'block' : 'none' }}>
{tagItems}
</TagsHolder>
</div>
);
}

View File

@@ -56,19 +56,6 @@ if (typeof module !== 'undefined') {
const markJsUtils = {};
const isInsideContainer = (node, tagName) => {
if (!node) return false;
tagName = tagName.toLowerCase();
while (node) {
if (node.tagName && node.tagName.toLowerCase() === tagName) return true;
node = node.parentNode;
}
return false;
};
markJsUtils.markKeyword = (mark, keyword, stringUtils, extraOptions = null) => {
if (typeof keyword === 'string') {
keyword = {
@@ -84,13 +71,12 @@ markJsUtils.markKeyword = (mark, keyword, stringUtils, extraOptions = null) => {
if (isBasicSearch) accuracy = 'partially';
if (keyword.type === 'regex') {
accuracy = 'complementary';
// Remove the trailing wildcard and "accuracy = complementary" will take
// care of highlighting the relevant keywords.
// Remove the trailing wildcard and "accuracy = complementary" will take care of
// highlighting the relevant keywords.
// Known bug: it will also highlight word that contain the term as a
// suffix for example for "ent*", it will highlight "present" which is
// incorrect (it should only highlight what starts with "ent") but for
// now will do. Mark.js doesn't have an option to tweak this behaviour.
// Known bug: it will also highlight word that contain the term as a suffix for example for "ent*", it will highlight "present"
// which is incorrect (it should only highlight what starts with "ent") but for now will do. Mark.js doesn't have an option
// to tweak this behaviour.
value = keyword.value.substr(0, keyword.value.length - 1);
}
@@ -100,18 +86,6 @@ markJsUtils.markKeyword = (mark, keyword, stringUtils, extraOptions = null) => {
{},
{
accuracy: accuracy,
filter: (node, _term, _totalCounter, _counter) => {
// We exclude SVG because it creates a "<mark>" tag inside
// the document, which is not a valid SVG tag. As a result
// the content within that tag disappears.
//
// mark.js has an "exclude" parameter, but it doesn't work
// so we use "filter" instead.
//
// https://github.com/joplin/plugin-abc-sheet-music
if (isInsideContainer(node, 'SVG')) return false;
return true;
},
},
extraOptions
)

View File

@@ -1,12 +1,11 @@
{
"name": "@joplin/app-desktop",
"version": "2.11.1",
"version": "2.10.8",
"description": "Joplin for Desktop",
"main": "main.js",
"private": true,
"scripts": {
"dist": "yarn run bundleDefaultPlugins && yarn run electronRebuild && npx electron-builder",
"bundleDefaultPlugins": "cd ../tools && node bundleDefaultPlugins.js",
"dist": "yarn run electronRebuild && npx electron-builder",
"build": "gulp build",
"postinstall": "yarn run build",
"electronBuilder": "gulp electronBuilder",
@@ -91,11 +90,7 @@
"CFBundleURLName": "org.joplinapp.x-callback-url"
}
]
},
"binaries": [
"Contents/Resources/build/defaultPlugins/io.github.jackgruber.backup/7zip-bin/mac/arm64/7za",
"Contents/Resources/build/defaultPlugins/io.github.jackgruber.backup/7zip-bin/mac/x64/7za"
]
}
},
"linux": {
"icon": "../../Assets/LinuxIcons",
@@ -112,9 +107,7 @@
},
"homepage": "https://github.com/laurent22/joplin#readme",
"devDependencies": {
"@electron/notarize": "1.2.3",
"@electron/rebuild": "3.2.10",
"@joplin/tools": "~2.11",
"@joplin/tools": "~2.10",
"@testing-library/react-hooks": "8.0.1",
"@types/jest": "29.2.6",
"@types/node": "18.11.18",
@@ -122,7 +115,9 @@
"@types/react-redux": "7.1.25",
"@types/styled-components": "5.1.26",
"electron": "19.1.4",
"electron-builder": "24.1.2",
"electron-builder": "23.6.0",
"electron-notarize": "1.2.2",
"electron-rebuild": "3.2.9",
"glob": "8.1.0",
"gulp": "4.0.2",
"jest": "29.4.3",
@@ -141,9 +136,9 @@
"@electron/remote": "2.0.9",
"@fortawesome/fontawesome-free": "5.15.4",
"@joeattardi/emoji-button": "4.6.4",
"@joplin/lib": "~2.11",
"@joplin/pdf-viewer": "~2.11",
"@joplin/renderer": "~2.11",
"@joplin/lib": "~2.10",
"@joplin/pdf-viewer": "~2.10",
"@joplin/renderer": "~2.10",
"async-mutex": "0.4.0",
"codemirror": "5.65.9",
"color": "3.2.1",
@@ -152,7 +147,7 @@
"debounce": "1.2.1",
"electron-window-state": "5.0.3",
"formatcoords": "1.1.3",
"fs-extra": "11.1.1",
"fs-extra": "11.1.0",
"highlight.js": "11.7.0",
"immer": "7.0.15",
"keytar": "7.9.0",
@@ -168,17 +163,17 @@
"react-datetime": "3.2.0",
"react-dom": "18.2.0",
"react-redux": "8.0.5",
"react-select": "5.7.2",
"react-select": "5.7.0",
"react-toggle-button": "2.2.0",
"react-tooltip": "4.5.1",
"redux": "4.2.1",
"reselect": "4.1.7",
"roboto-fontface": "0.10.0",
"smalltalk": "2.5.1",
"sqlite3": "5.1.6",
"styled-components": "5.3.9",
"sqlite3": "5.1.4",
"styled-components": "5.3.6",
"styled-system": "5.1.5",
"taboverride": "4.0.3",
"tinymce": "5.10.6"
}
}
}

View File

@@ -6,14 +6,14 @@ const { shimInit } = require('@joplin/lib/shim-init-node.js');
const folderId1 = 'aa012345678901234567890123456789';
const folderId2 = 'bb012345678901234567890123456789';
describe('PerFolderSortOrderService', () => {
beforeAll(async () => {
shimInit();
Setting.autoSaveEnabled = false;
PerFolderSortOrderService.initialize();
Setting.setValue('notes.perFolderSortOrderEnabled', true);
});
beforeAll(async () => {
shimInit();
Setting.autoSaveEnabled = false;
PerFolderSortOrderService.initialize();
Setting.setValue('notes.perFolderSortOrderEnabled', true);
});
describe('PerFolderSortOrderService', () => {
test('get(), isSet() and set()', async () => {
// Clear all per-folder sort order

View File

@@ -2,12 +2,12 @@ import { notesSortOrderFieldArray, notesSortOrderNextField, setNotesSortOrder }
import Setting from '@joplin/lib/models/Setting';
const { shimInit } = require('@joplin/lib/shim-init-node.js');
describe('notesSortOrderUtils', () => {
beforeAll(() => {
shimInit();
Setting.autoSaveEnabled = false;
});
beforeAll(() => {
shimInit();
Setting.autoSaveEnabled = false;
});
describe('notesSortOrderUtils', () => {
it('should always provide the same ordered fields', async () => {
const expected = ['user_updated_time', 'user_created_time', 'title', 'order'];

View File

@@ -1,6 +1,6 @@
const fs = require('fs');
const path = require('path');
const electron_notarize = require('@electron/notarize');
const electron_notarize = require('electron-notarize');
const execCommand = require('./execCommand');
function isDesktopAppTag(tagName) {

View File

@@ -0,0 +1,6 @@
module.exports = {
bracketSpacing: false,
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
};

View File

@@ -150,8 +150,8 @@ android {
applicationId "net.cozic.joplin"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 2097687
versionName "2.11.2"
versionCode 2097684
versionName "2.10.8"
// ndk {
// abiFilters "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
// }

View File

@@ -2,7 +2,6 @@
* @jest-environment jsdom
*/
import { EditorSettings } from '../types';
import { initCodeMirror } from './CodeMirror';
import { themeStyle } from '@joplin/lib/theme';
@@ -10,8 +9,6 @@ import Setting from '@joplin/lib/models/Setting';
import { forceParsing } from '@codemirror/language';
import loadLangauges from './testUtil/loadLanguages';
import { expect, describe, it } from '@jest/globals';
const createEditorSettings = (themeId: number) => {
const themeData = themeStyle(themeId);
@@ -26,14 +23,6 @@ const createEditorSettings = (themeId: number) => {
};
describe('CodeMirror', () => {
// This checks for a regression -- occasionally, when updating packages,
// syntax highlighting in the CodeMirror editor stops working. This is usually
// fixed by
// 1. removing all `@codemirror/` and `@lezer/` dependencies from yarn.lock,
// 2. upgrading all CodeMirror packages to the latest versions in package.json, and
// 3. re-running `yarn install`.
//
// See https://github.com/laurent22/joplin/issues/7253
it('should give headings a different style', async () => {
const headerLineText = '# Testing...';
const initialText = `${headerLineText}\nThis is a test.`;

View File

@@ -239,5 +239,17 @@ describe('markdownCommands', () => {
expect(sel.from).toBe('> Testing...> \n> \n'.length);
expect(sel.to).toBe(editor.state.doc.length);
});
it('toggling inline code should both create and navigate out of an inline code region', async () => {
const initialDocText = 'Testing...\n\n';
const editor = await createEditor(initialDocText, EditorSelection.cursor(initialDocText.length), []);
toggleCode(editor);
editor.dispatch(editor.state.replaceSelection('f(x) = ...'));
toggleCode(editor);
editor.dispatch(editor.state.replaceSelection(' is a function.'));
expect(editor.state.doc.toString()).toBe('Testing...\n\n`f(x) = ...` is a function.');
});
});

View File

@@ -30,7 +30,6 @@ interface Props {
initialSelection?: Selection;
style: ViewStyle;
contentStyle?: ViewStyle;
toolbarEnabled: boolean;
onChange: ChangeEventHandler;
onSelectionChange: SelectionChangeEventHandler;
@@ -365,19 +364,6 @@ function NoteEditor(props: Props, ref: any) {
console.error('NoteEditor: webview error');
}, []);
const toolbar = <MarkdownToolbar
style={{
// Don't show the markdown toolbar if there isn't enough space
// for it:
flexShrink: 1,
}}
editorSettings={editorSettings}
editorControl={editorControl}
selectionState={selectionState}
searchState={searchState}
onAttach={props.onAttach}
/>;
// - `scrollEnabled` prevents iOS from scrolling the document (has no effect on Android)
// when an editable region (e.g. a the full-screen NoteEditor) is focused.
return (
@@ -415,7 +401,18 @@ function NoteEditor(props: Props, ref: any) {
searchState={searchState}
/>
{props.toolbarEnabled ? toolbar : null}
<MarkdownToolbar
style={{
// Don't show the markdown toolbar if there isn't enough space
// for it:
flexShrink: 1,
}}
editorSettings={editorSettings}
editorControl={editorControl}
selectionState={selectionState}
searchState={searchState}
onAttach={props.onAttach}
/>
</View>
);
}

View File

@@ -2,12 +2,9 @@ const React = require('react');
import Setting from '@joplin/lib/models/Setting';
import { useEffect, useMemo, useState } from 'react';
import { View, Dimensions, Alert, Button } from 'react-native';
import FingerprintScanner from 'react-native-fingerprint-scanner';
import { SensorInfo } from './sensorInfo';
import { _ } from '@joplin/lib/locale';
import Logger from '@joplin/lib/Logger';
import biometricAuthenticate from './biometricAuthenticate';
const logger = Logger.create('BiometricPopup');
interface Props {
themeId: number;
@@ -16,36 +13,24 @@ interface Props {
}
export default (props: Props) => {
// The initial prompt is there so that the user can choose to opt-in to
// biometrics auth the first time the app is launched. However since it
// doesn't work properly, we disable it. We only want the user to enable the
// feature after they've read the description in the config screen.
const [initialPromptDone, setInitialPromptDone] = useState(true); // useState(Setting.value('security.biometricsInitialPromptDone'));
const [display, setDisplay] = useState(props.sensorInfo.enabled || !initialPromptDone);
const [initialPromptDone, setInitialPromptDone] = useState(Setting.value('security.biometricsInitialPromptDone'));
const [display, setDisplay] = useState(!!props.sensorInfo.supportedSensors && (props.sensorInfo.enabled || !initialPromptDone));
const [tryBiometricsCheck, setTryBiometricsCheck] = useState(initialPromptDone);
logger.info('Render start');
logger.info('initialPromptDone', initialPromptDone);
logger.info('display', display);
logger.info('tryBiometricsCheck', tryBiometricsCheck);
logger.info('props.sensorInfo', props.sensorInfo);
useEffect(() => {
if (!display || !tryBiometricsCheck) return;
const biometricsCheck = async () => {
logger.info('biometricsCheck: start');
try {
await biometricAuthenticate();
await FingerprintScanner.authenticate({ description: _('Verify your identity') });
setTryBiometricsCheck(false);
setDisplay(false);
} catch (error) {
Alert.alert(error.message);
Alert.alert(_('Could not verify your identify'), error.message);
setTryBiometricsCheck(false);
} finally {
FingerprintScanner.release();
}
setTryBiometricsCheck(false);
logger.info('biometricsCheck: end');
};
void biometricsCheck();
@@ -56,9 +41,6 @@ export default (props: Props) => {
if (!display) return;
const complete = (enableBiometrics: boolean) => {
logger.info('complete: start');
logger.info('complete: enableBiometrics:', enableBiometrics);
setInitialPromptDone(true);
Setting.setValue('security.biometricsInitialPromptDone', true);
Setting.setValue('security.biometricsEnabled', enableBiometrics);
@@ -73,8 +55,6 @@ export default (props: Props) => {
type: 'BIOMETRICS_DONE_SET',
value: true,
});
logger.info('complete: end');
};
Alert.alert(
@@ -93,7 +73,7 @@ export default (props: Props) => {
},
]
);
}, [initialPromptDone, display, props.dispatch]);
}, [initialPromptDone, props.sensorInfo.supportedSensors, display, props.dispatch]);
const windowSize = useMemo(() => {
return {
@@ -103,18 +83,12 @@ export default (props: Props) => {
}, []);
useEffect(() => {
logger.info('effect 1: start');
if (!display) {
logger.info('effect 1: display', display);
props.dispatch({
type: 'BIOMETRICS_DONE_SET',
value: true,
});
}
logger.info('effect 1: end');
}, [display, props.dispatch]);
const renderTryAgainButton = () => {

View File

@@ -1,28 +0,0 @@
import Logger from '@joplin/lib/Logger';
import FingerprintScanner, { Errors } from 'react-native-fingerprint-scanner';
import { _ } from '@joplin/lib/locale';
const logger = Logger.create('biometricAuthenticate');
export default async () => {
try {
logger.info('Authenticate...');
await FingerprintScanner.authenticate({ description: _('Verify your identity') });
logger.info('Authenticate done');
} catch (error) {
const errorName = (error as Errors).name;
let errorMessage = error.message;
if (errorName === 'FingerprintScannerNotEnrolled' || errorName === 'FingerprintScannerNotAvailable') {
errorMessage = _('Biometric unlock is not setup on the device. Please set it up in order to unlock Joplin. If the device is on lockout, consider switching it off and on to reset biometrics scanning.');
}
error.message = _('Could not verify your identify: %s', errorMessage);
logger.warn(error);
throw error;
} finally {
FingerprintScanner.release();
}
};

View File

@@ -1,7 +1,5 @@
import Logger from '@joplin/lib/Logger';
import Setting from '@joplin/lib/models/Setting';
import FingerprintScanner from 'react-native-fingerprint-scanner';
const logger = Logger.create('sensorInfo');
export interface SensorInfo {
enabled: boolean;
@@ -10,40 +8,11 @@ export interface SensorInfo {
}
export default async (): Promise<SensorInfo> => {
// Early exit if the feature is disabled, so that we don't make any
// FingerprintScanner scanner calls, since it seems they can fail and freeze
// the app.
logger.info('Start');
logger.info('security.biometricsEnabled', Setting.value('security.biometricsEnabled'));
if (!Setting.value('security.biometricsEnabled')) {
return {
enabled: false,
sensorsHaveChanged: false,
supportedSensors: '',
};
}
let hasChanged = false;
let supportedSensors = '';
try {
logger.info('Getting isSensorAvailable...');
// Note: If `isSensorAvailable()` doesn't return anything, it seems we
// could assume that biometrics are not setup on the device, and thus we
// can unlock the app. However that's not always correct - on some
// devices (eg Galaxy S22), `isSensorAvailable()` will return nothing if
// the device is on lockout - i.e. if the user gave the wrong
// fingerprint multiple times.
//
// So we definitely can't unlock the app in that case, and it means
// `isSensorAvailable()` is pretty much useless. Instead we ask for
// fingerprint when the user turns on the feature and at that point we
// know if the device supports biometrics or not.
const result = await FingerprintScanner.isSensorAvailable();
logger.info('isSensorAvailable result', result);
supportedSensors = result;
if (result) {
@@ -53,7 +22,7 @@ export default async (): Promise<SensorInfo> => {
}
}
} catch (error) {
logger.warn('Could not check for biometrics sensor:', error);
console.warn('Could not check for biometrics sensor:', error);
Setting.setValue('security.biometricsSupportedSensors', '');
}

View File

@@ -25,12 +25,12 @@ const testCases: testCase[] = [
describe('getResponsiveValue', () => {
test('should throw exception if value map is an empty object', () => {
test('Should throw exception if value map is an empty object', () => {
const input = {};
expect(() => getResponsiveValue(input)).toThrow('valueMap cannot be an empty object!');
});
test('should return correct values', () => {
test('Should return correct values', () => {
const mockReturnValues = [
{ width: 400 },
{ width: 480 },

View File

@@ -23,7 +23,6 @@ const { themeStyle } = require('../global-style.js');
const shared = require('@joplin/lib/components/shared/config-shared.js');
import SyncTargetRegistry from '@joplin/lib/SyncTargetRegistry';
import { openDocumentTree } from '@joplin/react-native-saf-x';
import biometricAuthenticate from '../biometrics/biometricAuthenticate';
class ConfigScreenComponent extends BaseScreenComponent {
public static navigationOptions(): any {
@@ -464,7 +463,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
<Text key="label" style={this.styles().switchSettingText}>
{label}
</Text>
<Switch key="control" style={this.styles().switchSettingControl} trackColor={{ false: theme.dividerColor }} value={value} onValueChange={(value: any) => void updateSettingValue(key, value)} />
<Switch key="control" style={this.styles().switchSettingControl} trackColor={{ false: theme.dividerColor }} value={value} onValueChange={(value: any) => updateSettingValue(key, value)} />
</View>
{descriptionComp}
</View>
@@ -475,39 +474,13 @@ class ConfigScreenComponent extends BaseScreenComponent {
return !hasDescription ? this.styles().settingContainer : this.styles().settingContainerNoBottomBorder;
}
private async handleSetting(key: string, value: any): Promise<boolean> {
// When the user tries to enable biometrics unlock, we ask for the
// fingerprint or Face ID, and if it's correct we save immediately. If
// it's not, we don't turn on the setting.
if (key === 'security.biometricsEnabled' && !!value) {
try {
await biometricAuthenticate();
shared.updateSettingValue(this, key, value);
await this.saveButton_press();
} catch (error) {
shared.updateSettingValue(this, key, false);
Alert.alert(error.message);
}
return true;
}
if (key === 'security.biometricsEnabled' && !value) {
shared.updateSettingValue(this, key, value);
await this.saveButton_press();
return true;
}
return false;
}
public settingToComponent(key: string, value: any) {
const themeId = this.props.themeId;
const theme = themeStyle(themeId);
const output: any = null;
const updateSettingValue = async (key: string, value: any) => {
const handled = await this.handleSetting(key, value);
if (!handled) shared.updateSettingValue(this, key, value);
const updateSettingValue = (key: string, value: any) => {
return shared.updateSettingValue(this, key, value);
};
const md = Setting.settingMetadata(key);
@@ -544,7 +517,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
fontSize: theme.fontSize,
}}
onValueChange={(itemValue: string) => {
void updateSettingValue(key, itemValue);
updateSettingValue(key, itemValue);
}}
/>
</View>
@@ -580,7 +553,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
</Text>
<View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center', flex: 1 }}>
<Text style={this.styles().sliderUnits}>{unitLabel}</Text>
<Slider key="control" style={{ flex: 1 }} step={md.step} minimumValue={minimum} maximumValue={maximum} value={value} onValueChange={value => void updateSettingValue(key, value)} />
<Slider key="control" style={{ flex: 1 }} step={md.step} minimumValue={minimum} maximumValue={maximum} value={value} onValueChange={value => updateSettingValue(key, value)} />
</View>
</View>
);
@@ -604,7 +577,7 @@ class ConfigScreenComponent extends BaseScreenComponent {
<Text key="label" style={this.styles().settingText}>
{md.label()}
</Text>
<TextInput autoCorrect={false} autoComplete="off" selectionColor={theme.textSelectionColor} keyboardAppearance={theme.keyboardAppearance} autoCapitalize="none" key="control" style={this.styles().settingControl} value={value} onChangeText={(value: any) => void updateSettingValue(key, value)} secureTextEntry={!!md.secure} />
<TextInput autoCorrect={false} autoComplete="off" selectionColor={theme.textSelectionColor} keyboardAppearance={theme.keyboardAppearance} autoCapitalize="none" key="control" style={this.styles().settingControl} value={value} onChangeText={(value: any) => updateSettingValue(key, value)} secureTextEntry={!!md.secure} />
</View>
);
} else {

View File

@@ -1118,7 +1118,6 @@ class NoteScreenComponent extends BaseScreenComponent {
bodyComponent = <NoteEditor
ref={this.editorRef}
toolbarEnabled={this.props.toolbarEnabled}
themeId={this.props.themeId}
initialText={note.body}
initialSelection={this.selection}
@@ -1232,7 +1231,6 @@ const NoteScreen = connect((state: any) => {
themeId: state.settings.theme,
editorFont: [state.settings['style.editor.fontFamily']],
editorFontSize: state.settings['style.editor.fontSize'],
toolbarEnabled: state.settings['editor.mobile.toolbarEnabled'],
ftsEnabled: state.settings['db.ftsEnabled'],
sharedData: state.sharedData,
showSideMenu: state.showSideMenu,

View File

@@ -523,7 +523,7 @@
INFOPLIST_FILE = Joplin/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 12.11.0;
MARKETING_VERSION = 12.10.5;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@@ -551,7 +551,7 @@
INFOPLIST_FILE = Joplin/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 12.11.0;
MARKETING_VERSION = 12.10.5;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
@@ -705,7 +705,7 @@
INFOPLIST_FILE = ShareExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 12.11.0;
MARKETING_VERSION = 12.10.5;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = net.cozic.joplin.ShareExtension;
@@ -736,7 +736,7 @@
INFOPLIST_FILE = ShareExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 12.11.0;
MARKETING_VERSION = 12.10.5;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = net.cozic.joplin.ShareExtension;
PRODUCT_NAME = "$(TARGET_NAME)";

View File

@@ -306,7 +306,7 @@ PODS:
- React-jsinspector (0.70.6)
- React-logger (0.70.6):
- glog
- react-native-alarm-notification (2.11.0):
- react-native-alarm-notification (2.10.0):
- React
- react-native-camera (4.2.1):
- React-Core
@@ -316,7 +316,7 @@ PODS:
- React-Core
- react-native-camera/RN (4.2.1):
- React-Core
- react-native-document-picker (8.1.4):
- react-native-document-picker (8.1.3):
- React-Core
- react-native-fingerprint-scanner (6.0.0):
- React
@@ -324,15 +324,15 @@ PODS:
- React-Core
- react-native-get-random-values (1.8.0):
- React-Core
- react-native-image-picker (5.3.1):
- react-native-image-picker (5.0.2):
- React-Core
- react-native-image-resizer (1.4.5):
- React-Core
- react-native-netinfo (9.3.8):
- react-native-netinfo (9.3.7):
- React-Core
- react-native-rsa-native (2.0.5):
- React
- react-native-saf-x (2.11.0):
- react-native-saf-x (2.10.2):
- React-Core
- react-native-safe-area-context (4.5.0):
- RCT-Folly
@@ -432,7 +432,7 @@ PODS:
- React
- RNSecureRandom (1.0.1):
- React
- RNShare (8.2.1):
- RNShare (8.2.0):
- React-Core
- RNVectorIcons (9.2.0):
- React-Core
@@ -714,17 +714,17 @@ SPEC CHECKSUMS:
React-jsiexecutor: b4a65947391c658450151275aa406f2b8263178f
React-jsinspector: 60769e5a0a6d4b32294a2456077f59d0266f9a8b
React-logger: 1623c216abaa88974afce404dc8f479406bbc3a0
react-native-alarm-notification: 26527410a6162d07a9dc57f4bbc62e94ff48e65d
react-native-alarm-notification: 0f58eaa37a4188480536fd7ab62db9b1dfba392f
react-native-camera: 3eae183c1d111103963f3dd913b65d01aef8110f
react-native-document-picker: a9bd26996d1b2e4f412dd186041714c79af381d0
react-native-document-picker: 958e2bc82e128be69055be261aeac8d872c8d34c
react-native-fingerprint-scanner: ac6656f18c8e45a7459302b84da41a44ad96dbbe
react-native-geolocation: 69f4fd37650b8e7fee91816d395e62dd16f5ab8d
react-native-get-random-values: a6ea6a8a65dc93e96e24a11105b1a9c8cfe1d72a
react-native-image-picker: ec9b713e248760bfa0f879f0715391de4651a7cb
react-native-image-picker: a5dddebb4d2955ac4712a4ed66b00a85f62a63ac
react-native-image-resizer: d9fb629a867335bdc13230ac2a58702bb8c8828f
react-native-netinfo: fbc23bc2fe217155d85f2f7e0644b1654df8029b
react-native-netinfo: 2517ad504b3d303e90d7a431b0fcaef76d207983
react-native-rsa-native: 12132eb627797529fdb1f0d22fd0f8f9678df64a
react-native-saf-x: 9bd5238d3b43d76bbec64aa82c173ac20a4bce9f
react-native-saf-x: db5a33862e7aec0f9f2d4cccfe7264b09b234e2e
react-native-safe-area-context: 39c2d8be3328df5d437ac1700f4f3a4f75716acc
react-native-slider: 33b8d190b59d4f67a541061bb91775d53d617d9d
react-native-sqlite-storage: f6d515e1c446d1e6d026aa5352908a25d4de3261
@@ -751,7 +751,7 @@ SPEC CHECKSUMS:
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNQuickAction: 6d404a869dc872cde841ad3147416a670d13fa93
RNSecureRandom: 07efbdf2cd99efe13497433668e54acd7df49fef
RNShare: eaee3dd5a06dad397c7d3b14762007035c5de405
RNShare: b089c33619bbfb0a32bc4069c858b9274e694187
RNVectorIcons: fcc2f6cb32f5735b586e66d14103a74ce6ad61f8
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
Yoga: 99caf8d5ab45e9d637ee6e0174ec16fbbb01bcfc

View File

@@ -2,7 +2,7 @@
"name": "@joplin/app-mobile",
"description": "Joplin for Mobile",
"license": "AGPL-3.0-or-later",
"version": "2.11.0",
"version": "2.10.0",
"private": true,
"scripts": {
"start": "react-native start --reset-cache",
@@ -18,14 +18,14 @@
"postinstall": "jetify && yarn run build"
},
"dependencies": {
"@joplin/lib": "~2.11",
"@joplin/react-native-alarm-notification": "~2.11",
"@joplin/react-native-saf-x": "~2.11",
"@joplin/renderer": "~2.11",
"@joplin/lib": "~2.10",
"@joplin/react-native-alarm-notification": "~2.10",
"@joplin/react-native-saf-x": "~2.10",
"@joplin/renderer": "~2.10",
"@react-native-community/clipboard": "1.5.1",
"@react-native-community/datetimepicker": "6.7.5",
"@react-native-community/geolocation": "2.1.0",
"@react-native-community/netinfo": "9.3.8",
"@react-native-community/netinfo": "9.3.7",
"@react-native-community/push-notification-ios": "1.10.1",
"@react-native-community/slider": "4.4.2",
"assert-browserify": "2.0.0",
@@ -44,23 +44,23 @@
"react-native-action-button": "2.8.5",
"react-native-camera": "4.2.1",
"react-native-dialogbox": "0.6.10",
"react-native-document-picker": "8.1.4",
"react-native-document-picker": "8.1.3",
"react-native-dropdownalert": "4.5.1",
"react-native-exit-app": "1.1.0",
"react-native-file-viewer": "2.1.5",
"react-native-fingerprint-scanner": "6.0.0",
"react-native-fs": "2.20.0",
"react-native-get-random-values": "1.8.0",
"react-native-image-picker": "5.3.1",
"react-native-image-picker": "5.0.2",
"react-native-image-resizer": "1.4.5",
"react-native-modal-datetime-picker": "14.0.1",
"react-native-paper": "5.5.2",
"react-native-paper": "5.2.0",
"react-native-popup-menu": "0.16.1",
"react-native-quick-actions": "0.3.13",
"react-native-rsa-native": "2.0.5",
"react-native-safe-area-context": "4.5.0",
"react-native-securerandom": "1.0.1",
"react-native-share": "8.2.1",
"react-native-share": "8.2.0",
"react-native-side-menu-updated": "1.3.2",
"react-native-sqlite-storage": "6.0.1",
"react-native-url-polyfill": "1.3.0",
@@ -79,36 +79,36 @@
"devDependencies": {
"@babel/core": "7.16.0",
"@babel/runtime": "7.16.3",
"@codemirror/commands": "6.2.2",
"@codemirror/commands": "6.1.2",
"@codemirror/lang-cpp": "6.0.2",
"@codemirror/lang-html": "6.4.3",
"@codemirror/lang-html": "6.4.0",
"@codemirror/lang-java": "6.0.1",
"@codemirror/lang-javascript": "6.1.5",
"@codemirror/lang-markdown": "6.1.0",
"@codemirror/lang-javascript": "6.1.1",
"@codemirror/lang-markdown": "6.0.5",
"@codemirror/lang-php": "6.0.1",
"@codemirror/lang-rust": "6.0.1",
"@codemirror/language": "6.6.0",
"@codemirror/legacy-modes": "6.3.2",
"@codemirror/search": "6.3.0",
"@codemirror/state": "6.2.0",
"@codemirror/view": "6.9.3",
"@joplin/tools": "~2.11",
"@lezer/highlight": "1.1.4",
"@codemirror/language": "6.3.2",
"@codemirror/legacy-modes": "6.3.1",
"@codemirror/search": "6.2.3",
"@codemirror/state": "6.1.4",
"@codemirror/view": "6.7.1",
"@joplin/tools": "~2.10",
"@lezer/highlight": "1.1.3",
"@types/fs-extra": "9.0.13",
"@types/jest": "29.2.6",
"@types/react-native": "0.70.6",
"@types/react-redux": "7.1.25",
"babel-plugin-module-resolver": "4.1.0",
"execa": "4.1.0",
"fs-extra": "11.1.1",
"fs-extra": "11.1.0",
"gulp": "4.0.2",
"jest": "29.4.3",
"jest-environment-jsdom": "29.4.3",
"jetifier": "2.0.0",
"jsdom": "21.1.1",
"jsdom": "21.0.0",
"md5-file": "5.0.0",
"metro-react-native-babel-preset": "0.72.3",
"nodemon": "2.0.22",
"nodemon": "2.0.20",
"ts-jest": "29.0.5",
"ts-loader": "9.4.2",
"ts-node": "10.9.1",

View File

@@ -501,7 +501,7 @@ async function initialize(dispatch: Function) {
if (Setting.value('env') === 'prod') {
await db.open({ name: getDatabaseName(currentProfile, isSubProfile) });
} else {
await db.open({ name: getDatabaseName(currentProfile, isSubProfile, '-3') });
await db.open({ name: getDatabaseName(currentProfile, isSubProfile) });
// await db.clearForTesting();
}
@@ -984,10 +984,6 @@ class AppComponent extends React.Component {
const biometricIsEnabled = !!this.state.sensorInfo && this.state.sensorInfo.enabled;
const shouldShowMainContent = !biometricIsEnabled || this.props.biometricsDone;
logger.info('root.biometrics: biometricIsEnabled', biometricIsEnabled);
logger.info('root.biometrics: shouldShowMainContent', shouldShowMainContent);
logger.info('root.biometrics: this.state.sensorInfo', this.state.sensorInfo);
const mainContent = (
<View style={{ flex: 1, backgroundColor: theme.backgroundColor }}>
<SideMenu

View File

@@ -24,10 +24,9 @@ export const getResourceDir = (profile: Profile, isSubProfile: boolean) => {
return `${getProfilesRootDir()}/resources-${profile.id}`;
};
// The suffix is for debugging only
export const getDatabaseName = (profile: Profile, isSubProfile: boolean, suffix: string = '') => {
if (!isSubProfile) return `joplin${suffix}.sqlite`;
return `joplin-${profile.id}${suffix}.sqlite`;
export const getDatabaseName = (profile: Profile, isSubProfile: boolean) => {
if (!isSubProfile) return 'joplin.sqlite';
return `joplin-${profile.id}.sqlite`;
};
export const loadProfileConfig = async () => {

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"id": "<%= pluginId %>",
"app_min_version": "2.11",
"app_min_version": "2.10",
"version": "1.0.0",
"name": "<%= pluginName %>",
"description": "<%= pluginDescription %>",

View File

@@ -1,6 +1,6 @@
{
"name": "generator-joplin",
"version": "2.11.0",
"version": "2.10.0",
"description": "Scaffolds out a new Joplin plugin",
"homepage": "https://github.com/laurent22/joplin/tree/dev/packages/generator-joplin",
"author": {
@@ -24,7 +24,7 @@
},
"dependencies": {
"chalk": "2.4.2",
"slugify": "1.6.6",
"slugify": "1.6.5",
"yeoman-generator": "5.8.0",
"yosay": "2.0.2"
},

View File

@@ -1,6 +1,6 @@
{
"name": "@joplin/htmlpack",
"version": "2.11.0",
"version": "2.10.2",
"description": "Pack an HTML file and all its linked resources into a single HTML file",
"main": "dist/index.js",
"types": "src/index.ts",
@@ -17,7 +17,7 @@
"@joplin/fork-htmlparser2": "^4.1.43",
"css": "3.0.0",
"datauri": "4.1.0",
"fs-extra": "11.1.1",
"fs-extra": "11.1.0",
"html-entities": "1.4.0"
},
"devDependencies": {

View File

@@ -20,7 +20,7 @@ import Folder from './models/Folder';
import BaseItem from './models/BaseItem';
import Note from './models/Note';
import Tag from './models/Tag';
import { splitCommandString } from '@joplin/utils';
const { splitCommandString } = require('./string-utils.js');
import { reg } from './registry';
import time from './time';
import BaseSyncTarget from './BaseSyncTarget';
@@ -192,12 +192,6 @@ export default class BaseApplication {
continue;
}
if (arg === '--safe-mode') {
matched.isSafeMode = true;
argv.splice(0, 1);
continue;
}
if (arg === '--open-dev-tools') {
Setting.setConstant('flagOpenDevTools', true);
argv.splice(0, 1);
@@ -706,7 +700,7 @@ export default class BaseApplication {
flagContent = flagContent.trim();
let flags: any = splitCommandString(flagContent);
let flags = splitCommandString(flagContent);
flags.splice(0, 0, 'cmd');
flags.splice(0, 0, 'node');
@@ -835,10 +829,6 @@ export default class BaseApplication {
appLogger.info(`Client ID: ${Setting.value('clientId')}`);
if (initArgs?.isSafeMode) {
Setting.setValue('isSafeMode', true);
}
if (Setting.value('firstStart')) {
// If it's a sub-profile, the locale must come from the root
// profile.

View File

@@ -96,20 +96,14 @@ export default class SyncTargetOneDrive extends BaseSyncTarget {
let context = Setting.value(`sync.${this.syncTargetId()}.context`);
context = context === '' ? null : JSON.parse(context);
let accountProperties = context ? context.accountProperties : null;
const api = this.api();
if (!accountProperties) {
accountProperties = await api.execAccountPropertiesRequest();
accountProperties = await this.api_.execAccountPropertiesRequest();
context ? context.accountProperties = accountProperties : context = { accountProperties: accountProperties };
Setting.setValue(`sync.${this.syncTargetId()}.context`, JSON.stringify(context));
}
api.setAccountProperties(accountProperties);
this.api_.setAccountProperties(accountProperties);
const appDir = await this.api().appDirectory();
// the appDir might contain non-ASCII characters
// /[^\u0021-\u00ff]/ is used in Node.js to detect the unescaped characters.
// See https://github.com/nodejs/node/blob/bbbf97b6dae63697371082475dc8651a6a220336/lib/_http_client.js#L176
const baseDir = RegExp(/[^\u0021-\u00ff]/).exec(appDir) !== null ? encodeURI(appDir) : appDir;
const fileApi = new FileApi(baseDir, new FileApiDriverOneDrive(this.api()));
const fileApi = new FileApi(appDir, new FileApiDriverOneDrive(this.api()));
fileApi.setSyncTargetId(this.syncTargetId());
fileApi.setLogger(this.logger());
return fileApi;

View File

@@ -1,3 +1,4 @@
const { setupDatabaseAndSynchronizer, switchClient, supportDir } = require('./testing/test-utils.js');
const shim = require('./shim').default;
const { enexXmlToHtml } = require('./import-enex-html-gen.js');
@@ -49,7 +50,6 @@ const compareOutputToExpected = (options) => {
const outputFile = fileWithPath(`${options.testName}.html`);
const testTitle = `should convert from Enex to Html: ${options.testName}`;
// eslint-disable-next-line jest/require-top-level-describe
it(testTitle, (async () => {
const enexInput = await shim.fsDriver().readFile(inputFile);
const expectedOutput = await shim.fsDriver().readFile(outputFile);

View File

@@ -1,18 +1,5 @@
const markJsUtils = {};
const isInsideContainer = (node, tagName) => {
if (!node) return false;
tagName = tagName.toLowerCase();
while (node) {
if (node.tagName && node.tagName.toLowerCase() === tagName) return true;
node = node.parentNode;
}
return false;
};
markJsUtils.markKeyword = (mark, keyword, stringUtils, extraOptions = null) => {
if (typeof keyword === 'string') {
keyword = {
@@ -28,13 +15,12 @@ markJsUtils.markKeyword = (mark, keyword, stringUtils, extraOptions = null) => {
if (isBasicSearch) accuracy = 'partially';
if (keyword.type === 'regex') {
accuracy = 'complementary';
// Remove the trailing wildcard and "accuracy = complementary" will take
// care of highlighting the relevant keywords.
// Remove the trailing wildcard and "accuracy = complementary" will take care of
// highlighting the relevant keywords.
// Known bug: it will also highlight word that contain the term as a
// suffix for example for "ent*", it will highlight "present" which is
// incorrect (it should only highlight what starts with "ent") but for
// now will do. Mark.js doesn't have an option to tweak this behaviour.
// Known bug: it will also highlight word that contain the term as a suffix for example for "ent*", it will highlight "present"
// which is incorrect (it should only highlight what starts with "ent") but for now will do. Mark.js doesn't have an option
// to tweak this behaviour.
value = keyword.value.substr(0, keyword.value.length - 1);
}
@@ -44,18 +30,6 @@ markJsUtils.markKeyword = (mark, keyword, stringUtils, extraOptions = null) => {
{},
{
accuracy: accuracy,
filter: (node, _term, _totalCounter, _counter) => {
// We exclude SVG because it creates a "<mark>" tag inside
// the document, which is not a valid SVG tag. As a result
// the content within that tag disappears.
//
// mark.js has an "exclude" parameter, but it doesn't work
// so we use "filter" instead.
//
// https://github.com/joplin/plugin-abc-sheet-music
if (isInsideContainer(node, 'SVG')) return false;
return true;
},
},
extraOptions
)

View File

@@ -409,36 +409,38 @@ describe('models/Note', () => {
expect(movedNote.conflict_original_id).toBe('');
}));
});
describe('models/Note_replacePaths', () => {
function testResourceReplacment(body: string, pathsToTry: string[], expected: string) {
expect(Note['replaceResourceExternalToInternalLinks_'](pathsToTry, body)).toBe(expected);
}
test('basic replacement', () => {
test('Basic replacement', () => {
const body = '![image.png](file:///C:Users/Username/resources/849eae4dade045298c107fc706b6d2bc.png?t=1655192326803)';
const pathsToTry = ['file:///C:Users/Username/resources'];
const expected = '![image.png](:/849eae4dade045298c107fc706b6d2bc)';
testResourceReplacment(body, pathsToTry, expected);
});
test('replacement with spaces', () => {
test('Replacement with spaces', () => {
const body = '![image.png](file:///C:Users/Username%20with%20spaces/resources/849eae4dade045298c107fc706b6d2bc.png?t=1655192326803)';
const pathsToTry = ['file:///C:Users/Username with spaces/resources'];
const expected = '![image.png](:/849eae4dade045298c107fc706b6d2bc)';
testResourceReplacment(body, pathsToTry, expected);
});
test('replacement with Non-ASCII', () => {
test('Replacement with Non-ASCII', () => {
const body = '![image.png](file:///C:Users/UsernameWith%C3%A9%C3%A0%C3%B6/resources/849eae4dade045298c107fc706b6d2bc.png?t=1655192326803)';
const pathsToTry = ['file:///C:Users/UsernameWithéàö/resources'];
const expected = '![image.png](:/849eae4dade045298c107fc706b6d2bc)';
testResourceReplacment(body, pathsToTry, expected);
});
test('replacement with Non-ASCII and spaces', () => {
test('Replacement with Non-ASCII and spaces', () => {
const body = '![image.png](file:///C:Users/Username%20With%20%C3%A9%C3%A0%C3%B6/resources/849eae4dade045298c107fc706b6d2bc.png?t=1655192326803)';
const pathsToTry = ['file:///C:Users/Username With éàö/resources'];
const expected = '![image.png](:/849eae4dade045298c107fc706b6d2bc)';
testResourceReplacment(body, pathsToTry, expected);
});
});

View File

@@ -874,21 +874,16 @@ export default class Note extends BaseItem {
if (note.id === noteIds[0] && index === i) return defer();
}
// If some of the target notes have order = 0, set the order field to a reasonable
// value to avoid moving the note. Using "smallest value / 2" (vs, for example,
// subtracting a constant) ensures items remain in their current position at the
// end, without ever reaching 0.
// If some of the target notes have order = 0, set the order field to user_created_time
// (historically, all notes had the order field set to 0)
let hasSetOrder = false;
let previousOrder = 0;
for (let i = 0; i < notes.length; i++) {
const note = notes[i];
if (!note.order) {
const newOrder = previousOrder ? previousOrder / 2 : note.user_created_time;
const updatedNote = await this.updateNoteOrder_(note, newOrder);
const updatedNote = await this.updateNoteOrder_(note, note.user_created_time);
notes[i] = updatedNote;
hasSetOrder = true;
}
previousOrder = notes[i].order;
}
if (hasSetOrder) notes = await getSortedNotes(folderId);

View File

@@ -24,9 +24,6 @@ describe('models/Note_CustomSortOrder', () => {
// (which normally is the creation timestamp). So if the user tries to move notes
// in the middle of other notes with order = 0, the order of all these notes is
// initialised at this point.
// Also check that the order-0 notes stay in their previous position when their
// order values are initialized. There was at one point a bug where they popped to
// the top.
const folder1 = await Folder.save({});
const folder2 = await Folder.save({});
@@ -35,7 +32,6 @@ describe('models/Note_CustomSortOrder', () => {
notes1.push(await Note.save({ order: 0, parent_id: folder1.id })); await time.msleep(2);
notes1.push(await Note.save({ order: 0, parent_id: folder1.id })); await time.msleep(2);
notes1.push(await Note.save({ order: 0, parent_id: folder1.id })); await time.msleep(2);
notes1.push(await Note.save({ order: 1000, parent_id: folder1.id })); await time.msleep(2);
const notes2 = [];
notes2.push(await Note.save({ parent_id: folder2.id })); await time.msleep(2);
@@ -49,13 +45,12 @@ describe('models/Note_CustomSortOrder', () => {
};
}
await Note.insertNotesAt(folder1.id, notes2.map(n => n.id), 2);
await Note.insertNotesAt(folder1.id, notes2.map(n => n.id), 1);
const newNotes1 = [
await Note.load(notes1[0].id),
await Note.load(notes1[1].id),
await Note.load(notes1[2].id),
await Note.load(notes1[3].id),
];
// Check that timestamps haven't changed - moving a note should not change the user timestamps
@@ -69,13 +64,12 @@ describe('models/Note_CustomSortOrder', () => {
order: Note.customOrderByColumns(),
});
expect(sortedNotes.length).toBe(6);
expect(sortedNotes[0].id).toBe(notes1[3].id);
expect(sortedNotes[1].id).toBe(notes1[2].id);
expect(sortedNotes[2].id).toBe(notes2[0].id);
expect(sortedNotes[3].id).toBe(notes2[1].id);
expect(sortedNotes[4].id).toBe(notes1[1].id);
expect(sortedNotes[5].id).toBe(notes1[0].id);
expect(sortedNotes.length).toBe(5);
expect(sortedNotes[0].id).toBe(notes1[2].id);
expect(sortedNotes[1].id).toBe(notes2[0].id);
expect(sortedNotes[2].id).toBe(notes2[1].id);
expect(sortedNotes[3].id).toBe(notes1[1].id);
expect(sortedNotes[4].id).toBe(notes1[0].id);
}));
it('should bump system but not user updated time when changing sort value', (async () => {

View File

@@ -1050,17 +1050,6 @@ class Setting extends BaseModel {
isGlobal: true,
},
'editor.mobile.toolbarEnabled': {
value: true,
type: SettingItemType.Bool,
section: 'note',
public: true,
appTypes: [AppType.Mobile],
label: () => _('Enable the Markdown toolbar'),
storage: SettingStorage.File,
isGlobal: true,
},
// Works around a bug in which additional space is visible beneath the toolbar on some devices.
// See https://github.com/laurent22/joplin/pull/6823
'editor.mobile.removeSpaceBelowToolbar': {
@@ -1645,17 +1634,10 @@ class Setting extends BaseModel {
storage: SettingStorage.Database,
},
// The biometrics feature is disabled by default and marked as beta
// because it seems to cause a freeze or slow down startup on
// certain devices. May be the reason for:
//
// - https://discourse.joplinapp.org/t/on-android-when-joplin-gets-started-offline/29951/1
// - https://github.com/laurent22/joplin/issues/7956
'security.biometricsEnabled': {
value: false,
type: SettingItemType.Bool,
label: () => `${_('Use biometrics to secure access to the app')} (Beta)`,
description: () => 'Important: This is a beta feature and it is not compatible with certain devices. If the app no longer starts after enabling this or is very slow to start, please uninstall and reinstall the app.',
label: () => _('Use biometrics to secure access to the app'),
public: true,
appTypes: [AppType.Mobile],
},

View File

@@ -1,6 +1,6 @@
{
"name": "@joplin/lib",
"version": "2.11.0",
"version": "2.10.2",
"description": "Joplin Core library",
"author": "Laurent Cozic",
"homepage": "",
@@ -34,11 +34,10 @@
"@joplin/fork-htmlparser2": "^4.1.43",
"@joplin/fork-sax": "^1.2.47",
"@joplin/fork-uslug": "^1.0.8",
"@joplin/htmlpack": "~2.11",
"@joplin/renderer": "~2.11",
"@joplin/htmlpack": "^2.10.2",
"@joplin/renderer": "^2.10.2",
"@joplin/turndown": "^4.0.65",
"@joplin/turndown-plugin-gfm": "^1.0.47",
"@joplin/utils": "~2.11",
"@types/nanoid": "3.0.0",
"async-mutex": "0.4.0",
"base-64": "1.0.0",
@@ -54,7 +53,7 @@
"fast-xml-parser": "3.21.1",
"follow-redirects": "1.15.2",
"form-data": "4.0.0",
"fs-extra": "11.1.1",
"fs-extra": "11.1.0",
"hpagent": "1.2.0",
"html-entities": "1.4.0",
"html-minifier": "4.0.0",
@@ -69,7 +68,7 @@
"moment": "2.29.4",
"multiparty": "4.2.3",
"mustache": "4.2.0",
"nanoid": "3.3.6",
"nanoid": "3.3.4",
"node-fetch": "2.6.7",
"node-notifier": "10.0.1",
"node-persist": "3.1.3",
@@ -83,7 +82,7 @@
"reselect": "4.1.7",
"server-destroy": "1.0.1",
"sprintf-js": "1.1.2",
"sqlite3": "5.1.6",
"sqlite3": "5.1.4",
"string-padding": "1.0.2",
"string-to-stream": "3.0.1",
"tar": "6.1.13",

View File

@@ -1,6 +1,6 @@
/* eslint-disable import/prefer-default-export */
import { splitCommandString } from '@joplin/utils';
const { splitCommandString } = require('../../string-utils');
import { spawn } from 'child_process';
import Logger from '../../Logger';
import Setting from '../../models/Setting';

View File

@@ -110,8 +110,6 @@ export default class ReportService {
let syncedCount = 0;
for (let i = 0; i < BaseItem.syncItemDefinitions_.length; i++) {
const d = BaseItem.syncItemDefinitions_[i];
// ref: https://github.com/laurent22/joplin/issues/7940#issuecomment-1473709148
if (d.className === 'MasterKey') continue;
const ItemClass = BaseItem.getClass(d.className);
const o = {
total: await ItemClass.count(),

View File

@@ -100,11 +100,6 @@ export default class PluginService extends BaseService {
return this.plugins_;
}
public enabledPlugins(pluginSettings: PluginSettings): Plugins {
const enabledPlugins = Object.fromEntries(Object.entries(this.plugins_).filter((p) => this.pluginEnabled(pluginSettings, p[0])));
return enabledPlugins;
}
public get pluginIds(): string[] {
return Object.keys(this.plugins_);
}
@@ -113,10 +108,6 @@ export default class PluginService extends BaseService {
return this.isSafeMode_;
}
public get appVersion(): string {
return this.appVersion_;
}
public set isSafeMode(v: boolean) {
this.isSafeMode_ = v;
}

View File

@@ -215,21 +215,21 @@ export default class RepositoryApi {
return this.manifests_;
}
public async canBeUpdatedPlugins(installedManifests: PluginManifest[], appVersion: string): Promise<string[]> {
public async canBeUpdatedPlugins(installedManifests: PluginManifest[]): Promise<string[]> {
const output = [];
for (const manifest of installedManifests) {
const canBe = await this.pluginCanBeUpdated(manifest.id, manifest.version, appVersion);
const canBe = await this.pluginCanBeUpdated(manifest.id, manifest.version);
if (canBe) output.push(manifest.id);
}
return output;
}
public async pluginCanBeUpdated(pluginId: string, installedVersion: string, appVersion: string): Promise<boolean> {
public async pluginCanBeUpdated(pluginId: string, installedVersion: string): Promise<boolean> {
const manifest = (await this.manifests()).find(m => m.id === pluginId);
if (!manifest) return false;
return compareVersions(installedVersion, manifest.version) < 0 && compareVersions(appVersion, manifest.app_min_version) >= 0;
return compareVersions(installedVersion, manifest.version) < 0;
}
}

View File

@@ -66,7 +66,7 @@ describe('services_SearchFilter', () => {
for (const searchType of [SearchEngine.SEARCH_TYPE_FTS, SearchEngine.SEARCH_TYPE_NONLATIN_SCRIPT]) {
describe(`search type ${searchType}`, () => {
it('check case insensitivity for filter keywords', (async () => {
it('Check case insensitivity for filter keywords', (async () => {
let rows;
const notebook1 = await Folder.save({ title: 'folderA' });
const notebook2 = await Folder.save({ title: 'folderB' });
@@ -311,7 +311,7 @@ describe('services_SearchFilter', () => {
}));
it('should support filtering by tags (2)', (async () => {
it('should support filtering by tags', (async () => {
let rows;
const n1 = await Note.save({ title: 'peace talks', body: 'battle ground' });
const n2 = await Note.save({ title: 'mouse', body: 'mister' });

View File

@@ -138,6 +138,80 @@ function commandArgumentsToString(args) {
return output.join(' ');
}
function splitCommandString(command, options = null) {
options = options || {};
if (!('handleEscape' in options)) {
options.handleEscape = true;
}
const args = [];
let state = 'start';
let current = '';
let quote = '"';
let escapeNext = false;
for (let i = 0; i < command.length; i++) {
const c = command[i];
if (state === 'quotes') {
if (c !== quote) {
current += c;
} else {
args.push(current);
current = '';
state = 'start';
}
continue;
}
if (escapeNext) {
current += c;
escapeNext = false;
continue;
}
if (c === '\\' && options.handleEscape) {
escapeNext = true;
continue;
}
if (c === '"' || c === '\'') {
state = 'quotes';
quote = c;
continue;
}
if (state === 'arg') {
if (c === ' ' || c === '\t') {
args.push(current);
current = '';
state = 'start';
} else {
current += c;
}
continue;
}
if (c !== ' ' && c !== '\t') {
state = 'arg';
current += c;
}
}
if (state === 'quotes') {
throw new Error(`Unclosed quote in command line: ${command}`);
}
if (current !== '') {
args.push(current);
}
if (args.length <= 0) {
throw new Error('Empty command line');
}
return args;
}
function splitCommandBatch(commandBatch) {
const commandLines = [];
const eol = '\n';
@@ -294,4 +368,4 @@ function scriptType(s) {
return 'en';
}
module.exports = Object.assign({ formatCssSize, camelCaseToDash, removeDiacritics, substrWithEllipsis, nextWhitespaceIndex, escapeFilename, wrap, splitCommandBatch, padLeft, toTitleCase, urlDecode, escapeHtml, surroundKeywords, scriptType, commandArgumentsToString }, stringUtilsCommon);
module.exports = Object.assign({ formatCssSize, camelCaseToDash, removeDiacritics, substrWithEllipsis, nextWhitespaceIndex, escapeFilename, wrap, splitCommandString, splitCommandBatch, padLeft, toTitleCase, urlDecode, escapeHtml, surroundKeywords, scriptType, commandArgumentsToString }, stringUtilsCommon);

View File

@@ -60,7 +60,7 @@ const globalStyle: any = {
toolbarPadding: 6,
appearance: 'light',
mainPadding: 12,
topRowHeight: 50,
topRowHeight: 81,
editorPaddingLeft: 8,
};

View File

@@ -21,17 +21,6 @@ export function credentialDir() {
throw new Error(`Could not find credential directory in any of these paths: ${JSON.stringify(toTry)}`);
}
export const hasCredentialFile = (filename: string) => {
let d = '';
try {
d = credentialDir();
} catch (error) {
return false;
}
return pathExistsSync(`${d}/${filename}`);
};
export function credentialFile(filename: string) {
const rootDir = credentialDir();
const output = `${rootDir}/${filename}`;

View File

@@ -86,7 +86,6 @@ describe('getPluginLists', () => {
);
plugins[plugin.manifest.id] = plugin;
}
const v = versionInfo(packageInfo, plugins);
expect(v.body).toMatch(/\n\nPlugin1: 1\nPlugin2: 1\nPlugin3: 1/);
@@ -111,7 +110,6 @@ describe('getPluginLists', () => {
plugins[plugin.manifest.id] = plugin;
}
const v = versionInfo(packageInfo, plugins);
const body = '\n';

View File

@@ -16,8 +16,6 @@ function getPluginLists(plugins: Plugins): PluginList {
}
}
pluginList.sort(Intl.Collator().compare);
let completeList = '';
let summary = '';
if (pluginList.length > 0) {

View File

@@ -1,6 +1,6 @@
{
"name": "@joplin/pdf-viewer",
"version": "2.11.0",
"version": "2.10.0",
"description": "Provides embedded PDF viewers for Joplin",
"main": "dist/main.js",
"types": "src/main.ts",
@@ -28,7 +28,7 @@
"css-loader": "6.7.3",
"jest": "29.4.3",
"jest-environment-jsdom": "29.4.3",
"style-loader": "3.3.2",
"style-loader": "3.3.1",
"ts-jest": "29.0.5",
"ts-loader": "9.4.2",
"typescript": "4.9.4",
@@ -39,11 +39,11 @@
"@fortawesome/fontawesome-svg-core": "6.1.2",
"@fortawesome/free-solid-svg-icons": "6.1.2",
"@fortawesome/react-fontawesome": "0.2.0",
"@joplin/lib": "~2.11",
"@joplin/lib": "~2.10",
"async-mutex": "0.4.0",
"pdfjs-dist": "2.16.105",
"react": "18.2.0",
"react-dom": "18.2.0",
"styled-components": "5.3.9"
"styled-components": "5.3.5"
}
}

View File

@@ -22,7 +22,7 @@ function loadFile(filePath: string) {
describe('pdfData', () => {
test('should have correct page count', async () => {
test('Should have correct page count', async () => {
const file = await loadFile(pdfFilePath1);
const pdf = new PdfDocument(document);
await pdf.loadDoc(file);
@@ -39,7 +39,7 @@ describe('pdfData', () => {
// }).rejects.toThrowError();
// });
test('should get correct page size', async () => {
test('Should get correct page size', async () => {
const file = await loadFile(pdfFilePath1);
const pdf = new PdfDocument(document);
await pdf.loadDoc(file);
@@ -48,7 +48,7 @@ describe('pdfData', () => {
expect(size.width).toBeCloseTo(594.95996);
});
test('should calculate scaled size', async () => {
test('Should calculate scaled size', async () => {
const file = await loadFile(pdfFilePath1);
const pdf = new PdfDocument(document);
await pdf.loadDoc(file);
@@ -56,7 +56,7 @@ describe('pdfData', () => {
expect(scaledSize.scale).toBeCloseTo(0.336157);
});
test('should get correct active page', async () => {
test('Should get correct active page', async () => {
const file = await loadFile(pdfFilePath1);
const pdf = new PdfDocument(document);
await pdf.loadDoc(file);

View File

@@ -9,7 +9,7 @@ import * as path from 'path';
import * as process from 'process';
import validatePluginId from '@joplin/lib/services/plugins/utils/validatePluginId';
import validatePluginVersion from '@joplin/lib/services/plugins/utils/validatePluginVersion';
import { resolveRelativePathWithinDir, gitPullTry, gitRepoCleanTry, gitRepoClean } from '@joplin/tools/tool-utils.js';
import { execCommand2, resolveRelativePathWithinDir, gitPullTry, gitRepoCleanTry, gitRepoClean } from '@joplin/tools/tool-utils.js';
import checkIfPluginCanBeAdded from './lib/checkIfPluginCanBeAdded';
import updateReadme from './lib/updateReadme';
import { NpmPackage } from './lib/types';
@@ -17,7 +17,6 @@ import gitCompareUrl from './lib/gitCompareUrl';
import commandUpdateRelease from './commands/updateRelease';
import { isJoplinPluginPackage, readJsonFile } from './lib/utils';
import { applyManifestOverrides, getObsoleteManifests, readManifestOverrides } from './lib/overrideUtils';
import { execCommand } from '@joplin/utils';
function pluginInfoFromSearchResults(results: any[]): NpmPackage[] {
const output: NpmPackage[] = [];
@@ -50,7 +49,7 @@ async function checkPluginRepository(dirPath: string, dryRun: boolean) {
async function extractPluginFilesFromPackage(existingManifests: any, workDir: string, packageName: string, destDir: string): Promise<any> {
const previousDir = chdir(workDir);
await execCommand(`npm install ${packageName} --save --ignore-scripts`, { showStderr: false, showStdout: false });
await execCommand2(`npm install ${packageName} --save --ignore-scripts`, { showStderr: false, showStdout: false });
const pluginDir = resolveRelativePathWithinDir(workDir, 'node_modules', packageName, 'publish');
@@ -155,7 +154,7 @@ async function processNpmPackage(npmPackage: NpmPackage, repoDir: string, dryRun
await fs.mkdirp(packageTempDir);
chdir(packageTempDir);
await execCommand('npm init --yes --loglevel silent', { quiet: true });
await execCommand2('npm init --yes --loglevel silent', { quiet: true });
let actionType: ProcessingActionType = ProcessingActionType.Update;
let manifests: any = {};
@@ -201,8 +200,8 @@ async function processNpmPackage(npmPackage: NpmPackage, repoDir: string, dryRun
if (!dryRun) {
if (!(await gitRepoClean())) {
await execCommand('git add -A', { showStdout: false });
await execCommand(['git', 'commit', '-m', commitMessage(actionType, manifest, previousManifest, npmPackage, error)], { showStdout: false });
await execCommand2('git add -A', { showStdout: false });
await execCommand2(['git', 'commit', '-m', commitMessage(actionType, manifest, previousManifest, npmPackage, error)], { showStdout: false });
} else {
console.info('Nothing to commit');
}
@@ -228,14 +227,14 @@ async function commandBuild(args: CommandBuildArgs) {
if (!dryRun) {
if (!(await gitRepoClean())) {
console.info('Updating README...');
await execCommand('git add -A');
await execCommand('git commit -m "Update README"');
await execCommand2('git add -A');
await execCommand2('git commit -m "Update README"');
}
}
chdir(previousDir);
const searchResults = (await execCommand('npm search joplin-plugin --searchlimit 5000 --json', { showStdout: false, showStderr: false })).trim();
const searchResults = (await execCommand2('npm search joplin-plugin --searchlimit 5000 --json', { showStdout: false, showStderr: false })).trim();
const npmPackages = pluginInfoFromSearchResults(JSON.parse(searchResults));
for (const npmPackage of npmPackages) {
@@ -246,11 +245,11 @@ async function commandBuild(args: CommandBuildArgs) {
await commandUpdateRelease(args);
if (!(await gitRepoClean())) {
await execCommand('git add -A');
await execCommand('git commit -m "Update stats"');
await execCommand2('git add -A');
await execCommand2('git commit -m "Update stats"');
}
await execCommand('git push');
await execCommand2('git push');
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "@joplin/plugin-repo-cli",
"version": "2.11.0",
"version": "2.10.2",
"description": "",
"main": "index.js",
"bin": "./dist/index.js",
@@ -18,10 +18,9 @@
"author": "",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@joplin/lib": "~2.11",
"@joplin/tools": "~2.11",
"@joplin/utils": "~2.11",
"fs-extra": "11.1.1",
"@joplin/lib": "^2.10.2",
"@joplin/tools": "^2.10.2",
"fs-extra": "11.1.0",
"gh-release-assets": "2.0.1",
"node-fetch": "2.6.7",
"source-map-support": "0.5.21",

View File

@@ -1,7 +1,7 @@
{
"name": "@joplin/react-native-alarm-notification",
"title": "React Native Alarm Notification for Joplin. Forked from https://github.com/emekalites/react-native-alarm-notification",
"version": "2.11.0",
"version": "2.10.0",
"description": "schedule alarm with notification in react-native",
"main": "index.js",
"private": true,

View File

@@ -1,6 +1,6 @@
{
"name": "@joplin/react-native-saf-x",
"version": "2.11.0",
"version": "2.10.2",
"description": "a module to help work with scoped storages on android easily",
"main": "src/index",
"react-native": "src/index",

View File

@@ -179,8 +179,6 @@ export interface RuleOptions {
noteId?: string;
vendorDir?: string;
itemIdToUrl?: ItemIdToUrlHandler;
platformName?: string;
}
export default class MdToHtml {

View File

@@ -1,8 +1,6 @@
import { RuleOptions } from '../../MdToHtml';
export default {
assets: function(theme: any) {
assets: function() {
return [
{ name: 'mermaid.min.js' },
{ name: 'mermaid_render.js' },
@@ -14,27 +12,14 @@ export default {
text: '.mermaid { background-color: white; width: 640px; }',
mime: 'text/css',
},
{
inline: true,
// Export button in mermaid graph should be shown only on hovering the mermaid graph
// ref: https://github.com/laurent22/joplin/issues/6101
text: `
.mermaid-export-graph { visibility: hidden; }
.joplin-editable:hover .mermaid-export-graph { visibility: visible; }
.mermaid-export-graph:hover { background-color: ${theme.backgroundColorHover3} !important; }
`.trim(),
mime: 'text/css',
},
];
},
plugin: function(markdownIt: any, ruleOptions: RuleOptions) {
plugin: function(markdownIt: any) {
const defaultRender: Function = markdownIt.renderer.rules.fence || function(tokens: any[], idx: number, options: any, env: any, self: any) {
return self.renderToken(tokens, idx, options, env, self);
};
const exportButtonMarkup = isDesktop(ruleOptions.platformName) ? exportGraphButton(ruleOptions) : '';
markdownIt.renderer.rules.fence = function(tokens: any[], idx: number, options: {}, env: any, self: any) {
const token = tokens[idx];
if (token.info !== 'mermaid') return defaultRender(tokens, idx, options, env, self);
@@ -46,49 +31,9 @@ export default {
return `
<div class="joplin-editable">
<pre class="joplin-source" data-joplin-language="mermaid" data-joplin-source-open="\`\`\`mermaid&#10;" data-joplin-source-close="&#10;\`\`\`&#10;">${contentHtml}</pre>
${exportButtonMarkup}
<pre class="mermaid">${contentHtml}</pre>
</div>
`;
};
},
};
const exportGraphButton = (ruleOptions: RuleOptions) => {
const theme = ruleOptions.theme;
// Clicking on export button manually triggers a right click context menu event
const onClickHandler = `
const target = arguments[0].target;
const button = target.closest("button.mermaid-export-graph");
if (!button) return false;
const $mermaid_elem = button.nextElementSibling;
const rightClickEvent = new PointerEvent("contextmenu", {bubbles: true});
rightClickEvent.target = $mermaid_elem;
$mermaid_elem.dispatchEvent(rightClickEvent);
return false;
`.trim();
const style = `
display: block;
margin-left: auto;
border-radius: ${theme.buttonStyle.borderRadius}px;
font-size: ${theme.fontSize}px;
color: ${theme.color};
background: ${theme.buttonStyle.backgroundColor};
border: ${theme.buttonStyle.border};
`.trim();
return `<button class="mermaid-export-graph" onclick='${onClickHandler}' style="${style}" alt="Export mermaid graph">${downloadIcon()}</button>`;
};
const downloadIcon = () => {
// https://www.svgrepo.com/svg/505363/download
return '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M20 15V18C20 19.1046 19.1046 20 18 20H6C4.89543 20 4 19.1046 4 18L4 15M8 11L12 15M12 15L16 11M12 15V3" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"></path></g></svg>';
};
const isDesktop = (platformName?: string) => {
if (!platformName) {
return false;
}
return ['darwin', 'linux', 'freebsd', 'win32'].includes(platformName);
};

View File

@@ -1,6 +1,6 @@
{
"name": "@joplin/renderer",
"version": "2.11.0",
"version": "2.10.2",
"description": "The Joplin note renderer, used the mobile and desktop application",
"repository": "https://github.com/laurent22/joplin/tree/dev/packages/renderer",
"main": "index.js",
@@ -29,7 +29,7 @@
"@joplin/fork-htmlparser2": "^4.1.43",
"@joplin/fork-uslug": "^1.0.8",
"font-awesome-filetypes": "2.1.0",
"fs-extra": "11.1.1",
"fs-extra": "11.1.0",
"highlight.js": "11.7.0",
"html-entities": "1.4.0",
"json-stringify-safe": "5.0.1",
@@ -43,7 +43,7 @@
"markdown-it-footnote": "3.0.3",
"markdown-it-ins": "3.0.1",
"markdown-it-mark": "3.0.1",
"markdown-it-multimd-table": "4.2.1",
"markdown-it-multimd-table": "4.2.0",
"markdown-it-sub": "1.0.0",
"markdown-it-sup": "1.0.0",
"markdown-it-toc-done-right": "4.2.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@joplin/server",
"version": "2.11.0",
"version": "2.10.9",
"private": true,
"scripts": {
"start-dev": "yarn run build && JOPLIN_IS_TESTING=1 nodemon --config nodemon.json --ext ts,js,mustache,css,tsx dist/app.js --env dev",
@@ -23,8 +23,8 @@
"dependencies": {
"@aws-sdk/client-s3": "3.241.0",
"@fortawesome/fontawesome-free": "5.15.4",
"@joplin/lib": "~2.11",
"@joplin/renderer": "~2.11",
"@joplin/lib": "~2.10",
"@joplin/renderer": "~2.10",
"@koa/cors": "3.1.0",
"@types/uuid": "9.0.0",
"bcryptjs": "2.4.3",
@@ -33,9 +33,9 @@
"compare-versions": "3.6.0",
"dayjs": "1.11.7",
"formidable": "2.1.1",
"fs-extra": "11.1.1",
"fs-extra": "11.1.0",
"html-entities": "1.4.0",
"jquery": "3.6.4",
"jquery": "3.6.3",
"knex": "2.4.2",
"koa": "2.14.1",
"markdown-it": "13.0.1",
@@ -44,21 +44,21 @@
"node-cron": "3.0.2",
"node-env-file": "0.1.8",
"nodemailer": "6.9.1",
"nodemon": "2.0.22",
"pg": "8.10.0",
"nodemon": "2.0.20",
"pg": "8.9.0",
"pretty-bytes": "5.6.0",
"prettycron": "0.10.0",
"query-string": "7.1.3",
"rate-limiter-flexible": "2.4.1",
"raw-body": "2.5.2",
"sqlite3": "5.1.6",
"sqlite3": "5.1.4",
"stripe": "8.222.0",
"uuid": "9.0.0",
"yargs": "17.7.1",
"zxcvbn": "4.4.2"
},
"devDependencies": {
"@joplin/tools": "~2.11",
"@joplin/tools": "~2.10",
"@rmp135/sql-ts": "1.16.0",
"@types/formidable": "2.0.5",
"@types/fs-extra": "9.0.13",
@@ -74,8 +74,8 @@
"gulp": "4.0.2",
"jest": "29.4.3",
"jest-expect-message": "1.1.3",
"jsdom": "21.1.1",
"node-mocks-http": "1.12.2",
"jsdom": "21.0.0",
"node-mocks-http": "1.12.1",
"source-map-support": "0.5.21",
"typescript": "4.9.4"
}

View File

@@ -237,6 +237,35 @@ describe('UserModel', () => {
stripeConfig().enabled = false;
});
test('should disable disable the account and send an email if payment failed for good', async () => {
stripeConfig().enabled = true;
const { user: user1 } = await models().subscription().saveUserAndSubscription('toto@example.com', 'Toto', AccountType.Basic, 'usr_111', 'sub_111');
const sub = await models().subscription().byUserId(user1.id);
const now = Date.now();
const paymentFailedTime = now - failedPaymentFinalAccount - 10;
await models().subscription().save({
id: sub.id,
last_payment_time: now - failedPaymentFinalAccount * 2,
last_payment_failed_time: paymentFailedTime,
});
await models().user().handleFailedPaymentSubscriptions();
{
const user1 = await models().user().loadByEmail('toto@example.com');
expect(user1.enabled).toBe(0);
const email = (await models().email().all()).pop();
expect(email.key).toBe(`payment_failed_account_disabled_${paymentFailedTime}`);
expect(email.body).toContain(stripePortalUrl());
}
stripeConfig().enabled = false;
});
test('should send emails and flag accounts when it is over the size limit', async () => {
const { user: user1 } = await createUserAndSession(1);
const { user: user2 } = await createUserAndSession(2);

View File

@@ -1,5 +1,3 @@
/* eslint-disable jest/require-top-level-describe */
import config from '../../../config';
import { Item } from '../../../services/database/types';
import { ErrorCode } from '../../../utils/errors';

View File

@@ -1,6 +1,5 @@
import { rootDir } from './tool-utils';
import { execCommand2, rootDir } from './tool-utils';
import * as moment from 'moment';
import { execCommand } from '@joplin/utils';
interface Argv {
dryRun?: boolean;
@@ -36,7 +35,7 @@ async function main() {
const buildDate = moment(new Date().getTime()).format('YYYY-MM-DDTHH:mm:ssZ');
let revision = '';
try {
revision = await execCommand('git rev-parse --short HEAD', { showStdout: false });
revision = await execCommand2('git rev-parse --short HEAD', { showStdout: false });
} catch (error) {
console.info('Could not get git commit: metadata revision field will be empty');
}
@@ -63,16 +62,16 @@ async function main() {
return;
}
await execCommand(dockerCommand);
await execCommand2(dockerCommand);
for (const tag of dockerTags) {
await execCommand(`docker tag "${repository}:${imageVersion}" "${repository}:${tag}"`);
if (pushImages) await execCommand(`docker push ${repository}:${tag}`);
await execCommand2(`docker tag "${repository}:${imageVersion}" "${repository}:${tag}"`);
if (pushImages) await execCommand2(`docker push ${repository}:${tag}`);
}
}
if (require.main === module) {
// eslint-disable-next-line promise/prefer-await-to-then
// eslint-disable-next-line promise/prefer-await-to-then -- Old code before rule was applied
main().catch((error) => {
console.error('Fatal error');
console.error(error);

View File

@@ -1,8 +1,8 @@
import { join } from 'path';
import { execCommand2 } from './tool-utils';
import { pathExists, mkdir, readFile, move, remove, writeFile } from 'fs-extra';
import { DefaultPluginsInfo } from '@joplin/lib/services/plugins/PluginService';
import getDefaultPluginsInfo from '@joplin/lib/services/plugins/defaultPlugins/desktopDefaultPluginsInfo';
import { execCommand } from '@joplin/utils';
const fetch = require('node-fetch');
interface PluginAndVersion {
@@ -41,7 +41,7 @@ async function downloadFile(url: string, outputPath: string) {
export async function extractPlugins(currentDir: string, defaultPluginDir: string, downloadedPluginsNames: PluginIdAndName): Promise<void> {
for (const pluginId of Object.keys(downloadedPluginsNames)) {
await execCommand(`tar xzf ${currentDir}/${downloadedPluginsNames[pluginId]}`, { quiet: true, splitCommandOptions: { handleEscape: false } });
await execCommand2(`tar xzf ${currentDir}/${downloadedPluginsNames[pluginId]}`, { quiet: true });
await move(`package/publish/${pluginId}.jpl`, `${defaultPluginDir}/${pluginId}/plugin.jpl`, { overwrite: true });
await move(`package/publish/${pluginId}.json`, `${defaultPluginDir}/${pluginId}/manifest.json`, { overwrite: true });
await remove(`${downloadedPluginsNames[pluginId]}`);
@@ -73,20 +73,6 @@ export const downloadPlugins = async (localPluginsVersions: PluginAndVersion, de
return downloadedPluginsNames;
};
// Mac app signing/notarizing fails if the binaries are inside an archive (plugin.jpl)
// Contents of plugin.jpl are unzipped just for Mac so that binary signing passes through
// ref: https://github.com/laurent22/joplin/pull/8048, https://github.com/laurent22/joplin/pull/8040
const extractMacPlugins = async (defaultPluginDir: string, downloadedPluginsNames: PluginIdAndName) => {
if (process.platform !== 'darwin') return;
for (const pluginId in downloadedPluginsNames) {
const pluginDirectory = `${defaultPluginDir}/${pluginId}`;
const archivePath = `${pluginDirectory}/plugin.jpl`;
await execCommand(`tar xzf ${archivePath} --directory ${pluginDirectory}`, { quiet: true, splitCommandOptions: { handleEscape: false } });
await remove(archivePath);
}
};
async function start(): Promise<void> {
const defaultPluginDir = join(__dirname, '..', '..', 'packages', 'app-desktop', 'build', 'defaultPlugins');
const defaultPluginsInfo = getDefaultPluginsInfo();
@@ -98,7 +84,6 @@ async function start(): Promise<void> {
const localPluginsVersions = await localPluginsVersion(defaultPluginDir, defaultPluginsInfo);
const downloadedPluginNames: PluginIdAndName = await downloadPlugins(localPluginsVersions, defaultPluginsInfo, manifests);
await extractPlugins(__dirname, defaultPluginDir, downloadedPluginNames);
await extractMacPlugins(defaultPluginDir, downloadedPluginNames);
}
if (require.main === module) {

View File

@@ -1,5 +1,4 @@
import { execCommand } from '@joplin/utils';
import { rootDir } from './tool-utils';
import { execCommand2, rootDir } from './tool-utils';
const sqlts = require('@rmp135/sql-ts').default;
const fs = require('fs-extra');
@@ -7,7 +6,7 @@ const fs = require('fs-extra');
async function main() {
// Run the CLI app once so as to generate the database file
process.chdir(`${rootDir}/packages/app-cli`);
await execCommand('yarn start version');
await execCommand2('yarn start version');
const sqlTsConfig = {
'client': 'sqlite3',

View File

@@ -1,84 +0,0 @@
import { expectThrow } from '@joplin/lib/testing/test-utils';
import { filesApplyToPlatform, parseRenovateMessage, RenovateMessage, summarizeRenovateMessages } from './git-changelog';
describe('git-changelog', () => {
test('should find out if a file path is relevant to a platform', async () => {
type TestCase = [string[], string, boolean];
const testCases: TestCase[] = [
[['packages/app-mobile/package.json'], 'ios', true],
[['packages/app-mobile/package.json'], 'android', true],
[['packages/app-mobile/package.json'], 'destop', false],
[[], 'destop', false],
[['packages/server/package.json'], 'server', true],
[['packages/app-mobile/package.json', 'packages/server/package.json'], 'server', true],
[['packages/app-mobile/package.json', 'packages/server/package.json'], 'android', true],
[['packages/app-mobile/package.json', 'packages/server/package.json'], 'desktop', false],
[['packages/server/package.json'], 'desktop', false],
[['packages/lib/package.json'], 'server', true],
[['packages/lib/package.json'], 'desktop', true],
[['packages/lib/package.json'], 'android', true],
[['packages/lib/package.json'], 'clipper', false],
[['packages/app-clipper/package.json'], 'clipper', true],
];
for (const testCase of testCases) {
const [files, platform, expected] = testCase;
const actual = filesApplyToPlatform(files, platform);
expect(actual).toBe(expected);
}
});
test('should parse Renovate messages', async () => {
type TestCase = [string, string, string];
const testCases: TestCase[] = [
['Update typescript-eslint monorepo to v5 (#7291)', 'typescript-eslint', 'v5'],
['Update aws-sdk-js-v3 monorepo to v3.215.0', 'aws-sdk-js-v3', 'v3.215.0'],
['Update dependency moment to v2.29.4 (#7087)', 'moment', 'v2.29.4'],
];
for (const testCase of testCases) {
const [message, pkg, version] = testCase;
const actual = parseRenovateMessage(message);
expect(actual.package).toBe(pkg);
expect(actual.version).toBe(version);
}
await expectThrow(async () => parseRenovateMessage('not a renovate message'));
});
test('should summarize Renovate messages', async () => {
type TestCase = [RenovateMessage[], string];
const testCases: TestCase[] = [
[
[
{ package: 'sas', version: 'v1.0' },
{ package: 'sas', version: 'v1.2' },
{ package: 'moment', version: 'v3.4' },
{ package: 'eslint', version: 'v1.2' },
],
'Updated packages moment (v3.4), sas (v1.2)',
],
[
[
{ package: 'eslint', version: 'v1.2' },
],
'',
],
[
[],
'',
],
];
for (const testCase of testCases) {
const [messages, expected] = testCase;
const actual = summarizeRenovateMessages(messages);
expect(actual).toBe(expected);
}
});
});

View File

@@ -8,7 +8,6 @@ interface LogEntry {
message: string;
commit: string;
author: Author;
files: string[];
}
enum Platform {
@@ -59,10 +58,6 @@ async function gitLog(sinceTag: string) {
const authorEmail = splitted[1];
const authorName = splitted[2];
const message = splitted[3].trim();
let files: string[] = [];
const filesResult = await execCommand(`git diff-tree --no-commit-id --name-only ${commit} -r`);
files = filesResult.split('\n').map(s => s.trim()).filter(s => !!s);
output.push({
commit: commit,
@@ -72,7 +67,6 @@ async function gitLog(sinceTag: string) {
name: authorName,
login: await githubUsername(authorEmail, authorName),
},
files,
});
}
@@ -97,102 +91,6 @@ function platformFromTag(tagName: string): Platform {
throw new Error(`Could not determine platform from tag: "${tagName}"`);
}
export const filesApplyToPlatform = (files: string[], platform: string): boolean => {
const isMainApp = ['android', 'ios', 'desktop', 'cli', 'server'].includes(platform);
const isMobile = ['android', 'ios'].includes(platform);
for (const file of files) {
if (file.startsWith('packages/app-cli') && platform === 'cli') return true;
if (file.startsWith('packages/app-clipper') && platform === 'clipper') return true;
if (file.startsWith('packages/app-mobile') && isMobile) return true;
if (file.startsWith('packages/app-desktop') && platform === 'desktop') return true;
if (file.startsWith('packages/fork-htmlparser2') && isMainApp) return true;
if (file.startsWith('packages/fork-uslug') && isMainApp) return true;
if (file.startsWith('packages/htmlpack') && isMainApp) return true;
if (file.startsWith('packages/lib') && isMainApp) return true;
if (file.startsWith('packages/pdf-viewer') && platform === 'desktop') return true;
if (file.startsWith('packages/react-native-') && isMobile) return true;
if (file.startsWith('packages/renderer') && isMainApp) return true;
if (file.startsWith('packages/server') && platform === 'server') return true;
if (file.startsWith('packages/tools') && isMainApp) return true;
if (file.startsWith('packages/turndown') && isMainApp) return true;
}
return false;
};
export interface RenovateMessage {
package: string;
version: string;
}
export const parseRenovateMessage = (message: string): RenovateMessage => {
const regexes = [
/^Update dependency ([^\s]+) to ([^\s]+)/,
/^Update ([^\s]+) monorepo to ([^\s]+)/,
];
for (const regex of regexes) {
const m = message.match(regex);
if (m) {
return {
package: m[1],
version: m[2],
};
}
}
throw new Error(`Not a Renovate message: ${message}`);
};
export const summarizeRenovateMessages = (messages: RenovateMessage[]): string => {
// Exclude some dev dependencies
messages = messages.filter(m => {
if ([
'yeoman-generator',
'madge',
'lint-staged',
'gettext-extractor',
'gettext-extractor',
'ts-jest',
'ts-node',
'typescript',
'eslint',
'jest',
].includes(m.package)) {
return false;
}
if (m.package.startsWith('@types/')) return false;
if (m.package.startsWith('typescript-')) return false;
return true;
});
const temp: Record<string, string> = {};
for (const message of messages) {
if (!temp[message.package]) {
temp[message.package] = message.version;
} else {
if (message.version > temp[message.package]) {
temp[message.package] = message.version;
}
}
}
const temp2: string[] = [];
for (const [pkg, version] of Object.entries(temp)) {
temp2.push(`${pkg} (${version})`);
}
temp2.sort();
if (temp2.length) return `Updated packages ${temp2.join(', ')}`;
return '';
};
function filterLogs(logs: LogEntry[], platform: Platform) {
const output: LogEntry[] = [];
const revertedLogs = [];
@@ -200,8 +98,6 @@ function filterLogs(logs: LogEntry[], platform: Platform) {
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars
// let updatedTranslations = false;
const renovateMessages: RenovateMessage[] = [];
for (const log of logs) {
// Save to an array any commit that has been reverted, and exclude
@@ -214,18 +110,9 @@ function filterLogs(logs: LogEntry[], platform: Platform) {
if (revertedLogs.indexOf(log.message) >= 0) continue;
let isRenovate = false;
let prefix = log.message.trim().toLowerCase().split(':');
if (prefix.length <= 1) {
if (log.author && log.author.name === 'renovate[bot]') {
prefix = ['renovate'];
isRenovate = true;
} else {
continue;
}
} else {
prefix = prefix[0].split(',').map(s => s.trim());
}
if (prefix.length <= 1) continue;
prefix = prefix[0].split(',').map(s => s.trim());
let addIt = false;
@@ -241,11 +128,6 @@ function filterLogs(logs: LogEntry[], platform: Platform) {
if (platform === 'server' && prefix.indexOf('server') >= 0) addIt = true;
if (platform === 'cloud' && (prefix.indexOf('cloud') >= 0 || prefix.indexOf('server') >= 0)) addIt = true;
if (isRenovate && filesApplyToPlatform(log.files, platform)) {
renovateMessages.push(parseRenovateMessage(log.message));
addIt = false;
}
// Translation updates often comes in format "Translation: Update pt_PT.po"
// but that's not useful in a changelog especially since most people
// don't know country and language codes. So we catch all these and
@@ -266,16 +148,6 @@ function filterLogs(logs: LogEntry[], platform: Platform) {
// Actually we don't really need this info - translations are being updated all the time
// if (updatedTranslations) output.push({ message: 'Updated translations' });
const renovateSummary = summarizeRenovateMessages(renovateMessages);
if (renovateSummary) {
output.push({
author: { name: '', email: '', login: '' },
commit: '',
files: [],
message: renovateSummary,
});
}
return output;
}
@@ -409,9 +281,7 @@ function formatCommitMessage(commit: string, msg: string, author: Author, option
} else {
const commitStrings = [commit.substr(0, 7)];
if (authorMd) commitStrings.push(`by ${authorMd}`);
if (commitStrings.join('').length) {
output += ` (${commitStrings.join(' ')})`;
}
output += ` (${commitStrings.join(' ')})`;
}
}
@@ -509,11 +379,8 @@ async function main() {
console.info(changelogString.join('\n'));
}
if (require.main === module) {
// eslint-disable-next-line promise/prefer-await-to-then
main().catch((error) => {
console.error('Fatal error');
console.error(error);
process.exit(1);
});
}
main().catch((error) => {
console.error('Fatal error');
console.error(error);
process.exit(1);
});

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