A race condition could cause domDone to get stuck on false, causing
any further bridge messages and setHtml() calls to be ignored. Fix
the issue by clearing pending actions and resetting domDone when
setting HTML.
Qt.transparent prevents subpixel anti-aliasing from working, resulting
in slightly blurry fonts on non-retina displays.
(The window background color is not determined correctly on macOS, so
we hardcode it.)
Credits for discovering this issue go to the unknown author of
https://ankiweb.net/shared/info/94394764
Since we're automatically disabling proxies now, the main remaining
issue seems to be Windows users resuming their machine from sleep -
for some reason localhost is inaccessible during the resume process.
Because <base> is set to the media server URL, <a href='#' ...> causes
a page transition from the current setHtml() page data. Previous Qt
versions allowed us to just ignore the request, but now returning False
in acceptNavigationRequest() causes the subsequent page navigation to
be rejected as well, resulting in no visible change when clicking on a
deck in the deck list.
To deal with this, Anki will now warn when such navigation requests
come in, as the anchors need to be updated to return false. pycmd()
has been updated to return false to make returning in onclick easier.
Also use QUrl.matches() instead of converting the potentially long
URL to a string.
Renames stdHtml buttonspec to widgetspec, and applies a number of Linux-
specific adjustments, including:
+ updated button designs that more native/modern
+ updated widget focus colors that follow the theme
default color palette
- basic mode is the default, and includes only HTML elements that can be
added/edited easily with the default editor
- extended mode is enabled by holding down shift and includes a bunch of
other HTML elements
- the bulk of image use is in webviews, so we move almost all used
images to web/imgs, as it's easier to manage
- change AnkiWebView to always use the local media server as a base, as
much of the UI has come to depend on it
- remove images from a few areas, as they felt dated
- delete a bunch of unused images
- href=# links were being opened in a browser window, so the code now
ignores them - the HTML should really be updated to return false in the
onclick handler
- update a few icons
the old code was allowing the main thread to read .port before it had
been updated, and was binding to sockets that were already in use on
Windows. instead, we use a system-assigned free port and block the main
thread until it's been allocated
setHtml() and deferred js now share a single queue, to ensure that js
calls are delivered to the correct page
also remove the onLoadFinished hook, which is no longer used
This reverts commit 331239de05.
This commit caused the blur event from the editor to fire after the saveNow()
callback had run, which broke the reviewer when returning from editcurrent.
Reverting for now, as the actual error is harmless AFAICT.