Commit Graph

210 Commits

Author SHA1 Message Date
hikaru-y
ac47ef54a2 Set background-color of body to var(--window-bg)
required to emulate day mode in clayout
if background-color is not set in .card styling
2021-06-24 23:47:14 +09:00
Damien Elmes
8e5e277ee4 don't wait for images before revealing
Currently there's a nasty blink when revealing the answer if the answer
has images on it, as the entire card is hidden, and not shown again until
the images have loaded. This patch removes the wait, so text should appear
more quickly, but it will mean the images may pop in.

We still wait for images before scrolling, to avoid a scroll to the wrong
location.

There's plenty of scope to improve this further - preloading images,
rendering MathJax in advance, etc, but those changes will need to wait
for now. #1120 has some related discussion.
2021-06-24 12:22:25 +10:00
Damien Elmes
61e86cc29d new change notetype implementation for the frontend
- changes can now be undone
- the same field can now be mapped to multiple target fields, allowing
fields to be cloned
- the old Qt dialog has been removed
- the old col.models.change() API calls the new code, to avoid
breaking existing consumers. It requires the field map to always
be passed in, but that appears to have been the common case.
- closes #1175
2021-06-10 22:19:24 +10:00
RumovZ
daa696e703 Tweak flag colors 2021-06-01 18:14:54 +02:00
RumovZ
c97c6c6e98 Add violet, turquoise and purple flags 2021-05-31 12:03:30 +02:00
Damien Elmes
0026506543 update ts deps
- prettier's formatting has changed, so files needed to be reformatted
- dart is spitting out deprecation warnings like:

254 │   2: $spacer / 2,
    │      ^^^^^^^^^^^
    ╵
    bazel-out/darwin-fastbuild/bin/ts/sass/bootstrap/_variables.scss 254:6  @import
    ts/sass/button_mixins.scss 2:9                                          @use
    ts/components/ColorPicker.svelte 2:5                                    root stylesheet

DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.

Recommendation: math.div($grid-gutter-width, 2)
2021-05-26 09:37:40 +10:00
Damien Elmes
d7d226843e improve type answer legibility
https://forums.ankiweb.net/t/accessibility-suggestion-correct-answer-text-contrast-in-dark-mode/10105

