Henrik Giesel
2ab06a6540
Move editor to /ts/editor
2021-01-31 14:15:03 +01:00
Henrik Giesel
859a52ab15
Fix type issues
2021-01-31 13:34:39 +01:00
Henrik Giesel
33160dcb00
Make editor a rollup package
2021-01-31 13:34:37 +01:00
Henrik Giesel
126af1fef3
Fix focus on first field upon opening editor
2021-01-30 14:20:14 +01:00
Damien Elmes
b66bedbc9f
Merge pull request #957 from hgiesel/fieldsshadow
...
Implement editor as Web Component
2021-01-30 15:13:58 +10:00
Henrik Giesel
61346cf1f7
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
2e72de4af0
Reorder methods / properties
2021-01-29 20:13:02 +01:00
Henrik Giesel
e37fd2e091
Remove unnecessarily observed attribute
2021-01-29 20:11:00 +01:00
Henrik Giesel
3559834bc9
Make forEditorField more cheaper to execute by avoiding casting to Array
2021-01-29 19:38:55 +01:00
Henrik Giesel
79dc0ecf86
Remove explicit ids, as they are not necessary anymore
2021-01-29 18:07:31 +01:00
Henrik Giesel
5e67e706fb
No need to set initial values for editing area base CSS
2021-01-29 17:51:26 +01:00
Henrik Giesel
32ee863577
Remove checking for class names for instance checks
2021-01-29 17:41:27 +01:00
Henrik Giesel
982372beae
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
0beefc0699
Move setting of index to connectedCallback
2021-01-29 14:54:59 +01:00
Henrik Giesel
fe87f986d3
Remove user styling in editor again for now
2021-01-29 14:54:59 +01:00
Henrik Giesel
594fc9bebd
Fix focus change on tab
2021-01-29 14:54:59 +01:00
Henrik Giesel
6e907fd8b6
Move styling attributes from editor to editing-area that are for editing area
2021-01-29 14:54:58 +01:00
Henrik Giesel
a620bf91a8
Make button highlight white in nightMode
2021-01-29 14:54:58 +01:00
Henrik Giesel
3eade1c64d
Make the text color part of the base style in editor
2021-01-29 14:54:58 +01:00
Henrik Giesel
af3753948a
Allow stylesheet of note type take effect on editor fields
2021-01-29 14:54:58 +01:00
Henrik Giesel
8a525d3643
Use currentField.getSelection instead of window.getSelection
2021-01-29 14:54:58 +01:00
Henrik Giesel
08a6f8f02f
Use new focusEditingArea and blurEditingArea to delegate to editing area
2021-01-29 14:54:58 +01:00
Henrik Giesel
aed38de228
Fix dupes, but also make sticky, and centered to draw more attention
2021-01-29 14:54:58 +01:00
Henrik Giesel
bec709c7a9
Update setFonts and setBackgrounds
2021-01-29 14:54:58 +01:00
Henrik Giesel
db0c776210
Fix inListItem for shadow roots
2021-01-29 14:54:58 +01:00
Henrik Giesel
e0d1450ce0
Rename fieldContainsInlineContent to containsInlineContent to reflect new usage
2021-01-29 14:54:58 +01:00
Henrik Giesel
7dc4b8818c
Isolate styling of editing-area into new scss file
2021-01-29 14:54:58 +01:00
Henrik Giesel
1db71805d3
Create a rough draft of the editor web component
2021-01-29 14:54:58 +01:00
Henrik Giesel
4b7d406559
Make sticky topbar have a positive z-index
2021-01-29 14:21:32 +01:00
Henrik Giesel
bf7ff65af6
Rename fieldIsInInlineMode to fieldContainsInlineContent
2021-01-27 02:35:14 +01:00
Henrik Giesel
d9f00c4839
Remove unused helper functions
2021-01-27 00:55:00 +01:00
Henrik Giesel
b2b17f4c3d
Recreate border-spacing with margins for #fields
2021-01-27 00:50:26 +01:00
Henrik Giesel
9b5d915983
Change nodeIsInline logic to be more typesafe
2021-01-26 23:49:48 +01:00
Henrik Giesel
feddf96f2a
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
520c4a3b4d
Make #fields display correctly
2021-01-26 23:17:50 +01:00
Henrik Giesel
e481452114
Make fields div instead of table + implement fieldIsInInlineMode logic
2021-01-26 23:00:55 +01:00
Henrik Giesel
335267d42e
Strip trailing newline if inline elements logic
2021-01-26 21:26:04 +01:00
Henrik Giesel
1df6c5f596
Avoid highlighting of toprightbuttons to shift the topbar
2021-01-22 12:53:45 +01:00
Henrik Giesel
9226d50185
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
97f8f1b89e
Switch from floating windows and clearfix to flex and justify-content: space-between
2021-01-22 11:37:11 +01:00
Henrik Giesel
1f4de7fe4b
Adjust the positioning of the editor toolarea via CSS
2021-01-21 21:36:33 +01:00
Henrik Giesel
2946843b81
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
e91a4b4362
Remove javascript resizing code from editor.ts
2021-01-21 19:59:16 +01:00
Henrik Giesel
6262997599
Explicitly execute code deactivating button focus from editor.py
2021-01-20 17:06:08 +01:00
Henrik Giesel
cfc8e34cf0
Remove jQuery from most top functions, and avoid waiting for jquery load
2021-01-19 03:52:46 +01:00
Henrik Giesel
5b24e5c522
Remove some unnecessary jQuery, replace some toggles with classList.toggle
2021-01-19 03:06:44 +01:00
Henrik Giesel
27a1e81088
Remove code which supposedly fixing focus, but which is not functional
2021-01-19 02:54:15 +01:00
Henrik Giesel
47d26126e7
Switch to iterables for elem.style and elem.attributes
2021-01-19 02:48:41 +01:00
Henrik Giesel
a4921a36dd
Satisfy formatter
2021-01-19 01:08:15 +01:00
Henrik Giesel
4deeb798ca
Prefer template string and addEventListener
over string concatenation and .on<event>
2021-01-18 17:42:29 +01:00