mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Svelte Editor hotfixes (#1436)
* Fix white on white text in light mode * Reflect rename to FieldsEditor in class name * Fix adjusting fields ending in an endless loop
This commit is contained in:
parent
ad2c17aced
commit
bf3adbc812
3 changed files with 12 additions and 5 deletions
|
@ -2,12 +2,12 @@
|
||||||
Copyright: Ankitects Pty Ltd and contributors
|
Copyright: Ankitects Pty Ltd and contributors
|
||||||
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
-->
|
-->
|
||||||
<div class="multi-root-editor">
|
<div class="fields-editor">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.multi-root-editor {
|
.fields-editor {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
|
@ -83,7 +83,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
newStore.subscribe((value) => updateField(i, value));
|
newStore.subscribe((value) => updateField(i, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = fieldStores.length; i > newFieldNames.length; i++) {
|
for (
|
||||||
|
let i = fieldStores.length;
|
||||||
|
i > newFieldNames.length;
|
||||||
|
i = fieldStores.length
|
||||||
|
) {
|
||||||
fieldStores.pop();
|
fieldStores.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import SetContext from "./SetContext.svelte";
|
import SetContext from "./SetContext.svelte";
|
||||||
import ContentEditable from "../editable/ContentEditable.svelte";
|
import ContentEditable from "../editable/ContentEditable.svelte";
|
||||||
|
|
||||||
import { onMount, getAllContexts } from "svelte";
|
import { onMount, getContext, getAllContexts } from "svelte";
|
||||||
import {
|
import {
|
||||||
nodeIsElement,
|
nodeIsElement,
|
||||||
nodeContainsInlineContent,
|
nodeContainsInlineContent,
|
||||||
|
@ -48,6 +48,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import { wrapInternal } from "../lib/wrap";
|
import { wrapInternal } from "../lib/wrap";
|
||||||
import { nodeStore } from "../sveltelib/node-store";
|
import { nodeStore } from "../sveltelib/node-store";
|
||||||
import type { DecoratedElement } from "../editable/decorated";
|
import type { DecoratedElement } from "../editable/decorated";
|
||||||
|
import { nightModeKey } from "../components/context-keys";
|
||||||
|
|
||||||
export let hidden: boolean;
|
export let hidden: boolean;
|
||||||
|
|
||||||
|
@ -222,10 +223,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
unsubscribeToEditingArea();
|
unsubscribeToEditingArea();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const nightMode = getContext<boolean>(nightModeKey);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<RichTextStyles
|
<RichTextStyles
|
||||||
color="white"
|
color={nightMode ? "white" : "black"}
|
||||||
let:attachToShadow={attachStyles}
|
let:attachToShadow={attachStyles}
|
||||||
let:promise={stylesPromise}
|
let:promise={stylesPromise}
|
||||||
let:stylesDidLoad
|
let:stylesDidLoad
|
||||||
|
|
Loading…
Reference in a new issue