Henrik Giesel
6af6d7dbb6
Render error if MathJax raises error
2021-02-02 18:11:16 +01:00
Henrik Giesel
9f3403d704
Move editor css to editor directory
2021-01-31 19:03:40 +01:00
Henrik Giesel
978258067b
Move editor to /ts/editor
2021-01-31 14:15:03 +01:00
Henrik Giesel
e667191899
Fix type issues
2021-01-31 13:34:39 +01:00
Henrik Giesel
aba2506394
Make editor a rollup package
2021-01-31 13:34:37 +01:00
Henrik Giesel
a94bcbcc74
Fix focus on first field upon opening editor
2021-01-30 14:20:14 +01:00
Damien Elmes
747075e9a7
Merge pull request #957 from hgiesel/fieldsshadow
...
Implement editor as Web Component
2021-01-30 15:13:58 +10:00
Henrik Giesel
44351bc997
Rename editingContainer -> editingArea; editingArea -> editable
...
* Custom elements are now namespaces with `anki-`
* The element names are inspired by summernote, which have the same
naming scheme of "editingArea > editable"
2021-01-29 20:32:21 +01:00
Henrik Giesel
c44c1513a3
Reorder methods / properties
2021-01-29 20:13:02 +01:00
Henrik Giesel
da79acf685
Remove unnecessarily observed attribute
2021-01-29 20:11:00 +01:00
Henrik Giesel
e7a49d5c48
Make forEditorField more cheaper to execute by avoiding casting to Array
2021-01-29 19:38:55 +01:00
Henrik Giesel
00a4d0357d
Remove explicit ids, as they are not necessary anymore
2021-01-29 18:07:31 +01:00
Henrik Giesel
1617565f2d
No need to set initial values for editing area base CSS
2021-01-29 17:51:26 +01:00
Henrik Giesel
36ce422119
Remove checking for class names for instance checks
2021-01-29 17:41:27 +01:00
Henrik Giesel
a33fa9c0cf
Put HTML initialization into web component constructor
...
* disconnectedCallback should remove event listeners and free other resources
* attributes belong to connectedCallback
2021-01-29 15:50:34 +01:00
Henrik Giesel
514d6b68b6
Move setting of index to connectedCallback
2021-01-29 14:54:59 +01:00
Henrik Giesel
1f5793e9e7
Remove user styling in editor again for now
2021-01-29 14:54:59 +01:00
Henrik Giesel
ef404c73ce
Fix focus change on tab
2021-01-29 14:54:59 +01:00
Henrik Giesel
646415fd09
Move styling attributes from editor to editing-area that are for editing area
2021-01-29 14:54:58 +01:00
Henrik Giesel
fc24ebfb9e
Make button highlight white in nightMode
2021-01-29 14:54:58 +01:00
Henrik Giesel
f3aaa40238
Make the text color part of the base style in editor
2021-01-29 14:54:58 +01:00
Henrik Giesel
49c3723647
Allow stylesheet of note type take effect on editor fields
2021-01-29 14:54:58 +01:00
Henrik Giesel
3d2c4b9969
Use currentField.getSelection instead of window.getSelection
2021-01-29 14:54:58 +01:00
Henrik Giesel
28276a9acf
Use new focusEditingArea and blurEditingArea to delegate to editing area
2021-01-29 14:54:58 +01:00
Henrik Giesel
b423c372d5
Fix dupes, but also make sticky, and centered to draw more attention
2021-01-29 14:54:58 +01:00
Henrik Giesel
8381d9f842
Update setFonts and setBackgrounds
2021-01-29 14:54:58 +01:00
Henrik Giesel
7170a2b853
Fix inListItem for shadow roots
2021-01-29 14:54:58 +01:00
Henrik Giesel
0c2b560718
Rename fieldContainsInlineContent to containsInlineContent to reflect new usage
2021-01-29 14:54:58 +01:00
Henrik Giesel
cbb5224f48
Isolate styling of editing-area into new scss file
2021-01-29 14:54:58 +01:00
Henrik Giesel
fd704381a0
Create a rough draft of the editor web component
2021-01-29 14:54:58 +01:00
Henrik Giesel
e9d8e73239
Make sticky topbar have a positive z-index
2021-01-29 14:21:32 +01:00
Henrik Giesel
04a7b88595
Rename fieldIsInInlineMode to fieldContainsInlineContent
2021-01-27 02:35:14 +01:00
Henrik Giesel
aa61f24547
Remove unused helper functions
2021-01-27 00:55:00 +01:00
Henrik Giesel
8572c1e1d7
Recreate border-spacing with margins for #fields
2021-01-27 00:50:26 +01:00
Henrik Giesel
bd270ba52c
Change nodeIsInline logic to be more typesafe
2021-01-26 23:49:48 +01:00
Henrik Giesel
876efba70c
Change logic to detect inline elements, as the display style property may not be set after setting innerHTML
2021-01-26 23:42:04 +01:00
Henrik Giesel
898cdb94e4
Make #fields display correctly
2021-01-26 23:17:50 +01:00
Henrik Giesel
a76d1772df
Make fields div instead of table + implement fieldIsInInlineMode logic
2021-01-26 23:00:55 +01:00
Henrik Giesel
6464a2bb83
Strip trailing newline if inline elements logic
2021-01-26 21:26:04 +01:00
Henrik Giesel
1a02613274
Avoid highlighting of toprightbuttons to shift the topbar
2021-01-22 12:53:45 +01:00
Henrik Giesel
f462f54e55
Space items by using margins instead of spaces
...
* also changed name of topbutton container back to topbutsOuter as it is clearer
* starting with Chromium 83, `row-gap` would be better suited for this
2021-01-22 12:17:10 +01:00
Henrik Giesel
e1979ef9a0
Switch from floating windows and clearfix to flex and justify-content: space-between
2021-01-22 11:37:11 +01:00
Henrik Giesel
431b2fde63
Adjust the positioning of the editor toolarea via CSS
2021-01-21 21:36:33 +01:00
Henrik Giesel
8467b052f9
Remove image click event handler, as it never takes place
...
* className of fields will be "field clearfix", never just "field"
2021-01-21 20:50:17 +01:00
Henrik Giesel
3c3c78ee71
Remove javascript resizing code from editor.ts
2021-01-21 19:59:16 +01:00
Henrik Giesel
ba7252b664
Explicitly execute code deactivating button focus from editor.py
2021-01-20 17:06:08 +01:00
Henrik Giesel
55cf7a27ba
Remove jQuery from most top functions, and avoid waiting for jquery load
2021-01-19 03:52:46 +01:00
Henrik Giesel
fc0402db81
Remove some unnecessary jQuery, replace some toggles with classList.toggle
2021-01-19 03:06:44 +01:00
Henrik Giesel
077a22adcc
Remove code which supposedly fixing focus, but which is not functional
2021-01-19 02:54:15 +01:00
Henrik Giesel
9803a4ab00
Switch to iterables for elem.style and elem.attributes
2021-01-19 02:48:41 +01:00
Henrik Giesel
0534f217ae
Satisfy formatter
2021-01-19 01:08:15 +01:00
Henrik Giesel
c8c10c07b2
Prefer template string and addEventListener over string concatenation and .on<event>
2021-01-18 17:42:29 +01:00
Henrik Giesel
2efc2030f6
Use more strict TypeScript in editor.ts
2021-01-18 17:18:35 +01:00
Henrik Giesel
2ec2bc91da
Switch to KeyboardEvent.code rather than KeyboardEvent.which, which is deprecated
2021-01-18 15:19:57 +01:00
Henrik Giesel
131d71682b
Deal with div insertion on deleting list item
2021-01-15 18:46:37 +01:00
Henrik Giesel
b5e26f7e51
Consider list edge case for line breaks
...
* Enter makes a new bullet point
* Shift+Enter makes a line break in current bullet point
2021-01-15 18:46:37 +01:00
Henrik Giesel
93b429a21b
Prefer <br> over <div></div>
2021-01-15 18:46:37 +01:00
Henrik Giesel
d58f9a6fea
Improve styling of new preview button on light and nightMode
2021-01-09 23:55:39 +01:00
Henrik Giesel
f3f1849148
Make button show its toggle state
2021-01-09 23:16:01 +01:00
Damien Elmes
a27e94e54d
merge separate vendor rules into single rule
...
Rather than creating a separate rule for each package, we can just
create a generic one and reuse it. Also switch to keyword arguments
in the resulting macros, as it's easier to read.
2021-01-02 11:14:00 +10:00
Henrik Giesel
e51685d4e6
Fix input type for _drawFlag
2021-01-01 14:14:50 +01:00
Henrik Giesel
b7923ee20e
Remove browsersel
2020-12-31 16:48:04 +01:00
Henrik Giesel
6087bb9a0f
Add css-browser-selector to BAZEL build file in data/web/js/vendor
2020-12-31 16:41:31 +01:00
Henrik Giesel
137e4b3d15
Remove hardcoded protobufjs
2020-12-31 16:17:46 +01:00
Henrik Giesel
e30ed8c2fa
Add build recipe to aqt/data/web/js
2020-12-31 16:15:25 +01:00
Damien Elmes
9953305241
Merge pull request #878 from hgiesel/updateQueue
...
Replace `_updatingQA` with promise-based `_updatingQueue`
2020-12-31 12:42:58 +10:00
Henrik Giesel
a1d948d5a2
Replace () => void | Promise<void> with Callback typedef
2020-12-30 16:04:59 +01:00
Henrik Giesel
bbb1a9ed94
Add types to reviewer.ts
2020-12-30 15:06:22 +01:00
Henrik Giesel
8aef0be0f6
Replace _updatingQa synchronization with promise-based _updatingQueue
2020-12-30 14:45:27 +01:00
Henrik Giesel
03da021706
Put loads first in BUILD.bazel
2020-12-30 12:16:59 +01:00
Henrik Giesel
b9c4d2d1ad
Remove jquery-ui from vendor folder
2020-12-30 12:12:49 +01:00
Henrik Giesel
dda55b16f1
Add jquery-ui to vendor/BUILD.bazel
2020-12-30 12:06:06 +01:00
Damien Elmes
9b92d3ce1f
Revert "Merge pull request #873 from hgiesel/otherjsdeps"
...
This reverts commit ad7491a9ae , reversing
changes made to 5a79515f2a .
- Standard graphs render incorrectly on latest version - the wrong number
of days are shown, and the grid lines look wrong. Any version after 0.8.3
seems to suffer from this problem.
- Pie graphs and stack graphs don't render - they are provided in separate
files, and plot.js in previous Anki versions has them included in the one
file. To maintain compatibility with add-ons, we'd need to create a single
file as before, instead of importing multiple files.
If the above issues are fixed I'd be happy to merge this in again, but
as the old graphs are on the way out, it's probably not worth the effort.
2020-12-30 14:13:52 +10:00
Damien Elmes
fcffad3535
Merge pull request #874 from hgiesel/jqueryreview
...
Update _updateQa
2020-12-30 13:51:54 +10:00
Henrik Giesel
633d20f9fd
Satisfy prettier
2020-12-29 14:45:20 +01:00
Henrik Giesel
05425c666f
Hook functions may also return void
2020-12-29 14:01:09 +01:00
Henrik Giesel
9b844a469a
Replace ts-ignore with declare var
2020-12-29 13:43:47 +01:00
Henrik Giesel
a1d389a5b8
Fix typing of reviewer hooks
2020-12-29 13:42:30 +01:00
Henrik Giesel
244219ab27
Use async/await syntax in _updateQa
2020-12-29 13:34:39 +01:00
Henrik Giesel
7ecdb2859e
Remove plot.js
2020-12-29 12:16:50 +01:00
Henrik Giesel
fe7d1aef2b
Copy flot file to vendor directory
2020-12-29 12:11:28 +01:00
Henrik Giesel
b9dfab79dd
Avoid building jquery to its own directory
2020-12-28 14:18:07 +01:00
Henrik Giesel
b6fba45ad5
Remove jquery from Anki repo and replace with Bazel BUILD
2020-12-28 13:16:12 +01:00
Damien Elmes
184d5ab368
Merge pull request #858 from hgiesel/editorwhitespace
...
Remove placeholder `<br>`s in empty fields in editor
2020-12-28 16:50:23 +10:00
Henrik Giesel
3db9dec76b
Hide "Edit" and "More" buttons in reviewer bottom bar, if window width is too small
2020-12-26 15:50:32 +01:00
Damien Elmes
d183ce85bf
further decrease default q/a fade time
2020-12-22 13:02:07 +10:00
Damien Elmes
584f23cfe0
Merge pull request #859 from hgiesel/tabindex2
...
Consider removing special handling of Shift+Tab in Editor on macOS
2020-12-21 18:38:35 +10:00
Damien Elmes
147be1258d
work around --text-fg ending up in fields
...
https://forums.ankiweb.net/t/strange-behaviour-in-the-html-editor/5796/4
2020-12-21 17:56:20 +10:00
Damien Elmes
e2ba0c3b1c
.prettierrc needs to be in web/, as it's needed for sass as well
2020-12-21 17:05:31 +10:00
Henrik Giesel
8f3bf6ad3c
Focus special handling of Shift+Tab on macOS
2020-12-21 08:00:47 +01:00
Damien Elmes
7f89750fde
check formatting of .js files in aqt/data
...
mathjax.js did not match //ts:format output
2020-12-21 16:10:59 +10:00
Damien Elmes
5dcae09c5a
link .prettierrc into qt/aqt/data/web/js
...
So automatic formatting in VS Code matches CI format
2020-12-21 16:09:06 +10:00
Henrik Giesel
a21636a1d7
Remove special treatment of empty fields in editor ts
2020-12-21 03:13:31 +01:00
Henrik Giesel
c6a082f120
Wrap field name in editor in span
2020-12-20 23:40:51 +01:00
Damien Elmes
5ab1b06ddb
avoid distributing BUILD.bazel in js/vendor
2020-12-12 10:35:01 +10:00
Henrik Giesel
6fb80a78bf
Switch back to fadeTo rather than fadeIn/fadeOut
2020-12-09 14:19:45 +01:00
Damien Elmes
19e6c9cb50
export mathjax.js
2020-11-30 15:15:37 +10:00
Damien Elmes
679a4573aa
quieten MathJax
2020-11-18 21:34:44 +10:00
Henrik Giesel
0d94016193
Switch from jQuery pre 3.0.0 pseudo promises to ES6 promises
2020-11-16 01:09:59 +01:00
Henrik Giesel
35b82bcd72
Satisfy formatter
2020-11-15 21:40:59 +01:00
Henrik Giesel
f498ae88dc
Improve ts hooks to allow for asynchronous actions
...
* reviewer ts hooks may now return a promise, which are then waited upon with Promise.all
* this does not break old ts hooks, as Promise.all allows for non-Promises in its array
2020-11-15 21:16:06 +01:00
Henrik Giesel
d18653cf16
Include default MathJax packages
...
* by default load all the default tex-chtml packages, which additionally include:
* require: using \require{package-name} to load a package
* autoload: using a command from a different package automatically loads it
* configmacros: allows for definition of predefined macros
2020-11-15 20:56:50 +01:00
Henrik Giesel
cc2ba7d07f
Load require package in Mathjax
2020-11-15 13:58:51 +01:00
Damien Elmes
896a1e44b1
add rule to copy mathjax from node_modules
2020-11-15 20:22:28 +10:00
Henrik Giesel
06bd0376b1
Remove @types/mathjax as it is for MathJax 2
2020-11-14 14:14:25 +01:00
Henrik Giesel
3ec4b0da3a
Add moving MathJax3 into mathjax directory to build process
2020-11-14 14:14:25 +01:00
Henrik Giesel
6a29e0cd4d
Rip out MathJax 2 and setup MathJax 3 environment
2020-11-14 14:14:25 +01:00
Henrik Giesel
839e6652dd
Update MathJax2 config to MathJax3 config
...
Used: https://mathjax.github.io/MathJax-demos-web/convert-configuration/convert-configuration.html
2020-11-14 14:14:25 +01:00
Damien Elmes
a4af59fc4d
format_fix -> format; rename svelte-check for consistency
2020-11-12 20:19:32 +10:00
k12ish
1ca0eb04bb
Improve compatibility with graphics pad/touchscreen
...
When using anki with a graphics pad, text is often selected on accident. This snippet of CSS will fix that issue
2020-11-08 18:14:37 +00:00
Damien Elmes
e4ba941cf1
move aqt_data into source folder; implement wheel building
2020-11-04 12:14:03 +10:00