From b62705eadf7335c7ee0c6c8797047e1f1ccdbf44 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Mon, 1 Aug 2022 02:08:25 +0200 Subject: [PATCH] Make attachToShadow an async function --- ts/editor/rich-text-input/RichTextStyles.svelte | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ts/editor/rich-text-input/RichTextStyles.svelte b/ts/editor/rich-text-input/RichTextStyles.svelte index 9679a3939..62afd7bd5 100644 --- a/ts/editor/rich-text-input/RichTextStyles.svelte +++ b/ts/editor/rich-text-input/RichTextStyles.svelte @@ -47,16 +47,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } as StyleLinkType, ]; - function attachToShadow(element: Element) { + async function attachToShadow(element: Element): Promise { const customStyles = new CustomStyles({ target: element.shadowRoot as any, props: { styles }, }); - customStyles.addStyleTag("userBase").then((styleTag) => { - userBaseResolve(styleTag); - callback(customStyles); - }); + const styleTag = await customStyles.addStyleTag("userBase"); + userBaseResolve(styleTag); + callback(customStyles); }