Commit Graph

9657 Commits

Author SHA1 Message Date
Matthias Metelka
9b878a2229
Make auto-closing of HTML tags default but optional (#2101) 2022-10-03 13:14:57 +10:00
Hikaru Y
76065e843b
Fix scrolling with keys / keyboard event listeners not working on answer side (#2099)
* Revert "Fix reviewer shortcuts being inaccessible due to IME"

This reverts commit 5bf031f1e3.

* Work around WebEngine/IME bug in Qt6
2022-10-03 12:53:09 +10:00
Aristotelis
da4d80da2a
Add API shim for webview.get_window_bg_color (#2095)
* Maintain shim for webview.get_window_bg_color

Used by the AMBOSS add-on

* Fix deprecation message
2022-10-03 12:50:22 +10:00
Damien Elmes
ccb18ec709 Update d3 deps for CWE 2022-09-30 14:22:23 +10:00
Damien Elmes
4bf243d0af Fix type answer warning making text bold 2022-09-30 14:08:03 +10:00
Damien Elmes
ea3b40e400 Fix font size not being removed when pasting between fields 2022-09-30 14:05:03 +10:00
Matthias Metelka
de4d69454a
Set line-height = 1 on inline floating-reference (#2096) 2022-09-30 11:43:08 +10:00
Damien Elmes
6944210fbe Fix theming on Windows
- Use Unix path separator
- Strip off UNC prefix when running under Bazel
2022-09-28 15:12:14 +10:00
Matthias Metelka
f72570c604
Make tags editor resizable using Henrik's components (#2046)
* Make tags editor resizable using Henrik's components

All credit for the components goes to Henrik. I just tweaked the design a bit and implemented them in NoteEditor.

Co-Authored-By: Henrik Giesel <hengiesel@gmail.com>

* Remove PaneContent padding

Co-Authored-By: Henrik Giesel <hengiesel@gmail.com>

* Add responsive box-shadows on scroll/resize

only shown when content overflows in the respective direction.

* Remove comment

* Fix overflow calculations and shadow mix-up

This happened when I switched from using scrolledToX to overflowX booleans.

* Simplify overflow calculations

* Make drag handles 0 height/width

The remaining height requirement comes from a margin set on NoteEditor.

* Run eslint on components

* Split editor into three panes: Toolbar, Fields, Tags

* Remove upper split for now

to unblock 2.1.55 beta

* Move panes.scss to sass folder

* Use single type for resizable panes

* Implement collapsed state toggled with click on resizer

* Add button to uncollapse tags pane and focus input

* Add indicator for # of tags

* Use dbclick to prevent interference with resize state

* Add utility functions for expand/collapse

* Meddle around with types and formatting

* Fix collapsed state being forgotten on second browser open (dae)

* Fix typecheck (dae)

Our tooling generates .d.ts files from the Svelte files, but it doesn't
expect variables to be exported. By changing them into functions, they
get included in .bazel/bin/ts/components/Pane.svelte.d.ts

* Remove an unnecessary bridgeCommand (dae)

* Fix the bottom of tags getting cut off (dae)

Not sure why offsetHeight is inaccurate in this case.

* Add missing header (dae)

Co-authored-by: Henrik Giesel <hengiesel@gmail.com>
2022-09-28 14:02:32 +10:00
Damien Elmes
a54b815c7b Update translations 2022-09-28 11:47:59 +10:00
Damien Elmes
eb5600019a Revert "Fix/autofix empty div (#2066)"
This reverts commit 892c9f6da8.

Reverting until #2093 can be addressed
2022-09-28 11:47:59 +10:00
Matthias Metelka
23e6b2123e
Redesign deck options inputs (#2082)
* Create _input-mixins.scss

* Use button-mixins on more elements

* Replace <select> tag with custom Select component

* Fix RevertButton causing cursor: pointer when hidden

* Increase SaveButton chevron width

* Hide floating component box-shadow when inactive

* Rework SpinBox and move it into components

* Run eslint and prettier

* Remove leftover options prop

* Pass disabled array to EnumSelector again

* Update MapperRow.svelte

* Darken QHeaderView border color

Slipping this in without an extra PR.

* Adjust disabled color, border and cursor

* Remove redundant icon definition from stylesheets

* Fix deck options initial config

* Fix z-index issues in change notetype screen

It might be best to handle z-index locally in each user component instead of hard-coded component values.

* Give web SpinBox a horizontal design

* Give QRadioButton the same treatment as QCheckBox in #2079

* Fix unused CSS selector warning with base button-mixin

* Remove redundant import

* Fix deck options save button

* Delete input-mixins and remove unused down-arrow

* Run eslint on change-notetype

* Run eslint on components
2022-09-27 12:16:45 +10:00
Damien Elmes
6a7f2d8a79 Restrict cloze shortcut workaround to non-increment case
The workaround is only needed for the option key, and seems to trip
some people up, perhaps due to the order they're pressing/releasing the
keys.

Closes #2090
2022-09-26 11:22:00 +10:00
Abdo
73035819a9
Fix pm.night_mode() (#2091)
* Fix pm.night_mode()

* Add deprecation notice (dae)
2022-09-26 11:06:21 +10:00
Damien Elmes
dd939beafe Simplify asReference 2022-09-26 10:04:08 +10:00
Damien Elmes
4089e76800
Add option to shrink editor images by default (#2071)
+ Don't persist shrinking toggle

Closes #1894
2022-09-26 09:47:50 +10:00
Matthias Metelka
c1176a2e6c
Fix custom webview scrollbar not showing (#2085)
* Fix custom scrollbar not showing

* Move body selector out of scrollbar mixin

* Apply custom scrollbar to child elements too

* Remove some duplicate definitions

* Run prettier
2022-09-26 09:13:06 +10:00
Damien Elmes
fe9b0aecf7 Add missing sim lines in build files
Latest rules_rust now requires them. Can't use the 0.16 release
due to not-yet-merged https://github.com/google/cargo-raze/pull/524
2022-09-25 12:55:55 +10:00
Matthias Metelka
abb018b507
Fix Qt stylesheets getting duplicated over and over again (#2083) 2022-09-24 15:57:10 +10:00
Damien Elmes
cfb309e6b3 Update Rust deps 2022-09-24 13:22:46 +10:00
Damien Elmes
a39a3b4d34 Update to latest rules_rust and Rust 1.64 2022-09-24 11:12:58 +10:00
Damien Elmes
9abc73360e Update Python deps
Addresses a protobuf CVE. Required some other patches due to changes
in latest mypy and pylint.
2022-09-24 09:46:43 +10:00
Damien Elmes
b97a8bfa26 Fix daily counts being included in apkg import
Fixes https://github.com/ankidroid/Anki-Android/issues/12477
2022-09-24 09:05:29 +10:00
Damien Elmes
66178edd5a Compile _vars.scss in //sass
Saves an extra copy, and allows use by mobile clients
2022-09-23 13:48:18 +10:00
Damien Elmes
a2e957d345 Update translations 2022-09-21 13:44:44 +10:00
Damien Elmes
fa596f1848 Update Mac bundle to Qt 6.3.2 2022-09-21 12:52:45 +10:00
Damien Elmes
88b3a8bd12 Update to Qt 6.3.2 2022-09-21 12:21:11 +10:00
Damien Elmes
192dfe8185 Get the runtime Qt version instead of the compile-time version
PyQt sometimes bumps the Qt libraries without changing the Python side
2022-09-21 12:21:10 +10:00
Matthias Metelka
bff76727fe
Make mdi icons for Qt themeable (#2078)
* Fix create_vars_from_map not creating vars with default definition

* Add white and black to vars

* Replace some hard-coded SVGs with mdi equivalents

* Implement function to dynamically adjust SVG icon color

* Use new svg function to make Qt stylesheet icons respond to theme changes

* Use svg function for sidebar tool icons

* Create copy for each new color instead of modifying source file

* Fix check fails

* Add custom checkbox style for #2079

* Add example of how to generate svgs during build (dae)

* Create arbitrary color variants for each icon with Bazel

* Remove unused label (dae)
2022-09-21 12:02:30 +10:00
Matthias Metelka
e109c62aa9
Improve hover feedback on various widgets (#2079)
* Use cursor: pointer on QCheckBoxes too and exclude disabled widgets

* Left-align all QCheckBoxes to make hover-area and clickable area the same

Altough the clickable area has always been restricted to the label, the widget itself stretched all the way. This became a problem with the new cursor-pointer for checkboxes.

* Remove Switch duplicate from deck-options

* Add cursor: pointer to Switch and RevertButton

* Add cursor: pointer to bottom toolbar buttons

* Add cursor: pointer to gears

* Add cursor: pointer to radio and checkbox inputs of graphs page

* Improve button appearance in stats screen

* Add cursor: pointer to QTabBar and QToolButton

* Add cursor: pointer to non-editable QComboBox

* Center settings-will-take-effect-after notice in preferences screen

* Use public without_qt5_compat_wrapper() function

* Run prettier
2022-09-20 16:34:15 +10:00
Damien Elmes
09cb8b3cf6 Always scan for media changes
The check runs in the background, and the dentry cache and SQLite
page cache should make this more efficient after the first run.

Closes #1736
2022-09-20 16:13:10 +10:00
Matthias Metelka
52f52724fa
Add orientation toggle to browser view menu (#2074)
* Use horizontal orientation on browser splitter by default

* Add View menu action to toggle browser orientation

* Add shortcut for toggleOrientation action

based on the most popular add-on.

* Try to fix typing issue

* Make orientation respond to aspect ratio

aspect ratio < 1 means vertical orientation, >= 1 horizontal

* Implement three-way switch for browser orientation

* Fix typing

* Add separator before QWidgetAction

* Use submenu instead of widget and adjust enum

* Add accelerators; move non-accelerator strings into separate .ftl (dae)

* Move BrowserLayout to its own file (dae)
2022-09-20 12:56:59 +10:00
Damien Elmes
6b894a076b Allow users to set a low answer time cap
https://forums.ankiweb.net/t/options-maximum-answer-seconds-lower-minimum-value-please/23190
2022-09-19 13:40:30 +10:00
Matthias Metelka
24abb06cee
Color Palette Patch 1 (#2073)
* Make several colors more faint

* Move selection-color definition out of table.py and adjust colors

* Use functions for repetitive border-gradient definitions

* Tweak QTableView and QScrollBar styles

* Use mdi icon for Qt drag handles and adjust padding in browser.ui

* Apply appropriate drag-handle icon depending on orientation

* Fix formatting

* Remove unused import

* Add right margin to browser layout

* Apply splitter styling on macOS as well (dae)

+ Remove the styling from sliders, as it was presumably not intentional.
2022-09-19 10:58:05 +10:00
Damien Elmes
5bf031f1e3 Fix reviewer shortcuts being inaccessible due to IME
Only tested on Windows, but hopefully resolves the Linux issue as well.

Closes #1952
2022-09-17 14:15:07 +10:00
Damien Elmes
39d59caa48 Possible fix for error when copying text in editor
https://forums.ankiweb.net/t/error-copying-data-when-editing-a-note-field-anki-2-1-54/23147
https://forums.ankiweb.net/t/error-during-performing-an-ahk-script/23070
2022-09-17 11:47:41 +10:00
Matthias Metelka
8142176f84
Introduce new color palette using Sass maps (#2016)
* Remove --medium-border variable

* Implement color palette using Sass maps

I hand-picked the gray tones, the other colors are from the Tailwind CSS v3 palette.

Significant changes:
- light theme is brighter
- dark theme is darker
- borders are softer

I also deleted some platform- and night-mode-specific code.

* Use custom colors for note view switch

* Use same placeholder color for all inputs

* Skew color palette for more dark values

by removing gray[3], which wasn't used anywhere. Slight adjustments were made to the darker tones.

* Adjust frame- window- and border colors

* Give deck browser entries --frame-bg as background color

* Define styling for QComboBox and QLineEdit globally

* Experiment with CSS filter for inline-colors

Inside darker inputs, some colors like dark blue will be hard to read, so we could try to improve text-color contrast with global adjustments depending on the theme.

* Use different map structure for _vars.scss

after @hgiesel's idea: https://github.com/ankitects/anki/pull/2016#discussion_r947087871

* Move custom QLineEdit styles out of searchbar.py

* Merge branch 'main' into color-palette

* Revert QComboBox stylesheet override

* Align gray color palette more with macOS

* Adjust light theme

* Use --slightly-grey-text for options tab color

* Replace gray tones with more neutral values

* Improve categorization of global colors

by renaming almost all of them and sorting them into separate maps.

* Saturate highlight-bg in light theme

* Tweak gray tones

* Adjust box-shadow of EditingArea to make fields look inset

* Add Sass functions to access color palette and semantic variables

in response to https://github.com/ankitects/anki/pull/2016#issuecomment-1220571076

* Showcase use of access functions in several locations

@hgiesel in buttons.scss I access the color palette directly. Is this what you meant by "... keep it local to the component, and possibly make it global at a later time ..."?

* Fix focus box shadow transition and remove default shadow for a cleaner look

I couldn't quite get the inset look the way I wanted, because inset box-shadows do not respect the border radius, therefore causing aliasing.

* Tweak light theme border and shadow colors

* Add functions and colors to base_lib

* Add vars_lib as dependency to base_lib and button_mixins_lib

* Improve uses of default-themed variables

* Use old --frame-bg color and use darker tone for canvas-default

* Return CSS var by default and add palette-of function for raw value

* Showcase use of palette-of function

The #{...} syntax is required only because the use cases are CSS var definitions. In other cases a simple palette-of(keyword, theme) would suffice.

* Light theme: decrease brightness of canvas-default and adjust fg-default

* Use canvas-inset variable for switch knob

* Adjust light theme

* Add back box-shadow to EditingArea

* Light theme: darken background and flatten transition

also set hue and saturation of gray-8 to 0 (like all the other grays).

* Reduce flag colors to single default value

* Tweak card/note accent colors

* Experiment with inset look for fields again

Is this too dark in night mode? It's the same color used for all other text inputs.

* Dark theme: make border-default one shade darker

* Tweak inset shadow color

* Dark theme: make border-faint darker than canvas-default

meaning two shades darker than it currently was.

* Fix PlainTextInput not expanding

* Dark theme: use less saturated flag colors

* Adjust gray tones

* Fix nested variables not getting extracted correctly

* Rename canvas-outset to canvas-elevated

* Light theme: darken canvas-default

* Make canvas-elevated a bit darker

* Rename variables and use them in various components

* Refactor button mixins

* Remove fusion vars from Anki

* Adjust button gradients

* Refactor button mixins

* Fix deck browser table td background color

* Use color function in buttons.scss

* Rework QTabWidget stylesheet

* Fix crash on browser open

* Perfect QTableView header

* Fix bottom toolbar button gradient

* Fix focus outline of bottom toolbar buttons

* Fix custom webview scrollbar

* Fix uses of vars in various webviews

The command @use vars as * lead to repeated inclusion of the CSS vars.

* Enable primary button color with mixin

* Run prettier

* Fix Python code style issues

* Tweak colors

* Lighten scrollbar shades in light theme

* Fix code style issues caused by merge

* Fix harsh border color in editor

caused by leftover --medium-border variables, probably introduced with a merge commit.

* Compile Sass before extracting Python colors/props

This means the Python side doesn't need to worry about the map structure and Sass functions, just copy the output CSS values.

* Desaturate primary button colors by 10%

* Convert accidentally capitalized variable names to lowercase

* Simplify color definitions with qcolor function

* Remove default border-focus variable

* Remove redundant colon

* Apply custom scrollbar CSS only on Windows and Linux

* Make border-subtle color brighter than background in dark theme

* Make border-subtle color a shade brighter in light theme

* Use border-subtle for NoteEditor and EditorToolbar border

* Small patches
2022-09-16 14:11:18 +10:00
Zoom
3ec7e23d7c
Fix Windows dark mode detection: OpenKey can fail (#2068)
* Fix Windows dark mode detection: OpenKey can fail

#1497 introduced reading hardcoded Windows Registry key, which assumes key exists. This is not true on Windows 7. Later addition of `try-except` block missed that OpenKey might fail.

This fix allows launching current version of Anki on Windows 7 when installed with Pip with the modified Python 3.9 installation.

* Update CONTRIBUTORS

CI req: Add myself to the contributor list
2022-09-15 12:04:19 +10:00
Matthias Metelka
35431c5944
Collapsible patch (#2052)
* Animate Collapsible in both directions

* Fix field margin issues

* Fix code style issues

* Make duration prop optional

* Implement reduced motion mode for Collapsible

* Refactor Collapsible and add comments

* Fix LabelContainer badges disappearing when field is still hovered

* Remove reducedMotion store and use body class instead

* Export optional animated boolean

* Do not export duration

* Add 5px top padding to Fields.svelte

to make it look like it used to.

* Revert "Add 5px top padding to Fields.svelte"

This reverts commit f30026149a89f3d3b289c5030cd1ca34f728b036.

* Add top margin of 5px to Fields.svelte
2022-09-14 15:26:07 +10:00
Henrik Giesel
9d9d4a97c7
Apply border radius of plain text input to code mirror as well (#2067) 2022-09-13 14:20:26 +10:00
Henrik Giesel
a87d877082
Fuzzy search in symbol insertion overlay (#2059)
* Add flag for enabling insert symbols feature

* Add symbols overlay directory

* Detect if :xy is inserted into editable

* Allow naive updating of overlay, and special handling of ':'

* First step towards better Virtual Element support

* Update floating to reference range on insert text

* Position SymbolsOverlay always on top or bottom

* Add a data-provider to emulate API

* Show correct suggestions in symbols overlay

* Rename to replacementLength

* Allow replacing via clicking in menu

* Optionally remove inline padding of Popover

* Hide Symbols overlay on blur of content editable

* Add specialKey to inputHandler and generalize how arrow movement is detected

- This way macOS users can use Ctrl-N to mean down, etc.

* Detect special key from within SymbolsOverlay

* Implement full backwards search while typing

* Allow navigating symbol menu and accepting with enter

* Add some entries to data-provider

* Satisfy eslint

* Generate symbolsTable from sources

* Use other github source, allow multiple names

In return, symbol must be unique

* Automatically scroll in symbols dropdown

* Use from npm packages rather than downloading from URL

* Remove console.log

* Remove print

Co-authored-by: Damien Elmes <dae@users.noreply.github.com>

* Add pointerDown event to input-handler

- so that SymbolsOverlay can reset on field click

* Make tab do the same as enter

* Make font a bit smaller but increase relative icon size

* Satisfy type requirement of handlerlist

* Revert changing default size of DropdownItems

* Remove some now unused code for bootstrap dropdowns

* Use fuse to allow fuzzy searching of symbols

* Remove unnecessary async handling in data-provider

I did that because at first I was still expecting to fetch the symbols
from the backend

* Apply field font family in symbol preview

* Remove inline padding from latex popover

* Rename data-provier to symbols-table

* Add some explaining comments to interface

* Allow for auto insertion symbols

* Use deleteData and after instead of replaceData

* Allow using html in symbols

* Show html symbols as html

* Add SymbolsEntry component

* Also include containshtml at low search precedence

* Put character entities and gemoji into their own files

* Factor out prepareInsertion method

* Allow deletion while searching for correct symbol

* Respect insertCompositionText

* Delete data-provider

* Restrict auto insert queries to max 5 characters

* Satisfy svelte check

* Fix the overlay sometimes not showing

This will make sure to always normalize text nodes before searching.
However it adjacent text is partially formatted, this will still not
find the whole query.

For example, currently, entering `<b>:for</b>al` and then inputting `l`,
will not trigger a search for `forall`, because of the <b> formatting

* Add empty line

* Do not trigger overlay, when last character is whitespace or colon

* Add missing fuse license
2022-09-13 14:19:19 +10:00
Henrik Giesel
892c9f6da8
Fix/autofix empty div (#2066)
* Remove empty divs in rich text input

* Refactor inline content detection

* Fix formatting
2022-09-13 14:11:47 +10:00
Abdo
497b246b66
Add MainWindowState hints to more signatures (#2064) 2022-09-12 19:31:22 +10:00
Henrik Giesel
1a87937973
Fix sticky field labels - Make editor toolbar+tag editor non sticky in editor (#2058)
* Add back overflow:hidden to field descriptions

* Add explaining comment

* Put back overflow:hidden in FieldsEditor

* Move inline padding from Fields component but EditorField+LabelContainer

* Simplify editor design by making editor toolbar not sticky

* Make tag editor in note editor non-sticky as well

* Fix merge mess

* The floating elements were portaled because I passed in undefined and they have a default argument

- Fix unrelated to PR
2022-09-12 19:22:22 +10:00
Henrik Giesel
8f8f3bd465
Insert symbols overlay (#2051)
* Add flag for enabling insert symbols feature

* Add symbols overlay directory

* Detect if :xy is inserted into editable

* Allow naive updating of overlay, and special handling of ':'

* First step towards better Virtual Element support

* Update floating to reference range on insert text

* Position SymbolsOverlay always on top or bottom

* Add a data-provider to emulate API

* Show correct suggestions in symbols overlay

* Rename to replacementLength

* Allow replacing via clicking in menu

* Optionally remove inline padding of Popover

* Hide Symbols overlay on blur of content editable

* Add specialKey to inputHandler and generalize how arrow movement is detected

- This way macOS users can use Ctrl-N to mean down, etc.

* Detect special key from within SymbolsOverlay

* Implement full backwards search while typing

* Allow navigating symbol menu and accepting with enter

* Add some entries to data-provider

* Satisfy eslint

* Generate symbolsTable from sources

* Use other github source, allow multiple names

In return, symbol must be unique

* Automatically scroll in symbols dropdown

* Use from npm packages rather than downloading from URL

* Remove console.log

* Remove print

* Add pointerDown event to input-handler

- so that SymbolsOverlay can reset on field click

* Make tab do the same as enter

* Make font a bit smaller but increase relative icon size

* Satisfy type requirement of handlerlist

* Revert changing default size of DropdownItems

* Remove some now unused code for bootstrap dropdowns
2022-09-10 18:46:59 +10:00
Matthias Metelka
414ff5db1c
Redesign Qt widgets with stylesheets (#2050)
* Remove --medium-border variable

* Implement color palette using Sass maps

I hand-picked the gray tones, the other colors are from the Tailwind CSS v3 palette.

Significant changes:
- light theme is brighter
- dark theme is darker
- borders are softer

I also deleted some platform- and night-mode-specific code.

* Use custom colors for note view switch

* Use same placeholder color for all inputs

* Skew color palette for more dark values

by removing gray[3], which wasn't used anywhere. Slight adjustments were made to the darker tones.

* Adjust frame- window- and border colors

* Give deck browser entries --frame-bg as background color

* Define styling for QComboBox and QLineEdit globally

* Experiment with CSS filter for inline-colors

Inside darker inputs, some colors like dark blue will be hard to read, so we could try to improve text-color contrast with global adjustments depending on the theme.

* Use different map structure for _vars.scss

after @hgiesel's idea: https://github.com/ankitects/anki/pull/2016#discussion_r947087871

* Move custom QLineEdit styles out of searchbar.py

* Merge branch 'main' into color-palette

* Revert QComboBox stylesheet override

* Align gray color palette more with macOS

* Adjust light theme

* Add custom styling for Qt controls

* Use --slightly-grey-text for options tab color

* Replace gray tones with more neutral values

* Improve categorization of global colors

by renaming almost all of them and sorting them into separate maps.

* Saturate highlight-bg in light theme

* Tweak gray tones

* Adjust box-shadow of EditingArea to make fields look inset

* Add Sass functions to access color palette and semantic variables

in response to https://github.com/ankitects/anki/pull/2016#issuecomment-1220571076

* Showcase use of access functions in several locations

@hgiesel in buttons.scss I access the color palette directly. Is this what you meant by "... keep it local to the component, and possibly make it global at a later time ..."?

* Fix focus box shadow transition and remove default shadow for a cleaner look

I couldn't quite get the inset look the way I wanted, because inset box-shadows do not respect the border radius, therefore causing aliasing.

* Tweak light theme border and shadow colors

* Add functions and colors to base_lib

* Add vars_lib as dependency to base_lib and button_mixins_lib

* Improve uses of default-themed variables

* Use old --frame-bg color and use darker tone for canvas-default

* Return CSS var by default and add palette-of function for raw value

* Showcase use of palette-of function

The #{...} syntax is required only because the use cases are CSS var definitions. In other cases a simple palette-of(keyword, theme) would suffice.

* Light theme: decrease brightness of canvas-default and adjust fg-default

* Use canvas-inset variable for switch knob

* Adjust light theme

* Add back box-shadow to EditingArea

* Light theme: darken background and flatten transition

also set hue and saturation of gray-8 to 0 (like all the other grays).

* Reduce flag colors to single default value

* Tweak card/note accent colors

* Experiment with inset look for fields again

Is this too dark in night mode? It's the same color used for all other text inputs.

* Dark theme: make border-default one shade darker

* Tweak inset shadow color

* Dark theme: make border-faint darker than canvas-default

meaning two shades darker than it currently was.

* Fix PlainTextInput not expanding

* Dark theme: use less saturated flag colors

* Adjust gray tones

* Create stylesheet overrides for various Qt widgets

Including QPushButton, QComboBox, QSpinBox, QLineEdit, QListWidget, QTabWidget, QTreeWidget, QToolTip, QTableView, QScrollBar and sub-widgets.

* Make webview scrollbar look identical to Qt one

* Add blue colors for primary buttons

* Tweak disabled state of SpinBox button

* Apply styles to all platforms

mainly so people like @hgiesel can easily test the widget style overrides, but maybe you actually prefer them over the native ones, who knows :)

* Tweak webview button borders

* Add type annotations to eventFilter

* Adjust padding of QComboBox and its drop-down arrow

* Use isinstance for comparison

* Remove reimport of Any

* Revert "Merge branch 'redesign-test' into custom-qt-controls"

This reverts commit ff36297456b693a0d4b4b69f5f487ac1a01c1861, reversing
changes made to 6bb45355d143aa081d2d643933bd02ddc43206de.

* Add missing copyright header

* Left-align QTabWidget headers

* Exclude macOS from stylesheet overrides

* Fix failure to start on macOS (dae)

* Use standard macOS theme in dark mode (dae)

I believe this was originally behind a feature flag because the user
had to use a hack to get it to work
(https://forums.ankiweb.net/t/title-bar-dark-mode-fix-broken/1189),
and it did not work correctly when the system theme was changed.

Since the introduction of libankihelper and the app automatically
updating as the system theme changes, these issues no longer seem to
exist, and switching between light and dark appears to work consistently.

Pushed into this PR because it addresses the background color issue
mentioned in code review.

Closes #2054
2022-09-08 20:44:38 +10:00
Henrik Giesel
3642dc6245
Use WithFloating for MathjaxOverlay (#2011)
* Allow passing in reference into WithFloating as prop

* Fix WithAutocomplete

* Fix WithFloating for MathjaxOverlay

* Add resize-store

* Allow passing debug=True to jest_test for debugger support (#2013)

* Disable auto-closing of HTML tags

https://forums.ankiweb.net/t/set-html-editor-as-a-default-editor-instead-of-visual-editor/20988/3

Closes #1963

* Add slight margin to MathjaxEditor

* Enable passing offset and shift to WithFloating

* Hide overflow of mathjax editor

* Add automatic hide functionality to sveltelib/position

* Last polishes for Surrounder class (#2017)

* Make private properties in Surrounder truly private

* Fix remove logic of Surrounder

* No reason for toggleTriggerRemove to be async

* Allow using alt-shift to set all remove formats but this one

* modifyFormat => updateFormat

* Fix formatting

* Fix field descriptions blocking cursor from being set (#2018)

- happens when focus is in HTML editor

* Remove hiding functionality again until it's really useful

* Add support for autoPlacement

* Implement new WithFloating that supports manually calling position()

* Implement hide mechanisms

* Add option in math dropdown to toggle MathJax rendering (#2014)

* Add option in math dropdown to toggle MathJax rendering

Closes #1942

* Hackily redraw the page when toggling MathJax

* Add Fluent string

* Default input setting in fields dialog (#1987) (kleinerpirat)

* Introduce field setting to use plain text editor by default (kleinerpirat)

* Remove leftover function from #1476

* Use boolean instead of string

* Simplify clear_other_field_duplicates

* Convert plain text key to camelCase

* Move HTML item below the existing checkbox, instead of to the right (dae)

Showing it on the right is more space efficient, but feels a bit
cluttered IMHO.

* Fix not being able to scroll when mouse hovers PlainTextInput (#2019)

* Remove overscroll-behavior: none for * (all elements)

* Revert "Remove overscroll-behavior: none for * (all elements)"

This reverts commit 189358908cecd03027e19d8fe47822735319ec17.

* Use body instead of *, but keep CSS rule

* Unify two CSS rules

* Remove console.logs

* Reposition mathjax menu on switching between inline/block

* Implement WithOverlay

* Implement FloatingArrow

* Display overlay with padding and brighter background

* Rename to MathjaxOverlay

* Simplify MathjaxOverlay component overall

* Rename ImageHandle to image overlay

* Generally fix ImageOverlay again

* Increase z-index of StickyContainer

* Fix setting block or inline on mathjax

* Add reasons in closing-{click,keyup}

* Have both WithFloating and WithOverlay use a simple show flag instead of a store

* Remove subscribe-trigger

* Fix clicking from one mathjax element to another

* Check before executing cleanup

* Do not wait for elements to mount before slotting in With{Floating,Overlay}

* Allow using reference slot for WithFloating and WithOveray

* Add inline argument to options

* Add support for inline slot in WithOvelay

* Use WithFloating for RemoveFormatButton

* Remove last uses of DropdownMenu and WithDropdown

* Remove all of the bootstrap dropdown components

* Fix closing behavior of several buttons and ImageOverlay

* Increase popover padding to 6px

* Find a different way to create some padding at the bottom of the fields

...before the tag editor

@kleinerpirat I think is what this css what trying to achieve?

* Satisfy tests

* Use removeStyleProperties in ImageOverlay

* Use notify function in WithOverlay and WithFloating

* Do not use portal for WithFloating and WithOverlay

Allows for scrolling

* Set hidden to default false in Rich/Plain TextInput

* Reset handle when changing mathjax elements via click

* Restrict size of empty mathjax image

* Prevent sticky labels from obscuring menus

* Remove several overflow-hidden

* Fix empty string being falsy bug when editing mathjax

* Do not import portal anymore

* Use { reason, originalEvent } instead of symbol as update to modified event store

* Fix closing behavior of image overlay (do not close after resize)

* Simplify Collapsible

* Use removeStyleProperties in Collapsible

* Satisfy eslint

* Fix latex shortcuts being mounted

* Fix mathjax overlay not focusable in first field

* Neither hide image overlay on escaped

* Fix Block ButtonDropdown wrapping

* Bring back portal to fix tag editor
2022-09-05 17:20:00 +10:00
RumovZ
e7af0febb1
More template checks (#2032)
* Show warning if multiple type boxes are used

* Report templates referencing media in Media Check

* Apply suggestions from code review

* Fix media-check.ftl

* Only report media references with fields

Like `<img src={{Front}}>`.
Also report Anki sound tags and latex.

* Loop existing media regexes
2022-09-05 16:52:25 +10:00
RumovZ
e39fb74e82
Enable state-dependent custom scheduling data (#2049)
* Enable state-dependent custom scheduling data

* Next(Card)States -> SchedulingStates

The fact that `current` was included in `next` always bothered me,
and custom data is part of the card state, so that was a bit confusing
too.

* Store custom_data in SchedulingState

* Make custom_data optional when answering

Avoids having to send it 4 extra times to the frontend, and avoids the
legacy answerCard() API clobbering the stored data.

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2022-09-05 16:48:01 +10:00
Damien Elmes
0bcb3a3564 Add non-legacy backend interface for adding new decks 2022-09-04 14:12:29 +10:00