From 0bb10b7e0544c548b9c49636eb38204b24d1db7c Mon Sep 17 00:00:00 2001 From: Andreas Tzionis Date: Thu, 21 Dec 2023 22:10:43 +0200 Subject: [PATCH] minor fix --- lib/client/vanilla/editor.tsx | 1 + lib/server/api/handle.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/client/vanilla/editor.tsx b/lib/client/vanilla/editor.tsx index 0d139537..f48e19be 100644 --- a/lib/client/vanilla/editor.tsx +++ b/lib/client/vanilla/editor.tsx @@ -65,6 +65,7 @@ const isEventOnElement = (element: HTMLElement, event: React.MouseEvent) => { + if (!element) return const rect = element.getBoundingClientRect() return rect.top + (rect.bottom - rect.top) / 2 > event.clientY } diff --git a/lib/server/api/handle.ts b/lib/server/api/handle.ts index 8040f17a..4a28a7cc 100644 --- a/lib/server/api/handle.ts +++ b/lib/server/api/handle.ts @@ -140,7 +140,9 @@ const handleTheme = async (req: NextApiRequest, res: NextApiResponse): Promise f.filter((c) => c !== 'index.ts')) + const componentNames = await fs.promises + .readdir(folderPath) + .then((f) => f.filter((c) => c !== 'index.ts' && !c.startsWith('.'))) const componentsP = componentNames.map(async (c) => { const assetPath = path.join(folderPath, c, 'index.html') const source = await fs.promises.readFile(assetPath, 'utf-8')