* Move up MathjaxOverlay to be initialized only once
* Move ImageOverlay to NoteEditor root
* Move Symbols Overlay to NoteEditor root
* Refactor image overlay to not require second mutation observer
* Use elevation + overflow:hidden in Editorfield
* Make it possible to show input next to each other again
* Set handle background color to code bg
* Make Collapsible unmount the component
* Simplify how decorated elements are mounted
* Set RichTextInput background to frame-bg again
* Strip out FocusTrap code
* Revert "Make Collapsible unmount the component"
This reverts commit 52722065ea199fa57ae750fa34bf47ee1c5aab3c.
* Allow clicking on label container to unfocus field
* Fix mathjax overlay resetting too its api too soon
* Allow scrolling on overlays
* Set focus-border border-color in focused field
* Fix background color of fields
* Add back grid-gap
removed it during merge to see if margin-top would behave any differently - which is not the case.
* Fix double border issue within Collapsible.svelte
* Format
* Edit appearance of focused fields a bit
* Remove unused properties
* Include elevation in button_mixins_lib
* Give label-container a background color
Co-authored-by: Henrik Giesel <hengiesel@gmail.com>
* Redesign deck config, swap tooltips for help modals, link to manual
* Replace canvas-inset with canvas-code for custom scheduling
* Make section header link to manual too
* Include elevation Sass library
* Remove two unused exports
* Fix tabbed spinboxes
* Update ftl/core/deck-config.ftl
* Update ftl/core/deck-config.ftl
* Fix format
* Make border-radius and box-shadow more subtle
* Fix margin for vertical aspect ratio
* Make direct hover on info badge apply effect instantly
* Add redirect line to manual underneath chapter
* 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>
* 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
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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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
* 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/3Closes#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
* 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>
* Add animation toggle to preferences
and move settings affecting appearance together.
* Add class to body if animations unchecked
* Fix formatting in preferences.ftl
* Update duration(height) function for Collapsible transition
and add explanation.
* Fix formatting
* Increase duration baseline to 10 and decrease factor to 20
* Restore initial layout and rename option to "Reduce motion"
* Move checkboxes together and fix tab order (dae)
+ Remove separation of UI size
* Add card meta for persisting custom scheduling state
* Rename meta -> custom_data
* Enforce limits on size of custom data
Large values will slow down table scans of the cards table, and it's
easier to be strict now and possibly relax things in the future than
the opposite.
* Pack card states and customData into a single message
+ default customData to empty if it can't be parsed
Co-authored-by: Damien Elmes <gpg@ankiweb.net>
* Introduce setting to collapse field by default
* Fix schema order
* Change wording from adjective to imperative
sounds a bit less clunky
* Update rslib/src/notetype/schema11.rs (dae)
* Keep settings in single column
* Add back Toggle Visual Editor string
* Add RichTextBadge component and show it conditionally
* Reverse input order depending on default setting
* Make PlainTextInput border-radius responsive to toggle states
* Prevent first Collapsible transition differently
* Focus inputs after Collapsible transition
The double tick calls are just a temporary solution until I find the exact moment an input is focusable again.
* Use requestAnimationFrame to await focusable state
Note: Svelte tick doesn't seem to work in this scenario.
* Adjust size of legacy buttons
* Revert "Adjust size of legacy buttons"
This reverts commit fb888fe1db9050c34b1a7b0820e6da5ac91ccee6.
* Remove unused function from #1476
* Use outline version for tag icon
* Add chevron icons
* Remove code icons, keep one pin icon version
* Add code-bg color
* Redesign fields
* Remove unused import
* Fix imports
* Move PlainTextBadge between editing inputs
where it belongs :)
* Make whole separator line clickable
* Fix transition
and format
* Don't show toggle when field is collapsed
* Show toggle only on hover
for mobile I'd like to implement a swipe mechanism.
* Use tweened SVG for triangle instead of CSS hack
* Implement more obvious HTML toggle on bottom right
* Reduce field height by a few pixels
* Reduce field height by two pixels
* Show HTML toggle when PlainTextInput is active, regardless of hover/focus
* Remove RichTextBadge.svelte
* Create separate collapsed field state
this means users can collapse fields with the HTML editor open and it will stay open when the field is expanded again.
* Add slide out animation to EditingArea, RichTextInput and PlainTextInput
only for collapsing, because it is choppy on expansion (common issue with Svelte transitions).
* Fix aliasing issue on focused field corners
* Make StickyBadge feel more responsive
* Move StickyBadge closer to field border
* Adjust field gutter/margins
* Make LabelContainer sticky
to make field operations accessible on fields with a lot of content.
* Add back html icons, remove visual editor icons
* Revert "Add code-bg color"
This reverts commit 4200f354193710b3acd9bcf84b67958e200ddcdb.
* Add rich text icon, remove strikethrough code icon
* Revert PlainTextBadge to original position
* Adjust margins in FieldState
* Rename PlainTextBadge to SecondaryInputBadge
in preparation for #1987
* Run eslint and prettier
* Make whole LabelContainer clickable area for collapse/expand
* Revert "Add slide out animation to EditingArea, RichTextInput and PlainTextInput"
This reverts commit 9a2b3410d0ead37ae1da408d68e14507a058a613.
* Fix error on collapse/expansion
this was caused by the {#if} blocks, which resulted in the deletion of original EditingAreas.
* Refocus when toggling chevron and secondary input badge
* Revert "Revert "Add code-bg color""
This reverts commit 1cfd3bda65354ab90c1ab4cbbef47596a1be8754.
* Use single rotating chevron icon and make it RTL-compatible
* Remove redundant CSS transition rule
* Introduce animated Collapsible component and fix refocus on toggle
* Do not try to force repaint, as it is not required
* Remove RTL store from LabelContainer
the direction is already applied globally.
* Collapse secondary input with field
* Add focusedField to NoteEditorAPI
* Replace :global CSS selector with class .visible
thus removing the assumption that the component is used inside an EditorField.
https://github.com/ankitects/anki/pull/2002#discussion_r944876448
* Use named function syntax instead of function expressions
* Add explanation comment
* Remove unnecessary :bind directive
* Create CollapseBadge component
* Move :global selector into .plain-text-input
* Add comment explaining box-shadow pseudo-element
* Move Collapsible from EditingArea, PlainTextInput and RichTextInput into user components
* Rename SecondaryInputBadge to PlainTextBadge and remove generalization logic
I kept the rich text icon inside icons.ts for future use.
* Sort imports
* Fix background-color for duplicates not showing
with yet another pseudo-element :)
The pseudo-element that covers up field borders on scroll caused this issue. Fighting fire with fire here.
* Increase size of plain text toggle to original value again
This makes the clickable area a bit bigger and looks slightly more consistent with StickyBadge.
* Scrap pseudo-element mess in LabelContainer and tackle the actual issue
* Add class .visible to StickyBadge too
This introduces a peculiar bug: The active prop of StickyBadge resets to false when the mouse leaves the field - regardless of the actual back-end value.
* Fix sticky badge resetting on mouseleave/blur
* Apply overflow: hidden only during transition
fixes MathJax handle getting cut off by fields
* Remove unused variable
* Fix visual bug caused by overflow:hidden not applying in time
I tried several asynchronous approaches, but they all caused issues: either they prevented the CSS transition or they made field inputs lose focus.
In the end I resorted to direct, synchronous DOM-manipulation and added an explanatory comment.
* Decrease Collapsible load time by blocking first transition
I noticed the sliding animation has a hefty performance impact when a large number of fields is loaded simultaneously.
Blocking the first transition (which isn't even visible) results in a big boost in load time.
* Replace usages of gap with margins for children
* Revert unnecessary removal of grid-gap definition
* Correct comments about flex-gap property
mistook that for grid-gap.
* Resolve style issues
* Add minimum targets to gap comment
Co-authored-by: Henrik Giesel <hengiesel@gmail.com>
* Introduce field setting to use plain text editor by default
* 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.
* 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
* Export surrounder directly from RichTextInput
* Change wording in editor/surround
* Remove empty line
* Change wording
* Fix interfaces
* Add field description directly in NoteEditor
* Strip description logic from ContentEditable
* Make RichTextInput position: relative
* Make attachToShadow an async function
* Apply field styling to field description
* Show FieldDescription only if content empty
* Remove descriptionStore and descriptionKey
* Revert "Make attachToShadow an async function"
This reverts commit b62705eadf7335c7ee0c6c8797047e1f1ccdbf44.
SvelteActionReturnType does not accept Promise<void>
* Fix mess after merge commit
* Require registering surround formats
* Add deck-specific limits to DeckNormal
* Add deck-specific limits to schema11
* Add DeckLimitsDialog
* deck_limits_qt6.py needs to be a symlink
* Clear duplicate deck setting keys on downgrade
* Export deck limits when exporting with scheduling
* Revert "deck_limits_qt6.py needs to be a symlink"
This reverts commit 4ee7be1e10c4e8c49bb20de3bf45ac18b5e2d4f6.
* Revert "Add DeckLimitsDialog"
This reverts commit eb0e2a62d33df0b518d9204a27b09e97966ce82a.
* Add day limits to DeckNormal
* Add deck and day limits mock to deck options
* Revert "Add deck and day limits mock to deck options"
This reverts commit 0775814989e8cb486483d06727b1af266bb4513a.
* Add Tabs component for daily limits
* Add borders to tabs component
* Revert "Add borders to tabs component"
This reverts commit aaaf5538932540f944d92725c63bb04cfe97ea14.
* Implement tabbed limits properly
* Add comment to translations
* Update rslib/src/decks/limits.rs
Co-authored-by: Damien Elmes <dae@users.noreply.github.com>
* Fix camel case in clear_other_duplicates()
* day_limit → current_limit
* Also import day limits
* Remember last used day limits
* Add day limits to schema 11
* Tweak comment (dae)
* Exclude day limit in export (dae)
* Tweak tab wording (dae)
* Update preset limits on preset change
* Explain tabs in tooltip (dae)
* Omit deck and today limits if v2 is enabled
* Preserve deck limit when switching to today limit
* Remove most of the original description placeholder implementation
* Move description showing logic to RichTextInput
- there is no need to propagate it to ContentEditable
* Remove the @html from field-description
This actually worked - however I removed it in case we'd rather offer
markdown support or something else in the future.
* Do not remove placeholder already on focus
- Other editors do not do it either
* Hide via hidden attribute instead of unmounting
* Do not pass content to ContentEditable
* Sort imports
* Change placeholder text color (dae)
In day mode, slightly-grey is almost indistinguishable from black
(at least on the monitor I'm using here)
* Don't use special label for tags column
This was setting the label of whichever column the user chose for tags
to "Tags". Showing field content is more helpful.
* Map tags column automatically like fields
It appears that a variable bound to the `innerHTML` property of
a contenteditable element is only updated when `input` event fires on
the element, and not when changes are made to the DOM programmatically.
* Format scss correctly so it passes ts:format
* Use on and singleCallback in ImageHandle and MathjaxHandle
* Add a few comments
* Fix relict of partial commit
* Fix 'element not found' in ImageHandle
* Remove setting css on image handle twice
* Remove use of container in ImageHandle
* Remove use of container in MathjaxHandle
* Use unprefixed properties of RichTextInputAPI
* Inline api to get to RichTextInputAPI
* Join customStyles into RichTextInputAPI
* Export RichTextInput; Remove SetContext
* Address eslint and svelte_check
- This is useful when you want to set up hooks, etc. on the EditorField
component
- Because when you can only use the NoteEditor export, you cannot notice
when fields are mounted or destroyed
* Move field description into EditingArea as placeholder
* Prevent insertion of breaks into empty fields
to allow :empty CSS selector to also work on fields other than the first one.
* Remove redundant setContext from EditingArea
* Fix import order
* Revert "Prevent insertion of breaks into empty fields"
This reverts commit 1615fd5cf441b1047dae6a34265acb9c5cae50b2.
* Use class:empty instead of :empty CSS pseudo-class
* Restrict description to single line, ellipse overflow
* Make description in field dialog a bit clearer
* Allow webviews to opt in to default D&D handling
* Remove redundant webview.js include
* Block default drag & drop behavior in reviewing screens
* Fix mypy error
* Fix footer moving upwards
* Fix column detection
Was broken because escaped line breaks were not considered.
Also removes delimiter detection on `#columns:` line. User must use tabs
or set delimiter beforehand.
* Add CSV preview
* Parse `#tags column:`
* Optionally export deck and notetype with CSV
* Avoid clones in CSV export
* Prevent bottom of page appearing under footer (dae)
* Increase padding to 1em (dae)
With 0.5em, when a vertical scrollbar is shown, it sits right next to
the right edge of the content, making it look like there's no right
margin.
* Experimental changes to make table fit+scroll (dae)
- limit individual cells to 15em, and show ellipses when truncated
- limit total table width to body width, so that inner table is shown
with scrollbar
- use class rather than id - ids are bad practice in Svelte components,
as more than one may be displayed on a single page
* Skip importing foreign notes with filtered decks
Were implicitly imported into the default deck before.
Also some refactoring to fetch deck ids and names beforehand.
* Hide spacer below hidden field mapping
* Fix guid being replaced when updating note
* Fix dupe identity check
Canonify tags before checking if dupe is identical, but only add update
tags later if appropriate.
* Fix deck export for notes with missing card 1
* Fix note lines starting with `#`
csv crate doesn't support escaping a leading comment char. :(
* Support import/export of guids
* Strip HTML from preview rows
* Fix initially set deck if current is filtered
* Make isHtml toggle reactive
* Fix `html_to_text_line()` stripping sound names
* Tweak export option labels
* Switch to patched rust-csv fork
Fixes writing lines starting with `#`, so revert 5ece10ad05f331.
* List column options with first column field
* Fix flag for exports with HTML stripped
* Add crate csv
* Add start of csv importing on backend
* Add Menomosyne serializer
* Add csv and json importing on backend
* Add plaintext importing on frontend
* Add csv metadata extraction on backend
* Add csv importing with GUI
* Fix missing dfa file in build
Added compile_data_attr, then re-ran cargo/update.py.
* Don't use doubly buffered reader in csv
* Escape HTML entities if CSV is not HTML
Also use name 'is_html' consistently.
* Use decimal number as foreign ease (like '2.5')
* ForeignCard.ivl → ForeignCard.interval
* Only allow fixed set of CSV delimiters
* Map timestamp of ForeignCard to native due time
* Don't trim CSV records
* Document use of empty strings for defaults
* Avoid creating CardGenContexts for every note
This requires CardGenContext to be generic, so it works both with an
owned and borrowed notetype.
* Show all accepted file types in import file picker
* Add import_json_file()
* factor → ease_factor
* delimter_from_value → delimiter_from_value
* Map columns to fields, not the other way around
* Fallback to current config for csv metadata
* Add start of new import csv screen
* Temporary fix for compilation issue on Linux/Mac
* Disable jest bazel action for import-csv
Jest fails with an error code if no tests are available, but this would
not be noticable on Windows as Jest is not run there.
* Fix field mapping issue
* Revert "Temporary fix for compilation issue on Linux/Mac"
This reverts commit 21f8a261408cdae49ec031aa21a1b659c4f66d82.
* Add HtmlSwitch and move Switch to components
* Fix spacing and make selectors consistent
* Fix shortcut tooltip
* Place import button at the top with path
* Fix meta column indices
* Remove NotetypeForString
* Fix queue and type of foreign cards
* Support different dupe resolution strategies
* Allow dupe resolution selection when importing CSV
* Test import of unnormalized text
Close #1863.
* Fix logging of foreign notes
* Implement CSV exports
* Use db_scalar() in notes_table_len()
* Rework CSV metadata
- Notetypes and decks are either defined by a global id or by a column.
- If a notetype id is provided, its field map must also be specified.
- If a notetype column is provided, fields are now mapped by index
instead of name at import time. So the first non-meta column is used for
the first field of every note, regardless of notetype. This makes
importing easier and should improve compatiblity with files without a
notetype column.
- Ensure first field can be mapped to a column.
- Meta columns must be defined as `#[meta name]:[column index]` instead
of in the `#columns` tag.
- Column labels contain the raw names defined by the file and must be
prettified by the frontend.
* Adjust frontend to new backend column mapping
* Add force flags for is_html and delimiter
* Detect if CSV is HTML by field content
* Update dupe resolution labels
* Simplify selectors
* Fix coalescence of oneofs in TS
* Disable meta columns from selection
Plus a lot of refactoring.
* Make import button stick to the bottom
* Write delimiter and html flag into csv
* Refetch field map after notetype change
* Fix log labels for csv import
* Log notes whose deck/notetype was missing
* Fix hiding of empty log queues
* Implement adding tags to all notes of a csv
* Fix dupe resolution not being set in log
* Implement adding tags to updated notes of a csv
* Check first note field is not empty
* Temporary fix for build on Linux/Mac
* Fix inverted html check (dae)
* Remove unused ftl string
* Delimiter → Separator
* Remove commented-out line
* Don't accept .json files
* Tweak tag ftl strings
* Remove redundant blur call
* Strip sound and add spaces in csv export
* Export HTML by default
* Fix unset deck in Mnemosyne import
Also accept both numbers and strings for notetypes and decks in JSON.
* Make DupeResolution::Update the default
* Fix missing dot in extension
* Make column indices 1-based
* Remove StickContainer from TagEditor
Fixes line breaking, border and z index on ImportCsvPage.
* Assign different key combos to tag editors
* Log all updated duplicates
Add a log field for the true number of found notes.
* Show identical notes as skipped
* Split tag-editor into separate ts module (dae)
* Add progress for CSV export
* Add progress for text import
* Tidy-ups after tag-editor split (dae)
- import-csv no longer depends on editor
- remove some commented lines
Calling `moveCaretToEnd()` when `richText` is empty will cause the first keystroke of
ibus-based input methods with candidates to goes double. For example, if you
type "a" it becomes "aa". This problem exists in many linux distributions.
When `richText` is empty, there is no need to place the caret, just return
as a workaround.
Issue was introduced in 7922f18296
when the styling was moved into base.scss. From what I can tell, there
are two locations where the current styling is required:
- the editor, to ensure the tags are shown at the bottom
- the change notetype screen, which requires this styling for a sticky
bar at top
I'm no CSS guru, so if someone thinks this could be solved in a better
way, please submit a follow-up PR.
Closes#1782
Re: https://forums.ankiweb.net/t/anki-2-1-53-release-candidate/20122/2
Autoloads in MathJax are asynchronous, and the caller is expected to
use asynchronous APIs when they are in use [1]. The editor uses the synchronous
tex2svg(), which throws a "MathJax retry" error when an autoload package
has not yet loaded. Attempting to use the package before it has loaded
appears to break future invocations as well, so the package fails to work
at all until a new webview is created.
The following HTML will reproduce the issue when added to a single card
in a new profile:
```
<strong>6 </strong>Every combination of <anki-mathjax>\boldsymbol{v}=(1,-2,1)</anki-mathjax> and <anki-mathjax>\boldsymbol{w}=(0,1,-1)</anki-mathjax> has components that add to _____.<br>
```
Ideally we'd switch the MathJax rendering to be asynchronous, but that
didn't work well when I tried it in #1862. For now I've just switched
to the full package, which adds about 130KB to the final minified JS
(2.76MB), and likely slows down editor loading somewhat.
[1] https://github.com/mathjax/MathJax/issues/2557#issuecomment-727655089
* Remove custom config and use tex-chtml-full for editor Mathjax
* Add mathjax package in /ts
* Share mathjax config between tex-svg and tex-chtml
* Use "[+]" in Mathjax config again
* Remove mention of MathJaxReady
* Satisfy eslint
* Move focus into input field, when input is shown
* Change trapFocusOut to move focus into available inputs
- This means that e.g. closing the HTML editor with focus in it will
focus the visual editor in turn
* Prevent Control+A unselecting tag editor when no tags exist
* Add ResizableImage.svelte in ts/editable
* Set image constrained via attributes instead of managed style sheet
* Implement new constrained size method
* Turn WithImageConstrained.svelte into normal ts file
* Introduce removeStyleProperties
Removes "style" attribute if all style properties were cleared
* Avoid --editor-width and use one variable set on container
* Disable shrinking if already smaller than shrunken size
* Add button to restore image to original size
* Don't allow restoring original size if no custom width set
* Bottom-center HandleLabel
* Satisfy svelte-check
This was implemented by me to prevent seemingly empty fields,
which however still contain some HTML (e.g. <div></div>) and
thus will trigger in the templates.
However it only worked in very limited cases, maybe we could
solve this better by indicating whether a field has content somehow.
* Instead of transforming to {\lt}, transform to <
- In Mathjax editor
- This way you can also use Mathjax convenience shortcuts like <=> in
chemistry mode: \ce{<=>}
* Remove unused translateEntitiesToMathjax() (dae)
https://github.com/ankitects/anki/pull/1818#discussion_r857238310
In the absence of strong arguments either way, and given the fact that
strong/em has broken a few (perhaps rare) use-cases, reverting seems
prudent. But happy to revisit this again in the future if someone has
a convincing argument for why we should be doing it differently.
Closes#1807
* Fix shift removing bold formatting
* Remove input handler on selection change
We listened to "non-input events" mostly to catch events that
change the selection (like Ctrl-a, or arrow keys) anyway
* Revert "Revert "Speed up editor by lazily loading CodeMirror (#1766)""
This reverts commit b0a2884f19.
* Pass in options via action update + Make access to editor optional
* First attempt at adding a directory for icons under //ts
* Fix image import
* Fix import order
* Add cloze button group
* Fix issue with toolbar.toolbar dynamically slottable
* Change tooltip for repeating cloze deletion
* Fix repeat cloze button not working on macOS (dae)
* Use async function in PlainTextInput
* Clean up PlainTextInput
* Refactor logic from {Rich,Plain}TextInput into own files
* Remove prohibited tags on content.subscribe which also parses the html
Issue report:
https://forums.ankiweb.net/t/anki-2-1-50-beta-6-release-candidate/18181/71
Localization was added in #1566. It works fine in the Qt5 build, but
the Qt6 build appears broken. This appears to be a change in Chromium,
and the latest Chrome has the same issue. Whether it's a legitimate bug
on their end, a deliberate change in behaviour, or we're doing something
wrong, I do not know.
* Extend maximum answer time...
Previously the time allowed to answer a question was capped at 10 minutes.
While this makes sense for fact recall, it limits the utility of Anki when
used for solving problems that can take more time to work through. This
extends the maximum answer time to 2 hours, which seems to be a reasonable
upper limit for solving a math or algorithm question.
* Add warning when max answer time exceeds 10 minutes
* Move warning below input field
* Start using WithFloating for SelectedTagBadge
* Adjust arrow on WithFloating for all directions
* Move TagOptionsBadge to its own sub directory
* Show autocomplete menu via WithFloating
* Have WithFloating return asReference instead of initializing its own reference element
* Add html: overflow: hidden for editor
* Replace ButtonToolbar with generic div
* Move scroll logic into autocomplete item + restrict Popover width to 95vw
* Fix autocomplete menu after pressing enter after selecting
- should not trigger an autocomplete choose
* Overlap TagInput perfectly with Tag
* Satisfy formatter
* Fix autocompletion item scrolling too much
* Remove unused Tag.svelte focusable prop
* Remove console.log
* Fix floating arrow is a diamond in dark mode
* Set autocompletion menu to 80vw
* Load fields_web from fields.py if appropriate flag is set
* Add FieldsPage as entry for new fields view
* Pass mypy
* Fix pylint
* Fix fields_web in Qt5 (dae)
May not be related to the CI error, but required for compatibility
with Qt5.
* Implement a first version of WithFloating and Portal
* Add outside slot for Portal
* Execute computePosition from WithFloating
* Set up a first example of new WithFloating with the Latex menu
* Use autoUpdate in WithFloating
* Create sveltelib/position
* Add event-store
* Use event-store in close-on-click
* Implement subscribeToUpdates
* Introduce sass/elevation
* Split close-on-click to closing-click and subscribe-trigger
* Have closing-* stores return a symbol
- This way they act more of an EventEmitter than a store
* Allow passing show store
* Remove styling on float on updatePosition removal
* Implement a nice border for dropdowns
* Apply different border and box-shadow to Popover in dark/light theme
* Fix Ctrl+Shift+T not working
* Satisfy formatters and tests
* Add copyright header
* move copyright header to top (dae)
* Use async functions in CodeMirror.svelte
* Fix using async functions by modifying svelte-preprocess output
* Revert "Fix using async functions by modifying svelte-preprocess output"
This reverts commit 94c9cadaaa3ca2084780833e9efc7807f2f1d1a9.
Trying a different fix.
* Change TypeScript target to ES2019
Protobuf 3.15 introduced support for marking scalar fields like
uint32 as optional, and all of our tooling appears to support it
now. This allows us to use simple optional/null checks in our Rust/
TypeScript code, without having to resort to an inner message.
I had to apply a minor patch to protobufjs to get this working with
the json-module output; this has also been submitted upstream:
https://github.com/protobufjs/protobuf.js/pull/1693
I've modified CardStatsResponse as an example of the new syntax.
One thing to note: while the Rust and TypeScript bindings use optional/
null fields, as that is the norm in those languages, Google's Python
bindings are not very Pythonic. Referencing an optional field that is
missing will yield the default value, and a separate HasField() call
is required, eg:
```
>>> from anki.stats_pb2 import CardStatsResponse as R
... msg = R.FromString(b"")
... print(msg.first_review)
... print(msg.HasField("first_review"))
0
False
```
* Move Trigger into its own file
* Try implement HandlerList
* Implement new input handler and handler-list
* Use new refocus HandlerList in TextColorButton
* Fix TextColorButton on windows
* Move ColorPicker to editor-toolbar
* Change trigger behavior of overwriteSurround
* Fix mathjax-overlay flushCaret
* Insert image via bridgeCommand return value
* Fix invoking color picker with F8
* Have remove format work even when collapsed
* Satisfy formatter
* Insert media via callback resolved from python
* Replace print with web.eval
* Fix python formatting
* remove unused function (dae)
* Clarify some comments
* Don't destructure insertion trigger
* Make superscript and subscript use domlib/surround
* Create new {Text,Highlight}ColorButton
* Use domlib/surround for textcolor
- However there's still a crucial bug, when you're breaking existing
colored span when unsurrounding, their color is not restored
* Add underline format to removeFormats
* Simplify type of ElementMatcher and ElementClearer for end users
* Add some comments for normalize-insertion-ranges
* Split normalize-insertion-ranges into remove-adjacent and remove-within
* Factor out find-remove from unsurround.ts
* Rename merge-mach, simplify remove-within
* Clarify some comments
* Refactor first reduce
* Refactor reduceRight
* Flatten functions in merge-ranges
* Move some functionality to merge-ranges and do not export
* Refactor merge-ranges
* Remove createInitialMergeMatch
* Finish refactoring of merge-ranges
* Refactor merge-ranges to minimal-ranges and add some unit testing
* Move more logic into text-node
* Remove most most of the logic from remove-adjacent
- remove-adjacent is still part of the "merging" logic, as it increases
the scope of the child node ranges
* Add some tests for edge cases
* Merge remove-adjacent logic into minimal-ranges
* Refactor unnecessary list destructuring
* Add some TODOs
* Put removing nodes and adding new nodes into sequence
* Refactor MatchResult to MatchType and return clear from matcher
* Inline surround/helpers
* Shorten name of param
* Add another edge case test
* Add an example where commonAncestorContainer != normalization level
* Fix bug in find-adjacent when find more than one nested nodes
* Allow comments for Along type
* Simplify find-adjacent by removing intermediate and/or curried functions
* Remove extend-adjacent
* Add more tests when find-adjacent finds by descension
* Fix find-adjacent descending into block-level elements
* Add clarifying comment to refusing to descend into block-level elements
* Move shifting logic into find-adjacent
* Rename file matcher to match-type
* Give a first implemention of TreeVertex
* Remove MatchType.ALONG
- findAdjacent now directly modifies the range
* Rename MatchType.MATCH into MatchType.REMOVE
* Implement a version of find-within that utilizies match-tree
* Turn child node range into a class
* Fix bug in new find-adjacent function
* Make all find-adjacent tests test for ranges
* Surrounding within farthestMatchingAncestor when available
* Fix an issue with negligable elements
- also rename "along" elements to "negligable"
* Add two TODOs to SurroundFormat interface
* Have a messy first implementation of the new tree-node algorithm
* Maintain whether formatting nodes are covered or within user selection
* Move covered and insideRange into TreeNode superclass
* Reimplement findAdjacent logic
* Add extension logic
* Add an evaluate method to nodes
* Introduce BlockNode
* Add a first evaluate implementation
* Add left shift and inner shift logic
* Implement SurroundFormatUser
* Allow pass in formatter, ascender and merger from outside
* Fix insideRange and covered switch-up
* Fix MatchNode.prototype.isAscendable
* Fix another switch-up of covered and insideRange...
* Remove a lot of old code
* Have surround functions only return the range
- I still cannot think of a good reason why we should return addedNodes
and removedNodes, except for testing.
* Create formatting-tree directory
* Create build-tree directory + Move find-above up to /domlib
* Remove range-anchors
* Move unsurround logic into no-splitting
* Fix extend-merge
* Fix inner shift being eroneusly returned as left shift
* Fix oversight in SplitRange
* Redefine how ranges are recreated
* Rename covered to insideMatch and put as fourth parameter instead of third
* Keep track of match holes and match leaves
* Rename ChildNodeRange to FlatRange
* Change signature of matcher
* Fix bug in extend-merge
* Improve Match class
* Utilize cache in TextColorButton
* Implement getBaseSurrounder for TextColorButton
* Add matchAncestors field to FormattingNode
* Introduce matchAncestors and getCache
* Do clearing during parsing already
- This way, you know whether elements will be removed before getting to
Formatting nodes
* Make HighlightColorButton use our surround mechanism
* Fix a bug with calling .removeAttribute and .hasAttribute
* Add side button to RemoveFormat button
* Add disabled to remove format side button
* Expose remove formats on RemoveFormat button
* Reinvent editor/surround as Surrounder class
* Fix split-text when working with insert trigger
* Try counteracting the contenteditable's auto surrounding
* Remove matching elements before normalizing
* Rewrite match-type
* Move setting match leaves into build
* Change editing strings
- So that color strings match bold/italic strings better
* Fix border radius of List options menu
* Implement extensions functionality
* Remove some unnecessary code
* Fix split range endOffset
* Type MatchType
* Reformat MatchType + add docs
* Fix domlib/surround/apply
* Satisfy last tests
* Register Surrounder as package
* Clarify some comments
* Correctly implement reformat
* Reformat with inactive eraser formats
* Clear empty spans with RemoveFormatButton
* Fix Super/Subscript button
* Use ftl string for hardcoded tooltip
* Adjust wording
This was inadvertently dropped in 478b3a53f1,
but AnkiWeb requires it.
In the future we will need to give these index pages a bit more thought,
as it's not very helpful to be exporting a creation function if we're
automatically mounting as the module is imported. Dropping the automatic
mounting would give us more flexibility, but currently that leads to
a FOUC in night mode, as the webview is revealed prior to a subsequent
web.eval() call being able to fire.
* avoid repinning Rust deps by default
* add id_tree dependency
* Respect intermediate child limits in v3
* Test new behaviour of v3 counts
* Rework v3 queue building to respect parent limits
* Add missing did field to SQL query
* Fix `LimitTreeMap::is_exhausted()`
* Rework tree building logic
https://github.com/ankitects/anki/pull/1638#discussion_r798328734
* Add timer for build_queues()
* `is_exhausted()` -> `limit_reached()`
* Move context and limits into `QueueBuilder`
This allows for moving more logic into QueueBuilder, so less passing
around of arguments. Unfortunately, some tests will require additional
work to set up.
* Fix stop condition in new_cards_by_position
* Fix order gather order of new cards by deck
* Add scheduler/queue/builder/burying.rs
* Fix bad tree due to unsorted child decks
* Fix comment
* Fix `cap_new_to_review_rec()`
* Add test for new card gathering
* Always sort `child_decks()`
* Fix deck removal in `cap_new_to_review_rec()`
* Fix sibling ordering in new card gathering
* Remove limits for deck total count with children
* Add random gather order
* Remove bad sibling order handling
All routines ensure ascending order now.
Also do some other minor refactoring.
* Remove queue truncating
All routines stop now as soon as the root limit is reached.
* Move deck fetching into `QueueBuilder::new()`
* Rework new card gather and sort options
https://github.com/ankitects/anki/pull/1638#issuecomment-1032173013
* Disable new sort order choices ...
depending on set gather order.
* Use enum instead of numbers
* Ensure valid sort order setting
* Update new gather and sort order tooltips
* Warn about random insertion order with v3
* Revert "Add timer for build_queues()"
This reverts commit c9f5fc6ebe87953c17a0c842990b009b5596c69c.
* Update rslib/src/storage/card/mod.rs (dae)
* minor wording tweaks to the tooltips (dae)
+ move legacy strings to bottom
+ consistent capitalization (our leech action still needs fixing,
but that will require introducing a new 'suspend card' string as the
existing one is used elsewhere as well)
* Fix field not being restored after Undo, if field also has focus
* Execute moveCaretToEnd after undoing a change
- Otherwise the caret might be placed in seemingly random positions
* Fix wording of comments
* Remove autofocus functionality of EditingArea
- instead await a tick in focusField
- We used the autofocus prop for the initial focus setting when opening the
editor. However it seems that awaiting tick in focusField also does the trick.
* Make eslint sort our imports
* fix missing deps in eslint rule (dae)
Caught on Linux due to the stricter sandboxing
* Remove exports-last eslint rule (for now?)
* Adjust browserslist settings
- We use ResizeObserver which is not supported in browsers like KaiOS,
Baidu or Android UC
* Raise minimum iOS version 13.4
- It's the first version that supports ResizeObserver
* Apply new eslint rules to sort imports
* Add componentHook functionality
* Register package NoteEditor
* Rename OldEditorAdapter to NoteEditor
* Expose instances in component-hook as well
* Rename NoteTypeButtons to NotetypeButtons
* Move PreviewButton initialization to BrowserEditor.svelte
* Remove focusInRichText
- Same thing can be done by inspecting activeInput
* Satisfy formatter
* Fix remaining rebase issues
* Add .bazel to .prettierignore
* Rename currentField and activeInput to focused{Field,Input}
* Move identifier to lib and registration to sveltelib
* Fix Dynamic component insertion
* Simplify editingInputIsRichText
* Give extra warning in svelte/svelte.ts
- This was caused by doing a rename of a files, that only differed in
case: NoteTypeButtons.svelte to NotetypeButtons.svelte
- It was quite tough to figure out, and this console.log might make it
easier if it ever happens again
* Change signature of contextProperty
* Add ts/typings for add-on definition files
* Add Anki types in typings/common/index.d.ts
* Export without .svelte suffix
It conflicts with how Svelte types its packages
* Fix left over .svelte import from editor.py
* Rename NoteTypeButtons to unrelated to ensure case-only rename
* Rename back to NotetypeButtons.svelte
* Remove unused component-hook.ts, Fix typing in lifecycle-hooks
* Merge runtime-require and register-package into one file
+ Give some preliminary types to require
* Rename uiDidLoad to loaded
* Fix eslint / svelte-check
* Rename context imports to noteEditorContext
* Fix import name mismatch
- I wonder why these issues are not caught by svelte-check?
* Rename two missed usages of uiDidLoad
* Fix ButtonDropdown from having wrong border-radius
* Uniformly rename libraries to packages
- I don't have a strong opinion on whether to name them libraries or
packages, I just think we should have a uniform name.
- JS/TS only uses the terms "module" and "namespace", however `package`
is a reserved keyword for future use, whereas `library` is not.
* Refactor registration.ts into dynamic-slotting
- This is part of an effort to refactor the dynamic slotting (extending
buttons) functionality out of components like ButtonGroup.
* Remove dynamically-slottable logic from ButtonToolbar
* Use DynamicallySlottable in editor-toolbar
* Fix no border radius on indentation button dropdown
* Fix AddonButtons
* Remove Item/ButtonGroupItem in deck-options, where it's not necessary
* Remove unnecessary uses of Item and ButtonGroupItem
* Fix remaining tests
* Fix relative imports
* Revert change return value of remapBinToSrcDir to ./bazel/out...
* Remove typings directory
* Adjust comments for dynamic-slottings
* Put PlainTextInput into its own directory
* Create a directory for RichTextInput
* Create editor-toolbar directory
* Move PreviewButton into editor-toolbar
* The time to refactor this is not quite yet here
* Create tag-editor directory
* Remove some of the uses of WithShortcut
* Remove all uses of WithShortcut from editor package
* Remove last uses of WithShortcut
* Fix typo
Unfortunately 5efaf5a4be broke the Svelte
language tools - presumably having paths outside of the repo is confusing
them.
As a plan B, the symlinks have been shifted to a single subdir. Along
with some exclusions in the VS Code config, this should allow VS Code
to continue to work out of the box, but the docs will need updating
to reflect the extra work required for PyCharm/IntelliJ.
+ fix svelte-check execution on a system without node installed. It
still throws up some errors that are presumably caused by our multiple
rootDirs - not sure if there's an easy way to work around that.
* Add _bytes methods for all methods in the backend
Expose get_note in qt/aqt/mediasrv.py
* Satisfy formatter
* Rename _bytes function to _raw and have them bytes as input
* Fix backend generation
* Use lib/proto/deckOptions in deck-options
* Add exposed_backend to qt/aqt/mediasrv.py
* Move some more backend methods to exposed_backend_list
* Use protobufjs for congrats and i18n
* Use protobufjs for completeTag
* Use protobufjs services in change-notetype
* Reorder post handlers in alphabetical manner
* Satisfy tests
* Remove unused collection methods
* Rename access_backend to raw_backend_request
* Use _vendor.stringcase instead of creating a new function
* Remove SKIP_UNROLL_OUTPUT
* Directly call _run_command in non _raw methods
* Remove TranslateString, ChangeNotetype and CompleteTag from SKIP_UNROLL_INPUT
* Remove UpdateDeckConfigs from SKIP_UNROLL_INPUT
* Remove ChangeNotetype from SKIP_UNROLL_INPUT
* Remove SKIP_UNROLL_INPUT
* Fix typing issue with translate_string
- Adds typing support for Protobuf maps in genbackend.py
* Do not emit convenience method for protobuf TranslateString
* Improve side margins in card info screen
* Improve top margin in deck options screen
* Hide revlog time of day on narrow screens
* Remove monospace for now (dae)
* Move some AddCards specific code to NoteCreator.svelte
* Add new strings for Toggling the Visual / HTML editor
* Set LabelContainer vertical-align to text-top
- Makes them look more centered
* Remove appendInParentheses helper
* Make all ts/*.html files include only module.js and module.css
* Move any JS from .html to index files
* Remove .html files from ts modules
* Remove Python with Starlark implemenation
* Remove reference to non-existing file
* Remove deck-option.html as well
* fix change-notetype screen (dae)
- fixes warnings about security issues in marked/markdown-it
- jsdoc is mostly unmaintained at this point, and we need to override
its dependencies manually
- typescript is still pinned
* Forbid inserting object and iframe tags via PlainTextInput
* Add optional browserMode parameter to Editor
* Create new ts modules for three editor instances
- note-creator for AddCards
- browser-editor for the editor in the Browser
- reviewer-editor for the EditCurrent
* Revert "Forbid inserting object and iframe tags via PlainTextInput"
This reverts commit ab90ae8194494d883a1863126496e2d8f332509e.
* Refactor browserMode to editorMode
* Move new editor variants inside /ts/editor directory
* Fix typo
* Avoid initial call of mirror-dom
* Disable updateFocus from OldEditorAdapter
* fixes IME input duplication bug
* Fix saving of latestLocation for ContentEditable
* Fix IME after calling placeCaretAfterContent
* Export other libraries from domlib/index.ts
* Remove dead code
+ Uncomment code which was mistakenly left commmented
* Use nested tables in revlog
This allows for centered rows, while still preserving internal
alignment.
* Fix hidden columns
* Replace inner tables with flexbox divs
* Replace revlog table with flexbox divs
* Replace flex-gap in revlog
Unsupported on iOS and Qt5.
* Move move-nodes logic into domlib
Refactor input-manager
Refactor out FocusTrap from EditingArea
Remove unnecessary selecting of node from surround
Add onInput interface to input-manager
Create MathjaxElement.svelte
- This should contain all the setup necessary for displaying
<anki-mathjax> elements in the rich text input
- Does not contain setup necessary for Mathjax Overlay
Deal with backwards deletion, when caret inside anki-mathjax
Set mathjax elements contenteditable=false
Do not undecorate mathjaxx element on disconnect
- Fixes issues, where Mathjax might undecorate when it is moved into a
different div
Add framed element custom element
Introduce iterateActions to allow global hooks for RichTextInput
Remove some old code
Deal with deletion of frame handles
Make Anki frame and frame handles restore each other
Make FrameElement restore its structure upon modification
Frame and strip off framing from MathjaxElement automatically
Move FrameHandle to separate FrameStart/FrameEnd
Refactor FrameHandle
Set data-frames on FrameElement
Fix logic error connected to FrameElement
Communicate frameHandle move{in,out} to anki-mathjax
Clear selection when blurring ContentEditable
Make sure frame is destroyed when undecorating Mathjax
Use Hairline space instead of zeroWidth
- it has better behavior in the contenteditable when placing the caret
via clicking
Allow detection of block elements with `block` attribute
- This way, anki-mathjax block="true" will make field a
field be recognized to have block content
Make block frame element operater without handles
- Clicking on the left/right side of a block mathjax will insert a br
element to that side
When deleting, remove mathajax-element not just image
Update MathjaxButtons to correctly show block state
SelectAll when moving into inline anki mathjax
Remove CodeMirror autofocus functionality
Move it to Mathjaxeditor directly
Fix getRangeAt throwing error
Update older code to use cross-browser
Fix issue with FrameHandles not being properyly removed
Satisfy formatting
Use === instead of node.isSameNode()
Fix issue of focusTrap not initialized
* Fix after rebasing
* Fix focus not being moved to first field
* Add documentation for input-manager and iterate-actions
* Export logic of ContentEditable to content-editable
* Fix issue with inserting newline right next to inline Mathjax
* Fix reframing issue of Mathjax Svelte component
* Allow for deletion of Inline Mathjax again
* Rename iterate-actions to action-list
* Add copyright header
* Split off frame-handle from frame-element
* Add some comments for framing process
* Add mising return types
* Add thousands comma separator for card counts graph
* Fix Answer Buttons graph's tooltip
Changes to the "times pressed" heading
* Shows the percent of that button out of all the presses
* Comma separates total on thousands
* Update CONTRIBUTERS
* Wider spacing for graph tables
* Switch to locale-based stats numbers
* Update CONTRIBUTORS
Wrong email?
* Fix counts graph on narrow devices
Graph and table now align in a column when the device's screen is narrow. Columns widths are bounded to not get too wide
* Rename toLocaleXXX functions
* toLocaleNumber -> localizedNumber
* toLocaleString -> localizedDate
Also cleans up sketchy "card counts" table formatting
* Localize more numbers
Uses locale-based rounding for more numbers now
* Localize graph axis ticks
* Fix future-due graph tooltip
* avoid div by zero (dae)
Ignoring NaN in localizedNumber() could potentially mask a mistake
in the future - better to explicitly handle the invalid case at the
source instead.
* Prevent unwanted <div> from being left behind when clearing field
* Use event.currentTarget instead of 'this'
* Check if event.data is empty for better performance
* Change order of conditions for better performance
* Fix media playback not terminating when previewer is closed
https://forums.ankiweb.net/t/anki-2-1-50-beta/15608/78
* Fix _on_preview_closed being called twice unnecessarily
The function was being called twice when the preview button is clicked
while the previewer is open.
* Fix console error caused by leftover code
The following error was shown in the console when closing previewer:
`Uncaught TypeError: Cannot read property 'classList' of null`
* Toggle state of preview button via 'active' prop
* Preload external css files to prevent flash of unstyled content
This is an implementation of the approach mentioned in the commit
message of 46b85d5.
* Tweak max_age value for css files
Ensure that css preloading works even on a slow PC.
* Fix steps being mistaken for seconds
* Cap steps at `u32::max` seconds
* Fix overflow of steps in Rust
* Prevent overflow of `IntervalKind`
* Prevent overflow in `revlod/mod.rs`
Also replace some `as` with `from` and `try_from` as is recommended to
highlight potential issues.
* Ensure v2 doesn't store overflowing revlog ivls
* Lower steps cap in deck options
Whereas large card intervals are converted to days, revlog intervals use
i32s to store large numbers of seconds.
* Format
* Add "Show duplicates" to LabelContainer
* Avoid bubbling down the duplicate logic into EditorField
* Move duplicate link into its own slot
to center it between name/description and field-state.
* Revert "Move duplicate link into its own slot"
This reverts commit 3a4511042da7083a52d67b58550b13d873dcbea5.
* Justify dupes within FieldState
to achieve the same result as before while avoiding additional logic within EditorField.
Co-Authored-By: Henrik Giesel <hengiesel@gmail.com>