- The previous commits moved the majority of the remaining global css
into components; move the remaining @emotion/css references into
ticks.scss and the styling of the Graph.svelte. This is not as elegant
as the emotion solution, but builds a whole lot faster, and most of
our styling can be scoped to a component anyway.
- Leave the .html files in ts/ for now. AnkiMobile uses them, and
AnkiDroid likely will in the future too. In the long run we'll likely
move to loading the JS into an existing page instead of loading a
separate page, but at that point we can just exclude the .html file from
copy_files_into_group() without affecting other clients.
Closes#1074
- svelte compilation outputs a separate .css file for each component
- compilation also adds an "import foo.css" to the top of each generated
.mjs file
- when the .mjs files are bundled into app.js, esbuild creates an app.css
as well
- graphs.scss was renamed to graphs_shared.scss and imported in the
top level GraphsPage. Henrik's style refactoring would be a better path
forward, but I needed to make this change for now, as the filenames were
conflicting.
- enable resolver patch on worker binary to ensure js imports work
on subsequent worker requests
- cache ts library content, and use unified interface for cache
- prepare for separate css outputs
Just a quick hack for now to store it in memory, as the temp file
conflicts on Windows due to the lack of a sandbox, and we don't really
have a need to write it to the filesystem anyway.
based on changes from upstream rules_svelte
Their code was using run_node() instead of ctx.actions.run(), which
seems to create a new worker for every CPU core, instead of respecting
the standard limit of 4.
Svelte 3.25.0 and onwards bundle compiler.mjs, which seems to be
preferentially used over the .js file. Presumably this is only breaking
on Windows due to the lack of a sandbox. Resolve by explicitly requesting
the .js file.
Issues that need fixing:
- when the editor saves the note with perform_op(), if it isn't modified,
no new undo entry is created, and perform_op then returns the changes
made by the previous operation instead
- the approach of fetching the last action in a subsequent backend
method is unsound, as another queued operation may sneak in first before
we have a chance to query the result - it would be better if it were
returned in a single atomic action
- redrawing the current card while editing is likely to make sound
autoplay annoyingly, and it has an unpleasant redraw. We may be better off
fading it out instead
Side note: the editor cursor moves to the start of the field when the
note is updated in another window - it might be nicer to have it move
the cursor to the end instead.
Bootstrap sets font-size to inherit, so it's not inherited from top.
Before, it defaulted to 13, so this should prevent add-ons, which
feature text in their buttons (like <select> buttons).
* Ported from #1046:
* disabling buttons will clear button highlight
* enabling button will set button highlight
* move caret to end executed before enabling buttons (so button highlight will be for actual position of caret)
* move caret to end will also be executed if previousActiveElement is null, which will only be the case before the first onBlur was executed:
* so that caret will be moved to end on opening editor
- using :host-context(.nightMode) allows for applying the nightmode
scroll bar inside the component
- apply max-width: 100% to all element within editable, not just images
- draw a border between sidebar and main area
- tweak padding
Testing is a pain, because you need to check day mode on the
three platforms, and night mode as well. If you can do it better, PRs
are welcome :-)
1. Clicking away from the editor window, and back on it should not focus old field
2. Clicking on a field, which is not fully visible, should scroll it into view
This is to provide minimal closures for the mutable file-local variables:
- changeTimer
- previousActiveElement
- currentNoteId
This makes it clear, that they should not be used, but rather the
functions which wrap them in an API
To support images on that screen, we'll first need to adjust the base url
for each platform, or rewrite the local image URLs, as otherwise they
are resolved to _anki/pages/...
Committing for reference; will roll back afterwards.
This adds approximately 150k to the bundled .js file in release mode.
html-sanitizer might be useful to replace our custom paste filtering
code in the future, but for now I'm not sure it's worth the extra
page load time over doing the filtering in Rust.