react-quill-editors
Version:
A fully customizable React rich text editor with no external dependencies. Features a comprehensive toolbar similar to popular Markdown editors with file operations, media insertion, and advanced formatting capabilities.
378 lines (324 loc) • 8.09 kB
CSS
.react-quill-editor {
border: 1px solid #e1e5e9;
border-radius: 8px;
overflow: hidden;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: #ffffff;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
min-height: 600px;
max-width: 100%;
}
.react-quill-editor .toolbar {
display: flex;
flex-wrap: nowrap;
gap: 8px;
padding: 12px 16px;
background: #f8f9fa;
border-bottom: 1px solid #e1e5e9;
align-items: center;
min-height: 56px;
flex-shrink: 0;
overflow-x: auto;
justify-content: flex-start;
}
.react-quill-editor .toolbar-group {
display: flex;
gap: 4px;
align-items: center;
margin-right: 12px;
padding: 4px;
border-radius: 4px;
background: rgba(255, 255, 255, 0.7);
border: 1px solid transparent;
flex-shrink: 0;
}
.react-quill-editor .toolbar-group:hover {
background: rgba(255, 255, 255, 0.9);
border-color: #dee2e6;
}
.react-quill-editor .toolbar-divider {
width: 1px;
height: 32px;
background: #dee2e6;
margin: 0 8px;
flex-shrink: 0;
}
.react-quill-editor .toolbar-button {
display: flex;
align-items: center;
justify-content: center;
width: 36px;
height: 36px;
border: 1px solid transparent;
border-radius: 4px;
background: transparent;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.2s ease;
user-select: none;
color: #495057;
position: relative;
flex-shrink: 0;
}
.react-quill-editor .toolbar-button:hover {
background: #e9ecef;
border-color: #ced4da;
color: #212529;
transform: translateY(-1px);
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.react-quill-editor .toolbar-button.active {
background: #007bff;
color: white;
border-color: #0056b3;
box-shadow: 0 2px 4px rgba(0, 123, 255, 0.3);
}
.react-quill-editor .toolbar-button:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
}
.react-quill-editor .toolbar-select {
padding: 6px 10px;
border: 1px solid #ced4da;
border-radius: 4px;
background: white;
font-size: 13px;
cursor: pointer;
min-width: 100px;
color: #495057;
transition: all 0.2s ease;
flex-shrink: 0;
}
.react-quill-editor .toolbar-select:focus {
outline: none;
border-color: #007bff;
box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}
.react-quill-editor .color-picker {
width: 36px;
height: 36px;
border: 1px solid #ced4da;
border-radius: 4px;
cursor: pointer;
background: white;
transition: all 0.2s ease;
flex-shrink: 0;
}
.react-quill-editor .color-picker:hover {
border-color: #007bff;
transform: translateY(-1px);
}
.react-quill-editor .color-picker::-webkit-color-swatch-wrapper {
padding: 0;
}
.react-quill-editor .color-picker::-webkit-color-swatch {
border: none;
border-radius: 3px;
}
.react-quill-editor .dropdown {
position: relative;
display: inline-block;
flex-shrink: 0;
}
.react-quill-editor .dropdown-content {
display: none;
position: absolute;
top: 100%;
left: 0;
background: white;
border: 1px solid #ced4da;
border-radius: 6px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
z-index: 1000;
min-width: 140px;
max-height: 250px;
overflow-y: auto;
margin-top: 6px;
padding: 6px 0;
}
.react-quill-editor .dropdown.show .dropdown-content {
display: block;
}
.react-quill-editor .dropdown-item {
padding: 8px 14px;
cursor: pointer;
border: none;
background: none;
width: 100%;
text-align: left;
font-size: 13px;
color: #495057;
transition: background-color 0.2s ease;
display: flex;
align-items: center;
gap: 8px;
}
.react-quill-editor .dropdown-item:hover {
background: #f8f9fa;
color: #212529;
}
.react-quill-editor .dropdown-item.selected {
background: #007bff;
color: white;
}
.react-quill-editor .editor-content {
flex: 1;
min-height: 500px;
padding: 24px 32px;
outline: none;
line-height: 1.6;
font-size: 16px;
color: #212529;
background: #ffffff;
overflow-y: auto;
border: none;
resize: none;
direction: ltr;
text-align: left;
}
.react-quill-editor .editor-content:focus {
background: #ffffff;
}
.react-quill-editor .editor-content[contenteditable="false"] {
background: #f8f9fa;
cursor: not-allowed;
}
.react-quill-editor .editor-content[contenteditable="true"]:empty:before {
content: attr(data-placeholder);
color: #6c757d;
pointer-events: none;
font-style: italic;
direction: ltr;
text-align: left;
}
/* Toolbar icons styling */
.react-quill-editor .toolbar-button[title="Bold"] {
font-weight: bold;
}
.react-quill-editor .toolbar-button[title="Italic"] {
font-style: italic;
}
.react-quill-editor .toolbar-button[title="Underline"] {
text-decoration: underline;
}
.react-quill-editor .toolbar-button[title="Strikethrough"] {
text-decoration: line-through;
}
.react-quill-editor .toolbar-button[title="Bullet List"] {
font-size: 18px;
}
.react-quill-editor .toolbar-button[title="Numbered List"] {
font-size: 14px;
font-weight: bold;
}
/* File operation buttons - MDEditor style */
.react-quill-editor .toolbar-button[title="Save"],
.react-quill-editor .toolbar-button[title="Delete"],
.react-quill-editor .toolbar-button[title="Close"] {
background: #f8f9fa;
border: 1px solid #dee2e6;
color: #6c757d;
}
.react-quill-editor .toolbar-button[title="Save"]:hover {
background: #d4edda;
border-color: #c3e6cb;
color: #155724;
}
.react-quill-editor .toolbar-button[title="Delete"]:hover {
background: #f8d7da;
border-color: #f5c6cb;
color: #721c24;
}
.react-quill-editor .toolbar-button[title="Close"]:hover {
background: #f8d7da;
border-color: #f5c6cb;
color: #721c24;
}
/* Special formatting buttons */
.react-quill-editor .toolbar-button[title="Quote"] {
font-size: 16px;
font-weight: bold;
}
.react-quill-editor .toolbar-button[title="Code Block"] {
font-size: 12px;
font-weight: bold;
}
.react-quill-editor .toolbar-button[title="Horizontal Rule"] {
font-size: 14px;
font-weight: bold;
}
/* Color dropdown styling */
.react-quill-editor .dropdown-item[style*="color"] {
padding-left: 18px;
}
.react-quill-editor .dropdown-item[style*="background-color"] {
padding-left: 18px;
}
/* Footer styling */
.react-quill-editor .editor-footer {
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 20px;
background: #f8f9fa;
border-top: 1px solid #e1e5e9;
font-size: 13px;
color: #6c757d;
flex-shrink: 0;
}
.react-quill-editor .word-count {
font-weight: 500;
}
.react-quill-editor .version-info {
font-style: italic;
}
/* Responsive design */
@media (max-width: 768px) {
.react-quill-editor .toolbar {
flex-wrap: wrap;
gap: 4px;
padding: 8px;
}
.react-quill-editor .toolbar-group {
margin-right: 6px;
margin-bottom: 4px;
}
.react-quill-editor .toolbar-divider {
display: none;
}
.react-quill-editor .editor-content {
padding: 16px 20px;
font-size: 15px;
}
.react-quill-editor .toolbar-button {
width: 32px;
height: 32px;
font-size: 13px;
}
}
/* Additional styling for better visual hierarchy */
.react-quill-editor .toolbar-group:last-child {
margin-right: 0;
}
.react-quill-editor .toolbar-group:first-child {
margin-left: 0;
}
/* Scrollbar styling */
.react-quill-editor .editor-content::-webkit-scrollbar {
width: 8px;
}
.react-quill-editor .editor-content::-webkit-scrollbar-track {
background: #f1f1f1;
border-radius: 4px;
}
.react-quill-editor .editor-content::-webkit-scrollbar-thumb {
background: #c1c1c1;
border-radius: 4px;
}
.react-quill-editor .editor-content::-webkit-scrollbar-thumb:hover {
background: #a8a8a8;
}