@daneshnaik/rich-text-editor 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -84,6 +84,33 @@ function App() {
|
|
|
84
84
|
export default App;
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
### Exporting / Printing (Only toolbar + page)
|
|
88
|
+
|
|
89
|
+
The package includes CSS helpers so consumers can print or export only the editor canvas and toolbar (no surrounding app chrome).
|
|
90
|
+
|
|
91
|
+
- Print: the package defines `@media print` rules that automatically hide other page content and show only `.editor-toolbar` and `.editor-container`.
|
|
92
|
+
- Programmatic export: use the `export-only` helper class on `document.body` to hide everything except the editor, then trigger `window.print()` or your capture routine.
|
|
93
|
+
|
|
94
|
+
Example button (optional):
|
|
95
|
+
|
|
96
|
+
```jsx
|
|
97
|
+
import React from 'react';
|
|
98
|
+
import ExportButton from './components/ExportButton'; // or from package export when bundled
|
|
99
|
+
|
|
100
|
+
function MyEditorPage() {
|
|
101
|
+
return (
|
|
102
|
+
<div>
|
|
103
|
+
<RichTextEditor />
|
|
104
|
+
<ExportButton />
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export default MyEditorPage;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
If you're bundling the library for npm, include the `ExportButton` in your published module exports so consumers can import it directly from the package.
|
|
113
|
+
|
|
87
114
|
## Requirements
|
|
88
115
|
|
|
89
116
|
- React 18.0.0 or higher
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
*{margin:0;padding:0;box-sizing:border-box}:root{--toolbar-height: 64px;--toolbar-row-height: 44px;--toolbar-rows: 2;--toolbar-gap: 8px}.editor-container{width:100%;max-width:100%;margin:0;min-height:600px;height:auto;background:#f8f9fa;border-radius:0;box-shadow:none;overflow:visible;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;display:block;transition:all .3s cubic-bezier(.4,0,.2,1);position:relative;padding-top:0;padding-bottom:0}.editor-container.fullscreen{width:100vw;height:100vh;max-width:100%;margin:0;border-radius:0;z-index:9999}.editor-header,.editor-title,.editor-brand,.editor-badge,.editor-actions,.action-btn{display:none}.action-btn svg{display:none}.page-card .page-body{height:auto;overflow:visible;-webkit-overflow-scrolling:touch}.action-btn.active{display:none}.page-card .page-body img{max-width:100%;height:auto}.page-card .page-body:focus{outline:none!important;box-shadow:none!important}.page-card .page-body[contenteditable]{border:none!important;outline:none!important;box-shadow:none!important}.editor-toolbar{display:flex;gap:var(--toolbar-gap);padding:12px 24px;align-items:center;border-bottom:1px solid #e0e0e0;background:#fff;position:sticky;top:0;left:0;right:0;z-index:100;flex-wrap:wrap;flex-shrink:0;box-shadow:0 1px 3px #0000000f;max-height:calc((var(--toolbar-row-height) * var(--toolbar-rows)) + 24px);overflow:visible}.toolbar-group{display:flex;gap:4px;align-items:center;padding:0;position:relative;flex:0 1 auto}.toolbar-group:not(:last-child):after{content:"";width:1px;height:24px;background:#e0e0e0;margin-left:8px}.toolbar-btn{display:inline-flex;align-items:center;justify-content:center;min-width:32px;height:32px;padding:6px;border-radius:4px;background:transparent;color:#5f6368;cursor:pointer;transition:all .15s ease;border:none;position:relative;flex:0 0 auto}.toolbar-btn svg{width:18px;height:18px;stroke-width:2}.toolbar-btn:hover{background:#f1f3f4;color:#202124}.toolbar-btn:active{background:#e8eaed;transform:scale(.95)}.toolbar-btn.active{background:#e8f0fe;color:#1967d2}.toolbar-select{height:32px;padding:6px 28px 6px 12px;border:1px solid #dadce0;border-radius:4px;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%235f6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center;background-size:12px;color:#202124;appearance:none;min-width:88px;font-weight:500;font-size:14px;cursor:pointer;transition:all .15s ease;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;flex:0 1 140px}.toolbar-select:hover{border-color:#5f6368;background-color:#f8f9fa}.toolbar-select:focus{outline:none;border-color:#1967d2;box-shadow:0 0 0 2px #1967d21a}.color-picker-wrapper{width:32px;height:32px;border:1px solid #d1d5db;border-radius:6px;background:#fff;position:relative;overflow:hidden;cursor:pointer;transition:all .15s ease}.color-picker-wrapper:hover{border-color:#9ca3af;box-shadow:0 2px 4px #0000000f}.toolbar-dropdown-panel{position:absolute;top:calc(100% + 4px);left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;padding:6px;box-shadow:0 4px 16px #0000001f;z-index:2000;display:flex;gap:4px;align-items:center;max-width:400px;overflow-x:auto;overflow-y:hidden}.toolbar-dropdown-panel::-webkit-scrollbar{height:6px}.toolbar-dropdown-panel::-webkit-scrollbar-track{background:#f3f4f6;border-radius:3px}.toolbar-dropdown-panel::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}.toolbar-dropdown-panel .toolbar-btn{min-width:32px;width:32px;height:32px;flex-shrink:0;border:1px solid #e5e7eb}.toolbar-dropdown-panel .toolbar-btn:hover{background:#f3f4f6;border-color:#3b82f6}.color-picker-wrapper input[type=color]{position:absolute;left:0;top:0;width:100%;height:100%;border:none;padding:0;cursor:pointer}.color-picker-wrapper .color-label{position:absolute;right:4px;bottom:4px;font-size:9px;color:#6b7280;pointer-events:none;font-weight:600}.color-picker-wrapper:focus-within{box-shadow:0 6px 18px #0000001f,0 0 0 4px #22c55e0f;border-color:var(--accent)}.editor-content{flex:1;overflow-y:auto;overflow-x:hidden;background:#f8f9fa;padding:24px;display:flex;justify-content:center;align-items:flex-start;width:100%}.page-card{width:794px;margin:0 auto 24px;background:var(--card-bg);border-radius:0;box-shadow:0 4px 20px #00000014;padding:0;border:1px solid var(--border);border-top:none;display:flex;flex-direction:column;overflow:visible}.page-card .page-body{background:var(--editor-bg);min-height:1000px;padding:64px 96px;border-radius:0;box-shadow:none;border:none;color:#202124;overflow-wrap:break-word;word-wrap:break-word;overflow:visible;flex:1;font-size:16px;line-height:1.6;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;outline:none;cursor:text}.page-card.size-a4{width:794px;min-height:1123px}.page-card.size-letter{width:816px;min-height:1056px}.page-card.size-a3{width:1122px;min-height:1587px}.page-card.size-legal{width:816px;min-height:1344px}.page-card.size-custom{width:900px;min-height:1200px}.page-card{display:block;box-sizing:border-box}.page-card .page-body{height:auto;overflow:visible}.page-card .page-body table{width:100%;max-width:100%;table-layout:fixed;border-collapse:collapse}.page-card .page-body *{max-width:100%}.page-card .page-body th,.page-card .page-body td{white-space:normal;word-break:break-word;box-sizing:border-box}@media(max-width:1300px){.page-card.size-a3{width:calc(100% - 48px);height:auto}}@media(max-width:1000px){.page-card.size-a4,.page-card.size-letter,.page-card.size-legal,.page-card.size-custom{width:calc(100% - 48px);height:auto}.page-card .page-body{padding:32px 48px}}@media(max-width:768px){.page-card{width:calc(100% - 24px)!important}.page-card .page-body{padding:24px 32px}}.page-size-select{height:36px;padding:6px 10px;border-radius:8px;border:1px solid var(--border);background:#fff;color:var(--text-color);font-weight:600;margin-right:8px}.page-card .page-body h1{font-size:40px;font-weight:700;line-height:1.2;margin:24px 0 16px;color:#202124;letter-spacing:-.5px}.page-card .page-body h1 .page-card .page-body thead th{background:#0f172a88;color:#fff}.page-card .page-body h2{font-size:32px;font-weight:700;line-height:1.3;margin:20px 0 12px;color:#202124;letter-spacing:-.3px}.page-card .page-body h3{font-size:24px;font-weight:600;line-height:1.4;margin:16px 0 10px;color:#202124}.page-card .page-body h4{font-size:20px;font-weight:600;line-height:1.4;margin:14px 0 8px;color:#202124}.page-card .page-body p{margin:0 0 12px;line-height:1.6;color:#3c4043}.page-card .page-body[data-placeholder]:empty:before{content:attr(data-placeholder);color:#9aa0a6;font-style:italic;pointer-events:none;position:absolute}.page-card .page-body strong,.page-card .page-body b{font-weight:700;color:#202124}.page-card .page-body em,.page-card .page-body i{font-style:italic}.page-card .page-body ul,.page-card .page-body ol{margin:12px 0;padding-left:28px}.page-card .page-body li{margin:6px 0;line-height:1.6;color:#3c4043}.editor-content:focus{outline:none;background:var(--editor-bg)}.editor-content p{margin:0 0 16px;transition:color .2s ease}.editor-content h3,.editor-content h4,.editor-content h5,.editor-content h6{color:var(--text-color);margin:24px 0 16px;font-weight:700;transition:color .2s ease}.editor-content a{color:var(--accent);text-decoration:underline}.page-card .page-body a{color:#1d4ed8;text-decoration:underline;cursor:pointer}.page-card .page-body a:hover{opacity:.92}.page-card .page-body a[contenteditable=false]{cursor:pointer}.editable-image-wrap{position:relative;display:inline-block;margin:4px;max-width:100%;vertical-align:top;width:fit-content}.editable-image-wrap.selected{outline:3px solid #3b82f6;outline-offset:2px;box-shadow:0 0 0 1px #3b82f633}.editable-image-wrap img{display:block;max-width:100%;height:auto}.image-resize-handle{position:absolute;width:12px;height:12px;background:#3b82f6;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 6px #0003;z-index:20;display:none}.editable-image-wrap.selected .image-resize-handle{display:block}.image-resize-handle.nw{top:-6px;left:-6px;cursor:nw-resize}.image-resize-handle.ne{top:-6px;right:-6px;cursor:ne-resize}.image-resize-handle.sw{bottom:-6px;left:-6px;cursor:sw-resize}.image-resize-handle.se{bottom:-6px;right:-6px;cursor:se-resize}.image-resize-handle:hover{background:#2563eb;transform:scale(1.2)}.image-controls{position:absolute;bottom:-44px;left:50%;transform:translate(-50%);display:none;gap:4px;background:#fff;border:1px solid #cbd5e1;padding:6px 8px;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:100;white-space:nowrap}.editable-image-wrap.selected .image-controls{display:flex}.image-control-btn{min-width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;font-weight:600;font-size:11px;background:#fff;border:1px solid #e5e7eb;border-radius:4px;cursor:pointer;color:#374151;transition:all .15s ease;padding:0 8px}.image-control-btn:hover{background:#3b82f6;color:#fff;border-color:#3b82f6;transform:translateY(-1px);box-shadow:0 2px 6px #0000001a}.image-control-btn svg{width:14px;height:14px}.image-control-divider{width:1px;height:24px;background:#e5e7eb;margin:0 4px}.editor-content img{max-width:100%;height:auto;border-radius:6px;margin:12px 0}.editor-content hr{border:none;border-top:1px solid var(--border);margin:20px 0}.editor-content blockquote{border-left:4px solid var(--border);padding-left:12px;color:var(--muted);font-style:italic}.editor-content code{background:var(--surface-1);color:var(--text-color);padding:3px 6px;border-radius:4px;font-family:Monaco,Menlo,monospace}.editor-content table{border-collapse:collapse;width:100%;margin:16px 0;background:var(--editor-bg);border-radius:0;overflow:visible;box-shadow:none;position:relative}.editor-content table th{background:#f8f9fa;color:var(--text-color);font-weight:700;text-align:left;padding:12px 16px;border:1px solid #cbd5e1;font-size:14px}.editor-content table td{padding:12px 16px;border:1px solid #cbd5e1;color:var(--text-color);background:#fff;font-size:14px}.editor-content table tr:hover td{background:#fefce8}.editable-table-wrap{position:relative;margin:20px 0;display:inline-block;min-width:200px}.editable-table-wrap.selected{outline:3px solid #fbbf24;outline-offset:2px;box-shadow:0 0 0 1px #fbbf2433}.table-resize-handle{position:absolute;width:14px;height:14px;background:#fbbf24;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 6px #0003;cursor:nwse-resize;z-index:20;display:none}.editable-table-wrap.selected .table-resize-handle{display:block}.table-resize-handle.nw{top:-7px;left:-7px;cursor:nw-resize}.table-resize-handle.ne{top:-7px;right:-7px;cursor:ne-resize}.table-resize-handle.sw{bottom:-7px;left:-7px;cursor:sw-resize}.table-resize-handle.se{bottom:-7px;right:-7px;cursor:se-resize}.table-resize-handle:hover{background:#f59e0b;transform:scale(1.2)}.table-controls{position:absolute;top:-48px;left:0;display:none;gap:4px;background:#fff;border:1px solid #cbd5e1;padding:6px;border-radius:6px;box-shadow:0 4px 12px #0000001a;z-index:100}.editable-table-wrap.selected .table-controls{display:flex}.table-control-btn{min-width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;font-weight:600;font-size:11px;background:#fff;border:1px solid #e5e7eb;border-radius:4px;cursor:pointer;color:#374151;transition:all .15s ease}.table-control-btn:hover{background:#fbbf24;color:#fff;border-color:#fbbf24;transform:translateY(-1px);box-shadow:0 2px 6px #0000001a}.editor-content pre{background:#0b0b0b;color:#f7f7f7;padding:16px;border-radius:8px;overflow-x:auto;margin:16px 0}.editor-content pre code{background:none;color:inherit;padding:0;font-family:Monaco,Menlo,monospace}.editor-footer,.status-bar,.status-item,.status-bar-bottom{display:none}.status-bar-bottom .status-item{display:inline;white-space:nowrap;padding:0;background:none;border:none}.status-item:hover{transform:translateY(-2px);box-shadow:0 4px 8px #0000000f}.editor-content::-webkit-scrollbar,.modal-body::-webkit-scrollbar{width:12px}.editor-content::-webkit-scrollbar-track,.modal-body::-webkit-scrollbar-track{background:#f3f4f6;border-radius:6px}.editor-content::-webkit-scrollbar-thumb,.modal-body::-webkit-scrollbar-thumb{background:#9aa3ad;border-radius:6px;border:2px solid #f3f4f6}.modal-overlay,.link-modal-overlay{position:fixed;inset:0;background:#00000080;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);display:flex;align-items:center;justify-content:center;z-index:10000;animation:rte-fadeIn .18s ease}@keyframes rte-fadeIn{0%{opacity:0}to{opacity:1}}.modal-content{background:var(--card-bg);border-radius:12px;box-shadow:0 25px 50px -12px #00000040;width:90%;max-width:680px;max-height:90vh;overflow:hidden;display:flex;flex-direction:column;animation:rte-slideUp .28s ease}@keyframes rte-slideUp{0%{transform:translateY(12px);opacity:0}to{transform:translateY(0);opacity:1}}.modal-header{display:flex;justify-content:space-between;align-items:center;padding:18px 20px;background:var(--header-bg);color:#fff}.modal-header h3{margin:0;font-size:18px;font-weight:600}.modal-close{background:#ffffff0f;border:1px solid rgba(255,255,255,.08);color:#fff;width:36px;height:36px;border-radius:8px;display:flex;align-items:center;justify-content:center;cursor:pointer}.modal-close:hover{background:#ffffff1f;transform:rotate(90deg)}.modal-body{padding:20px;overflow-y:auto;flex:1}.modal-footer{display:flex;justify-content:flex-end;gap:12px;padding:16px 20px;background:var(--surface-1);border-top:1px solid var(--border)}.form-group{margin-bottom:16px}.form-group label{display:block;margin-bottom:8px;font-weight:600;color:var(--muted);font-size:14px}.form-input{width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:8px;font-size:15px;font-family:inherit}.form-input:focus{outline:none;box-shadow:0 0 0 4px #0000000a;border-color:var(--border)}.btn-primary{padding:10px 20px;background:var(--inverse-bg);color:#fff;border:none;border-radius:8px;font-weight:600;cursor:pointer}.btn-primary:hover{transform:translateY(-2px);box-shadow:0 6px 12px #00000014}.btn-secondary{padding:10px 20px;background:var(--editor-bg);color:var(--text-color);border:1px solid var(--border);border-radius:8px;cursor:pointer}.html-preview{background:#0b0b0b;color:#f7f7f7;padding:16px;border-radius:8px;overflow-x:auto;font-size:13px;font-family:Monaco,Menlo,monospace;white-space:pre-wrap;word-break:break-all}.editor-content::selection{background:#11182714;color:var(--text-color)}.table-size-picker{position:absolute;top:calc(100% + 4px);left:0;background:#fff;border:1px solid #d1d5db;border-radius:8px;padding:12px;box-shadow:0 10px 25px #0000001a,0 4px 8px #0000000f;z-index:2000;display:none}.table-size-picker.show{display:block}.table-size-grid{display:grid;gap:2px;cursor:pointer}.table-drag-handle{width:18px;height:18px;border-radius:4px;background:#0000000f;position:absolute;top:8px;left:8px;display:flex;align-items:center;justify-content:center;cursor:grab;z-index:1500}.table-drag-handle:active{cursor:grabbing}.table-context-menu{position:absolute;right:8px;top:36px;background:#fff;border:1px solid #d1d5db;border-radius:8px;padding:8px;box-shadow:0 8px 30px #0000001f;display:flex;flex-direction:column;gap:6px;min-width:160px;z-index:2000}.table-context-menu button{background:transparent;border:none;text-align:left;padding:8px 10px;border-radius:6px;cursor:pointer}.table-context-menu button:hover{background:#f3f4f6}.table-context-menu hr{border:none;height:1px;background:#eef2f7;margin:6px 0}.table-cell-preview{width:18px;height:18px;border:1px solid #d1d5db;background:#fff;transition:all .1s;border-radius:2px}.table-cell-preview.hover{background:#3b82f6;border-color:#2563eb}.table-size-label{text-align:center;margin-top:8px;font-size:12px;color:#6b7280;font-weight:600}.page-card .page-body td.selected-cell,.page-card .page-body th.selected-cell{outline:2px solid rgba(59,130,246,.9);background:#3b82f60f}.find-replace-modal{background:#fff;padding:24px;border-radius:12px;box-shadow:0 20px 50px #00000026;max-width:450px;width:90%}.find-replace-modal h3{margin:0 0 20px;font-size:18px;color:#1e293b;font-weight:700}.find-replace-group{margin-bottom:16px}.find-replace-group label{display:block;margin-bottom:6px;font-size:13px;color:#475569;font-weight:600}.find-replace-input{width:100%;padding:8px 12px;border:1px solid #cbd5e1;border-radius:6px;font-size:14px;transition:all .15s ease}.find-replace-input:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.find-replace-buttons{display:flex;gap:8px;margin-top:20px;flex-wrap:wrap}.find-replace-btn{padding:8px 16px;border-radius:6px;font-size:13px;font-weight:600;cursor:pointer;border:1px solid #cbd5e1;background:#fff;color:#374151;transition:all .15s}.find-replace-btn:hover{background:#f8fafc;border-color:#94a3b8}.find-replace-btn.primary{background:#3b82f6;color:#fff;border-color:#3b82f6}.find-replace-btn.primary:hover{background:#2563eb;border-color:#2563eb}.find-replace-status{margin-top:12px;font-size:13px;color:#64748b;min-height:18px;font-weight:500}.editor-content::-moz-selection{background:#11182714;color:var(--text-color)}@keyframes editorFadeIn{0%{opacity:0}to{opacity:1}}@keyframes slideDown{0%{transform:translateY(-20px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes slideUp{0%{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes fadeInLeft{0%{transform:translate(-20px);opacity:0}to{transform:translate(0);opacity:1}}@keyframes fadeInRight{0%{transform:translate(20px);opacity:0}to{transform:translate(0);opacity:1}}@keyframes fadeInUp{0%{transform:translateY(30px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes pulse{0%,to{opacity:.5}50%{opacity:.8}}@media(max-width:1024px){.editor-content{padding:40px 60px}.editor-header,.editor-toolbar,.editor-footer{padding-left:24px;padding-right:24px}}@media(max-width:768px){.editor-container{margin:0}.editor-header{flex-direction:column;gap:12px;align-items:flex-start;padding:16px 20px}.editor-title{font-size:18px}.action-btn span{display:none}.action-btn{padding:8px;min-width:40px}.editor-toolbar{padding:12px 20px;top:auto;position:relative}.toolbar-group{padding:2px}.toolbar-btn{width:38px;height:38px}.toolbar-select{min-width:110px;height:38px;font-size:13px}.color-picker-wrapper{width:38px;height:38px}.editor-content{padding:24px 20px;min-height:400px;font-size:16px}.editor-footer{padding:12px 20px;position:relative}.modal-content{width:95%;max-width:620px}}@media print{.editor-header,.editor-toolbar,.editor-footer{display:none}.editor-container{box-shadow:none;border:none}.editor-content{max-height:none}}
|
|
1
|
+
*{margin:0;padding:0;box-sizing:border-box}:root{--toolbar-height: 64px;--toolbar-row-height: 44px;--toolbar-rows: 2;--toolbar-gap: 8px}.editor-container{width:100%;max-width:100%;margin:0;min-height:600px;height:auto;background:#f8f9fa;border-radius:0;box-shadow:none;overflow:visible;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;display:block;transition:all .3s cubic-bezier(.4,0,.2,1);position:relative;padding-top:0;padding-bottom:0}.editor-container.fullscreen{width:100vw;height:100vh;max-width:100%;margin:0;border-radius:0;z-index:9999}.editor-header,.editor-title,.editor-brand,.editor-badge,.editor-actions,.action-btn{display:none}.action-btn svg{display:none}.page-card .page-body{height:auto;overflow:visible;-webkit-overflow-scrolling:touch}.action-btn.active{display:none}.page-card .page-body img{max-width:100%;height:auto}.page-card .page-body:focus{outline:none!important;box-shadow:none!important}.page-card .page-body[contenteditable]{border:none!important;outline:none!important;box-shadow:none!important}.editor-toolbar{display:flex;gap:var(--toolbar-gap);padding:12px 24px;align-items:center;border-bottom:1px solid #e0e0e0;background:#fff;position:sticky;top:0;left:0;right:0;z-index:100;flex-wrap:wrap;flex-shrink:0;box-shadow:0 1px 3px #0000000f;max-height:calc((var(--toolbar-row-height) * var(--toolbar-rows)) + 24px);overflow:visible}.toolbar-group{display:flex;gap:4px;align-items:center;padding:0;position:relative;flex:0 1 auto}.toolbar-group:not(:last-child):after{content:"";width:1px;height:24px;background:#e0e0e0;margin-left:8px}.toolbar-btn{display:inline-flex;align-items:center;justify-content:center;min-width:32px;height:32px;padding:6px;border-radius:4px;background:transparent;color:#5f6368;cursor:pointer;transition:all .15s ease;border:none;position:relative;flex:0 0 auto}.toolbar-btn svg{width:18px;height:18px;stroke-width:2}.toolbar-btn:hover{background:#f1f3f4;color:#202124}.toolbar-btn:active{background:#e8eaed;transform:scale(.95)}.toolbar-btn.active{background:#e8f0fe;color:#1967d2}.toolbar-select{height:32px;padding:6px 28px 6px 12px;border:1px solid #dadce0;border-radius:4px;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%235f6368' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center;background-size:12px;color:#202124;appearance:none;min-width:88px;font-weight:500;font-size:14px;cursor:pointer;transition:all .15s ease;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;flex:0 1 140px}.toolbar-select:hover{border-color:#5f6368;background-color:#f8f9fa}.toolbar-select:focus{outline:none;border-color:#1967d2;box-shadow:0 0 0 2px #1967d21a}.color-picker-wrapper{width:32px;height:32px;border:1px solid #d1d5db;border-radius:6px;background:#fff;position:relative;overflow:hidden;cursor:pointer;transition:all .15s ease}.color-picker-wrapper:hover{border-color:#9ca3af;box-shadow:0 2px 4px #0000000f}.toolbar-dropdown-panel{position:absolute;top:calc(100% + 4px);left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;padding:6px;box-shadow:0 4px 16px #0000001f;z-index:2000;display:flex;gap:4px;align-items:center;max-width:400px;overflow-x:auto;overflow-y:hidden}.toolbar-dropdown-panel::-webkit-scrollbar{height:6px}.toolbar-dropdown-panel::-webkit-scrollbar-track{background:#f3f4f6;border-radius:3px}.toolbar-dropdown-panel::-webkit-scrollbar-thumb{background:#d1d5db;border-radius:3px}.toolbar-dropdown-panel .toolbar-btn{min-width:32px;width:32px;height:32px;flex-shrink:0;border:1px solid #e5e7eb}.toolbar-dropdown-panel .toolbar-btn:hover{background:#f3f4f6;border-color:#3b82f6}.color-picker-wrapper input[type=color]{position:absolute;left:0;top:0;width:100%;height:100%;border:none;padding:0;cursor:pointer}.color-picker-wrapper .color-label{position:absolute;right:4px;bottom:4px;font-size:9px;color:#6b7280;pointer-events:none;font-weight:600}.color-picker-wrapper:focus-within{box-shadow:0 6px 18px #0000001f,0 0 0 4px #22c55e0f;border-color:var(--accent)}.editor-content{flex:1;overflow-y:auto;overflow-x:hidden;background:#f8f9fa;padding:24px;display:flex;justify-content:center;align-items:flex-start;width:100%}.page-card{width:794px;margin:0 auto 24px;background:var(--card-bg);border-radius:0;box-shadow:0 4px 20px #00000014;padding:0;border:1px solid var(--border);border-top:none;display:flex;flex-direction:column;overflow:visible}.page-card .page-body{background:var(--editor-bg);min-height:1000px;padding:64px 96px;border-radius:0;box-shadow:none;border:none;color:#202124;overflow-wrap:break-word;word-wrap:break-word;overflow:visible;flex:1;font-size:16px;line-height:1.6;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;outline:none;cursor:text}.page-card.size-a4{width:794px;min-height:1123px}.page-card.size-letter{width:816px;min-height:1056px}.page-card.size-a3{width:1122px;min-height:1587px}.page-card.size-legal{width:816px;min-height:1344px}.page-card.size-custom{width:900px;min-height:1200px}.page-card{display:block;box-sizing:border-box}.page-card .page-body{height:auto;overflow:visible}.page-card .page-body table{width:100%;max-width:100%;table-layout:fixed;border-collapse:collapse}.page-card .page-body *{max-width:100%}.page-card .page-body th,.page-card .page-body td{white-space:normal;word-break:break-word;box-sizing:border-box}@media(max-width:1300px){.page-card.size-a3{width:calc(100% - 48px);height:auto}}@media(max-width:1000px){.page-card.size-a4,.page-card.size-letter,.page-card.size-legal,.page-card.size-custom{width:calc(100% - 48px);height:auto}.page-card .page-body{padding:32px 48px}}@media(max-width:768px){.page-card{width:calc(100% - 24px)!important}.page-card .page-body{padding:24px 32px}}.page-size-select{height:36px;padding:6px 10px;border-radius:8px;border:1px solid var(--border);background:#fff;color:var(--text-color);font-weight:600;margin-right:8px}.page-card .page-body h1{font-size:40px;font-weight:700;line-height:1.2;margin:24px 0 16px;color:#202124;letter-spacing:-.5px}.page-card .page-body h1 .page-card .page-body thead th{background:#0f172a88;color:#fff}.page-card .page-body h2{font-size:32px;font-weight:700;line-height:1.3;margin:20px 0 12px;color:#202124;letter-spacing:-.3px}.page-card .page-body h3{font-size:24px;font-weight:600;line-height:1.4;margin:16px 0 10px;color:#202124}.page-card .page-body h4{font-size:20px;font-weight:600;line-height:1.4;margin:14px 0 8px;color:#202124}.page-card .page-body p{margin:0 0 12px;line-height:1.6;color:#3c4043}.page-card .page-body[data-placeholder]:empty:before{content:attr(data-placeholder);color:#9aa0a6;font-style:italic;pointer-events:none;position:absolute}.page-card .page-body strong,.page-card .page-body b{font-weight:700;color:#202124}.page-card .page-body em,.page-card .page-body i{font-style:italic}.page-card .page-body ul,.page-card .page-body ol{margin:12px 0;padding-left:28px}.page-card .page-body li{margin:6px 0;line-height:1.6;color:#3c4043}.editor-content:focus{outline:none;background:var(--editor-bg)}.editor-content p{margin:0 0 16px;transition:color .2s ease}.editor-content h3,.editor-content h4,.editor-content h5,.editor-content h6{color:var(--text-color);margin:24px 0 16px;font-weight:700;transition:color .2s ease}.editor-content a{color:var(--accent);text-decoration:underline}.page-card .page-body a{color:#1d4ed8;text-decoration:underline;cursor:pointer}.page-card .page-body a:hover{opacity:.92}.page-card .page-body a[contenteditable=false]{cursor:pointer}.editable-image-wrap{position:relative;display:inline-block;margin:4px;max-width:100%;vertical-align:top;width:fit-content}.editable-image-wrap.selected{outline:3px solid #3b82f6;outline-offset:2px;box-shadow:0 0 0 1px #3b82f633}.editable-image-wrap img{display:block;max-width:100%;height:auto}.image-resize-handle{position:absolute;width:12px;height:12px;background:#3b82f6;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 6px #0003;z-index:20;display:none}.editable-image-wrap.selected .image-resize-handle{display:block}.image-resize-handle.nw{top:-6px;left:-6px;cursor:nw-resize}.image-resize-handle.ne{top:-6px;right:-6px;cursor:ne-resize}.image-resize-handle.sw{bottom:-6px;left:-6px;cursor:sw-resize}.image-resize-handle.se{bottom:-6px;right:-6px;cursor:se-resize}.image-resize-handle:hover{background:#2563eb;transform:scale(1.2)}.image-controls{position:absolute;bottom:-44px;left:50%;transform:translate(-50%);display:none;gap:4px;background:#fff;border:1px solid #cbd5e1;padding:6px 8px;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:100;white-space:nowrap}.editable-image-wrap.selected .image-controls{display:flex}.image-control-btn{min-width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;font-weight:600;font-size:11px;background:#fff;border:1px solid #e5e7eb;border-radius:4px;cursor:pointer;color:#374151;transition:all .15s ease;padding:0 8px}.image-control-btn:hover{background:#3b82f6;color:#fff;border-color:#3b82f6;transform:translateY(-1px);box-shadow:0 2px 6px #0000001a}.image-control-btn svg{width:14px;height:14px}.image-control-divider{width:1px;height:24px;background:#e5e7eb;margin:0 4px}.editor-content img{max-width:100%;height:auto;border-radius:6px;margin:12px 0}.editor-content hr{border:none;border-top:1px solid var(--border);margin:20px 0}.editor-content blockquote{border-left:4px solid var(--border);padding-left:12px;color:var(--muted);font-style:italic}.editor-content code{background:var(--surface-1);color:var(--text-color);padding:3px 6px;border-radius:4px;font-family:Monaco,Menlo,monospace}.editor-content table{border-collapse:collapse;width:100%;margin:16px 0;background:var(--editor-bg);border-radius:0;overflow:visible;box-shadow:none;position:relative}.editor-content table th{background:#f8f9fa;color:var(--text-color);font-weight:700;text-align:left;padding:12px 16px;border:1px solid #cbd5e1;font-size:14px}.editor-content table td{padding:12px 16px;border:1px solid #cbd5e1;color:var(--text-color);background:#fff;font-size:14px}.editor-content table tr:hover td{background:#fefce8}.editable-table-wrap{position:relative;margin:20px 0;display:inline-block;min-width:200px}.editable-table-wrap.selected{outline:3px solid #fbbf24;outline-offset:2px;box-shadow:0 0 0 1px #fbbf2433}.table-resize-handle{position:absolute;width:14px;height:14px;background:#fbbf24;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 6px #0003;cursor:nwse-resize;z-index:20;display:none}.editable-table-wrap.selected .table-resize-handle{display:block}.table-resize-handle.nw{top:-7px;left:-7px;cursor:nw-resize}.table-resize-handle.ne{top:-7px;right:-7px;cursor:ne-resize}.table-resize-handle.sw{bottom:-7px;left:-7px;cursor:sw-resize}.table-resize-handle.se{bottom:-7px;right:-7px;cursor:se-resize}.table-resize-handle:hover{background:#f59e0b;transform:scale(1.2)}.table-controls{position:absolute;top:-48px;left:0;display:none;gap:4px;background:#fff;border:1px solid #cbd5e1;padding:6px;border-radius:6px;box-shadow:0 4px 12px #0000001a;z-index:100}.editable-table-wrap.selected .table-controls{display:flex}.table-control-btn{min-width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;font-weight:600;font-size:11px;background:#fff;border:1px solid #e5e7eb;border-radius:4px;cursor:pointer;color:#374151;transition:all .15s ease}.table-control-btn:hover{background:#fbbf24;color:#fff;border-color:#fbbf24;transform:translateY(-1px);box-shadow:0 2px 6px #0000001a}.editor-content pre{background:#0b0b0b;color:#f7f7f7;padding:16px;border-radius:8px;overflow-x:auto;margin:16px 0}.editor-content pre code{background:none;color:inherit;padding:0;font-family:Monaco,Menlo,monospace}.editor-footer,.status-bar,.status-item,.status-bar-bottom{display:none}.status-bar-bottom .status-item{display:inline;white-space:nowrap;padding:0;background:none;border:none}.status-item:hover{transform:translateY(-2px);box-shadow:0 4px 8px #0000000f}.editor-content::-webkit-scrollbar,.modal-body::-webkit-scrollbar{width:12px}.editor-content::-webkit-scrollbar-track,.modal-body::-webkit-scrollbar-track{background:#f3f4f6;border-radius:6px}.editor-content::-webkit-scrollbar-thumb,.modal-body::-webkit-scrollbar-thumb{background:#9aa3ad;border-radius:6px;border:2px solid #f3f4f6}.modal-overlay,.link-modal-overlay{position:fixed;inset:0;background:#00000080;-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);display:flex;align-items:center;justify-content:center;z-index:10000;animation:rte-fadeIn .18s ease}@keyframes rte-fadeIn{0%{opacity:0}to{opacity:1}}.modal-content{background:var(--card-bg);border-radius:12px;box-shadow:0 25px 50px -12px #00000040;width:90%;max-width:680px;max-height:90vh;overflow:hidden;display:flex;flex-direction:column;animation:rte-slideUp .28s ease}@keyframes rte-slideUp{0%{transform:translateY(12px);opacity:0}to{transform:translateY(0);opacity:1}}.modal-header{display:flex;justify-content:space-between;align-items:center;padding:18px 20px;background:var(--header-bg);color:#fff}.modal-header h3{margin:0;font-size:18px;font-weight:600}.modal-close{background:#ffffff0f;border:1px solid rgba(255,255,255,.08);color:#fff;width:36px;height:36px;border-radius:8px;display:flex;align-items:center;justify-content:center;cursor:pointer}.modal-close:hover{background:#ffffff1f;transform:rotate(90deg)}.modal-body{padding:20px;overflow-y:auto;flex:1}.modal-footer{display:flex;justify-content:flex-end;gap:12px;padding:16px 20px;background:var(--surface-1);border-top:1px solid var(--border)}.form-group{margin-bottom:16px}.form-group label{display:block;margin-bottom:8px;font-weight:600;color:var(--muted);font-size:14px}.form-input{width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:8px;font-size:15px;font-family:inherit}.form-input:focus{outline:none;box-shadow:0 0 0 4px #0000000a;border-color:var(--border)}.btn-primary{padding:10px 20px;background:var(--inverse-bg);color:#fff;border:none;border-radius:8px;font-weight:600;cursor:pointer}.btn-primary:hover{transform:translateY(-2px);box-shadow:0 6px 12px #00000014}.btn-secondary{padding:10px 20px;background:var(--editor-bg);color:var(--text-color);border:1px solid var(--border);border-radius:8px;cursor:pointer}.html-preview{background:#0b0b0b;color:#f7f7f7;padding:16px;border-radius:8px;overflow-x:auto;font-size:13px;font-family:Monaco,Menlo,monospace;white-space:pre-wrap;word-break:break-all}.editor-content::selection{background:#11182714;color:var(--text-color)}.table-size-picker{position:absolute;top:calc(100% + 4px);left:0;background:#fff;border:1px solid #d1d5db;border-radius:8px;padding:12px;box-shadow:0 10px 25px #0000001a,0 4px 8px #0000000f;z-index:2000;display:none}.table-size-picker.show{display:block}.table-size-grid{display:grid;gap:2px;cursor:pointer}.table-drag-handle{width:18px;height:18px;border-radius:4px;background:#0000000f;position:absolute;top:8px;left:8px;display:flex;align-items:center;justify-content:center;cursor:grab;z-index:1500}.table-drag-handle:active{cursor:grabbing}.table-context-menu{position:absolute;right:8px;top:36px;background:#fff;border:1px solid #d1d5db;border-radius:8px;padding:8px;box-shadow:0 8px 30px #0000001f;display:flex;flex-direction:column;gap:6px;min-width:160px;z-index:2000}.table-context-menu button{background:transparent;border:none;text-align:left;padding:8px 10px;border-radius:6px;cursor:pointer}.table-context-menu button:hover{background:#f3f4f6}.table-context-menu hr{border:none;height:1px;background:#eef2f7;margin:6px 0}.table-cell-preview{width:18px;height:18px;border:1px solid #d1d5db;background:#fff;transition:all .1s;border-radius:2px}.table-cell-preview.hover{background:#3b82f6;border-color:#2563eb}.table-size-label{text-align:center;margin-top:8px;font-size:12px;color:#6b7280;font-weight:600}.page-card .page-body td.selected-cell,.page-card .page-body th.selected-cell{outline:2px solid rgba(59,130,246,.9);background:#3b82f60f}.find-replace-modal{background:#fff;padding:24px;border-radius:12px;box-shadow:0 20px 50px #00000026;max-width:450px;width:90%}.find-replace-modal h3{margin:0 0 20px;font-size:18px;color:#1e293b;font-weight:700}.find-replace-group{margin-bottom:16px}.find-replace-group label{display:block;margin-bottom:6px;font-size:13px;color:#475569;font-weight:600}.find-replace-input{width:100%;padding:8px 12px;border:1px solid #cbd5e1;border-radius:6px;font-size:14px;transition:all .15s ease}.find-replace-input:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.find-replace-buttons{display:flex;gap:8px;margin-top:20px;flex-wrap:wrap}.find-replace-btn{padding:8px 16px;border-radius:6px;font-size:13px;font-weight:600;cursor:pointer;border:1px solid #cbd5e1;background:#fff;color:#374151;transition:all .15s}.find-replace-btn:hover{background:#f8fafc;border-color:#94a3b8}.find-replace-btn.primary{background:#3b82f6;color:#fff;border-color:#3b82f6}.find-replace-btn.primary:hover{background:#2563eb;border-color:#2563eb}.find-replace-status{margin-top:12px;font-size:13px;color:#64748b;min-height:18px;font-weight:500}.editor-content::-moz-selection{background:#11182714;color:var(--text-color)}@keyframes editorFadeIn{0%{opacity:0}to{opacity:1}}@keyframes slideDown{0%{transform:translateY(-20px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes slideUp{0%{transform:translateY(20px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes fadeInLeft{0%{transform:translate(-20px);opacity:0}to{transform:translate(0);opacity:1}}@media print{body *{visibility:hidden!important}.editor-toolbar,.editor-container,.editor-container *{visibility:visible!important}.editor-container{position:absolute!important;left:0!important;top:0!important;width:100%!important}.editor-toolbar{position:fixed!important;top:0!important;left:0!important;right:0!important;z-index:9999!important}.page-card,.page-card .page-body{background:#fff!important;box-shadow:none!important;border:none!important}}body.export-only *{display:none!important}body.export-only .editor-toolbar,body.export-only .editor-container,body.export-only .editor-container *{display:block!important}body.export-only{background:transparent!important}@keyframes fadeInRight{0%{transform:translate(20px);opacity:0}to{transform:translate(0);opacity:1}}@keyframes fadeInUp{0%{transform:translateY(30px);opacity:0}to{transform:translateY(0);opacity:1}}@keyframes pulse{0%,to{opacity:.5}50%{opacity:.8}}@media(max-width:1024px){.editor-content{padding:40px 60px}.editor-header,.editor-toolbar,.editor-footer{padding-left:24px;padding-right:24px}}@media(max-width:768px){.editor-container{margin:0}.editor-header{flex-direction:column;gap:12px;align-items:flex-start;padding:16px 20px}.editor-title{font-size:18px}.action-btn span{display:none}.action-btn{padding:8px;min-width:40px}.editor-toolbar{padding:12px 20px;top:auto;position:relative}.toolbar-group{padding:2px}.toolbar-btn{width:38px;height:38px}.toolbar-select{min-width:110px;height:38px;font-size:13px}.color-picker-wrapper{width:38px;height:38px}.editor-content{padding:24px 20px;min-height:400px;font-size:16px}.editor-footer{padding:12px 20px;position:relative}.modal-content{width:95%;max-width:620px}}@media print{.editor-header,.editor-toolbar,.editor-footer{display:none}.editor-container{box-shadow:none;border:none}.editor-content{max-height:none}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@daneshnaik/rich-text-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "A powerful and feature-rich WYSIWYG rich text editor for React with table editing, image handling, and extensive formatting options",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/rich-text-editor.umd.cjs",
|