Commit Graph

127 Commits

Author SHA1 Message Date
Damien Elmes
b1f4ea562a remove the default question fade
Fading was primarily motivated by wanting to prevent ugly redraw,
but we wait for both MathJax and images now.
2021-03-22 12:11:00 +10:00
Damien Elmes
c3145977f0 delay scrolling to answer until images load 2021-03-22 12:05:18 +10:00
Damien Elmes
7d8f19e6e4 merge in Henrik's TS/Svelte refactor with some changes
- The previous commits moved the majority of the remaining global css
into components; move the remaining @emotion/css references into
ticks.scss and the styling of the Graph.svelte. This is not as elegant
as the emotion solution, but builds a whole lot faster, and most of
our styling can be scoped to a component anyway.
- Leave the .html files in ts/ for now. AnkiMobile uses them, and
AnkiDroid likely will in the future too. In the long run we'll likely
move to loading the JS into an existing page instead of loading a
separate page, but at that point we can just exclude the .html file from
copy_files_into_group() without affecting other clients.

Closes #1074
2021-03-21 23:01:18 +10:00
Damien Elmes
a581c082f6 switch from rollup to esbuild
brings the 2+ second bundle on a module like the graphs down to 90ms
2021-03-21 16:06:36 +10:00
Henrik Giesel
d13bd1096d Remove explicit popperjs again, because it's included in bootstrap.bundle 2021-03-09 13:37:56 +01:00
Henrik Giesel
aeda64a890 Add bootstrap, bootstrap-icons, and popperjs 2021-03-09 13:37:56 +01:00
Henrik Giesel
8aa8174d4b Fix scrollbar issue in anki-editable component in two ways
- using :host-context(.nightMode) allows for applying the nightmode
  scroll bar inside the component
- apply max-width: 100% to all element within editable, not just images
2021-02-23 15:52:20 +01:00
Damien Elmes
5ae66af5d2 rework v2 scheduler upgrade; drop downgrade
- Rework V2 upgrade so that it no longer resets cards in learning,
or empties filtered decks.
- V1 users will receive a message at the top of the deck list
encouraging them to upgrade, and they can upgrade directly from that
screen.
- The setting in the preferences screen has been removed, so users
will need to use an older Anki version if they wish to switch back to
V1.
- Prevent V2 exports with scheduling from being importable into a V1
collection - the code was previously allowing this when it shouldn't
have been.
- New collections still default to v1 at the moment.

Also add helper to get map of decks and deck configs, as there were
a few places in the codebase where that was required.
2021-02-21 15:50:41 +10:00
Damien Elmes
3c1fa68460 turn top bar dark when night mode enabled on macOS 2021-02-04 19:19:56 +10:00
Damien Elmes
39c6429fe2 fix broken card styling fix :-) 2021-02-03 22:32:55 +10:00
Damien Elmes
7e8886c352 fix broken card styling 2021-02-03 22:22:12 +10:00
Damien Elmes
e683e5c4d7
Merge pull request #973 from hgiesel/mathjaxerror
Render error if MathJax raises error
2021-02-03 13:09:12 +10:00
Henrik Giesel
e5587ffa59 Move copy_page to ts/copy.bzl and rename to copy_files_into_group 2021-02-02 18:20:11 +01:00
Henrik Giesel
803d6fbd3b Render error if MathJax raises error 2021-02-02 18:11:16 +01:00
Henrik Giesel
70b7cbcd4a Move editor css to editor directory 2021-01-31 19:03:40 +01:00
Henrik Giesel
2ab06a6540 Move editor to /ts/editor 2021-01-31 14:15:03 +01:00
Henrik Giesel
859a52ab15 Fix type issues 2021-01-31 13:34:39 +01:00
Henrik Giesel
33160dcb00 Make editor a rollup package 2021-01-31 13:34:37 +01:00
Henrik Giesel
126af1fef3 Fix focus on first field upon opening editor 2021-01-30 14:20:14 +01:00
Damien Elmes
b66bedbc9f
Merge pull request #957 from hgiesel/fieldsshadow
Implement editor as Web Component
2021-01-30 15:13:58 +10:00
Henrik Giesel
61346cf1f7 Rename editingContainer -> editingArea; editingArea -> editable
* Custom elements are now namespaces with `anki-`
* The element names are inspired by summernote, which have the same
  naming scheme of "editingArea > editable"
