Commit graph

121 commits

Author SHA1 Message Date
Henrik Giesel
e2bda7273e 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
125c2b232a 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
51ac1ea935 turn top bar dark when night mode enabled on macOS 2021-02-04 19:19:56 +10:00
Damien Elmes
2f9dea13ac fix broken card styling fix :-) 2021-02-03 22:32:55 +10:00
Damien Elmes
efb2ce77ed fix broken card styling 2021-02-03 22:22:12 +10:00
Damien Elmes
e6d9dd6a82 Merge pull request #973 from hgiesel/mathjaxerror
Render error if MathJax raises error
2021-02-03 13:09:12 +10:00
Henrik Giesel
b6cfccda67 Move copy_page to ts/copy.bzl and rename to copy_files_into_group 2021-02-02 18:20:11 +01:00
Henrik Giesel
6af6d7dbb6 Render error if MathJax raises error 2021-02-02 18:11:16 +01:00
Henrik Giesel
9f3403d704 Move editor css to editor directory 2021-01-31 19:03:40 +01:00
Henrik Giesel
978258067b Move editor to /ts/editor 2021-01-31 14:15:03 +01:00
Henrik Giesel
e667191899 Fix type issues 2021-01-31 13:34:39 +01:00
Henrik Giesel
aba2506394 Make editor a rollup package 2021-01-31 13:34:37 +01:00
Henrik Giesel
a94bcbcc74 Fix focus on first field upon opening editor 2021-01-30 14:20:14 +01:00
Damien Elmes
747075e9a7 Merge pull request #957 from hgiesel/fieldsshadow
Implement editor as Web Component
2021-01-30 15:13:58 +10:00
Henrik Giesel
44351bc997 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
c44c1513a3 Reorder methods / properties 2021-01-29 20:13:02 +01:00
Henrik Giesel
da79acf685 Remove unnecessarily observed attribute 2021-01-29 20:11:00 +01:00
Henrik Giesel
e7a49d5c48 Make forEditorField more cheaper to execute by avoiding casting to Array 2021-01-29 19:38:55 +01:00
Henrik Giesel
00a4d0357d Remove explicit ids, as they are not necessary anymore 2021-01-29 18:07:31 +01:00
Henrik Giesel
1617565f2d No need to set initial values for editing area base CSS 2021-01-29 17:51:26 +01:00
Henrik Giesel
36ce422119 Remove checking for class names for instance checks 2021-01-29 17:41:27 +01:00
Henrik Giesel
a33fa9c0cf 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
514d6b68b6 Move setting of index to connectedCallback 2021-01-29 14:54:59 +01:00
Henrik Giesel
1f5793e9e7 Remove user styling in editor again for now 2021-01-29 14:54:59 +01:00
Henrik Giesel
ef404c73ce Fix focus change on tab 2021-01-29 14:54:59 +01:00
Henrik Giesel
646415fd09 Move styling attributes from editor to editing-area that are for editing area 2021-01-29 14:54:58 +01:00
Henrik Giesel
fc24ebfb9e Make button highlight white in nightMode 2021-01-29 14:54:58 +01:00
Henrik Giesel
f3aaa40238 Make the text color part of the base style in editor 2021-01-29 14:54:58 +01:00
Henrik Giesel
49c3723647 Allow stylesheet of note type take effect on editor fields 2021-01-29 14:54:58 +01:00
Henrik Giesel
3d2c4b9969 Use currentField.getSelection instead of window.getSelection 2021-01-29 14:54:58 +01:00
Henrik Giesel
28276a9acf Use new focusEditingArea and blurEditingArea to delegate to editing area 2021-01-29 14:54:58 +01:00
Henrik Giesel
b423c372d5 Fix dupes, but also make sticky, and centered to draw more attention 2021-01-29 14:54:58 +01:00
Henrik Giesel
8381d9f842 Update setFonts and setBackgrounds 2021-01-29 14:54:58 +01:00
Henrik Giesel
7170a2b853 Fix inListItem for shadow roots 2021-01-29 14:54:58 +01:00
Henrik Giesel
0c2b560718 Rename fieldContainsInlineContent to containsInlineContent to reflect new usage 2021-01-29 14:54:58 +01:00
Henrik Giesel
cbb5224f48 Isolate styling of editing-area into new scss file 2021-01-29 14:54:58 +01:00
Henrik Giesel
fd704381a0 Create a rough draft of the editor web component 2021-01-29 14:54:58 +01:00
Henrik Giesel
e9d8e73239 Make sticky topbar have a positive z-index 2021-01-29 14:21:32 +01:00
Henrik Giesel
04a7b88595 Rename fieldIsInInlineMode to fieldContainsInlineContent 2021-01-27 02:35:14 +01:00
Henrik Giesel
aa61f24547 Remove unused helper functions 2021-01-27 00:55:00 +01:00
Henrik Giesel
8572c1e1d7 Recreate border-spacing with margins for #fields 2021-01-27 00:50:26 +01:00
Henrik Giesel
bd270ba52c Change nodeIsInline logic to be more typesafe 2021-01-26 23:49:48 +01:00
Henrik Giesel
876efba70c 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
898cdb94e4 Make #fields display correctly 2021-01-26 23:17:50 +01:00
Henrik Giesel
a76d1772df Make fields div instead of table + implement fieldIsInInlineMode logic 2021-01-26 23:00:55 +01:00
Henrik Giesel
6464a2bb83 Strip trailing newline if inline elements logic 2021-01-26 21:26:04 +01:00
Henrik Giesel
1a02613274 Avoid highlighting of toprightbuttons to shift the topbar 2021-01-22 12:53:45 +01:00
Henrik Giesel
f462f54e55 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
e1979ef9a0 Switch from floating windows and clearfix to flex and justify-content: space-between 2021-01-22 11:37:11 +01:00
Henrik Giesel
431b2fde63 Adjust the positioning of the editor toolarea via CSS 2021-01-21 21:36:33 +01:00