mirror of
https://github.com/ankitects/anki.git
synced 2026-01-14 06:23:57 -05:00
Fix CodeMirror not properly sized when opening editor (#2426)
* Revert "Fix open editors getting carried over to different notetypes (#2393)"
This reverts commit 75f582e559.
* Fix CodeMirror not properly sized when opening editor
If the initial value of a tweened store is 'undefined' or 'null', the
first value change will take effect immediately. Therefore, by setting
the initial value of 'size' to 'undefined', 'collpased' will be set to
'false' with no transition time if 'false' is passed to 'collapse' prop,
ensuring that CodeMirror is properly sized.
This commit is contained in:
parent
7c48c94563
commit
ae7df2fd37
1 changed files with 4 additions and 4 deletions
|
|
@ -18,7 +18,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
}
|
||||
$: duration = dynamicDuration(contentHeight);
|
||||
|
||||
const size = tweened<number>(0);
|
||||
const size = tweened<number | undefined>(undefined);
|
||||
|
||||
async function transition(collapse: boolean): Promise<void> {
|
||||
if (collapse) {
|
||||
|
|
@ -50,10 +50,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
|
||||
let collapsibleElement: HTMLElement;
|
||||
|
||||
$: collapsed = $size === 0;
|
||||
$: collapsed = ($size ?? 0) === 0;
|
||||
$: expanded = $size === 1;
|
||||
$: height = $size * contentHeight;
|
||||
$: transitioning = $size > 0 && !(collapsed || expanded);
|
||||
$: height = ($size ?? 0) * contentHeight;
|
||||
$: transitioning = ($size ?? 0) > 0 && !(collapsed || expanded);
|
||||
$: measuring = !(collapsed || transitioning || expanded);
|
||||
|
||||
let hidden = collapsed;
|
||||
|
|
|
|||
Loading…
Reference in a new issue