Block a user
@dahyeon/editor (0.0.3)
Installation
@dahyeon:registry=https://git.dahyeon.us/api/packages/dahyeon/npm/npm install @dahyeon/editor@0.0.3"@dahyeon/editor": "0.0.3"About this package
React 19 기반의 **고급 Lexical Editor 컴포넌트 라이브러리**입니다. 풍부한 텍스트 편집 기능, 코드 블록 하이라이팅, 표 편집, 커스텀 스타일 등 **WYSIWYG + Markdown 성격을 섞은 Hybrid Editor**를 제공합니다.
@dahyeon/editor
React 19 기반의 고급 Lexical Editor 컴포넌트 라이브러리입니다. 풍부한 텍스트 편집 기능, 코드 블록 하이라이팅, 표 편집, 커스텀 스타일 등 WYSIWYG + Markdown 성격을 섞은 Hybrid Editor를 제공합니다.
이 라이브러리는 독립적으로 패키징되어 있으며 Tailwind 기반 스타일을 포함합니다.
✨ Features
- Lexical 기반 Rich Editor
- 표 삽입 / 셀 병합 / 셀 색상 변경
- 폰트 패밀리 / 크기 지정
- Headings / Lists / Inline code / Code block
- Code highlight plugin (Prism 기반)
- Undo/Redo (HistoryPlugin)
- 자동 Heading ID 생성 (TOC용)
- 초기 콘텐츠 JSON/Plain Text 자동 파싱
- Tailwind 스타일 포함
📦 Installation
먼저 Gitea npm 레지스트리를 설정해야 합니다.
프로젝트 루트에 .npmrc 작성:
@dahyeon:registry=https://git.dahyeon.us/api/packages/dahyeon/npm/
//git.dahyeon.us/api/packages/dahyeon/npm/:_authToken=YOUR_TOKEN
설치:
npm install @dahyeon/editor
# 또는
pnpm add @dahyeon/editor
🔤 폰트 로딩은 호스트 애플리케이션에서 처리해야 합니다
이 라이브러리는 편집기 내부에서 다음과 같은 font-family를 사용합니다:
- Noto Sans KR
- Noto Serif KR
- Gothic A1
- Gowun Batang
- Gowun Dodum
- Asta Sans
- Chiron GoRound TC
하지만 라이브러리 내부에서는 폰트를 포함하거나 로딩하지 않습니다.
따라서 애플리케이션에서 직접 <link> 또는 @import로 폰트를 불러와야 합니다.
예: index.html (권장)
<link
href="https://fonts.googleapis.com/css2?family=Asta+Sans:wght@300..800&family=Chiron+GoRound+TC:wght@200..900&family=Gothic+A1&family=Gowun+Batang&family=Gowun+Dodum&family=Noto+Sans+KR:wght@100..900&family=Noto+Serif+KR:wght@200..900&display=swap"
rel="stylesheet"
/>
또는: global.css
@import url('https://fonts.googleapis.com/css2?family=Asta+Sans:wght@300..800&family=Chiron+GoRound+TC:wght@200..900&family=Gothic+A1&family=Gowun+Batang&family=Gowun+Dodum&family=Noto+Sans+KR:wght@100..900&family=Noto+Serif+KR:wght@200..900&display=swap');
🧩 Usage
import { useState } from 'react';
import { LexicalEditor } from '@dahyeon/editor';
export default function Page() {
const [content, setContent] = useState('');
return (
<LexicalEditor
initialContent={content}
onChange={setContent}
placeholder="여기에 내용을 입력하세요…"
/>
);
}
🛠 Props
initialContent?: string
- JSON(lexical editor state) 또는 plain text
- 컴포넌트 최초 mount 시 1회만 적용됨
onChange: (content: string) => void
- content는 JSON 문자열로 반환됩니다
- plain text로 저장하려면 JSON 파싱 후 필요한 값만 사용하세요
placeholder?: string
- 사용자 입력 없을 때 표시되는 placeholder 텍스트
📁 CSS 포함 정보
라이브러리는 자체적으로 다음을 포함합니다:
- Tailwind로 빌드된 최종 CSS
- Lexical 테마 스타일
- 코드 하이라이트 스타일
하지만 다음은 포함하지 않습니다:
- Google Fonts → 호스트 앱이 로딩해야 합니다.
⚙️ Requirements
- React 19+
- ReactDOM 19+
- Tailwind를 프로젝트에서 사용하지 않아도 됩니다 (CSS는 라이브러리에 포함됨)
🚀 Publishing / Versioning (Maintainer Only)
npm version patch
npm run build
npm publish
Gitea Packages에서 자동 등록됩니다.
📄 License
MIT
원하면:
- “TOC 플러그인 예시”
- “JSON → HTML 변환 가이드”
- “SSR에서 사용할 때 주의 사항”
- “Next.js + Vite + React 19 환경 예시”
같은 상세 문서도 추가해줄게.
Dependencies
Dependencies
| ID | Version |
|---|---|
| @lexical/html | ^0.38.2 |
| @lexical/list | ^0.38.2 |
| @lexical/markdown | ^0.38.2 |
| @lexical/react | ^0.38.2 |
| @lexical/rich-text | ^0.38.2 |
| @lexical/selection | ^0.38.2 |
| @lexical/utils | ^0.38.2 |
| @lexkit/editor | ^0.0.37 |
| lexical | ^0.38.2 |
Development Dependencies
| ID | Version |
|---|---|
| @eslint/js | ^9.39.1 |
| @tailwindcss/vite | ^4.1.17 |
| @types/node | ^24.10.0 |
| @types/react | ^19.2.2 |
| @types/react-dom | ^19.2.2 |
| @vitejs/plugin-react | ^5.1.0 |
| eslint | ^9.39.1 |
| eslint-plugin-react-hooks | ^7.0.1 |
| eslint-plugin-react-refresh | ^0.4.24 |
| globals | ^16.5.0 |
| tailwindcss | ^4.1.17 |
| typescript | ~5.9.3 |
| typescript-eslint | ^8.46.3 |
| vite | ^7.2.2 |
Peer Dependencies
| ID | Version |
|---|---|
| react | ^19 |
| react-dom | ^19 |
Details
Assets (1)
Versions (2)
View all
editor-0.0.3.tgz
84 KiB