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')