Commit Graph

7552 Commits

Author SHA1 Message Date
Henrik Giesel
cf38cb334e Fix remaining errors in editor/*.svelte files 2021-05-07 15:10:28 +02:00
Henrik Giesel
6081a02558 Use MouseEvent instead of KeyboardEvent in WithShortcut
* otherwise the disabled button will allow it to pass through
2021-05-07 14:46:08 +02:00
Henrik Giesel
9e747a5744 Rename Detachable.detach to detached 2021-05-07 14:31:08 +02:00
Henrik Giesel
6a804f6775 Use json.dumps instead of backticks in editor.py 2021-05-07 14:22:06 +02:00
Henrik Giesel
49745e1282 Fix module name formatting 2021-05-07 02:14:54 +02:00
Henrik Giesel
de8abebcd1 Fix Preview Button after changing from f-string to normal string 2021-05-07 02:12:37 +02:00
Henrik Giesel
cc02563ca1 Fix Preview tooltip 2021-05-07 02:04:44 +02:00
Henrik Giesel
f50d81f787 Fix unused CSS selector issue in graphs introduced by updating Svelte 2021-05-07 02:04:44 +02:00
Henrik Giesel
15f306950d Use any in toolbar.ts for using context as parameter 2021-05-07 02:04:44 +02:00
Henrik Giesel
81cf2c9bd4 Turn on editor:eslint 2021-05-07 02:04:44 +02:00
Henrik Giesel
d1c99cfb7b Add copyright header 2021-05-07 02:04:44 +02:00
Henrik Giesel
b2eec9c3c3 Add ts-expect-error for module import in EditorToolbar 2021-05-07 02:04:44 +02:00
Henrik Giesel
2112b419f9 Fix ButtonDropdown 2021-05-07 02:04:44 +02:00
Henrik Giesel
193e2f9e60 Make LabelButtons support active notion 2021-05-07 02:04:44 +02:00
Henrik Giesel
0f4d4eb5a9 Only initialize extension apis if necessary 2021-05-07 02:04:44 +02:00
Henrik Giesel
c9368ed98f Add lefttopbtns as AddonButtons 2021-05-07 02:04:44 +02:00
Henrik Giesel
928f486867 Add ButtonToolbarItem as interface for modifying button groups 2021-05-07 02:04:44 +02:00
Henrik Giesel
4a6b3b3786 Clean up ButtonGroup and factor out extension logic 2021-05-07 02:04:44 +02:00
Henrik Giesel
e80f43e8fc Enable setting of PreviewButton and hiding of cloze button again 2021-05-07 02:04:42 +02:00
Henrik Giesel
862905c58a Fix typing issues 2021-05-07 02:03:55 +02:00
Henrik Giesel
9c1936698c Set tooltip for buttons correctly 2021-05-07 02:03:55 +02:00
Henrik Giesel
0371405c23 Use ButtonGroupItem for all buttons in editor 2021-05-07 02:03:55 +02:00
Henrik Giesel
bcb1b5d214 Set ButtonPosition via ButtonGroupItem 2021-05-07 02:03:55 +02:00
Henrik Giesel
e1cc22b9ee Add hiding functionality in ButtonGroup 2021-05-07 02:03:55 +02:00
Henrik Giesel
26f85a0f9d Add API for adding new buttons, updating existing ones in ButtonGroup 2021-05-07 02:03:55 +02:00
Henrik Giesel
413ac6cf63 Fix issue with dropdowns 2021-05-07 02:03:55 +02:00
Henrik Giesel
c1adebf2da Add .dropdown-menu class to DropdownMenu 2021-05-07 02:03:55 +02:00
Henrik Giesel
9d9df2a04b Add back ColorButtons 2021-05-07 02:03:55 +02:00
Henrik Giesel
bd31a19852 Activate FormatBlockButtons 2021-05-07 02:03:55 +02:00
Henrik Giesel
baff3df381 Add all format inline buttons 2021-05-07 02:03:55 +02:00
Henrik Giesel
982c85ded6 Export module functions from EditorToolbar 2021-05-07 02:03:55 +02:00
Henrik Giesel
0baf14dc8b Refactor {CommandIcon,Icon,Square}Button into IconButton and WithState 2021-05-07 02:03:55 +02:00
Henrik Giesel
2f5074bff6 Make StickyBar flex 2021-05-07 02:03:55 +02:00
Henrik Giesel
8aa3f5f2fa Translate ts files in ts/editor to svelte files 2021-05-07 02:03:55 +02:00
Henrik Giesel
47b1cfe804 Rename editor-toolbar to components 2021-05-07 02:03:55 +02:00
Henrik Giesel
59876439e7 Add StickyBar.svelte WithTheming.svelte 2021-05-07 02:03:55 +02:00
Henrik Giesel
4736b1ce1c Move Notetype buttons to using slots instead of dynamic components 2021-05-07 02:03:55 +02:00
Henrik Giesel
6d6c798ca3 Simplify structure of EditorToolbar and ButtonGroup in editor HTML file 2021-05-07 02:03:55 +02:00
Damien Elmes
af2c7c0744 fix missing keyboard modifier translations on Linux/Windows
https://forums.ankiweb.net/t/card-browser-hotkeys-semi-broken/9815
2021-05-07 09:30:06 +10:00
Damien Elmes
d878de54c0 default to the v2 scheduler in new collections
ported from 53d9433d94
2021-05-06 19:09:28 +10:00
Damien Elmes
fc2d3ba07c remove AnkiDroid timezone confirmation
By the time this update reaches stable, AnkiDroid 2.15 should already
be out.
2021-05-06 19:05:15 +10:00
Damien Elmes
6ca089c36c don't throw an error when an invalid sort order is provided 2021-05-06 17:00:58 +10:00
Damien Elmes
be994f4102 add support for custom undo steps, and merging multiple actions
Allows add-on authors to define their own label for a group of undoable
operations. For example:

def mark_and_bury(
    *,
    parent: QWidget,
    card_id: CardId,
) -> CollectionOp[OpChanges]:
    def op(col: Collection) -> OpChanges:
        target = col.add_custom_undo_entry("Mark and Bury")
        col.sched.bury_cards([card_id])
        card = col.get_card(card_id)
        col.tags.bulk_add(note_ids=[card.nid], tags="marked")
        return col.merge_undo_entries(target)

    return CollectionOp(parent, op)

The .add_custom_undo_entry() is for adding your own custom actions.
When extending a standard Anki action, instead store `target = 
col.undo_status().last_step` after executing the standard operation.

This started out as a bigger refactor that required a separate
.commit_undoable() call to be run after each operation, instead of
having each operation return changes directly. But that proved to be
somewhat cumbersome in unit tests, and ran the risk of unexpected
behaviour if the caller invoked an operation without remembering to
finalize it.
2021-05-06 16:39:06 +10:00
Damien Elmes
2663c891eb fix dmypy action 2021-05-05 15:54:41 +10:00
Damien Elmes
0fb745cdb9 add a valid, empty file so the check action works in Rust Analyzer 2021-05-05 15:53:27 +10:00
Damien Elmes
1011dfec9b add script to run Rust Analyzer using Bazel's build products
Considerably speeds up initial load, but have not done much testing
yet.
2021-05-04 20:06:42 +10:00
Damien Elmes
4951ef12c9 fix properties missing from generated Svelte .d.ts files
They're currently being set to 'any', as we're not providing the dependencies
to the tsc invocation. Older Anki versions had the same issue, and we'll
want to fix that as well, but for now this at least restores the missing
props.
2021-05-04 18:55:58 +10:00
Damien Elmes
6d319e8c9e bump version 2021-05-04 16:24:28 +10:00
Damien Elmes
abab4826bb support undo for (renamed) unbury_deck() action 2021-04-30 20:03:20 +10:00
Damien Elmes
d0f3007fad remove some unneeded transactions from tests 2021-04-30 19:18:02 +10:00