mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
Fix CodeMirror not properly sized when opening editor (#2426)
* Revert "Fix open editors getting carried over to different notetypes (#2393)"
This reverts commit bf5bcd3f52
.
* 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
fd688b5fc0
commit
a32c7a8e63
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