Commit Graph

9307 Commits

Author SHA1 Message Date
Felipe Kinoshita
ce966b13ca
Change X-GNOME-SingleWindow key to SingleMainWindow (#1582)
X-GNOME-SingleWindow was upstreamed to be an XDG spec with the name
"SingleMainWindow" in
https://gitlab.freedesktop.org/xdg/xdg-specs/-/merge_requests/53
2022-01-20 11:58:27 +10:00
RumovZ
1dae2f42ff
Make note: and card: search require full match (#1606) 2022-01-20 11:57:16 +10:00
RumovZ
a51232debe
Fix is_zoom_event() (#1607) 2022-01-20 11:56:12 +10:00
Henrik Giesel
f90895995f
Fix the caret flushing behavior when moving out of a Mathjax element (#1605)
* Fix the caret flushing behavior when moving out of a Mathjax element

* Fix typing issue and add docs for ContentEditableAPI
2022-01-19 10:17:53 +10:00
Henrik Giesel
0bb04e2951
Fix bug when selecting text next to frame by clicking three times (#1604) 2022-01-19 10:15:53 +10:00
RumovZ
fe7a8db231
Selectively disable zoom (#1602)
* Make webview zoom optional

Also suppress mouse wheel zooming.

* Disable zoom for top and bottom bars in main view

* Factor in macos zoom by scrolling and refactor
2022-01-18 19:12:57 +10:00
RumovZ
0e06a1c679
Webview margins (#1583)
* 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)
2022-01-17 15:04:25 +10:00
Damien Elmes
eba21780e1 add Belarusian to prefs 2022-01-16 15:58:57 +10:00
Damien Elmes
a6c6de8a29 update translations 2022-01-16 15:48:46 +10:00
qxo
90da6a8885
fix: AttributeError: 'QMouseEvent' object has no attribute 'pos' (#1598)
* fix: AttributeError: 'QMouseEvent' object has no attribute 'pos'

```
Caught exception:
Traceback (most recent call last):
  File "D:\Python\Python39\lib\site-packages\aqt\browser\sidebar\tree.py", line 328, in mouseReleaseEvent
    if (index := self.currentIndex()) == self.indexAt(event.pos()):
d
```

* fix:   AttributeError: 'QMouseEvent' object has no attribute 'pos'
2022-01-16 15:29:04 +10:00
Damien Elmes
7af4d30c56 add scripts/run-qt5.15.bat for Windows devs 2022-01-16 15:23:00 +10:00
qxo
e831c9ca60
chore: ignore .idea/ folder created by IntelliJ IDE (#1599) 2022-01-16 15:14:16 +10:00
Henrik Giesel
478b3a53f1
Remove individual .html files + other refactorings (#1588)
* 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)
2022-01-16 15:05:35 +10:00
qxo
492f0a5e32
fix: try catch excepton in get_windows_dark_mode and global cache the check (#1587)
* fix: try catch excepton on get_windows_dark_mode and global cache that check

* add commitor email to CONTRIBUTORS

* remove is_windows_dark_mode cache

* avoid logging the missing key (dae)

The check happens frequently, so this will fill up the user's console if we print it each time.
2022-01-16 14:07:28 +10:00
RumovZ
77b1546583
Remove redundant error mapping (#1593)
Helpful regex error in Find&Replace was obscured by generic
"Invalid input" error.
2022-01-16 13:46:27 +10:00
RumovZ
9936f6f7d1
Only warn once about missing av player (#1592) 2022-01-16 13:46:01 +10:00
RumovZ
0e21c49f58
Use white menubar on Windows in lightmode (#1590) 2022-01-16 13:45:16 +10:00
Damien Elmes
e3bfc86f50 update JS deps
- 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
2022-01-16 13:29:48 +10:00
Damien Elmes
ce049ec360 sass/codemirror does not appear to be used 2022-01-15 21:19:58 +10:00
Damien Elmes
15358ac4e8 copy_bootstrap_css/icons were unused 2022-01-15 20:35:11 +10:00
Damien Elmes
732c33c2b3 update to latest rules_python 2022-01-15 16:16:33 +10:00
Damien Elmes
1315a3a3bb update mypy and mypy-protobuf
- The way mypy gathers site packages has changed slightly, so we had to
update extendsitepkgs.py to work with it.
- Not sure if there's a way to avoid the ignore in
operations/__init__.py. mypy is still ensuring a provided argument has
a .changes attribute, so thankfully we don't seem to have lost much here.
2022-01-15 16:04:04 +10:00
Damien Elmes
d651c85dc8 update most Python deps
mypy and mypy-protobuf have been excluded, as they have changes that
break our build
2022-01-15 15:17:03 +10:00
Damien Elmes
bbc191711d update Rust deps 2022-01-15 14:59:43 +10:00
Damien Elmes
ec0ee4d162 rebuild Rust build files with cargo-raze 0.14.1
Tags are now sorted; updating this before a crate update.
2022-01-15 14:33:53 +10:00
Damien Elmes
27f6585307 update to latest rules_rust + Rust 1.58 2022-01-15 14:22:21 +10:00
Damien Elmes
404a1a1f6d PEP8 editorMode 2022-01-12 15:01:43 +10:00
Henrik Giesel
3beea5e1e4
Split/Merge editor.py for its three use cases (#1581)
* 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
2022-01-12 14:51:43 +10:00
Henrik Giesel
489eadb352
Fix IME input after tab (#1584)
* 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
2022-01-12 08:39:41 +10:00
Henrik Giesel
4e4d12a62a
Browser sidebar icon improvements (#1586)
* Fix cardtype icon, add flag-off icon, remove flag.svg

* This removes the old flag.svg, because mdi-icons also has
  one icon called `flag.svg`, and there was undefined behavior
  which flag icon was being picked, when requesting "flag.svg"

* Sort no-flag to beginning of subtree

* to match tags
2022-01-11 16:35:46 +10:00
Ryan
ead75f2898
Calendar graph uses consistent colors across years (#1585) 2022-01-11 16:26:26 +10:00
Henrik Giesel
4360fd16fb
Use default colors for CodeMirror in light theme Anki (#1578)
Refactor PlainTextInput

Put CodeMirror themes into variables
2022-01-10 12:51:50 +10:00
RumovZ
1cee864875
Fix padding and alignment inside revlog table (#1576)
* 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.
2022-01-10 12:50:48 +10:00
Henrik Giesel
81cc5a0914
Small Tag editor fixes (#1580)
* Adjust height of TagInputs to not switch when changing mode

* Hide scrollbar on tag suggestions when not necessary
2022-01-08 11:48:17 +10:00
Henrik Giesel
7e5b6aba4a
Reset .style.width when resizing images (#1579) 2022-01-08 11:47:12 +10:00
Henrik Giesel
739e286b0b
Fix some Mathjax issues (#1547)
* 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
2022-01-08 11:46:01 +10:00
Damien Elmes
a6c65efd36 another attempt at enforcing script load order
See discussion on 36e20fd110 (commitcomment-62861929)
2022-01-07 14:23:55 +10:00
Abdo
aaaea03c72
Fix new preview card's position being interpreted as a date (#1577)
* Fix new preview card's position being interpreted as a date

Can be reproduced by opening the Card Info screen of a new preview card
not answered yet.

* Update rslib/src/stats/card.rs
2022-01-06 19:52:54 +10:00
Damien Elmes
349d5d0862 Revert "Guarantee execution order of <script> elements (#1574)"
This reverts commit 36e20fd110.

Reverting until this can be investigated:

36e20fd110 (commitcomment-62861929)
2022-01-04 10:43:56 +10:00
Hikaru Y
36e20fd110
Guarantee execution order of <script> elements (#1574) 2022-01-04 08:58:09 +10:00
Abdo
35c8449ab2
Increment sched.reps for preview cards in V2 (#1573)
This is to make the timebox dialog report the correct count.
2022-01-04 08:56:02 +10:00
Fusion future
71e554b1db
Add "X-GNOME-SingleWindow=true" to the desktop file (#1572)
Since this commit (ebd2acd98e),
Plasma Desktop will check "X-GNOME-SingleWindow" property to determine
whether to show "Open New Window" action in the context menu of a task.

Anki cannot launch a new instance or open a new window, so add the
property and set it to true to hide the action.
2022-01-04 08:53:22 +10:00
Damien Elmes
e49496abae temporarily disable importing multiple files
Will follow up on this on https://github.com/ankitects/anki/pull/1562
2022-01-02 09:49:51 +10:00
Damien Elmes
008c62a844 dump traceback to console on importing exception 2022-01-02 09:47:44 +10:00
RumovZ
30dc2cf7ea
Add Create Copy to reviewer and use current card's deck (#1569)
* Use deck of current card when copying note

* Add Create Copy to reviewer menu

* Add ellipsis to Set Due Date
2021-12-31 16:45:30 +10:00
Vova Selin
2df3698e8c
Minor changes to graphs (#1566)
* 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.
2021-12-29 15:04:15 +10:00
Damien Elmes
972c9da12e don't cache js files
https://forums.ankiweb.net/t/anki-2-1-50-beta/15608/101
2021-12-28 13:50:11 +10:00
Damien Elmes
c3b5902da0 add color-scheme: dark in night mode
https://forums.ankiweb.net/t/anki-2-1-50-beta/15608/97
2021-12-28 13:35:19 +10:00
Damien Elmes
4c49337700 tweaks to development.md 2021-12-24 14:12:36 +10:00
Damien Elmes
693672d7a3 remove extraneous to_vec() call 2021-12-24 13:09:19 +10:00