Commit graph

8704 commits

Author SHA1 Message Date
Damien Elmes
5d7eb8c425 update to latest rules_nodejs & switch to ts_project
ts_library() is deprecated and will presumably be dropped from a
future rules_nodejs, and it wasn't working with the jest tests
after updating, so we switch over to ts_project().

There are some downsides:

- It's a bit slower, as the worker mode doesn't appear to function
at the moment.
- Getting it working with a mix of source files and generated files
was quite tricky, especially as things behave differently on Windows,
and differently when editing with VS Code. Solved with a small patch
to the rules, and a wrapper script that copies everything into the
bin folder first. To keep VS Code working correctly as well, the built
files are symlinked into the source folder.
- TS libraries are not implicitly linked to node_modules, so they
can't be imported with an absolute name like "lib/proto" - we need
to use relative paths like "../lib/proto" instead. Adjusting "paths"
in tsconfig.json makes it work for TS compilation, but then it fails
at the esbuild stage. We could resolve it by wrapping the TS
libraries in a subsequent js_library() call, but that has the downside
of losing the transient dependencies, meaning they need to be listed
again.  Alternatively we might be able to solve it in the future by
adjusting esbuild, but for now the paths have been made relative to
keep things simple.

Upsides:

- Along with updates to the Svelte tooling, Svelte typing has improved.
All exports made in a Svelte file are now visible to other files that
import them, and we no longer rebuild the Svelte files when TS files
are updated, as the Svelte files do no type checking themselves, and
are just a simple transpilation. Svelte-check now works on Windows again,
and there should be no errors when editing in VS Code after you've
built the project. The only downside seems to be that cmd+clicking
on a Svelte imports jumps to the .d.ts file instead of the original now;
presumably they'll fix that in a future plugin update.
- Each subfolder now has its own tsconfig.json, and tsc can be called
directly for testing purposes (but beware it will place build products
in the source tree): ts/node_modules/.bin/tsc -b ts
- We can drop the custom esbuild_toolchain, as it's included in the
latest rules_nodejs.

Other changes:

- "image_module_support" is moved into lib/, and imported with
<reference types=...>
- Images are now imported directly from their npm package; the
extra copy step has been removed.

Windows users may need to use "bazel clean" before building this,
due to old files lying around in the build folder.
2021-10-01 12:52:53 +10:00
Damien Elmes
c7f4d30e7f fix uncaught error when int over 64 bits passed into db_command() 2021-09-30 16:46:33 +10:00
Damien Elmes
7ce0b944bd update svelte-check
Invoking from scripts/svelte-check is currently broken due to sass
imports - it appears to have been broken some time back.
2021-09-29 12:27:27 +10:00
Damien Elmes
899d0556e8 handle changed aria-expanded typing 2021-09-29 12:20:27 +10:00
Damien Elmes
6db52323dd make 'for' argument optional in TooltipLabel
The latest svelte-check has revealed we were not passing 'for' in
when we should have been. This is a quick hack to get the tests passing
again, but a better approach that actually makes this accessible again
would be good in the future.
2021-09-29 12:20:03 +10:00
Damien Elmes
9b994ac537 silence execCommand deprecation warnings for now 2021-09-29 11:36:37 +10:00
Damien Elmes
b1e7a25623 Revert "Revert "Merge pull request #1364 from evandroforks/fix_unclosed_python_file""
This reverts commit a2ac197fd7.

Looks like it wasn't the cause of the previously reported problem:

https://forums.ankiweb.net/t/2-1-48-tts-problem/13587/2
2021-09-27 18:43:16 +10:00
Damien Elmes
04a620ff1a Merge pull request #1382 from RumovZ/tags-from-sidebar
Tags from sidebar
2021-09-27 18:41:32 +10:00
Damien Elmes
c3c51af7a9 Merge pull request #1388 from lolilolicon/patch-1
Quote $PREFIX properly for paths with spaces
2021-09-27 18:39:25 +10:00
Damien Elmes
da1f890115 Merge pull request #1391 from sobjornstad/change_note_type_hook
Add hook for selecting a new note type in the add window
2021-09-27 18:38:40 +10:00
Soren Bjornstad
834118ce8a Add hook after selecting a new note type in the add window 2021-09-24 21:54:33 -05:00
Damien Elmes
5d0736ab96 update svelte2tsx
We can now use the typings from the Svelte library instead of the
svelte2tsx shims
2021-09-25 11:07:31 +10:00
lolilolicon
739d3d3cb5 Update CONTRIBUTORS 2021-09-24 13:46:01 +00:00
lolilolicon
1120e6d644 Quote $PREFIX properly for paths with spaces 2021-09-23 01:24:52 +00:00
lolilolicon
ad9497aaf7 Quote $PREFIX properly for paths with spaces 2021-09-23 01:20:53 +00:00
Damien Elmes
8f7e7498da update to TypeScript 4.4.x 2021-09-23 09:53:37 +10:00
Damien Elmes
81104f47f4 fixes for TypeScript 4.4.x
closes #1386
2021-09-23 09:52:21 +10:00
RumovZ
b42379bf96 Apply suggestions from code review
Capitalise "selected"

Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
2021-09-22 16:59:05 +02:00
Damien Elmes
df26c61164 update ts deps
typescript and bootstrap have been pinned for now:

https://github.com/ankitects/anki/issues/1386
https://github.com/ankitects/anki/issues/1385

hint failures for svelte-check have also been temporarily turned
off, due to it now complaining about document.execCommand():

