Commit Graph

37 Commits

Author SHA1 Message Date
Damien Elmes
fa498626a0 use inline-block so enter inserts br tags 2017-09-13 11:23:09 +10:00
Damien Elmes
4990b2f8eb mathjax tweaks
- drop support for $$ in favour of separate opening and closing tags
- add shortcuts to add mathjax
- don't highlight any clozes in blue if field contains mathjax chars
2017-09-08 19:20:37 +10:00
Damien Elmes
a7ed7fa4e3 fix cutting and copying between fields
the shortcut keys are handled by webengine on platforms other than
osx, so rather than messing with an event filter we catch the cut and
copy events in js and send a signal back
2017-09-02 13:48:03 +10:00
Damien Elmes
a96ddfc3fd allow templates and add-ons to hook into reviewer updated/shown
eg

from anki.hooks import addHook

def prepare(q):
    return q + """
<script>
onUpdateHook.push(function () {
    window.scrollTo(0, 2000);
})
</script>"""

addHook('prepareQuestion', prepare)
2017-08-28 14:54:22 +10:00
Damien Elmes
db5d23d9dc catch exceptions when setting HTML
thanks to Alicia for the original solution:
dee4c98e9b
2017-08-17 20:02:28 +10:00
Damien Elmes
53fb3b0e8c only macs seem to require the shift+tab fix 2017-08-16 21:51:57 +10:00
Damien Elmes
4467b7c991 restore marking support
maybe multiple mark types would make sense in the future, but for now
let's stick to what will work in the older clients
2017-08-16 20:30:29 +10:00
Damien Elmes
d0389e138e Merge pull request #197 from techdavid/fix-bottom-drag-default
Fix decks being moved to the default deck when dragged to the bottom
2017-08-15 21:21:52 +10:00
Damien Elmes
a16aa73d6e switch to svg images for better hidpi rendering 2017-08-15 13:54:58 +10:00
David Bailey
06add3ee07 Fix decks being moved to the default deck when dragged to the bottom
Previously ontoDeckId was undefined if a deck was moved to the bottom, resulting in it being moved to the default deck, instead of being made a top-level deck.
2017-08-14 22:58:14 +01:00
Damien Elmes
44c764b895 fix sidebar showing, tweak icons 2017-08-14 16:57:43 +10:00
Damien Elmes
ad6dcde531 OCD fix for gear icon 2017-08-13 19:05:59 +10:00
Damien Elmes
cc0ec00fe7 add a little padding in bottom area 2017-08-12 17:04:07 +10:00
Damien Elmes
ec5e54d21d reformat css 2017-08-12 16:14:32 +10:00
Damien Elmes
71101d041a ditch marked tag in favour of card flags
Users can now mark individual cards with one of four different coloured
flags, instead of relying on a tag that applied to the whole note.

- replaced marking functionality in reviewer and browser with new
flag options
- added flag:x search
- marked and leech tags now show in normal tag list in filter screen,
instead of being treated specially
- the other clients will need updating to set and shown the flags, but
flags set in the beta should be preserved by the other clients
2017-08-12 16:08:10 +10:00
Damien Elmes
a882937dd3 fix cloze in mathjax workaround 2017-08-11 21:09:47 +10:00
Damien Elmes
ba16b8714b remove images and move away from qt resources
- 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
2017-08-11 20:59:43 +10:00
Damien Elmes
6c765d7302 remove toolbar in browser in favour of menu items 2017-08-11 14:40:51 +10:00
Damien Elmes
c3415028b0 mathjax and fade improvements
- remove the unnecessary processing delays mathjax defaults to
- use a separate fade time for question and answer
2017-08-10 20:45:42 +10:00
Damien Elmes
06fcccaf44 remove border on bottom toolbar; fix hacky spacing of top elements 2017-08-10 19:17:28 +10:00
Damien Elmes
f3f90842dc move the inline css and some more js into separate files
- stdHtml() css= arg now takes a list of files like js=
- the files are loaded in the head of the document so that styling
that comes later in the document can easily override it

