diff --git a/src/Editor/Editor.svelte b/src/Editor/Editor.svelte index 1ab22c10..7a47f3be 100644 --- a/src/Editor/Editor.svelte +++ b/src/Editor/Editor.svelte @@ -48,6 +48,7 @@ */ export let text = undefined; + import { onMount } from "svelte"; import { quill } from "./quill"; console.log(invalidText); @@ -68,6 +69,21 @@ placeholder, }; + onMount(() => { + let container = document.getElementById(id); + if (invalid) { + let style = "2px solid red"; + container.style["borderLeft"] = style; + container.style["borderBottom"] = style; + container.style["borderRight"] = style; + let toolbar = + container.parentNode.getElementsByClassName("ql-toolbar")[0]; + toolbar.style["borderLeft"] = style; + toolbar.style["borderTop"] = style; + toolbar.style["borderRight"] = style; + } + }); + const onTextChange = (event) => { html = event.detail.html; text = event.detail.text; @@ -87,7 +103,11 @@ {#if disabled} {@html html} {:else} -
+
{/if} {#if invalid}
{invalidText}