There's probably more that could be done here, but that can probably
wait for #1068
2021-05-22 10:31:29 +10:00
Damien Elmes
398cdc8992 add night mode styling to type-in-the-answer box
https://forums.ankiweb.net/t/night-mode-does-not-affect-input-tags/10116
2021-05-20 19:14:12 +10:00
Damien Elmes
9edac805ad support card state mutator in test scheduler
Documentation to come
2021-05-17 16:59:02 +10:00
Damien Elmes
b485b8cbb9 deckconfig->deckoptions 2021-04-25 19:02:30 +10:00
Henrik Giesel
b1de095162 Include editor-toolbar as a library in editor 2021-04-20 13:44:44 +02:00
Damien Elmes
10b7ab2c6d include sourcemaps for pages/* in dev builds 2021-04-20 17:33:46 +10:00
Henrik Giesel
37ed3e8209 Fix some code quality issues 2021-04-15 13:09:49 +02:00
Henrik Giesel
a0a9619722 Include icons directly in ts lib 2021-04-15 13:09:49 +02:00
Henrik Giesel
de77e40e4d Add ts/editor-toolbar 2021-04-15 13:09:48 +02:00
Damien Elmes
7f738c11a2 deck config prototype work in progress
Still in the early stages, and not hooked up yet.
2021-04-14 22:33:10 +10:00
Damien Elmes
cca9195ea5 run prettier on some sass files 2021-04-14 18:22:33 +10:00
Damien Elmes
ca6edc1470
Merge pull request #1123 from hgiesel/reviewerbottomdropjquery
Remove jQuery reviewer-bottom.ts and overview.ts
2021-04-14 12:35:39 +10:00
Henrik Giesel
a76f1d64ad Move compile_sass.bzl to /ts + Remove core.css from data/web (unused?) 2021-04-13 19:47:03 +02:00
Henrik Giesel
ffd159f9a0 Declare dependencies in data/web/css 2021-04-13 19:47:03 +02:00
Henrik Giesel
8f0f8f9af8 Use graphs-base and congrats-base 2021-04-13 19:47:03 +02:00
Henrik Giesel
825509ba0c Move card_counts and split off fusion_vars 2021-04-13 19:47:03 +02:00
Henrik Giesel
86262030e3 Purge jQuery from reviewer-bottom 2021-04-13 19:41:04 +02:00
Henrik Giesel
ae3f8adbb3 Remove overview.ts 2021-04-13 19:38:57 +02:00
Damien Elmes
18f03d5cb1
Merge pull request #1119 from hgiesel/reviewerdropjquery
Remove last jQuery from reviewer.ts / Remove fadeTime
2021-04-13 23:12:13 +10:00
Henrik Giesel
be7630648d Add setInnerHTML as a Replacement for $.html 2021-04-13 13:32:50 +02:00
Damien Elmes
e520e8df02 add missing copyright headers to *.ts 2021-04-13 18:57:08 +10:00
Henrik Giesel
c9fcf955f4 Remove display:none from mark and flag, and preset hidden attribute instead 2021-04-13 01:00:09 +02:00
Henrik Giesel
74a9d0b0a1 Make imageLoaded adhere to its function signature 2021-04-13 00:42:09 +02:00
Henrik Giesel
f4f0298378 Remove jQuery from mark and flag in reviewer.ts 2021-04-13 00:37:58 +02:00
Henrik Giesel
e131b70c4c Remove jQuery from _updateQA 2021-04-13 00:22:00 +02:00
Damien Elmes
28f830730e fix '\\' being converted to single backslash
Appears the default changed in 3.x
https://github.com/mathjax/MathJax/issues/2532

https://forums.ankiweb.net/t/double-backslashes-in-text-of-notes-are-turned-into-single-backslashes-on-display/9048
2021-04-07 21:50:33 +10:00
Henrik Giesel
bbea9ac9d7 Remove bootstrap-icons from css folder 2021-03-28 16:14:52 +02:00
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
Henrik Giesel
e481452114 Make fields div instead of table + implement fieldIsInInlineMode logic 2021-01-26 23:00:55 +01:00
Henrik Giesel
335267d42e Strip trailing newline if inline elements logic 2021-01-26 21:26:04 +01:00
Henrik Giesel
1df6c5f596 Avoid highlighting of toprightbuttons to shift the topbar 2021-01-22 12:53:45 +01:00
Henrik Giesel
9226d50185 Space items by using margins instead of spaces
* also changed name of topbutton container back to topbutsOuter as it is clearer
* starting with Chromium 83, `row-gap` would be better suited for this
2021-01-22 12:17:10 +01:00
Henrik Giesel
97f8f1b89e Switch from floating windows and clearfix to flex and justify-content: space-between 2021-01-22 11:37:11 +01:00
Henrik Giesel
1f4de7fe4b Adjust the positioning of the editor toolarea via CSS 2021-01-21 21:36:33 +01:00
Henrik Giesel
2946843b81 Remove image click event handler, as it never takes place
* className of fields will be "field clearfix", never just "field"
2021-01-21 20:50:17 +01:00
Henrik Giesel
e91a4b4362 Remove javascript resizing code from editor.ts 2021-01-21 19:59:16 +01:00
Henrik Giesel
6262997599 Explicitly execute code deactivating button focus from editor.py 2021-01-20 17:06:08 +01:00
Henrik Giesel
cfc8e34cf0 Remove jQuery from most top functions, and avoid waiting for jquery load 2021-01-19 03:52:46 +01:00
Henrik Giesel
5b24e5c522 Remove some unnecessary jQuery, replace some toggles with classList.toggle 2021-01-19 03:06:44 +01:00
Henrik Giesel
27a1e81088 Remove code which supposedly fixing focus, but which is not functional 2021-01-19 02:54:15 +01:00
Henrik Giesel
47d26126e7 Switch to iterables for elem.style and elem.attributes 2021-01-19 02:48:41 +01:00
Henrik Giesel
a4921a36dd Satisfy formatter 2021-01-19 01:08:15 +01:00
Henrik Giesel
4deeb798ca Prefer template string and addEventListener over string concatenation and .on<event> 2021-01-18 17:42:29 +01:00
Henrik Giesel
150de7a683 Use more strict TypeScript in editor.ts 2021-01-18 17:18:35 +01:00
Henrik Giesel
a898224d3d Switch to KeyboardEvent.code rather than KeyboardEvent.which, which is deprecated 2021-01-18 15:19:57 +01:00