{/* Font Family */}
{/* Font Size */}
{/* Text Formatting */}
{/* Headings */}
{/* Lists */}
{/* Table */}
{showTablePicker && (
{tableSize.rows > 0 && tableSize.cols > 0
? `${tableSize.rows} x ${tableSize.cols} 표 삽입`
: '표 삽입'}
{Array.from({ length: 8 }, (_, row) => (
{Array.from({ length: 10 }, (_, col) => (
setTableSize({ rows: row + 1, cols: col + 1 })}
onClick={() => insertTable(row + 1, col + 1)}
/>
))}
))}
)}
{/* Cell Background Color */}
{showColorPicker && (
셀 배경색
{CELL_COLORS.map((color) => (
))}
)}
{/* Alignment */}
);
}
function onError(error: Error) {
console.error('Lexical Error:', error);
}
export function LexicalEditor({ initialContent, onChange, placeholder = '내용을 입력하세요...' }: LexicalEditorProps) {
const [fontFamily, setFontFamily] = useState(FONT_FAMILIES[0].value);
const [fontSize, setFontSize] = useState(FONT_SIZES[3].value); // Default: 16px
const initialConfig = {
namespace: 'WikiEditor',
theme: editorTheme,
onError,
nodes: [
HeadingNode,
ListNode,
ListItemNode,
QuoteNode,
CodeNode,
CodeHighlightNode,
LinkNode,
AutoLinkNode,
TableNode,
TableCellNode,
TableRowNode,
],
};
return (
}
placeholder={
{placeholder}
}
ErrorBoundary={LexicalErrorBoundary}
/>
);
}