1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-09-02 20:46:21 +02:00

Compare commits

...

167 Commits

Author SHA1 Message Date
Laurent Cozic
77c7f966cf Electron release v1.0.235 2020-08-18 21:56:50 +01:00
Laurent Cozic
619fa1d607 Revert "Desktop, Mobile: Add support for media player for video and audio files"
Reverted as it now attempts to render note links as images. See:

https://discourse.joplinapp.org/t/joplin-for-windows-1-0-234-bug/10558?u=laurent

This reverts commit 13280ce1b3.
2020-08-18 21:52:00 +01:00
Laurent Cozic
157736ff7e Desktop: Fixed regression: Several menu items did not work anymore 2020-08-18 21:45:22 +01:00
Naveen M V
0b57d906f8 Doc: Update search engine doc (#3614)
Add documentation for search filters
2020-08-18 00:15:00 +01:00
Laurent Cozic
86bfdb5c79 Android release v1.0.337 2020-08-17 21:48:37 +01:00
Laurent Cozic
fc7d34f79c Electron release v1.0.234 2020-08-17 21:44:40 +01:00
Matias Laporte
9d962f0328 All: Translation: Update es_ES.po (#3629) 2020-08-13 20:38:30 -04:00
Laurent Cozic
79e1a33b28 Fixed tabs 2020-08-08 10:21:25 +01:00
Caleb John
0eedae1f62 Desktop: Fixed vim mode issue where status bar was not visible (#3606) 2020-08-08 10:15:01 +01:00
Caleb John
e1144c098e Desktop: Fixed scrolling issue when editing while searching in CodeMirror (#3593)
Only scroll to search matchs when the user changes the search or
explicitly changes the search index
https://discourse.joplinapp.org/t/codemirror-feedback/10397
2020-08-08 10:11:55 +01:00
Caleb John
5c5cb0f781 Desktop: Implement scroll-past-end on CodeMirror editor (#3589) 2020-08-08 09:55:10 +01:00
Laurent Cozic
656615b571 Merge branch 'dev' of github.com:laurent22/joplin into dev 2020-08-08 00:35:55 +01:00
jonath92
799a9e810d All: Resolves #1266: Add support for OneDrive for Business (#3433) 2020-08-08 00:35:30 +01:00
R3dError
aa147bbcdc Desktop: Added attach file to menu bar (#3540) 2020-08-08 00:32:49 +01:00
alexchee
8c7a24282c All: Fixes #3591: Fixed sync fetching issue (#3599) 2020-08-08 00:30:11 +01:00
Naveen M V
f99f3f8a6d All: Resolves #1877: Add search filters (#3213) 2020-08-08 00:13:21 +01:00
Laurent Cozic
29fbafdfff Mobile: Fixed issue when creating new notebook and going back 2020-08-07 02:03:33 +00:00
Laurent Cozic
3253146dae Merge branch 'master' into dev 2020-08-06 15:30:00 +01:00
Laurent Cozic
7e4ac0fd73 Tools: Add complexity rule 2020-08-05 23:16:51 +00:00
Laurent Cozic
60d77cb5ea ios-v10.0.52 2020-08-05 15:57:21 +01:00
Laurent Cozic
8299164964 Android release v1.0.336 2020-08-05 00:18:42 +01:00
Laurent Cozic
488393e75d Mobile: Fixes #3597: Fixed regression when saving a new notebook 2020-08-05 00:08:11 +01:00
Laurent Cozic
c19f8c8035 Mobile: Fixes #3597: Fixed regression when saving a new notebook 2020-08-05 00:07:55 +01:00
Laurent Cozic
b0b55718cc Merge branch 'dev' of github.com:laurent22/joplin into dev 2020-08-04 23:00:38 +01:00
Laurent Cozic
5ade9ff2f6 Tools: Updated eslint and clarified comma-dangle rule 2020-08-04 23:00:11 +01:00
Allan Jacquet-Cretides
e4cfb518ba Desktop: Resolves #3569: Show full folder name in mouse-over pop-up text (#3590) 2020-08-04 22:45:32 +01:00
Laurent Cozic
89864de1ff Tools: Added eslint radix rule 2020-08-04 22:36:50 +01:00
Laurent
ee2a474611 Update .travis.yml 2020-08-04 22:31:59 +01:00
Caleb John
223caca0f5 Desktop: Enable CodeMirror keybindings (#3545) 2020-08-02 16:26:26 +01:00
Laurent Cozic
ee358f70dd Desktop: Add version info to error screen 2020-08-02 16:21:30 +01:00
Laurent Cozic
0718828d60 Merge branch 'master' into dev 2020-08-02 16:12:11 +01:00
Laurent Cozic
d13f54c2ce CLI v1.0.166 2020-08-02 15:03:57 +01:00
Laurent Cozic
90f7f99cd1 ios-v10.0.51 2020-08-02 15:01:39 +01:00
Laurent Cozic
a273bbaeee Fixed Android build 2020-08-02 13:37:32 +01:00
Laurent Cozic
619b426689 Android release v1.0.335 2020-08-02 13:34:09 +01:00
Laurent Cozic
97c752a39e Fixed config 2020-08-02 13:16:41 +01:00
Laurent Cozic
7565f1cada Fixed mobile version build 2020-08-02 12:38:36 +01:00
Laurent
0c147236a3 All: Add mechanism to lock and upgrade sync targets (#3524) 2020-08-02 12:28:50 +01:00
Anjula Karunarathne
88f22fabf7 Desktop: Added KeymapService to manage keyboard shortcuts (#3252) 2020-08-02 12:26:55 +01:00
Thatcher Chamberlin
5f46d60c5e Desktop, Cli, Update Katex to v0.12.0 (#3571) 2020-08-02 12:24:03 +01:00
Jess
cc8c200826 Desktop: Resolves #3529: Fix AppImage Icon (#3570) 2020-08-02 12:17:51 +01:00
Laurent
4485947b0f Desktop: Fixed copy, cut and paste in Rich Text editor (#3565) 2020-08-02 12:16:42 +01:00
Roman Musin
9f1a877f96 Android: remove hardcoded portrait screen orientation for share activity (#3418) 2020-08-02 12:14:56 +01:00
Laurent Cozic
13280ce1b3 Desktop, Mobile: Add support for media player for video and audio files
Co-authored-by: Bryan <bryan.r.gerlach@gmail.com>
2020-08-02 12:03:49 +01:00
Caleb John
7f73931530 Desktop: Fixes #3560: Modify the CodeMirror linter plugin to fix katex (#3582)
Rewrite the joplin mode to manually handle parsing.

This gives us more control over katex parsing and the ability to upgrade
in the future
2020-08-02 11:33:59 +01:00
Caleb John
bbfed9bca8 Desktop: Codemirror: clean up list indent code (#3581) 2020-08-01 19:09:52 +01:00
Caleb John
bab29cd582 Desktop: Toggle Editor rather than setting split mode on search (#3561) 2020-08-01 19:07:52 +01:00
Laurent Cozic
baea44cbd6 Fixed mobile version build 2020-08-01 18:56:56 +01:00
Laurent Cozic
ab0538df43 All: Security: Apply latest package security updates 2020-08-01 18:56:26 +01:00
Laurent Cozic
58d4a69053 Merge branch 'dev' of github.com:laurent22/joplin into dev 2020-08-01 18:21:42 +01:00
Laurent
9147b3061a Desktop: Hide completed to-dos in GotoAnything (#3580) 2020-08-01 18:17:40 +01:00
Laurent
1b0102f62c Update stale.yml 2020-08-01 18:15:17 +01:00
j-krl
471631933b CLI: Resolves #3217: Added link navigation shortcuts (#3275) 2020-08-01 17:57:45 +01:00
Laurent
cd761932c1 Merge branch 'dev' into cli-shortcuts-ts 2020-08-01 17:50:03 +01:00
Laurent Cozic
e63eee89ef Electron release v1.0.233 2020-08-01 15:27:30 +01:00
Laurent Cozic
4393ebbcc6 Desktop: Fixed potential crash when notebook does not have a title 2020-08-01 15:20:17 +01:00
Laurent Cozic
ed82390a8d Desktop: Fixed toolbar button state when going from setting screen to main screen 2020-08-01 15:11:14 +01:00
Laurent Cozic
79e708779f Merge branch 'master' of github.com:laurent22/joplin 2020-08-01 14:49:31 +01:00
Laurent Cozic
98905f6892 Tools: Cleaned up and improve build config, and fixed TypeScript Watch high CPU usage 2020-08-01 14:48:56 +01:00
Retew
44e57c3959 All: Translation: Update ru_RU.po (#3579) 2020-07-29 23:35:43 -04:00
voltinus
35d48394ce All: Translation: Update pl_PL.po (#3577) 2020-07-29 23:32:24 -04:00
Laurent Cozic
eb42a5f34b Mobile: Reduced auto-sync interval when opening app, and fixed Amazon S3 config 2020-07-28 22:47:24 +00:00
Laurent Cozic
729c8c6fac Electron release v1.0.232 2020-07-28 19:11:14 +01:00
Laurent Cozic
7a1707d864 Finished reverting hierarchical tag feature 2020-07-28 19:09:50 +01:00
Laurent Cozic
64d7603eed Revert "All: Added support for hierarchical/nested tags (#2572)"
This reverts commit e11e57f1d8.
2020-07-28 18:50:34 +01:00
Laurent Cozic
89e6b680a6 Revert "Desktop: Regression: Fix sort tags alphabetically in side-menu (#3489)"
This reverts commit 10ff43f4f0.
2020-07-28 18:49:34 +01:00
Helmut K. C. Tessarek
da071a804c Update website 2020-07-27 13:27:45 -04:00
Helmut K. C. Tessarek
7833ca5ae6 https://joplin.cozic.net -> https://joplinapp.org 2020-07-27 13:26:17 -04:00
Mehrad Mahmoudian
44d49b57b9 fixed a typo and added checked checkbox in Markdown Guide (#3556)
* Doc: Fixed a typo in a markdown syntax of a link

* Doc: added an example of a checked checkbox

and added how the checkboxes would get translated when turned to HTML

* Doc: added a picture of a rendered markdown checkbox in Joplin
2020-07-27 13:19:11 -04:00
Laurent
9db150f8ff Update stale.yml 2020-07-27 11:06:45 +01:00
Laurent Cozic
e2d3630783 Tools: Added sync target snapshots 2020-07-25 11:38:43 +01:00
Laurent Cozic
cb1b5cae9f Update website 2020-07-24 19:46:27 +01:00
Laurent Cozic
3af5b31c1c Merge branch 'master' of github.com:laurent22/joplin 2020-07-24 19:44:33 +01:00
Laurent Cozic
b6dafd6da6 Doc: Showcasing plugins as screenshots (#3549)
Co-authored-by: Mehrad Mahmoudian <m.mahmoudian@gmail.com>
2020-07-24 19:42:44 +01:00
Laurent Cozic
d08b922632 Electron release v1.0.231 2020-07-24 18:02:12 +01:00
Laurent Cozic
9d4e250f6b Electron release v1.0.230 2020-07-24 17:45:14 +01:00
Laurent Cozic
c19cc1b39a Merge branch 'master' of github.com:laurent22/joplin 2020-07-24 17:28:55 +01:00
Laurent Cozic
73bd6f9776 Update turndown 2020-07-24 17:28:28 +01:00
WhiredPlanck
6fef55398f All: Translation: Update zh_CN.po (#3542)
* [trans] Update zh_CN.po

* [trans] Give the specific names of AWS secret and AWS key
2020-07-24 11:58:09 -04:00
Laurent Cozic
d209d5036b Desktop, Cli: Security: Fixed a path traversal vulnerability in clipper server API that could allow an attacker to read or write an arbitrary file (CVE-2020-15844) 2020-07-24 00:45:15 +00:00
Laurent Cozic
4be02bc33c Desktop: Fixed save issue in Rich Text editor when making a change to a note and quickly switching to a different notebook 2020-07-23 23:55:01 +00:00
Laurent Cozic
d6daa34e0a Linter 2020-07-23 23:06:58 +00:00
Laurent Cozic
9cebbbe7cf Desktop, Cli: Fixed attachments being out of order when importing Enex file 2020-07-23 18:43:01 +01:00
Laurent Cozic
71e5304298 Desktop: Fixes #3534: Undoing changes multiple time on an existing note could result in a blank note 2020-07-23 19:56:53 +00:00
Laurent Cozic
8f8d11c9b3 Desktop: Fixes #3510: Note links would be broken after saving a note in Rich Text editor 2020-07-23 19:38:42 +00:00
Laurent Cozic
1cd86fd3ea Cli: Fixes #3548: Desktop-only scripts were incorrectly being loaded in CLI server tool 2020-07-23 19:04:04 +00:00
Laurent Cozic
7f1f5a8c3d Desktop: Fixes #3503: Editor window was no longer being resized with the main window 2020-07-22 23:26:45 +01:00
Caleb John
9dfb0642da Desktop: Split Codemirror setOptions into different effects (#3522) 2020-07-22 23:18:52 +01:00
Caleb John
0fa8dfa063 Desktop: Enforce that whitespace check for unindent checks the begining of a (#3515) 2020-07-22 23:17:49 +01:00
Caleb John
1d79dedf6d Fix architecture check to only search within machine details (#3512) 2020-07-22 23:16:42 +01:00
Caleb John
a274a56e65 Desktop: CodeMirror: Change rootSize parameters to prevent collision with styles.editor (#3505) 2020-07-22 23:16:06 +01:00
Caleb John
44d3a4213f Desktop: Enable searching in editor rather than the viewer for CodeMirror (#3360) 2020-07-22 23:13:23 +01:00
Laurent Cozic
e68eb196b7 Removed debug code 2020-07-22 19:09:20 +01:00
Laurent Cozic
4bef79cd71 Desktop: Fixes #3407: In some cases, changes made to an attachment would not be saved. Also added banner to show that an attachment is being edited 2020-07-22 19:03:31 +01:00
Laurent Cozic
f3dc3602c8 Desktop: Fixes #3366: Revealing file in Windows did not work 2020-07-22 17:24:01 +01:00
Vaidotas Šimkus
17e140ba56 Api: Fixes #3539: Fixes nested tag API to handle calls with no 'fields' query key 2020-07-22 10:38:49 +01:00
Laurent Cozic
89d0575ccd All: Security: Upgrade packages to fix minor vulnerabilities 2020-07-21 22:22:58 +01:00
Helmut K. C. Tessarek
ca0197a319 fix linter error (#3518) 2020-07-20 00:19:08 +01:00
Helmut K. C. Tessarek
62bc296abe Update translations 2020-07-19 15:18:42 -04:00
Gen Neko
e58dc809ec All: Translation: Update ja_JP.po (#3526)
Translate new strings for the nested tag and note properties.
2020-07-19 14:41:40 -04:00
Arda Kılıçdağı
abd57ad384 All: Translation: Update tr_TR.po (#3523)
Turkish translations updated
2020-07-18 13:42:48 -04:00
Tim Mundt
bada9286d0 All: Translation: Update de_DE.po (#3517) 2020-07-17 19:34:14 -04:00
Roman Musin
3807317e66 Mobile: Increase max resource size to 100mb (#3431) 2020-07-15 18:29:16 +01:00
Vaidotas Šimkus
10ff43f4f0 Desktop: Regression: Fix sort tags alphabetically in side-menu (#3489) 2020-07-15 18:28:40 +01:00
Caleb John
282f6de1a9 Desktop: Load more CodeMirror modes for syntax highlighting (#3401) 2020-07-15 11:46:14 +01:00
alexchee
9a55afec01 All: Add support for AWS S3 synchronisation (Beta) (#2815) 2020-07-15 10:22:55 +01:00
Robert
c8c4bb3245 Update nl_NL.po (#3498) 2020-07-15 10:14:21 +01:00
Chen Yuyang
e1f831af62 Update translation zh_CN.po (#3490) 2020-07-15 10:13:39 +01:00
Laurent Cozic
657cebfda9 Desktop: Improved GotoAnything speed and made it safer
Previously we'd use the remove-markdown package to create the note
preview however this function would freeze on certain notes, and was
probably unsafe as it used regex to parse Markdown. Replaced this in
favour of Markdown-it along with htmlparser2 to strip all markup from a
note.
2020-07-14 23:27:45 +01:00
Laurent Cozic
7f1c25793a Desktop: Fixes #3449: Fixed style caching 2020-07-14 19:17:25 +00:00
Laurent Cozic
b770ffda4d Desktop: Regression: Fixed adding a new sub-notebook to a notebook 2020-07-14 18:56:02 +00:00
Laurent Cozic
d0b3e15999 Electron release v1.0.229 2020-07-14 15:33:20 +01:00
Laurent Cozic
20433b0282 Desktop: Fixed alarms on macOS 2020-07-14 15:32:49 +01:00
Caleb John
452b41de0f Desktop: Fixes #3440: Improve Markdown rendering in CodeMirror, in particular for math expressions (#3448) 2020-07-12 19:42:19 +01:00
Helmut K. C. Tessarek
b69008225f Update translations 2020-07-12 14:33:09 -04:00
yaozeye
b3a778e983 All: Translation: Update zh_TW.po (#3470) 2020-07-12 14:22:26 -04:00
yaozeye
a57c6e9155 All: Translation: Update zh_CN.po (#3468) 2020-07-12 14:22:07 -04:00
Laurent Cozic
3fbfba2c03 Merge branch 'master' of github.com:laurent22/joplin 2020-07-12 19:20:32 +01:00
Laurent Cozic
8a5e6875f0 Desktop, Cli: Fixes #3473: Fix filename when exporting notebook as Markdown 2020-07-12 19:13:08 +01:00
Vaidotas Šimkus
e11e57f1d8 All: Added support for hierarchical/nested tags (#2572)
The implementation uses / symbol as a nesting separator. I.e. tag/subtag is a nested tag, where tag is the parent tag and subtag is its child. Creating a tag named tag/subtag/subsubtag creates three tags, one for each level. The tags are associated using parent_id field.

In the app, viewing notes with a tag will also show all notes that are associated with any of the tag's descendant tags (same for the note count). Deleting a tag will also delete all its descendant tags.

In the desktop app the tags are shown nested just like the notebooks.
2020-07-12 18:09:07 +01:00
Laurent Cozic
073bd80f89 Electron release v1.0.228 2020-07-12 18:05:06 +01:00
Laurent Cozic
e3aaee738a Desktop: Fixes #3482: Fixed regression when moving note to notebook from menu 2020-07-12 17:27:56 +01:00
Laurent Cozic
f1b2b7b86b Desktop: Fixes #3481: Crash when applying tags to multiple notes from within another tag 2020-07-12 17:15:17 +01:00
Laurent Cozic
e0a87d6253 Revert "All: Add support for sync target lock"
This reverts commit 51235f191d.

Not ready yet, moving to a branch
2020-07-12 16:38:54 +01:00
Laurent Cozic
a7eae2e033 Update donate.md 2020-07-11 14:27:35 +01:00
Laurent Cozic
51235f191d All: Add support for sync target lock
The goal is to allow locking a sync target so that maintenance
operations, such as upgrading the target to a more efficient format,
can be done. For now, only the lock mechanism is in place, as a way to
evaluate it, and to see if it can cause any issue.
2020-07-10 23:42:03 +01:00
Laurent Cozic
003ead2511 Clean up 2020-07-10 19:54:29 +01:00
Laurent Cozic
8dc8527fdc CLI v1.0.165 2020-07-10 19:52:58 +01:00
Laurent Cozic
985dcc2605 Update stale.yml
30 days should be enough - either we tag the issue or it gets closed, and it's likely all issues will be checked by at least one mod within 30 days.
2020-07-10 18:02:35 +01:00
WhiredPlanck
4063cdba11 All: Translation: Update zh_CN.po (#3451)
* branch off from master

* fix typo and improve translations
2020-07-07 15:14:52 -04:00
WhiredPlanck
c96c591fa9 All: Translation: Update zh_TW.po (#3450)
* Update zh_TW.po

* fix typo and improve translations
2020-07-07 15:14:27 -04:00
Laurent Cozic
4913fdb800 Electron release v1.0.227 2020-07-07 19:18:03 +01:00
Laurent Cozic
24bc7f153a Desktop: Fixes #3461: Fixed regression which could cause a crash after deleting a notebook 2020-07-07 19:17:33 +01:00
Laurent Cozic
8732c97dcd Desktop: Fixed GotoAnything rendering issue with HTML notes 2020-07-07 19:17:33 +01:00
Damien MASCRÉ
e092eaef6f Updates to the french translation (#3466)
* Update french translation.

* Update french translation.
2020-07-07 15:09:30 +01:00
cadolphs
4ade1bf65f Desktop: Add approximate reading time to note statistics (#3373)
* First stab at a reading time calculator

* Use ceil instead of floor for rounding

* Fix variable names to camelCase

* Up wpm to 250, add source
2020-07-07 00:39:36 +01:00
Laurent Cozic
77a03599de Desktop: WYSIWYG: Fixed inserting date time and other content inside header 2020-07-04 12:17:30 +01:00
Laurent Cozic
9c057071b5 Electron release v1.0.226 2020-07-04 10:47:04 +01:00
Laurent Cozic
ee3f4beeaf Desktop: Dev fix: Better handling of command props 2020-07-04 10:46:22 +01:00
Laurent Cozic
7035b1f9f6 Desktop: Dev fix: Added back title on header buttons 2020-07-04 10:46:22 +01:00
Deep Majumder
3aea55ee63 Tools: Generates SHA-256 sum of AppImage for Linux (#3410) 2020-07-03 22:46:20 +01:00
Laurent Cozic
28acb4eca6 Electron release v1.0.225 2020-07-03 22:43:19 +01:00
Laurent Cozic
c63c6370b5 Desktop: Refactored command system
The goal is to make the command system more modular, so each command can
be defined as a single object that includes a declaration (name, label,
etc.) and a runtime (to execute the command, test if it should be
enabled, etc.)

Utility methods are provided to convert a command to a menu item or a
toolbar button, thus reducing duplicated and boiler plate code across the
codebase (often the menu item logic was duplicated in the toolbar
button logic and vice versa).

The goal is to make it easier to add new commands (and associated menu
item and toolbar buttons) and to call them from
anywhere. This is also useful for plugins, which can also easily define
new commands.

Could also allow creating a command palette.
2020-07-03 22:32:39 +01:00
Laurent Cozic
6046f40e45 Tools: Fixed tests following highlight.js upgrade (changed in HTML escape mode) 2020-07-03 22:30:33 +01:00
Caleb John
262159cf73 Desktop: Codemirror: Remove cancelled keys in favour of explicit keymaps (#3417) 2020-07-02 23:00:56 +01:00
Caleb John
8eb94bc8ab Desktop: Manually refresh codemirror whenever the window size changes (#3388)
* Manually refresh codemirror whenever the parent div size changes

* Set editor width through style rather than adding an extra property

* use Memo for editorStyle
2020-07-02 22:45:43 +01:00
WhiredPlanck
a9390affaa All: Translation: Update zh_CN.po (#3430)
* Update zh_CN.po

* Correct typo

* Correct typo: NextCloud --> Nextcloud; Improved translation

* Improved translation (2)
2020-06-30 10:30:09 -04:00
Arda Kılıçdağı
66392b4e8a Yandex disk removed from supported WEBDAV clients (#3432)
Yandex.disk recently removed file upload support from WebDAV

https://ru.stackoverflow.com/questions/1043523/После-загрузки-файла-на-Яндекс-Диск-по-webdav-происходят-паузы-по-60-секунд-на-к
https://qna.habr.com/q/677787

So this makes Yandex.disk unusable at the moment.

Here's a similar issue, please see recent comments: https://github.com/PhilippC/keepass2android/issues/506

I've personally tried, and cannot even access to Yandex.disk at the moment through WebDAV.

This PR simply removes yandex.disk line from the ReadMe.

Thanks,
2020-06-30 10:26:30 -04:00
Laurent Cozic
3283f34c79 ios-v10.0.50 2020-06-28 20:17:13 +01:00
j-krl
fd568b5300 interop unnecessary 2020-06-18 15:50:19 -06:00
j-krl
f19f148297 word choice 2020-05-25 20:18:13 -06:00
j-krl
79c6eb5503 Added to docs and rewrote LinkSelector as ts file 2020-05-25 20:14:38 -06:00
j-krl
1204bed80a Merge branch 'cli-shortcuts-ts' of https://github.com/j-krl/joplin into cli-shortcuts-ts 2020-05-25 20:10:04 -06:00
j-krl
dc91b1f7d6 Added to docs and rewrote LinkSelector as ts file 2020-05-25 20:09:53 -06:00
j-krl
66dc2b33de Added to docs and rewrote LinkSelector as ts file 2020-05-25 20:00:16 -06:00
j-krl
811942d45e Merge branch 'cli-shortcuts' of https://github.com/j-krl/joplin into cli-shortcuts 2020-05-24 03:20:44 -06:00
j-krl
dbde239a25 formatting 2020-05-24 03:20:05 -06:00
j-krl
ab3ba3e2ca formatting 2020-05-24 03:11:45 -06:00
j-krl
79e77b5a10 removed personal comments 2020-05-24 02:44:24 -06:00
j-krl
c3395133c9 automatic page scrolling, docs updated 2020-05-24 02:38:14 -06:00
j-krl
b1d073cdeb next/prev link index is buggy on page change 2020-05-23 21:09:22 -06:00
j-krl
25d723b373 switched to class based implementation 2020-05-23 07:23:55 -06:00
j-krl
e9783d050b I'm going to have to rewrite this entire thing... 2020-05-22 15:26:42 -06:00
j-krl
e1be1ead86 big link doesn't work but regular link does 2020-05-22 06:39:08 -06:00
j-krl
b129bed69f installed open package 2020-05-22 06:06:28 -06:00
j-krl
265ad50ce4 app 2020-05-22 05:50:56 -06:00
j-krl
3e2570601f app-gui 2020-05-22 05:48:27 -06:00
528 changed files with 41419 additions and 29767 deletions

View File

@@ -61,9 +61,43 @@ Modules/TinyMCE/IconPack/postinstall.js
Modules/TinyMCE/langs/
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD
CliClient/app/LinkSelector.js
CliClient/build/LinkSelector.js
CliClient/tests/synchronizer_LockHandler.js
CliClient/tests/synchronizer_MigrationHandler.js
ElectronClient/commands/focusElement.js
ElectronClient/commands/startExternalEditing.js
ElectronClient/commands/stopExternalEditing.js
ElectronClient/global.d.js
ElectronClient/gui/ErrorBoundary.js
ElectronClient/gui/Header/commands/focusSearch.js
ElectronClient/gui/MainScreen/commands/editAlarm.js
ElectronClient/gui/MainScreen/commands/exportPdf.js
ElectronClient/gui/MainScreen/commands/hideModalMessage.js
ElectronClient/gui/MainScreen/commands/moveToFolder.js
ElectronClient/gui/MainScreen/commands/newNote.js
ElectronClient/gui/MainScreen/commands/newNotebook.js
ElectronClient/gui/MainScreen/commands/newTodo.js
ElectronClient/gui/MainScreen/commands/print.js
ElectronClient/gui/MainScreen/commands/renameFolder.js
ElectronClient/gui/MainScreen/commands/renameTag.js
ElectronClient/gui/MainScreen/commands/search.js
ElectronClient/gui/MainScreen/commands/selectTemplate.js
ElectronClient/gui/MainScreen/commands/setTags.js
ElectronClient/gui/MainScreen/commands/showModalMessage.js
ElectronClient/gui/MainScreen/commands/showNoteContentProperties.js
ElectronClient/gui/MainScreen/commands/showNoteProperties.js
ElectronClient/gui/MainScreen/commands/showShareNoteDialog.js
ElectronClient/gui/MainScreen/commands/toggleNoteList.js
ElectronClient/gui/MainScreen/commands/toggleSidebar.js
ElectronClient/gui/MainScreen/commands/toggleVisiblePanes.js
ElectronClient/gui/MultiNoteActions.js
ElectronClient/gui/NoteContentPropertiesDialog.js
ElectronClient/gui/NoteEditor/commands/editorCommandDeclarations.js
ElectronClient/gui/NoteEditor/commands/focusElementNoteBody.js
ElectronClient/gui/NoteEditor/commands/focusElementNoteTitle.js
ElectronClient/gui/NoteEditor/commands/showLocalSearch.js
ElectronClient/gui/NoteEditor/commands/showRevisions.js
ElectronClient/gui/NoteEditor/NoteBody/AceEditor/AceEditor.js
ElectronClient/gui/NoteEditor/NoteBody/AceEditor/styles/index.js
ElectronClient/gui/NoteEditor/NoteBody/AceEditor/Toolbar.js
@@ -77,6 +111,8 @@ ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/Toolbar.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/index.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/types.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useCursorUtils.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useEditorSearch.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useJoplinMode.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useLineSorting.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useListIdent.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useScrollUtils.js
@@ -95,12 +131,20 @@ ElectronClient/gui/NoteEditor/utils/useMessageHandler.js
ElectronClient/gui/NoteEditor/utils/useNoteSearchBar.js
ElectronClient/gui/NoteEditor/utils/useSearchMarkers.js
ElectronClient/gui/NoteEditor/utils/useWindowCommandHandler.js
ElectronClient/gui/NoteList/commands/focusElementNoteList.js
ElectronClient/gui/NoteListItem.js
ElectronClient/gui/NoteToolbar/NoteToolbar.js
ElectronClient/gui/ResourceScreen.js
ElectronClient/gui/Root_UpgradeSyncTarget.js
ElectronClient/gui/ShareNoteDialog.js
ElectronClient/gui/SideBar/commands/focusElementSideBar.js
ReactNativeClient/lib/AsyncActionQueue.js
ReactNativeClient/lib/checkPermissions.js
ReactNativeClient/lib/commands/historyBackward.js
ReactNativeClient/lib/commands/historyForward.js
ReactNativeClient/lib/commands/synchronize.js
ReactNativeClient/lib/components/screens/UpgradeSyncTargetScreen.js
ReactNativeClient/lib/hooks/useEffectDebugger.js
ReactNativeClient/lib/hooks/useImperativeHandlerDebugger.js
ReactNativeClient/lib/hooks/usePrevious.js
ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/checkbox.js
@@ -108,18 +152,30 @@ ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/fence.js
ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/mermaid.js
ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/sanitize_html.js
ReactNativeClient/lib/JoplinServerApi.js
ReactNativeClient/lib/services/CommandService.js
ReactNativeClient/lib/services/keychain/KeychainService.js
ReactNativeClient/lib/services/keychain/KeychainServiceDriver.dummy.js
ReactNativeClient/lib/services/keychain/KeychainServiceDriver.mobile.js
ReactNativeClient/lib/services/keychain/KeychainServiceDriver.node.js
ReactNativeClient/lib/services/keychain/KeychainServiceDriverBase.js
ReactNativeClient/lib/services/ResourceEditWatcher.js
ReactNativeClient/lib/services/KeymapService.js
ReactNativeClient/lib/services/ResourceEditWatcher/index.js
ReactNativeClient/lib/services/ResourceEditWatcher/reducer.js
ReactNativeClient/lib/services/rest/actionApi.desktop.js
ReactNativeClient/lib/services/rest/errors.js
ReactNativeClient/lib/services/searchengine/filterParser.js
ReactNativeClient/lib/services/searchengine/queryBuilder.js
ReactNativeClient/lib/services/SettingUtils.js
ReactNativeClient/lib/services/synchronizer/gui/useSyncTargetUpgrade.js
ReactNativeClient/lib/services/synchronizer/LockHandler.js
ReactNativeClient/lib/services/synchronizer/MigrationHandler.js
ReactNativeClient/lib/services/synchronizer/migrations/1.js
ReactNativeClient/lib/services/synchronizer/migrations/2.js
ReactNativeClient/lib/services/synchronizer/utils/types.js
ReactNativeClient/lib/services/UndoRedoService.js
ReactNativeClient/lib/ShareExtension.js
ReactNativeClient/lib/shareHandler.js
ReactNativeClient/lib/versionInfo.js
ReactNativeClient/PluginAssetsLoader.js
ReactNativeClient/setUpQuickActions.js
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD

View File

@@ -4,9 +4,9 @@ module.exports = {
'es6': true,
'node': true,
},
"parser": "@typescript-eslint/parser",
'parser': '@typescript-eslint/parser',
'extends': ['eslint:recommended'],
"settings": {
'settings': {
'react': {
'version': '16.12',
},
@@ -37,33 +37,38 @@ module.exports = {
},
'parserOptions': {
'ecmaVersion': 2018,
"ecmaFeatures": {
"jsx": true,
},
"sourceType": "module",
'ecmaFeatures': {
'jsx': true,
},
'sourceType': 'module',
},
'rules': {
// -------------------------------
// Code correctness
// -------------------------------
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"no-unused-vars": "error",
"@typescript-eslint/no-unused-vars": "error",
"no-constant-condition": 0,
"no-prototype-builtins": 0,
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'no-unused-vars': 'error',
'@typescript-eslint/no-unused-vars': 'error',
'no-constant-condition': 0,
'no-prototype-builtins': 0,
// This error is always a false positive so far since it detects
// possible race conditions in contexts where we know it cannot happen.
"require-atomic-updates": 0,
"prefer-const": ["error"],
"no-var": ["error"],
"no-new-func": ["error"],
"import/prefer-default-export": ["error"],
"import/first": ["error"],
"no-array-constructor": ["error"],
'require-atomic-updates': 0,
'prefer-const': ['error'],
'no-var': ['error'],
'no-new-func': ['error'],
'import/prefer-default-export': ['error'],
'import/first': ['error'],
'no-array-constructor': ['error'],
'radix': ['error'],
// Warn only for now because fixing everything would take too much
// refactoring, but new code should try to stick to it.
'complexity': ['warn', { max: 10 }],
// Checks rules of Hooks
"react-hooks/rules-of-hooks": "error",
'react-hooks/rules-of-hooks': 'error',
// Checks effect dependencies
// Disable because of this: https://github.com/facebook/react/issues/16265
// "react-hooks/exhaustive-deps": "warn",
@@ -71,43 +76,49 @@ module.exports = {
// -------------------------------
// Formatting
// -------------------------------
"space-in-parens": ["error", "never"],
"space-infix-ops": ["error"],
"curly": ["error", "multi-line", "consistent"],
"semi": ["error", "always"],
"eol-last": ["error", "always"],
"quotes": ["error", "single"],
"indent": ["error", "tab"],
"comma-dangle": ["error", "always-multiline"],
"no-trailing-spaces": "error",
"linebreak-style": ["error", "unix"],
"prefer-template": ["error"],
"template-curly-spacing": ["error", "never"],
"object-curly-spacing": ["error", "always"],
"array-bracket-spacing": ["error", "never"],
"key-spacing": ["error", {
"beforeColon": false,
"afterColon": true,
"mode": "strict"
'space-in-parens': ['error', 'never'],
'space-infix-ops': ['error'],
'curly': ['error', 'multi-line', 'consistent'],
'semi': ['error', 'always'],
'eol-last': ['error', 'always'],
'quotes': ['error', 'single'],
'indent': ['error', 'tab'],
'comma-dangle': ['error', {
'arrays': 'always-multiline',
'objects': 'always-multiline',
'imports': 'always-multiline',
'exports': 'always-multiline',
'functions': 'never',
}],
"block-spacing": ["error"],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"no-spaced-func": ["error"],
"func-call-spacing": ["error"],
"space-before-function-paren": ["error", {
"anonymous": "never",
"named": "never",
"asyncArrow": "always"
'no-trailing-spaces': 'error',
'linebreak-style': ['error', 'unix'],
'prefer-template': ['error'],
'template-curly-spacing': ['error', 'never'],
'object-curly-spacing': ['error', 'always'],
'array-bracket-spacing': ['error', 'never'],
'key-spacing': ['error', {
'beforeColon': false,
'afterColon': true,
'mode': 'strict',
}],
"multiline-comment-style": ["error", "separate-lines"],
"space-before-blocks": "error",
"spaced-comment": ["error", "always"],
"keyword-spacing": ["error", { "before": true, "after": true }],
'block-spacing': ['error'],
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
'no-spaced-func': ['error'],
'func-call-spacing': ['error'],
'space-before-function-paren': ['error', {
'anonymous': 'never',
'named': 'never',
'asyncArrow': 'always',
}],
'multiline-comment-style': ['error', 'separate-lines'],
'space-before-blocks': 'error',
'spaced-comment': ['error', 'always'],
'keyword-spacing': ['error', { 'before': true, 'after': true }],
},
"plugins": [
"react",
"@typescript-eslint",
"react-hooks",
"import",
'plugins': [
'react',
'@typescript-eslint',
'react-hooks',
'import',
],
};

3
.github/stale.yml vendored
View File

@@ -1,6 +1,6 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 45
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
@@ -9,6 +9,7 @@ exemptLabels:
- "upstream"
- "backlog"
- "high"
- "spec"
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable

59
.gitignore vendored
View File

@@ -37,6 +37,7 @@ _mydocs
Assets/DownloadBadges*.psd
node_modules
Tools/github_oauth_token.txt
CliClient/tests/support/amazon-s3-auth.json
_releases
ReactNativeClient/lib/csstojs/
ReactNativeClient/lib/rnInjectedJs/
@@ -51,9 +52,43 @@ Tools/commit_hook.txt
*.map
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD
CliClient/app/LinkSelector.js
CliClient/build/LinkSelector.js
CliClient/tests/synchronizer_LockHandler.js
CliClient/tests/synchronizer_MigrationHandler.js
ElectronClient/commands/focusElement.js
ElectronClient/commands/startExternalEditing.js
ElectronClient/commands/stopExternalEditing.js
ElectronClient/global.d.js
ElectronClient/gui/ErrorBoundary.js
ElectronClient/gui/Header/commands/focusSearch.js
ElectronClient/gui/MainScreen/commands/editAlarm.js
ElectronClient/gui/MainScreen/commands/exportPdf.js
ElectronClient/gui/MainScreen/commands/hideModalMessage.js
ElectronClient/gui/MainScreen/commands/moveToFolder.js
ElectronClient/gui/MainScreen/commands/newNote.js
ElectronClient/gui/MainScreen/commands/newNotebook.js
ElectronClient/gui/MainScreen/commands/newTodo.js
ElectronClient/gui/MainScreen/commands/print.js
ElectronClient/gui/MainScreen/commands/renameFolder.js
ElectronClient/gui/MainScreen/commands/renameTag.js
ElectronClient/gui/MainScreen/commands/search.js
ElectronClient/gui/MainScreen/commands/selectTemplate.js
ElectronClient/gui/MainScreen/commands/setTags.js
ElectronClient/gui/MainScreen/commands/showModalMessage.js
ElectronClient/gui/MainScreen/commands/showNoteContentProperties.js
ElectronClient/gui/MainScreen/commands/showNoteProperties.js
ElectronClient/gui/MainScreen/commands/showShareNoteDialog.js
ElectronClient/gui/MainScreen/commands/toggleNoteList.js
ElectronClient/gui/MainScreen/commands/toggleSidebar.js
ElectronClient/gui/MainScreen/commands/toggleVisiblePanes.js
ElectronClient/gui/MultiNoteActions.js
ElectronClient/gui/NoteContentPropertiesDialog.js
ElectronClient/gui/NoteEditor/commands/editorCommandDeclarations.js
ElectronClient/gui/NoteEditor/commands/focusElementNoteBody.js
ElectronClient/gui/NoteEditor/commands/focusElementNoteTitle.js
ElectronClient/gui/NoteEditor/commands/showLocalSearch.js
ElectronClient/gui/NoteEditor/commands/showRevisions.js
ElectronClient/gui/NoteEditor/NoteBody/AceEditor/AceEditor.js
ElectronClient/gui/NoteEditor/NoteBody/AceEditor/styles/index.js
ElectronClient/gui/NoteEditor/NoteBody/AceEditor/Toolbar.js
@@ -67,6 +102,8 @@ ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/Toolbar.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/index.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/types.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useCursorUtils.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useEditorSearch.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useJoplinMode.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useLineSorting.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useListIdent.js
ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useScrollUtils.js
@@ -85,12 +122,20 @@ ElectronClient/gui/NoteEditor/utils/useMessageHandler.js
ElectronClient/gui/NoteEditor/utils/useNoteSearchBar.js
ElectronClient/gui/NoteEditor/utils/useSearchMarkers.js
ElectronClient/gui/NoteEditor/utils/useWindowCommandHandler.js
ElectronClient/gui/NoteList/commands/focusElementNoteList.js
ElectronClient/gui/NoteListItem.js
ElectronClient/gui/NoteToolbar/NoteToolbar.js
ElectronClient/gui/ResourceScreen.js
ElectronClient/gui/Root_UpgradeSyncTarget.js
ElectronClient/gui/ShareNoteDialog.js
ElectronClient/gui/SideBar/commands/focusElementSideBar.js
ReactNativeClient/lib/AsyncActionQueue.js
ReactNativeClient/lib/checkPermissions.js
ReactNativeClient/lib/commands/historyBackward.js
ReactNativeClient/lib/commands/historyForward.js
ReactNativeClient/lib/commands/synchronize.js
ReactNativeClient/lib/components/screens/UpgradeSyncTargetScreen.js
ReactNativeClient/lib/hooks/useEffectDebugger.js
ReactNativeClient/lib/hooks/useImperativeHandlerDebugger.js
ReactNativeClient/lib/hooks/usePrevious.js
ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/checkbox.js
@@ -98,18 +143,30 @@ ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/fence.js
ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/mermaid.js
ReactNativeClient/lib/joplin-renderer/MdToHtml/rules/sanitize_html.js
ReactNativeClient/lib/JoplinServerApi.js
ReactNativeClient/lib/services/CommandService.js
ReactNativeClient/lib/services/keychain/KeychainService.js
ReactNativeClient/lib/services/keychain/KeychainServiceDriver.dummy.js
ReactNativeClient/lib/services/keychain/KeychainServiceDriver.mobile.js
ReactNativeClient/lib/services/keychain/KeychainServiceDriver.node.js
ReactNativeClient/lib/services/keychain/KeychainServiceDriverBase.js
ReactNativeClient/lib/services/ResourceEditWatcher.js
ReactNativeClient/lib/services/KeymapService.js
ReactNativeClient/lib/services/ResourceEditWatcher/index.js
ReactNativeClient/lib/services/ResourceEditWatcher/reducer.js
ReactNativeClient/lib/services/rest/actionApi.desktop.js
ReactNativeClient/lib/services/rest/errors.js
ReactNativeClient/lib/services/searchengine/filterParser.js
ReactNativeClient/lib/services/searchengine/queryBuilder.js
ReactNativeClient/lib/services/SettingUtils.js
ReactNativeClient/lib/services/synchronizer/gui/useSyncTargetUpgrade.js
ReactNativeClient/lib/services/synchronizer/LockHandler.js
ReactNativeClient/lib/services/synchronizer/MigrationHandler.js
ReactNativeClient/lib/services/synchronizer/migrations/1.js
ReactNativeClient/lib/services/synchronizer/migrations/2.js
ReactNativeClient/lib/services/synchronizer/utils/types.js
ReactNativeClient/lib/services/UndoRedoService.js
ReactNativeClient/lib/ShareExtension.js
ReactNativeClient/lib/shareHandler.js
ReactNativeClient/lib/versionInfo.js
ReactNativeClient/PluginAssetsLoader.js
ReactNativeClient/setUpQuickActions.js
# AUTO-GENERATED - EXCLUDED TYPESCRIPT BUILD

View File

@@ -9,6 +9,7 @@ rvm: 2.3.3
branches:
only:
- master
- dev
- /^v\d+\.\d+(\.\d+)?(-\S*)?$/
matrix:
@@ -69,7 +70,7 @@ script:
# and that would break the desktop release.
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
cd CliClient
npm run test
npm run test-ci
testResult=$?
if [ $testResult -ne 0 ]; then
exit $testResult

View File

@@ -1,13 +1,13 @@
module.exports = {
"overrides": [
'overrides': [
{
"files": ["tests/**/*.js"],
'files': ['tests/**/*.js'],
'rules': {
// Ignore all unused function arguments, because in some
// case they are kept to indicate the function signature.
"no-unused-vars": ["error", { "argsIgnorePattern": ".*" }],
"@typescript-eslint/no-unused-vars": 0,
}
'no-unused-vars': ['error', { 'argsIgnorePattern': '.*' }],
'@typescript-eslint/no-unused-vars': 0,
},
},
],
};
};

View File

@@ -20,4 +20,6 @@ out.txt
linkToLocal.sh
yarn-error.log
tests/support/dropbox-auth.txt
tests/support/nextcloud-auth.json
tests/support/onedrive-auth.txt
build/

View File

@@ -0,0 +1,134 @@
const open = require('open');
interface LinkStoreEntry {
link: string;
noteX: number;
noteY: number;
}
class LinkSelector {
noteId_: string;
scrollTop_: number;
renderedText_: string;
currentLinkIndex_: number;
linkStore_: LinkStoreEntry[];
linkRegex_: RegExp;
constructor() {
this.noteId_ = null;
this.scrollTop_ = null; // used so 'o' won't open unhighlighted link after scrolling
this.renderedText_ = null;
this.currentLinkIndex_ = null;
this.linkStore_ = null;
this.linkRegex_ = /http:\/\/[0-9.]+:[0-9]+\/[0-9]+/g;
}
get link(): string | null {
if (this.currentLinkIndex_ === null) return null;
return this.linkStore_[this.currentLinkIndex_].link;
}
get noteX(): number | null {
if (this.currentLinkIndex_ === null) return null;
return this.linkStore_[this.currentLinkIndex_].noteX;
}
get noteY(): number | null {
if (this.currentLinkIndex_ === null) return null;
return this.linkStore_[this.currentLinkIndex_].noteY;
}
findLinks(renderedText: string): LinkStoreEntry[] {
const newLinkStore: LinkStoreEntry[] = [];
const lines: string[] = renderedText.split('\n');
for (let i = 0; i < lines.length; i++) {
const matches = [...lines[i].matchAll(this.linkRegex_)];
matches.forEach((_e, n) => {
newLinkStore.push(
{
link: matches[n][0],
noteX: matches[n].index,
noteY: i,
}
);
});
}
return newLinkStore;
}
updateText(renderedText: string): void {
this.currentLinkIndex_ = null;
this.renderedText_ = renderedText;
this.linkStore_ = this.findLinks(this.renderedText_);
}
updateNote(textWidget: any): void {
this.noteId_ = textWidget.noteId;
this.scrollTop_ = textWidget.scrollTop_;
this.updateText(textWidget.renderedText_);
}
scrollWidget(textWidget: any): void {
if (this.currentLinkIndex_ === null) return;
const noteY = this.linkStore_[this.currentLinkIndex_].noteY;
let viewBoxMin = textWidget.scrollTop_ + 1;
let viewBoxMax = viewBoxMin + textWidget.innerHeight - 2;
if (noteY < viewBoxMin) {
for (; noteY < viewBoxMin; textWidget.pageUp()) {
viewBoxMin = textWidget.scrollTop_;
viewBoxMax = viewBoxMin + textWidget.innerHeight;
}
return;
} else if (noteY > viewBoxMax) {
for (; noteY > viewBoxMax; textWidget.pageDown()) {
viewBoxMin = textWidget.scrollTop_;
viewBoxMax = viewBoxMin + textWidget.innerHeight;
}
return;
}
return;
}
changeLink(textWidget: any, offset: number): void | null {
if (textWidget.noteId !== this.noteId_) {
this.updateNote(textWidget);
this.changeLink(textWidget, offset);
return;
}
if (textWidget.renderedText_ !== this.renderedText_) {
this.updateText(textWidget.renderedText_);
this.changeLink(textWidget, offset);
return;
}
if (textWidget.scrollTop_ !== this.scrollTop_) this.scrollTop_ = textWidget.scrollTop_;
if (!this.linkStore_.length) return null;
let offsetMod = (offset + this.currentLinkIndex_) % this.linkStore_.length;
if (this.currentLinkIndex_ === null) {
if (offsetMod < 0) this.currentLinkIndex_ = this.linkStore_.length + offsetMod;
else if (!offsetMod) this.currentLinkIndex_ = 0;
else this.currentLinkIndex_ = offsetMod - 1;
return;
}
if (offsetMod < 0) offsetMod = this.linkStore_.length + offsetMod;
this.currentLinkIndex_ = offsetMod;
return;
}
openLink(textWidget: any): void {
if (textWidget.noteId !== this.noteId_) return;
if (textWidget.renderedText_ !== this.renderedText_) return;
if (textWidget.scrollTop_ !== this.scrollTop_) return;
open(this.linkStore_[this.currentLinkIndex_].link);
}
}
export default LinkSelector;

View File

@@ -33,6 +33,8 @@ const FolderListWidget = require('./gui/FolderListWidget.js');
const NoteListWidget = require('./gui/NoteListWidget.js');
const StatusBarWidget = require('./gui/StatusBarWidget.js');
const ConsoleWidget = require('./gui/ConsoleWidget.js');
const LinkSelector = require('./LinkSelector.js').default;
class AppGui {
constructor(app, store, keymap) {
@@ -74,6 +76,8 @@ class AppGui {
this.currentShortcutKeys_ = [];
this.lastShortcutKeyTime_ = 0;
this.linkSelector_ = new LinkSelector();
// Recurrent sync is setup only when the GUI is started. In
// a regular command it's not necessary since the process
// exits right away.
@@ -455,6 +459,30 @@ class AppGui {
} else {
this.stdout(_('Please select the note or notebook to be deleted first.'));
}
} else if (cmd === 'next_link' || cmd === 'previous_link') {
const noteText = this.widget('noteText');
noteText.render();
if (cmd === 'next_link') this.linkSelector_.changeLink(noteText, 1);
else this.linkSelector_.changeLink(noteText, -1);
this.linkSelector_.scrollWidget(noteText);
const cursorOffsetX = this.widget('mainWindow').width - noteText.innerWidth - 8;
const cursorOffsetY = 1 - noteText.scrollTop_;
if (this.linkSelector_.link) {
this.term_.moveTo(
this.linkSelector_.noteX + cursorOffsetX,
this.linkSelector_.noteY + cursorOffsetY
);
setTimeout(() => this.term_.term().inverse(this.linkSelector_.link), 50);
}
} else if (cmd === 'open_link') {
if (this.widget('noteText').hasFocus) {
this.linkSelector_.openLink(this.widget('noteText'));
}
} else if (cmd === 'toggle_console') {
if (!this.consoleIsShown()) {
this.showConsole();

View File

@@ -324,6 +324,9 @@ class Application extends BaseApplication {
{ keys: ['PAGE_DOWN'], type: 'function', command: 'page_down' },
{ keys: ['ENTER'], type: 'function', command: 'activate' },
{ keys: ['DELETE', 'BACKSPACE'], type: 'function', command: 'delete' },
{ keys: ['n'], type: 'function', command: 'next_link' },
{ keys: ['b'], type: 'function', command: 'previous_link' },
{ keys: ['o'], type: 'function', command: 'open_link' },
{ keys: [' '], command: 'todo toggle $n' },
{ keys: ['tc'], type: 'function', command: 'toggle_console' },
{ keys: ['tm'], type: 'function', command: 'toggle_metadata' },

View File

@@ -2,6 +2,7 @@ const yargParser = require('yargs-parser');
const { _ } = require('lib/locale.js');
const { time } = require('lib/time-utils.js');
const stringPadding = require('string-padding');
const { Logger } = require('lib/logger.js');
const cliUtils = {};
@@ -245,4 +246,17 @@ cliUtils.redrawDone = function() {
redrawStarted_ = false;
};
cliUtils.stdoutLogger = function(stdout) {
const stdoutFn = (...s) => stdout(s.join(' '));
const logger = new Logger();
logger.addTarget('console', { console: {
info: stdoutFn,
warn: stdoutFn,
error: stdoutFn,
} });
return logger;
};
module.exports = { cliUtils };

View File

@@ -18,7 +18,8 @@ class Command extends BaseCommand {
const command = args.command;
const ClipperServer = require('lib/ClipperServer');
const stdoutFn = (s) => this.stdout(s);
ClipperServer.instance().initialize();
const stdoutFn = (...s) => this.stdout(s.join(' '));
const clipperLogger = new Logger();
clipperLogger.addTarget('file', { path: `${Setting.value('profileDir')}/log-clipper.txt` });
clipperLogger.addTarget('console', { console: {

View File

@@ -11,6 +11,7 @@ const md5 = require('md5');
const locker = require('proper-lockfile');
const fs = require('fs-extra');
const SyncTargetRegistry = require('lib/SyncTargetRegistry');
const MigrationHandler = require('lib/services/synchronizer/MigrationHandler').default;
class Command extends BaseCommand {
constructor() {
@@ -29,7 +30,10 @@ class Command extends BaseCommand {
}
options() {
return [['--target <target>', _('Sync to provided target (defaults to sync.target config value)')]];
return [
['--target <target>', _('Sync to provided target (defaults to sync.target config value)')],
['--upgrade', _('Upgrade the sync target to the latest version.')],
];
}
static lockFile(filePath) {
@@ -148,12 +152,8 @@ class Command extends BaseCommand {
const syncTarget = reg.syncTarget(this.syncTargetId_);
if (!(await syncTarget.isAuthenticated())) {
app()
.gui()
.showConsole();
app()
.gui()
.maximizeConsole();
app().gui().showConsole();
app().gui().maximizeConsole();
const authDone = await this.doAuth();
if (!authDone) return cleanUp();
@@ -176,6 +176,34 @@ class Command extends BaseCommand {
if (!sync) throw new Error(_('Cannot initialise synchroniser.'));
if (args.options.upgrade) {
let migrationError = null;
try {
const migrationHandler = new MigrationHandler(
sync.api(),
sync.lockHandler(),
Setting.value('appType'),
Setting.value('clientId')
);
migrationHandler.setLogger(cliUtils.stdoutLogger(this.stdout.bind(this)));
await migrationHandler.upgrade();
} catch (error) {
migrationError = error;
}
if (!migrationError) {
Setting.setValue('sync.upgradeState', Setting.SYNC_UPGRADE_STATE_IDLE);
await Setting.saveAll();
}
if (migrationError) throw migrationError;
return cleanUp();
}
this.stdout(_('Starting synchronisation...'));
const contextKey = `sync.${this.syncTargetId_}.context`;
@@ -210,6 +238,12 @@ class Command extends BaseCommand {
throw error;
}
if (Setting.value('sync.upgradeState') > Setting.SYNC_UPGRADE_STATE_IDLE) {
this.stdout(`/!\\ ${_('Sync target must be upgraded! Run `%s` to proceed.', 'sync --upgrade')}`);
app().gui().showConsole();
app().gui().maximizeConsole();
}
cleanUp();
}

View File

@@ -4,9 +4,10 @@ const utils = require('../Tools/gulp/utils');
const tasks = {
copyLib: require('../Tools/gulp/tasks/copyLib'),
tsc: require('../Tools/gulp/tasks/tsc'),
updateIgnoredTypeScriptBuild: require('../Tools/gulp/tasks/updateIgnoredTypeScriptBuild'),
};
tasks.build = {
tasks.prepareBuild = {
fn: async () => {
const buildDir = `${__dirname}/build`;
await utils.copyDir(`${__dirname}/app`, buildDir, {
@@ -28,7 +29,7 @@ tasks.build = {
},
};
tasks.buildTests = {
tasks.prepareTestBuild = {
fn: async () => {
const testBuildDir = `${__dirname}/tests-build`;
@@ -37,6 +38,8 @@ tasks.buildTests = {
'lib/',
'locales/',
'node_modules/',
'*.ts',
'*.tsx',
],
});
@@ -46,16 +49,14 @@ tasks.buildTests = {
},
};
const buildTestSeries = [
tasks.buildTests.fn,
];
utils.registerGulpTasks(gulp, tasks);
if (require('os').platform() === 'win32') {
gulp.task('copyLib', tasks.copyLib.fn);
gulp.task('tsc', tasks.tsc.fn);
buildTestSeries.push('copyLib');
buildTestSeries.push('tsc');
}
gulp.task('build', gulp.series([
'prepareBuild',
'copyLib',
]));
gulp.task('build', tasks.build.fn);
gulp.task('buildTests', gulp.series(...buildTestSeries));
gulp.task('buildTests', gulp.series([
'prepareTestBuild',
'copyLib',
]));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -38,42 +38,42 @@ locales['tr_TR'] = require('./tr_TR.json');
locales['vi'] = require('./vi.json');
locales['zh_CN'] = require('./zh_CN.json');
locales['zh_TW'] = require('./zh_TW.json');
stats['ar'] = {"percentDone":83};
stats['ar'] = {"percentDone":82};
stats['eu'] = {"percentDone":35};
stats['bs_BA'] = {"percentDone":87};
stats['bg_BG'] = {"percentDone":69};
stats['ca'] = {"percentDone":55};
stats['hr_HR'] = {"percentDone":29};
stats['cs_CZ'] = {"percentDone":86};
stats['da_DK'] = {"percentDone":77};
stats['de_DE'] = {"percentDone":97};
stats['et_EE'] = {"percentDone":69};
stats['bs_BA'] = {"percentDone":85};
stats['bg_BG'] = {"percentDone":68};
stats['ca'] = {"percentDone":54};
stats['hr_HR'] = {"percentDone":28};
stats['cs_CZ'] = {"percentDone":84};
stats['da_DK'] = {"percentDone":76};
stats['de_DE'] = {"percentDone":99};
stats['et_EE'] = {"percentDone":68};
stats['en_GB'] = {"percentDone":100};
stats['en_US'] = {"percentDone":100};
stats['es_ES'] = {"percentDone":93};
stats['eo'] = {"percentDone":40};
stats['fr_FR'] = {"percentDone":98};
stats['gl_ES'] = {"percentDone":45};
stats['id_ID'] = {"percentDone":97};
stats['it_IT'] = {"percentDone":94};
stats['nl_NL'] = {"percentDone":88};
stats['es_ES'] = {"percentDone":91};
stats['eo'] = {"percentDone":39};
stats['fr_FR'] = {"percentDone":97};
stats['gl_ES'] = {"percentDone":44};
stats['id_ID'] = {"percentDone":95};
stats['it_IT'] = {"percentDone":93};
stats['nl_NL'] = {"percentDone":99};
stats['nl_BE'] = {"percentDone":35};
stats['nb_NO'] = {"percentDone":92};
stats['fa'] = {"percentDone":35};
stats['pl_PL'] = {"percentDone":88};
stats['pt_PT'] = {"percentDone":92};
stats['pt_BR'] = {"percentDone":99};
stats['nb_NO'] = {"percentDone":91};
stats['fa'] = {"percentDone":34};
stats['pl_PL'] = {"percentDone":87};
stats['pt_PT'] = {"percentDone":91};
stats['pt_BR'] = {"percentDone":98};
stats['ro'] = {"percentDone":35};
stats['sl_SI'] = {"percentDone":44};
stats['sv'] = {"percentDone":74};
stats['th_TH'] = {"percentDone":55};
stats['vi'] = {"percentDone":89};
stats['tr_TR'] = {"percentDone":98};
stats['el_GR'] = {"percentDone":94};
stats['ru_RU'] = {"percentDone":92};
stats['sr_RS'] = {"percentDone":75};
stats['zh_CN'] = {"percentDone":97};
stats['zh_TW'] = {"percentDone":93};
stats['ja_JP'] = {"percentDone":97};
stats['ko'] = {"percentDone":90};
stats['sv'] = {"percentDone":73};
stats['th_TH'] = {"percentDone":54};
stats['vi'] = {"percentDone":88};
stats['tr_TR'] = {"percentDone":99};
stats['el_GR'] = {"percentDone":93};
stats['ru_RU'] = {"percentDone":90};
stats['sr_RS'] = {"percentDone":74};
stats['zh_CN'] = {"percentDone":99};
stats['zh_TW'] = {"percentDone":98};
stats['ja_JP'] = {"percentDone":99};
stats['ko'] = {"percentDone":89};
module.exports = { locales: locales, stats: stats };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,8 @@
"license": "MIT",
"author": "Laurent Cozic",
"scripts": {
"test": "gulp buildTests -L && node node_modules/jasmine/bin/jasmine.js --config=tests/support/jasmine.json",
"test": "gulp buildTests -L && node node_modules/jasmine/bin/jasmine.js --fail-fast=true --config=tests/support/jasmine.json",
"test-ci": "gulp buildTests -L && node node_modules/jasmine/bin/jasmine.js --config=tests/support/jasmine.json",
"postinstall": "npm run build && patch-package --patch-dir ../patches",
"build": "gulp build",
"start": "gulp build -L && node 'build/main.js' --stack-trace-enabled --log-level debug --env dev"
@@ -27,7 +28,7 @@
],
"owner": "Laurent Cozic"
},
"version": "1.0.164",
"version": "1.0.166",
"bin": {
"joplin": "./main.js"
},
@@ -37,6 +38,7 @@
"dependencies": {
"app-module-path": "^2.2.0",
"async-mutex": "^0.1.3",
"aws-sdk": "^2.588.0",
"base-64": "^0.1.0",
"base64-stream": "^1.0.0",
"clean-html": "^1.5.0",
@@ -55,11 +57,11 @@
"htmlparser2": "^4.1.0",
"image-data-uri": "^2.0.0",
"image-type": "^3.0.0",
"joplin-turndown": "^4.0.28",
"joplin-turndown": "^4.0.29",
"joplin-turndown-plugin-gfm": "^1.0.12",
"json-stringify-safe": "^5.0.1",
"jssha": "^2.3.0",
"katex": "^0.11.1",
"katex": "^0.12.0",
"keytar": "^5.4.0",
"levenshtein": "^1.0.5",
"markdown-it": "^10.0.0",
@@ -84,14 +86,14 @@
"node-emoji": "^1.8.1",
"node-fetch": "^1.7.1",
"node-persist": "^2.1.0",
"patch-package": "^6.2.0",
"open": "^7.0.4",
"patch-package": "^6.2.2",
"promise": "^7.1.1",
"proper-lockfile": "^2.0.1",
"query-string": "4.3.4",
"read-chunk": "^2.1.0",
"redux": "^3.7.2",
"relative": "^3.0.2",
"remove-markdown": "^0.3.0",
"request": "^2.88.0",
"sax": "^1.2.4",
"server-destroy": "^1.0.1",

View File

@@ -4,8 +4,6 @@ const { asyncTest, setupDatabaseAndSynchronizer, switchClient } = require('test-
const { shim } = require('lib/shim');
const { enexXmlToHtml } = require('lib/import-enex-html-gen.js');
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60 * 60 * 1000; // Can run for a while since everything is in the same test unit
process.on('unhandledRejection', (reason, p) => {
console.warn('Unhandled Rejection at: Promise', p, 'reason:', reason);
});

View File

@@ -12,8 +12,6 @@ const BaseModel = require('lib/BaseModel.js');
const { shim } = require('lib/shim');
const { enexXmlToMd } = require('lib/import-enex-md-gen.js');
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60 * 60 * 1000; // Can run for a while since everything is in the same test unit
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
});

View File

@@ -13,8 +13,6 @@ const { shim } = require('lib/shim');
const HtmlToHtml = require('lib/joplin-renderer/HtmlToHtml');
const { enexXmlToMd } = require('lib/import-enex-md-gen.js');
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60 * 60 * 1000; // Can run for a while since everything is in the same test unit
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
});

View File

@@ -13,8 +13,6 @@ const { shim } = require('lib/shim');
const HtmlToMd = require('lib/HtmlToMd');
const { enexXmlToMd } = require('lib/import-enex-md-gen.js');
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60 * 60 * 1000; // Can run for a while since everything is in the same test unit
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
});

View File

@@ -0,0 +1,45 @@
require('app-module-path').addPath(__dirname);
const { asyncTest } = require('test-utils.js');
const MarkupToHtml = require('lib/joplin-renderer/MarkupToHtml');
describe('MarkupToHtml', function() {
it('should strip markup', asyncTest(async () => {
const service = new MarkupToHtml();
const testCases = {
[MarkupToHtml.MARKUP_LANGUAGE_MARKDOWN]: [
['', ''],
['## hello', 'hello'],
['## hello **hello!**', 'hello hello!'],
['*hi!*', 'hi!'],
['Some `code` here', 'Some code here'],
['Some <s>html</s> here', 'Some html here'],
['Some &amp; here', 'Some & here'],
['Some & here', 'Some & here'],
['[![image alt](:/fe9ea7fa727e4375b2e7d8a1b873314d)](https://example.com)', ''],
],
[MarkupToHtml.MARKUP_LANGUAGE_HTML]: [
['<h1>hello</h1>', 'hello'],
['Some <b>strong</b> text', 'Some strong text'],
['<b>M&amp;Ms</b>', 'M&Ms'],
['<style>BODY{margin:0;padding:0;background:#f0f0f0}</style>', ''],
],
};
for (const markup in testCases) {
for (const t of testCases[markup]) {
const input = t[0];
const expected = t[1];
const actual = service.stripMarkup(Number(markup), input);
expect(actual).toBe(expected, `Markup: ${markup}`);
}
}
expect(service.stripMarkup(1, 'one line\n\ntwo line', { collapseWhiteSpaces: true })).toBe('one line two line');
expect(service.stripMarkup(1, 'one line two line', { collapseWhiteSpaces: true })).toBe('one line two line');
expect(service.stripMarkup(1, 'one line\n two line', { collapseWhiteSpaces: true })).toBe('one line two line');
}));
});

View File

@@ -14,8 +14,6 @@ const MdToHtml = require('lib/joplin-renderer/MdToHtml');
const { enexXmlToMd } = require('lib/import-enex-md-gen.js');
const { themeStyle } = require('lib/theme');
jasmine.DEFAULT_TIMEOUT_INTERVAL = 60 * 60 * 1000; // Can run for a while since everything is in the same test unit
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
});
@@ -140,7 +138,7 @@ describe('MdToHtml', function() {
// The style is instead in the cssStrings property.
const result = await mdToHtml.render('just **testing**', null, { bodyOnly: true });
expect(result.cssStrings.length).toBe(1);
expect(result.html.trim()).toBe('<p>just <strong>testing</strong></p>');
expect(result.html.trim()).toBe('just <strong>testing</strong>');
}));
it('should split HTML and CSS', asyncTest(async () => {

View File

@@ -0,0 +1,135 @@
/* eslint-disable no-unused-vars */
require('app-module-path').addPath(__dirname);
const { uuid } = require('lib/uuid.js');
const { time } = require('lib/time-utils.js');
const { asyncTest, sleep, fileApi, fileContentEqual, checkThrowAsync } = require('test-utils.js');
const { shim } = require('lib/shim.js');
const fs = require('fs-extra');
const Setting = require('lib/models/Setting.js');
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
});
const api = null;
// NOTE: These tests work with S3 and memory driver, but not
// with other targets like file system or Nextcloud.
// All this is tested in an indirect way in tests/synchronizer
// anyway.
// We keep the file here as it could be useful as a spec for
// what calls a sync target should support, but it would
// need to be fixed first.
// To test out an FileApi implementation:
// * add a SyncTarget for your driver in `test-utils.js`
// * set `syncTargetId_` to your New SyncTarget:
// `const syncTargetId_ = SyncTargetRegistry.nameToId('memory');`
// describe('fileApi', function() {
// beforeEach(async (done) => {
// api = new fileApi();
// api.clearRoot();
// done();
// });
// describe('list', function() {
// it('should return items with relative path', asyncTest(async () => {
// await api.mkdir('.subfolder');
// await api.put('1', 'something on root 1');
// await api.put('.subfolder/1', 'something subfolder 1');
// await api.put('.subfolder/2', 'something subfolder 2');
// await api.put('.subfolder/3', 'something subfolder 3');
// sleep(0.8);
// const response = await api.list('.subfolder');
// const items = response.items;
// expect(items.length).toBe(3);
// expect(items[0].path).toBe('1');
// expect(items[0].updated_time).toMatch(/^\d+$/); // make sure it's using epoch timestamp
// }));
// it('should default to only files on root directory', asyncTest(async () => {
// await api.mkdir('.subfolder');
// await api.put('.subfolder/1', 'something subfolder 1');
// await api.put('file1', 'something 1');
// await api.put('file2', 'something 2');
// sleep(0.6);
// const response = await api.list();
// expect(response.items.length).toBe(2);
// }));
// }); // list
// describe('delete', function() {
// it('should not error if file does not exist', asyncTest(async () => {
// const hasThrown = await checkThrowAsync(async () => await api.delete('nonexistant_file'));
// expect(hasThrown).toBe(false);
// }));
// it('should delete specific file given full path', asyncTest(async () => {
// await api.mkdir('deleteDir');
// await api.put('deleteDir/1', 'something 1');
// await api.put('deleteDir/2', 'something 2');
// sleep(0.4);
// await api.delete('deleteDir/1');
// let response = await api.list('deleteDir');
// expect(response.items.length).toBe(1);
// response = await api.list('deleteDir/1');
// expect(response.items.length).toBe(0);
// }));
// }); // delete
// describe('get', function() {
// it('should return null if object does not exist', asyncTest(async () => {
// const response = await api.get('nonexistant_file');
// expect(response).toBe(null);
// }));
// it('should return UTF-8 encoded string by default', asyncTest(async () => {
// await api.put('testnote.md', 'something 2');
// const response = await api.get('testnote.md');
// expect(response).toBe('something 2');
// }));
// it('should return a Response object and writes file to options.path, if options.target is "file"', asyncTest(async () => {
// const localFilePath = `${Setting.value('tempDir')}/${uuid.create()}.md`;
// await api.put('testnote.md', 'something 2');
// sleep(0.2);
// const response = await api.get('testnote.md', { target: 'file', path: localFilePath });
// expect(typeof response).toBe('object');
// // expect(response.path).toBe(localFilePath);
// expect(fs.existsSync(localFilePath)).toBe(true);
// expect(fs.readFileSync(localFilePath, 'utf8')).toBe('something 2');
// }));
// }); // get
// describe('put', function() {
// it('should create file to remote path and content', asyncTest(async () => {
// await api.put('putTest.md', 'I am your content');
// sleep(0.2);
// const response = await api.get('putTest.md');
// expect(response).toBe('I am your content');
// }));
// it('should upload file in options.path to remote path, if options.source is "file"', asyncTest(async () => {
// const localFilePath = `${Setting.value('tempDir')}/${uuid.create()}.md`;
// fs.writeFileSync(localFilePath, 'I am the local file.');
// await api.put('testfile', 'ignore me', { source: 'file', path: localFilePath });
// sleep(0.2);
// const response = await api.get('testfile');
// expect(response).toBe('I am the local file.');
// }));
// }); // put
// });

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