Strip description logic from ContentEditable

This commit is contained in:
Henrik Giesel 2022-08-01 01:57:44 +02:00
parent 2c91917e4a
commit bf9f6650cb

View file

@ -7,11 +7,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</script> </script>
<script lang="ts"> <script lang="ts">
import { getContext } from "svelte"; import type { Writable } from "svelte/store";
import type { Readable, Writable } from "svelte/store";
import { updateAllState } from "../components/WithState.svelte"; import { updateAllState } from "../components/WithState.svelte";
import { descriptionKey } from "../lib/context-keys";
import actionList from "../sveltelib/action-list"; import actionList from "../sveltelib/action-list";
import type { MirrorAction } from "../sveltelib/dom-mirror"; import type { MirrorAction } from "../sveltelib/dom-mirror";
import type { SetupInputHandlerAction } from "../sveltelib/input-handler"; import type { SetupInputHandlerAction } from "../sveltelib/input-handler";
@ -36,9 +34,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
Object.assign(api, { focusHandler }); Object.assign(api, { focusHandler });
const description = getContext<Readable<string>>(descriptionKey);
$: descriptionCSSValue = `"${$description}"`;
export let content: string; export let content: string;
</script> </script>
@ -54,7 +49,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
on:blur on:blur
on:click={updateAllState} on:click={updateAllState}
on:keyup={updateAllState} on:keyup={updateAllState}
style="--description: {descriptionCSSValue}"
/> />
<style lang="scss"> <style lang="scss">
@ -70,17 +64,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
&:focus { &:focus {
outline: none; outline: none;
} }
&.empty::before {
content: var(--description);
opacity: 0.4;
cursor: text;
/* stay on single line */
position: absolute;
max-width: 95%;
overflow-x: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
} }
/* editable-base.scss contains styling targeting user HTML */ /* editable-base.scss contains styling targeting user HTML */