2021-01-29 20:32:21 +01:00
Henrik Giesel
2e72de4af0 Reorder methods / properties 2021-01-29 20:13:02 +01:00
Henrik Giesel
e37fd2e091 Remove unnecessarily observed attribute 2021-01-29 20:11:00 +01:00
Henrik Giesel
3559834bc9 Make forEditorField more cheaper to execute by avoiding casting to Array 2021-01-29 19:38:55 +01:00
Henrik Giesel
79dc0ecf86 Remove explicit ids, as they are not necessary anymore 2021-01-29 18:07:31 +01:00
Henrik Giesel
5e67e706fb No need to set initial values for editing area base CSS 2021-01-29 17:51:26 +01:00
Henrik Giesel
32ee863577 Remove checking for class names for instance checks 2021-01-29 17:41:27 +01:00
Henrik Giesel
982372beae Put HTML initialization into web component constructor
* disconnectedCallback should remove event listeners and free other resources
* attributes belong to connectedCallback
2021-01-29 15:50:34 +01:00
Henrik Giesel
0beefc0699 Move setting of index to connectedCallback 2021-01-29 14:54:59 +01:00
Henrik Giesel
fe87f986d3 Remove user styling in editor again for now 2021-01-29 14:54:59 +01:00
Henrik Giesel
594fc9bebd Fix focus change on tab 2021-01-29 14:54:59 +01:00
Henrik Giesel
6e907fd8b6 Move styling attributes from editor to editing-area that are for editing area 2021-01-29 14:54:58 +01:00
Henrik Giesel
a620bf91a8 Make button highlight white in nightMode 2021-01-29 14:54:58 +01:00
Henrik Giesel
3eade1c64d Make the text color part of the base style in editor 2021-01-29 14:54:58 +01:00
Henrik Giesel
af3753948a Allow stylesheet of note type take effect on editor fields 2021-01-29 14:54:58 +01:00
Henrik Giesel
8a525d3643 Use currentField.getSelection instead of window.getSelection 2021-01-29 14:54:58 +01:00
Henrik Giesel
08a6f8f02f Use new focusEditingArea and blurEditingArea to delegate to editing area 2021-01-29 14:54:58 +01:00
Henrik Giesel
aed38de228 Fix dupes, but also make sticky, and centered to draw more attention 2021-01-29 14:54:58 +01:00
Henrik Giesel
bec709c7a9 Update setFonts and setBackgrounds 2021-01-29 14:54:58 +01:00
Henrik Giesel
db0c776210 Fix inListItem for shadow roots 2021-01-29 14:54:58 +01:00
Henrik Giesel
e0d1450ce0 Rename fieldContainsInlineContent to containsInlineContent to reflect new usage 2021-01-29 14:54:58 +01:00
Henrik Giesel
7dc4b8818c Isolate styling of editing-area into new scss file 2021-01-29 14:54:58 +01:00
Henrik Giesel
1db71805d3 Create a rough draft of the editor web component 2021-01-29 14:54:58 +01:00
Henrik Giesel
4b7d406559 Make sticky topbar have a positive z-index 2021-01-29 14:21:32 +01:00
Henrik Giesel
bf7ff65af6 Rename fieldIsInInlineMode to fieldContainsInlineContent 2021-01-27 02:35:14 +01:00
Henrik Giesel
d9f00c4839 Remove unused helper functions 2021-01-27 00:55:00 +01:00
Henrik Giesel
b2b17f4c3d Recreate border-spacing with margins for #fields 2021-01-27 00:50:26 +01:00
Henrik Giesel
9b5d915983 Change nodeIsInline logic to be more typesafe 2021-01-26 23:49:48 +01:00
Henrik Giesel
feddf96f2a Change logic to detect inline elements, as the display style property may not be set after setting innerHTML 2021-01-26 23:42:04 +01:00
Henrik Giesel
520c4a3b4d Make #fields display correctly 2021-01-26 23:17:50 +01:00