fixes:
https://anki.tenderapp.com/discussions/beta-testing/661-anki-210-beta-7/page/1#comment_43164447
https://anki.tenderapp.com/discussions/beta-testing/661-anki-210-beta-7#comment_43177130
2017-08-10 19:02:32 +10:00
Damien Elmes
23f8e15816 give the preview window the same treatment
different approach to timer handling so that it's more responsive when
the user clicks a navigation button
2017-08-08 16:28:53 +10:00
Damien Elmes
4d064e1cba wait for keystrokes and don't reload entire page 2017-08-08 16:07:18 +10:00
Damien Elmes
4c286fa3f7 hack around clozes breaking mathjax 2017-08-06 14:48:30 +10:00
Damien Elmes
51a0e5fa4b fix field content showing under editor buttons 2017-08-06 13:55:09 +10:00
Damien Elmes
68d55239b4 rework fade in code
there were a number of issues with preloading:
- it could result in duplicate IDs in the document
- embedded styles failed to apply, because a preloaded item was
overriding them
- the type answer code needed rewriting to support it

so we're back to something closer to the old approach - a single node
that we fade out, update, and then fade in again. this means there's a
longer delay when revealing mathjax, but should minimize the breakage of
existing notes
2017-08-06 12:01:30 +10:00
Damien Elmes
797a7ea229 refactor editor focus handling
this fixes a bug where navigating to the next/previous card using
shortcut keys resulted in the first field being clobbered

- get rid of the stealFocus option in favour of explicitly passing
focusTo to setNote()
- setFields() is no longer responsible for setting focus
- add focusTo var to the browser so that the row changed hook can
restore focus when navigating to next/previous card
- fix the row changed hook being called twice
- the blur event now includes the field number instead of relying on the
 editor to have the correct currentField
- the current field is set to null on blur
- use deferred js and a callback rather than keeping track of when we
were loaded
- add shift+tab shortcut to go to previous field
2017-08-05 15:16:20 +10:00
Damien Elmes
72868507c7 bundle mhchem 2017-08-05 12:47:07 +10:00
Damien Elmes
9ec9274011 fix fields being overwritten when dropping
remove the unneeded setFocus() call which was causing the blur event
to fire with the wrong data
2017-08-01 17:40:51 +10:00
Damien Elmes
66500f5262 move webview js into separate file 2017-08-01 17:04:55 +10:00
Damien Elmes
d6c8c6e272 focus type answer area after it's appeared 2017-07-31 16:34:30 +10:00
Damien Elmes
8503ab29ab fix literal '\n' being inserted into card 2017-07-31 13:22:35 +10:00
Damien Elmes
49e2d82aae fade next card in
- to minimize pop-in of images and mathjax, fade the previous card
out and fade the next card in
- render the answer at the same time as the question so it can be
shown immediately
- move reviewer css to separate file
- remove image preloading code that should no longer be necessary
2017-07-29 14:24:45 +10:00
Damien Elmes
44d0766cc5 fix some js lint 2017-07-28 16:48:49 +10:00
Damien Elmes
b8e306062b improve cloze and latex tag display in RTL environment
https://anki.tenderapp.com/discussions/ankidesktop/24292-mixed-arabic-and-english-words
2017-07-28 16:39:32 +10:00
Damien Elmes
7ad6966943 split js code out into separate files, mathjax improvements
- js code that was previously bundled in .py files is now in the
web folder
- add helpers to create links to bundled files, and update
stdHtml() to accept a list of javascript files to include
instead of text
- render MathJax in card layout and preview screens - these should be
updated in the future to update the document dynamically like the
reviewer does
- start media server earlier so it can be used to serve content for
the toolbar, etc
- work around a bug in WebEngine on Windows that could cause the
media server to hang
2017-07-28 16:35:45 +10:00
Damien Elmes
fa3461e20b mathjax support 2017-07-27 14:18:10 +10:00