Hint: The signature '(commandId: string, showUI?: boolean, value?: string): boolean' of 'document.execCommand' is deprecated. (ts)
    const wrapWithForecolor = (color: string) => () => {
        document.execCommand("forecolor", false, color);
    };

Will follow up in #1377
2021-09-22 23:21:39 +10:00
Damien Elmes
2bd8704554 add SECURITY.md 2021-09-22 22:55:19 +10:00
Damien Elmes
6f8fddffd6 Merge pull request #1384 from hikaru-y/fix-previewer-memory-leak
Fix memory leak in previewer
2021-09-22 21:45:14 +10:00
hikaru-y
6e196e43fd Fix memory leak in previewer
Related thread:
https://forums.ankiweb.net/t/high-memory-usage-over-time-on-2-1-44/13544/
2021-09-22 17:21:08 +09:00
RumovZ
dcb7d44ce4 Enable adding/removing tags from the sidebar ...
... to selected notes.
2021-09-21 11:48:43 +02:00
Damien Elmes
016443cc88 Merge pull request #1376 from hgiesel/mathjaxcleanupv2
Mathjax Cleanup
2021-09-21 18:39:27 +10:00
Damien Elmes
54ec174453 Merge pull request #1375 from RumovZ/disable-actions
Disable unusable browser actions on row change
2021-09-21 18:38:30 +10:00
Damien Elmes
2b1ba8f039 bump version 2021-09-21 16:30:15 +10:00
Damien Elmes
888f02a0f6 Merge pull request #1379 from BlueGreenMagick/dont-fill-empty-on-add-cards
set CardLayout fill_empty=False for add cards editor
2021-09-21 15:08:54 +10:00
Damien Elmes
2695cb64ff add hidden option to disable tooltips in browse screen
https://forums.ankiweb.net/t/browser-text-pop-up-when-hovering-over-card-poll/13254
2021-09-21 15:03:37 +10:00
Damien Elmes
916ff49efe temporary fix for error on deleting (#1374) 2021-09-20 22:02:44 +10:00
Damien Elmes
8dde10e83a add startup message about forcing Wayland 2021-09-20 21:42:16 +10:00
Damien Elmes
c0abcdf647 Revert "Merge pull request #1364 from evandroforks/fix_unclosed_python_file"
This reverts commit c05475a49e.

Revert "possible fix for reported audio issues"

This reverts commit e53192a079.

Reverting in case https://forums.ankiweb.net/t/2-1-48-release-candidate/13268/10
is related to this change. If the issue persists, we'll know this was
not the cause.
2021-09-20 21:39:15 +10:00
bluegreenmagick
1a9e0ec1a0 set CardLayout fill_empty=False for add cards editor
Card layout view functions as a previewer in add cards dialog
so displaying accurately is more important than having placeholders.
Especially for card layouts using conditional-not fields {{^Field}}
card layout is rendered badly.
2021-09-20 18:34:49 +09:00
RumovZ
64fd90d633 Simplify sidebar context menu separators
Qt can collapse consecutive menu separators, so no need to check if a
subroutine has actually added any actions to the menu.
2021-09-19 18:33:36 +02:00
Henrik Giesel
66608b06b0 Allow for explicit any 2021-09-17 21:30:32 +02:00
Henrik Giesel
16b6d95593 Make HandleSelection perfectly size when first activating 2021-09-17 21:23:04 +02:00
Henrik Giesel
1e2fa82446 Fix missizing of HandleSelection when first moving from empty to Mathjax 2021-09-17 20:54:37 +02:00
Henrik Giesel
82d93f3eae Ugly fix: do not execute moveCursorPastPostfix when front includes "anki-mathjax" 2021-09-17 20:12:11 +02:00
RumovZ
8fd0e89a5a Disable unusable browser actions on row change 2021-09-17 16:16:34 +02:00
Henrik Giesel
222da3912a Add ChangeTimer.prototype.fireImmediately
so Mathjax is saved when exiting editor prematurely
2021-09-16 14:47:05 +02:00
Henrik Giesel
159e932f79 Wrap Mathjax compilation into try/catch 2021-09-16 14:31:20 +02:00
Damien Elmes
e53192a079 possible fix for reported audio issues
https://forums.ankiweb.net/t/2-1-48-release-candidate/13268/6

This is the only area of the sound code that has changed since 2.1.47
2021-09-16 10:27:37 +10:00
Damien Elmes
b423846e3e Merge pull request #1324 from hgiesel/mathjaxboxv4
MathJax Preview + In-line editor
2021-09-16 10:27:08 +10:00
Henrik Giesel
4b0e35a357 Rename StickyBar and StickyBottom to StickyHeader and StickyFooter 2021-09-15 23:15:55 +02:00
Henrik Giesel
9f500cf78a Remove now unused import in TagEditor 2021-09-15 22:59:47 +02:00
Henrik Giesel
d6702c1c68 Fix suggestions not showing when typing space in a TagInput 2021-09-15 22:54:53 +02:00
Henrik Giesel
84eda7c547 Make the ImageHandle and MathjaxHandle dropdowns perfectly touch the HandleSelection 2021-09-15 22:26:32 +02:00
Henrik Giesel
f4aa6bf90b Stop propagation for paste in MathjaxHandle editor 2021-09-15 22:14:38 +02:00
Henrik Giesel
dbaba6233a Prevent hiding handles by clicking on handles 2021-09-15 17:56:56 +02:00
Henrik Giesel
d4c535183b Remove style attribute after remove float property if not styling left 2021-09-15 17:36:48 +02:00
Henrik Giesel
e10a5f0a38 Always correctly update MathjaxHandle position 2021-09-15 17:05:43 +02:00