Commit Graph

34 Commits

Author SHA1 Message Date
Damien Elmes
372d5ed6e8 update copyright and clarify licenses 2019-02-05 14:01:33 +10:00
Damien Elmes
dd01561537 fire saveField("key") when webview loses focus
fixes the following reported issue, caused by currentField
being sent to None:

1. Start from the main view.
2. Click Add
3. In the Add window, change deck
4. In the Choose Deck window, add a new deck, give a random name
5. Back in the Add window, call "Edit HTML"
6. Anki displays an error

This change will mean the editFocusLost hook will not fire when
switching between windows, which is probably an improvement.
2019-02-05 10:46:47 +10:00
Damien Elmes
de38313071 make sure we save field in all blur cases
https://anki.tenderapp.com/discussions/ankidesktop/32268-changes-in-editcurrent-and-addcards-not-taking-effect-when-using-mouse-rather-than-hotkey
2019-01-29 09:51:54 +10:00
David Lönnhager
4ca2220117 Remove <br> from empty fields. 2019-01-19 19:36:55 +01:00
Damien Elmes
2c30ad9593 fix editor buttons overlapping field content
https://anki.tenderapp.com/discussions/ankidesktop/31235-editor-second-row-for-buttons-feature-request
2018-12-03 09:54:51 +10:00
Damien Elmes
09ff23dc70 filter font and background from all html elems in int. paste
https://anki.tenderapp.com/discussions/ankidesktop/30806-font-size-attribute-added-when-copying-text-inside-anki
2018-11-12 15:46:12 +10:00
Damien Elmes
d1a09d5ed1 ignore title in html paste
https://anki.tenderapp.com/discussions/ankidesktop/29375-paste
2018-08-29 18:49:22 +10:00
Damien Elmes
c3f3a996c5 fix changes made in Windows IME not being saved
https://anki.tenderapp.com/discussions/ankidesktop/28727-last-japanese-edit-in-a-field-doesnt-take-unless-enter-is-pressed-an-extra-time
2018-07-23 12:23:38 +10:00
Damien Elmes
e1338e8733 don't collapse whitespace in extended paste mode
for pre tags
2018-06-15 11:36:12 +10:00
Damien Elmes
46a540e22f sync field contents before applying cloze deletion
based on a patch by dlon:

https://github.com/dae/anki/pull/236
2018-05-28 13:40:35 +10:00
Damien Elmes
cb68be7a1b Revert "Revert "workaround for some drags not being accepted""
This reverts commit e7046ba398.

Without this change, dragging images from Google searches doesn't work on the
latest Chrome (tested on macOS).
2018-05-01 13:24:08 +10:00
Damien Elmes
844778636c preserve cursor position when switching to another window
https://anki.tenderapp.com/discussions/beta-testing/1043-anki-21-beta-37-if-switch-from-another-program-to-continue-editing-the-cursor-will-move-to-the-bottom
2018-04-30 15:26:54 +10:00
Damien Elmes
38178e5281 catch attempts to save field contents to wrong note 2018-04-30 15:15:20 +10:00
Damien Elmes
e7046ba398 Revert "workaround for some drags not being accepted"
This reverts commit 99009be1ca.

didn't fix user's problem, and has introduced issues with the cursor
disappearing
2018-02-05 11:27:14 +10:00
Damien Elmes
99009be1ca workaround for some drags not being accepted
https://anki.tenderapp.com/discussions/ankidesktop/26688-drag-and-drop-not-always-working
2018-01-30 11:06:46 +10:00
Damien Elmes
15df699479 preserve ordered lists 2018-01-27 15:26:41 +10:00
Damien Elmes
fccfdef73d add a flag to keep editor buttons enabled when no field selected 2017-12-08 21:06:16 +10:00
Damien Elmes
b85cc4321b move overflow-wrap into body, apply to editor too 2017-11-29 16:19:34 +10:00
Damien Elmes
8233021419 fix drag&drop failing to save again
I'm guessing the move to qt 5.9.2 caused this regression
2017-10-27 18:06:21 +10:00
Damien Elmes
6fc7fbc8f2 remove unwanted whitespace in paste filter
libreoffice adds newlines to exported HTML which interfere with cloze
deletion
2017-10-26 16:36:34 +10:00
Damien Elmes
a4d32a1200 fix hang on internal paste due to shadowed var 2017-10-26 11:45:05 +10:00
Damien Elmes
b22548dd4f fix arg name 2017-10-26 11:44:51 +10:00
Damien Elmes
1d3e5787a2 separate basic and extended paste modes
- 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
2017-10-25 20:20:28 +10:00
Damien Elmes
554ff3d8d2 drop experimental prewrap mode
- pasting in prewrap mode had been broken for a while and nobody noticed
- needs changes to export code and cloze handling code to deal with the
newlines
- newline rewriting in filterNode() is likely fragile
- may revisit post 2.1
2017-10-25 19:18:00 +10:00
Damien Elmes
4dbb87e4c1 filter out background and font settings in internal paste
should fix
https://anki.tenderapp.com/discussions/beta-testing/842-issue-when-copy-pasting-add-edit-and-browse-windows
and
https://anki.tenderapp.com/discussions/beta-testing/840-copy-paste-in-anki-editor-causes-copied-text-to-include-redundant-tags-which-is-deterimental-to-ux-when-using-night-mode-addon

this change will of course prevent these attributes from being copied
when they were manually included in the field instead of implicitly set
on the parent - I don't see a good way to distinguish between the two
cases
2017-10-25 17:51:22 +10:00
Damien Elmes
48405c0ee7 fix shift+tab on osx again
presumably broke in upgrade to qt 5.9.2
2017-10-25 16:54:24 +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
53fb3b0e8c only macs seem to require the shift+tab fix 2017-08-16 21:51:57 +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
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
8503ab29ab fix literal '\n' being inserted into card 2017-07-31 13:22:35 +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