mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 15:32:23 -04:00
Fix HTML editor not showing content initially (#2181)
* Fix HTML editor not showing initially * Remove line numbers from PlainTextInput
This commit is contained in:
parent
c60a1c8ebd
commit
03fe2385ef
3 changed files with 16 additions and 4 deletions
|
@ -11,7 +11,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
export let toggleDisplay = false;
|
||||
export let animated = !document.body.classList.contains("reduced-motion");
|
||||
|
||||
let collapsed = false;
|
||||
let contentHeight = 0;
|
||||
|
||||
function dynamicDuration(height: number): number {
|
||||
|
@ -56,6 +55,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
$: height = $size * contentHeight;
|
||||
$: transitioning = $size > 0 && !(collapsed || expanded);
|
||||
$: measuring = !(collapsed || transitioning || expanded);
|
||||
|
||||
let hidden = collapsed;
|
||||
|
||||
$: {
|
||||
/* await changes dependent on collapsed state */
|
||||
tick().then(() => (hidden = collapsed));
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
|
@ -64,9 +70,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
class:animated
|
||||
class:expanded
|
||||
class:full-hide={toggleDisplay}
|
||||
class:collapsed={!expanded}
|
||||
class:measuring
|
||||
class:transitioning
|
||||
class:hidden
|
||||
style:--height="{height}px"
|
||||
>
|
||||
<slot {collapsed} />
|
||||
|
@ -80,7 +86,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
<style lang="scss">
|
||||
.collapsible.animated {
|
||||
&.measuring {
|
||||
display: unset;
|
||||
display: initial;
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
}
|
||||
|
@ -94,7 +100,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
}
|
||||
|
||||
&.full-hide {
|
||||
&.collapsed {
|
||||
&.hidden {
|
||||
display: none;
|
||||
}
|
||||
&.transitioning {
|
||||
|
|
|
@ -34,6 +34,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
|
||||
const defaultConfiguration = {
|
||||
rtlMoveVisually: true,
|
||||
lineNumbers: false,
|
||||
};
|
||||
|
||||
const [editorPromise, resolve] = promiseWithResolver<CodeMirrorLib.Editor>();
|
||||
|
|
|
@ -164,10 +164,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
:global(.CodeMirror) {
|
||||
height: 100%;
|
||||
background: var(--canvas-code);
|
||||
padding-inline: 4px;
|
||||
}
|
||||
|
||||
:global(.CodeMirror-lines) {
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
:global(.CodeMirror-gutters) {
|
||||
background: var(--canvas-code);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue