Skip to Content

Mantine ํ†ตํ•ฉ

Mantineย ์˜ Provider์™€ ์ปดํฌ๋„ŒํŠธ ์•ˆ์—์„œ Inkio ์—๋””ํ„ฐ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ์˜ˆ์ œ์ž…๋‹ˆ๋‹ค.

์„ค์น˜

pnpm add @mantine/core @inkio/editor @inkio/extension

CSS ์ž„ํฌํŠธ ์ˆœ์„œ

// Mantine ์Šคํƒ€์ผ ๋จผ์ € import '@mantine/core/styles.css'; // ๊ทธ ๋‹ค์Œ Inkio ์Šคํƒ€์ผ import '@inkio/editor/minimal.css'; import '@inkio/extension/style.css';

์ค‘์š”: Mantine CSS๋ฅผ Inkio CSS๋ณด๋‹ค ๋จผ์ € ์ž„ํฌํŠธํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ˆœ์„œ๊ฐ€ ๋ฐ”๋€Œ๋ฉด Mantine์˜ ๊ธ€๋กœ๋ฒŒ ๋ฆฌ์…‹์ด ์—๋””ํ„ฐ ์Šคํƒ€์ผ์„ ๋ฎ์–ด์”๋‹ˆ๋‹ค.

์ „์ฒด ์ฝ”๋“œ

import '@mantine/core/styles.css'; import '@inkio/editor/minimal.css'; import '@inkio/extension/style.css'; import { Card, Container, MantineProvider, Stack, Text, Title } from '@mantine/core'; import { Editor } from '@inkio/editor'; import { getDefaultInkioExtensions } from '@inkio/extension'; import { useMemo } from 'react'; export default function MantineEditor({ theme }: { theme?: 'light' | 'dark' }) { const extensions = useMemo( () => getDefaultInkioExtensions({ placeholder: 'Start typing...' }), [], ); return ( <MantineProvider forceColorScheme={theme ?? 'light'}> <Container size="lg" py="md"> <Stack> <div> <Title order={2}>My Editor</Title> <Text c="dimmed" size="sm"> Mantine + Inkio </Text> </div> <Card withBorder shadow="sm" radius="md" p="md"> <Editor extensions={extensions} initialContent="<p>Hello from Mantine!</p>" showBubbleMenu showFloatingMenu /> </Card> </Stack> </Container> </MantineProvider> ); }

ํ…Œ๋งˆ ์—ฐ๋™

Mantine์˜ forceColorScheme prop์„ ์‚ฌ์šฉํ•˜์—ฌ ๋‹คํฌ/๋ผ์ดํŠธ ๋ชจ๋“œ๋ฅผ ์ œ์–ดํ•ฉ๋‹ˆ๋‹ค. Inkio๋Š” document.documentElement์˜ .dark ํด๋ž˜์Šค๋ฅผ ๊ฐ์ง€ํ•˜๋ฏ€๋กœ, Mantine ํ…Œ๋งˆ์™€ ํ•จ๊ป˜ ํด๋ž˜์Šค๋ฅผ ํ† ๊ธ€ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค:

useEffect(() => { document.documentElement.classList.toggle('dark', theme === 'dark'); }, [theme]);
Last updated on