Fix formatting/typing errors

This commit is contained in:
Abdo 2025-10-18 14:38:21 +03:00
parent 3084d59fb4
commit 9dcbf70aeb
2 changed files with 23 additions and 18 deletions

View file

@ -443,7 +443,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
closeMathjaxEditor?.(); closeMathjaxEditor?.();
$commitTagEdits(); $commitTagEdits();
await saveFieldNow(); await saveFieldNow();
if(!isLegacy) { if (!isLegacy) {
bridgeCommand("saved"); bridgeCommand("saved");
} }
} }

View file

@ -46,43 +46,48 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
$: setStyling("fontSize", fontSize + "px"); $: setStyling("fontSize", fontSize + "px");
$: setStyling("direction", direction); $: setStyling("direction", direction);
function attachToShadow(element: Element) {
async function attachToShadow(element: Element) { let stylesPromise: Promise<StyleLinkType[]>;
let styles: StyleLinkType[];
if (isLegacy) { if (isLegacy) {
styles = [ stylesPromise = Promise.resolve([
{ {
id: "rootStyle", id: "rootStyle",
type: "link", type: "link",
href: "./_anki/css/editable.css", href: "./_anki/css/editable.css",
}, },
]; ]);
} else { } else {
styles = [ stylesPromise = Promise.all([
import("$lib/editable/editable-base.scss?url"),
import("$lib/editable/content-editable.scss?url"),
import("$lib/editable/mathjax.scss?url"),
]).then(([editableBase, contentEditable, mathjax]) => [
{ {
id: "editableBaseStyle", id: "editableBaseStyle",
type: "link", type: "link",
href: (await import("$lib/editable/editable-base.scss?url")).default, href: editableBase.default,
}, },
{ {
id: "contentEditableStyle", id: "contentEditableStyle",
type: "link", type: "link",
href: (await import("$lib/editable/content-editable.scss?url")).default, href: contentEditable.default,
}, },
{ {
id: "mathjaxStyle", id: "mathjaxStyle",
type: "link", type: "link",
href: (await import("$lib/editable/mathjax.scss?url")).default, href: mathjax.default,
}, },
]; ]);
} }
const customStyles = mount(CustomStyles, { stylesPromise.then((styles) => {
target: element.shadowRoot!, const customStyles = mount(CustomStyles, {
props: { styles }, target: element.shadowRoot!,
}); props: { styles },
customStyles.addStyleTag("userBase").then((styleTag) => { });
userBaseResolve(styleTag); customStyles.addStyleTag("userBase").then((styleTag) => {
callback(customStyles); userBaseResolve(styleTag);
callback(customStyles);
});
}); });
} }
</script> </script>