mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-20 12:23:02 +00:00
Merge branch 'Editor_component'
This commit is contained in:
commit
c68fed836d
1 changed files with 21 additions and 1 deletions
|
@ -48,6 +48,7 @@
|
||||||
*/
|
*/
|
||||||
export let text = undefined;
|
export let text = undefined;
|
||||||
|
|
||||||
|
import { onMount } from "svelte";
|
||||||
import { quill } from "./quill";
|
import { quill } from "./quill";
|
||||||
|
|
||||||
console.log(invalidText);
|
console.log(invalidText);
|
||||||
|
@ -68,6 +69,21 @@
|
||||||
placeholder,
|
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) => {
|
const onTextChange = (event) => {
|
||||||
html = event.detail.html;
|
html = event.detail.html;
|
||||||
text = event.detail.text;
|
text = event.detail.text;
|
||||||
|
@ -87,7 +103,11 @@
|
||||||
{#if disabled}
|
{#if disabled}
|
||||||
{@html html}
|
{@html html}
|
||||||
{:else}
|
{:else}
|
||||||
<div use:quill="{{ options, html }}" on:text-change="{onTextChange}"></div>
|
<div
|
||||||
|
id="{id}"
|
||||||
|
use:quill="{{ options, html }}"
|
||||||
|
on:text-change="{onTextChange}"
|
||||||
|
></div>
|
||||||
{/if}
|
{/if}
|
||||||
{#if invalid}
|
{#if invalid}
|
||||||
<div class:bx--form-requirement="{true}">{invalidText}</div>
|
<div class:bx--form-requirement="{true}">{invalidText}</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue