feat: Implement a rich text editor using Lexical
All checks were successful
CI - Build and Push / Build and Push Docker Image (push) Successful in 14s

- Added RichTextEditor component with basic formatting features.
- Integrated toolbar with undo/redo, text formatting, and color pickers.
- Created EditorTheme for styling the editor components.
- Added styles for editor and toolbar.
- Introduced DropdownColorPicker for color selection.
- Updated package.json to include Lexical dependencies.
- Created EditorDemo page to showcase the rich text editor.
- Added README documentation for the editor's features and usage.
This commit is contained in:
2025-10-22 10:20:47 +08:00
parent 6dbb6ff7fb
commit f29f53dec6
13 changed files with 1306 additions and 0 deletions

View File

@@ -0,0 +1,148 @@
.editor-container {
margin: 20px auto;
border-radius: 8px;
max-width: 1100px;
color: #000;
position: relative;
line-height: 1.7;
font-weight: 400;
text-align: left;
border: 1px solid #e0e0e0;
background: #fff;
}
.editor-inner {
background: #fff;
position: relative;
border-bottom-left-radius: 8px;
border-bottom-right-radius: 8px;
}
.editor-input {
min-height: 300px;
resize: vertical;
font-size: 15px;
caret-color: rgb(5, 5, 5);
position: relative;
tab-size: 1;
outline: 0;
padding: 15px 20px;
caret-color: #444;
}
.editor-placeholder {
color: #999;
overflow: hidden;
position: absolute;
text-overflow: ellipsis;
top: 15px;
left: 20px;
font-size: 15px;
user-select: none;
display: inline-block;
pointer-events: none;
}
.editor-paragraph {
margin: 0;
margin-bottom: 8px;
position: relative;
}
.editor-paragraph:last-child {
margin-bottom: 0;
}
.editor-heading-h1 {
font-size: 2em;
font-weight: 700;
margin: 0;
margin-bottom: 12px;
padding: 0;
}
.editor-heading-h2 {
font-size: 1.5em;
font-weight: 700;
margin: 0;
margin-bottom: 10px;
padding: 0;
}
.editor-heading-h3 {
font-size: 1.25em;
font-weight: 700;
margin: 0;
margin-bottom: 8px;
padding: 0;
}
.editor-quote {
margin: 0;
margin-left: 20px;
margin-bottom: 10px;
font-size: 15px;
color: #666;
border-left: 4px solid #ccc;
padding-left: 16px;
}
.editor-code {
background-color: #f4f4f4;
font-family: Menlo, Consolas, Monaco, monospace;
display: block;
padding: 8px 12px;
line-height: 1.53;
font-size: 13px;
margin: 0;
margin-top: 8px;
margin-bottom: 8px;
overflow-x: auto;
position: relative;
tab-size: 2;
border-radius: 4px;
}
.editor-text-bold {
font-weight: bold;
}
.editor-text-italic {
font-style: italic;
}
.editor-text-underline {
text-decoration: underline;
}
.editor-text-strikethrough {
text-decoration: line-through;
}
.editor-text-code {
background-color: #f4f4f4;
padding: 1px 4px;
font-family: Menlo, Consolas, Monaco, monospace;
font-size: 90%;
border-radius: 3px;
}
.editor-list-ol {
padding: 0;
margin: 0;
margin-left: 20px;
}
.editor-list-ul {
padding: 0;
margin: 0;
margin-left: 20px;
}
.editor-listitem {
margin: 4px 0;
}
.editor-nested-listitem {
list-style-type: none;
}