@zencemarketing/text-editor-sdk 0.1.0-alpha.0 → 0.1.0-alpha.2
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 +22 -2
- package/dist/App.d.ts.map +1 -1
- package/dist/components/RichTextEditor.d.ts.map +1 -1
- package/dist/components/Toolbar.d.ts +1 -0
- package/dist/components/Toolbar.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +37 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +37 -22
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @zencemarketing/text-editor-sdk
|
|
2
2
|
|
|
3
|
-
> ⚠️ **Alpha Release**: This is an early alpha version (0.1.0-alpha.
|
|
3
|
+
> ⚠️ **Alpha Release**: This is an early alpha version (0.1.0-alpha.2). APIs may change before the stable 1.0.0 release. Use in production at your own risk.
|
|
4
4
|
|
|
5
5
|
A highly customizable, feature-rich React text editor built with Slate.js. Perfect for content management systems, messaging apps, comment sections, and any application requiring rich text editing capabilities.
|
|
6
6
|
|
|
@@ -188,10 +188,30 @@ interface Tag {
|
|
|
188
188
|
| `toolbarPosition` | `'top' \| 'bottom' \| 'both'` | `'top'` | Toolbar position |
|
|
189
189
|
| `topToolbarButtons` | `string[]` | `[]` | Buttons for top toolbar |
|
|
190
190
|
| `bottomToolbarButtons` | `string[]` | `[]` | Buttons for bottom toolbar |
|
|
191
|
+
| `moreMenuItems` | `MoreMenuItem[]` | `[]` | Items shown inside the More (⋯) popup |
|
|
191
192
|
|
|
192
193
|
**Available Toolbar Buttons:**
|
|
193
194
|
`'headings'`, `'bold'`, `'italic'`, `'underline'`, `'strikethrough'`, `'bulletList'`, `'numberedList'`, `'link'`, `'mediaUpload'`, `'mentions'`, `'tags'`, `'emoji'`, `'codeBlock'`, `'more'`
|
|
194
195
|
|
|
196
|
+
**Available `moreMenuItems`:**
|
|
197
|
+
`'paragraph'`, `'codeBlock'`, `'clearFormatting'`, `'decreaseIndent'`, `'increaseIndent'`, `'horizontalRule'`, `'undo'`, `'redo'`
|
|
198
|
+
|
|
199
|
+
**Example (hide code block in More menu):**
|
|
200
|
+
```tsx
|
|
201
|
+
<RichTextEditor
|
|
202
|
+
// ...other props
|
|
203
|
+
moreMenuItems={[
|
|
204
|
+
'paragraph',
|
|
205
|
+
'clearFormatting',
|
|
206
|
+
'decreaseIndent',
|
|
207
|
+
'increaseIndent',
|
|
208
|
+
'horizontalRule',
|
|
209
|
+
'undo',
|
|
210
|
+
'redo'
|
|
211
|
+
]}
|
|
212
|
+
/>
|
|
213
|
+
```
|
|
214
|
+
|
|
195
215
|
#### Action Buttons
|
|
196
216
|
|
|
197
217
|
| Prop | Type | Default | Description |
|
|
@@ -629,7 +649,7 @@ The editor includes its own CSS. Make sure your build tool processes CSS imports
|
|
|
629
649
|
|
|
630
650
|
## ⚠️ Alpha Version Notice
|
|
631
651
|
|
|
632
|
-
This is an **alpha release** (0.1.0-alpha.
|
|
652
|
+
This is an **alpha release** (0.1.0-alpha.2). This means:
|
|
633
653
|
|
|
634
654
|
- ✅ Core features are implemented and tested
|
|
635
655
|
- ⚠️ API may change before stable 1.0.0 release
|
package/dist/App.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAGA,OAAO,WAAW,CAAC;AAsDnB,iBAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AAGA,OAAO,WAAW,CAAC;AAsDnB,iBAAS,GAAG,4CAgRX;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../../src/components/RichTextEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAMjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAK/C,OAAO,sBAAsB,CAAC;AAS9B,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../../src/components/RichTextEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAMjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAK/C,OAAO,sBAAsB,CAAC;AAS9B,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqnCjD,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAc,MAAM,OAAO,CAAC;AAa3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,eAAe,CAAC;AAEvB,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACvD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,CAAC,EAAE,mBAAmB,CAAC,cAAc,CAAC,CAAC;IACnD,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"Toolbar.d.ts","sourceRoot":"","sources":["../../src/components/Toolbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAc,MAAM,OAAO,CAAC;AAa3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,OAAO,eAAe,CAAC;AAEvB,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACvD,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,CAAC,EAAE,mBAAmB,CAAC,cAAc,CAAC,CAAC;IACnD,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IACtC,IAAI,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACnC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,YAAY,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IACnC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,aAAa,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC;AAED,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA47BnC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.rte-custom-color-picker{background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);min-width:240px;padding:32px 12px 12px;position:relative}.rte-color-picker-presets{display:grid;gap:4px;grid-template-columns:repeat(6,1fr);margin-bottom:12px}.rte-color-preset{border:1px solid #ddd;border-radius:4px;cursor:pointer;height:32px;padding:0;transition:transform .1s,box-shadow .1s;width:32px}.rte-color-preset:hover{box-shadow:0 2px 4px rgba(0,0,0,.2);position:relative;transform:scale(1.1);z-index:1}.rte-color-picker-input-group{align-items:center;display:flex;gap:8px}.rte-color-preview{border:1px solid #ddd;border-radius:4px;flex-shrink:0;height:40px;width:40px}.rte-color-hex-input{border:1px solid #ddd;border-radius:4px;flex:1;font-family:monospace;font-size:14px;padding:8px;text-transform:uppercase}.rte-color-hex-input:focus{border-color:#06c;box-shadow:0 0 0 2px rgba(0,102,204,.1);outline:none}.rte-color-native-input{bottom:60px;height:1px;left:50%;opacity:0;pointer-events:none;position:absolute;top:auto;transform:translateX(-50%);width:1px;z-index:-1}.rte-color-native-button{background:#f8f9fa;border:1px solid #ddd;border-radius:4px;cursor:pointer;font-size:18px;margin-top:8px;padding:8px;position:relative;transition:background-color .2s;width:100%}.rte-color-native-button:hover{background:#e9ecef}.rte-toolbar{align-items:center;background-color:#f8f9fa;display:flex;flex-wrap:nowrap;gap:4px;padding:8px 12px}.rte-toolbar-top{border-bottom:1px solid #e0e0e0}.rte-toolbar-bottom{border-top:1px solid #e0e0e0}.rte-toolbar-action-buttons{display:flex;flex-shrink:0;gap:8px;margin-left:auto}.rte-toolbar-select{background-color:#fff;border:1px solid #ddd;border-radius:4px;cursor:pointer;font-size:14px;margin-right:4px;padding:4px 8px}.rte-toolbar-button{align-items:center;background-color:transparent;border:none;border-radius:4px;color:#333;cursor:pointer;display:flex;font-size:16px;height:32px;justify-content:center;transition:background-color .2s;width:32px}.rte-toolbar-button:hover{background-color:#e0e0e0}.rte-toolbar-button.active{background-color:#d0d0d0;color:#000}.rte-toolbar-button:disabled{cursor:not-allowed;opacity:.5}.rte-toolbar-divider{background-color:#ddd;height:24px;margin:0 4px;width:1px}.rte-toolbar-group{position:relative}.rte-link-dialog-wrapper{overflow:visible;position:relative}.rte-link-dialog-wrapper .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-link-dialog{background:#fff;border:1px solid #ddd;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);min-width:320px;overflow:hidden;position:relative}.rte-link-dialog-content{display:flex;gap:8px;padding:12px}.rte-close-button{align-items:center;background:#fff;border:1px solid #ddd;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.15);color:#666;cursor:pointer;display:flex;font-size:18px;height:24px;justify-content:center;line-height:1;padding:0;position:absolute;right:-12px;top:-12px;transition:all .2s;width:24px;z-index:10001}.rte-close-button:hover{background-color:#f0f0f0;border-color:#999;box-shadow:0 2px 6px rgba(0,0,0,.2);color:#000;transform:scale(1.1)}.rte-close-button:active{transform:scale(.95)}.rte-link-dialog input{border:1px solid #ddd;border-radius:6px;flex:1;font-size:14px;outline:none;padding:10px 12px;transition:border-color .2s}.rte-link-dialog input:focus{border-color:#06c}.rte-link-dialog button{background-color:#06c;border:none;border-radius:6px;color:#fff;cursor:pointer;font-size:14px;font-weight:500;padding:10px 16px;transition:background-color .2s}.rte-link-dialog button:hover{background-color:#0052a3}.rte-link-dialog button:active{background-color:#004080}.rte-mention-list-wrapper{overflow:visible;position:relative}.rte-mention-list-wrapper .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-mention-list{background:#fff;border:1px solid #ddd;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);display:flex;flex-direction:column;max-height:350px;max-width:400px;min-width:280px;overflow:hidden;position:relative}.rte-mention-list input{background:#f8f9fa;border:none;border-bottom:1px solid #e0e0e0;border-radius:8px 8px 0 0;box-sizing:border-box;color:#333;font-size:14px;outline:none;padding:12px 16px;transition:background-color .2s;width:100%}.rte-mention-list input:focus{background:#fff;border-bottom-color:#06c}.rte-mention-list input::-moz-placeholder{color:#999}.rte-mention-list input::placeholder{color:#999}.rte-mention-items{max-height:280px;overflow-y:auto;padding:4px 0}.rte-mention-items::-webkit-scrollbar{width:6px}.rte-mention-items::-webkit-scrollbar-track{background:#f1f1f1}.rte-mention-items::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.rte-mention-items::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.rte-mention-item{align-items:center;border-bottom:1px solid #f0f0f0;cursor:pointer;display:flex;gap:12px;padding:10px 16px;transition:all .2s}.rte-mention-item:last-child{border-bottom:none}.rte-mention-item:hover{background-color:#f5f5f5}.rte-mention-item:active{background-color:#e8e8e8}.rte-mention-item img{border-radius:50%;flex-shrink:0;height:32px;-o-object-fit:cover;object-fit:cover;width:32px}.rte-mention-item span{color:#333;flex:1;font-size:14px}.rte-emoji-picker-container{margin-top:4px;overflow:visible;position:absolute;right:0;top:100%;z-index:1000}.rte-emoji-picker-container .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-emoji-picker-wrapper{border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);overflow:hidden}.rte-more-menu{background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);margin-top:4px;
|
|
1
|
+
.rte-custom-color-picker{background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);min-width:240px;padding:32px 12px 12px;position:relative}.rte-color-picker-presets{display:grid;gap:4px;grid-template-columns:repeat(6,1fr);margin-bottom:12px}.rte-color-preset{border:1px solid #ddd;border-radius:4px;cursor:pointer;height:32px;padding:0;transition:transform .1s,box-shadow .1s;width:32px}.rte-color-preset:hover{box-shadow:0 2px 4px rgba(0,0,0,.2);position:relative;transform:scale(1.1);z-index:1}.rte-color-picker-input-group{align-items:center;display:flex;gap:8px}.rte-color-preview{border:1px solid #ddd;border-radius:4px;flex-shrink:0;height:40px;width:40px}.rte-color-hex-input{border:1px solid #ddd;border-radius:4px;flex:1;font-family:monospace;font-size:14px;padding:8px;text-transform:uppercase}.rte-color-hex-input:focus{border-color:#06c;box-shadow:0 0 0 2px rgba(0,102,204,.1);outline:none}.rte-color-native-input{bottom:60px;height:1px;left:50%;opacity:0;pointer-events:none;position:absolute;top:auto;transform:translateX(-50%);width:1px;z-index:-1}.rte-color-native-button{background:#f8f9fa;border:1px solid #ddd;border-radius:4px;cursor:pointer;font-size:18px;margin-top:8px;padding:8px;position:relative;transition:background-color .2s;width:100%}.rte-color-native-button:hover{background:#e9ecef}.rte-toolbar{align-items:center;background-color:#f8f9fa;display:flex;flex-wrap:nowrap;gap:4px;padding:8px 12px}.rte-toolbar-top{border-bottom:1px solid #e0e0e0}.rte-toolbar-bottom{border-top:1px solid #e0e0e0}.rte-toolbar-action-buttons{display:flex;flex-shrink:0;gap:8px;margin-left:auto}.rte-toolbar-select{background-color:#fff;border:1px solid #ddd;border-radius:4px;cursor:pointer;font-size:14px;margin-right:4px;padding:4px 8px}.rte-toolbar-button{align-items:center;background-color:transparent;border:none;border-radius:4px;color:#333;cursor:pointer;display:flex;font-size:16px;height:32px;justify-content:center;transition:background-color .2s;width:32px}.rte-toolbar-button:hover{background-color:#e0e0e0}.rte-toolbar-button.active{background-color:#d0d0d0;color:#000}.rte-toolbar-button:disabled{cursor:not-allowed;opacity:.5}.rte-toolbar-divider{background-color:#ddd;height:24px;margin:0 4px;width:1px}.rte-toolbar-group{position:relative}.rte-link-dialog-wrapper{overflow:visible;position:relative}.rte-link-dialog-wrapper .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-link-dialog{background:#fff;border:1px solid #ddd;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);min-width:320px;overflow:hidden;position:relative}.rte-link-dialog-content{display:flex;gap:8px;padding:12px}.rte-close-button{align-items:center;background:#fff;border:1px solid #ddd;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.15);color:#666;cursor:pointer;display:flex;font-size:18px;height:24px;justify-content:center;line-height:1;padding:0;position:absolute;right:-12px;top:-12px;transition:all .2s;width:24px;z-index:10001}.rte-close-button:hover{background-color:#f0f0f0;border-color:#999;box-shadow:0 2px 6px rgba(0,0,0,.2);color:#000;transform:scale(1.1)}.rte-close-button:active{transform:scale(.95)}.rte-link-dialog input{border:1px solid #ddd;border-radius:6px;flex:1;font-size:14px;outline:none;padding:10px 12px;transition:border-color .2s}.rte-link-dialog input:focus{border-color:#06c}.rte-link-dialog button{background-color:#06c;border:none;border-radius:6px;color:#fff;cursor:pointer;font-size:14px;font-weight:500;padding:10px 16px;transition:background-color .2s}.rte-link-dialog button:hover{background-color:#0052a3}.rte-link-dialog button:active{background-color:#004080}.rte-mention-list-wrapper{overflow:visible;position:relative}.rte-mention-list-wrapper .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-mention-list{background:#fff;border:1px solid #ddd;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);display:flex;flex-direction:column;max-height:350px;max-width:400px;min-width:280px;overflow:hidden;position:relative}.rte-mention-list input{background:#f8f9fa;border:none;border-bottom:1px solid #e0e0e0;border-radius:8px 8px 0 0;box-sizing:border-box;color:#333;font-size:14px;outline:none;padding:12px 16px;transition:background-color .2s;width:100%}.rte-mention-list input:focus{background:#fff;border-bottom-color:#06c}.rte-mention-list input::-moz-placeholder{color:#999}.rte-mention-list input::placeholder{color:#999}.rte-mention-items{max-height:280px;overflow-y:auto;padding:4px 0}.rte-mention-items::-webkit-scrollbar{width:6px}.rte-mention-items::-webkit-scrollbar-track{background:#f1f1f1}.rte-mention-items::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.rte-mention-items::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.rte-mention-item{align-items:center;border-bottom:1px solid #f0f0f0;cursor:pointer;display:flex;gap:12px;padding:10px 16px;transition:all .2s}.rte-mention-item:last-child{border-bottom:none}.rte-mention-item:hover{background-color:#f5f5f5}.rte-mention-item:active{background-color:#e8e8e8}.rte-mention-item img{border-radius:50%;flex-shrink:0;height:32px;-o-object-fit:cover;object-fit:cover;width:32px}.rte-mention-item span{color:#333;flex:1;font-size:14px}.rte-emoji-picker-container{margin-top:4px;overflow:visible;position:absolute;right:0;top:100%;z-index:1000}.rte-emoji-picker-container .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-emoji-picker-wrapper{border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);overflow:hidden}.rte-more-menu{background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);margin-top:4px;max-width:220px;min-width:200px;overflow:visible;padding-top:8px;position:absolute;right:0;top:100%;z-index:1000}.rte-more-menu-content{padding:4px 0}.rte-more-menu-item{align-items:center;background:transparent;border:none;color:#333;cursor:pointer;display:flex;font-size:14px;gap:12px;padding:8px 16px;text-align:left;transition:background-color .2s;width:100%}.rte-more-menu-item:hover{background-color:#f0f0f0}.rte-menu-icon{display:inline-block;font-size:16px;text-align:center;width:20px}.rte-menu-divider{background-color:#e0e0e0;height:1px;margin:4px 0}.rte-color-picker{background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);min-width:200px;padding:32px 8px 8px}.rte-resizable-container{display:inline-block;position:relative}.rte-resizable-container:hover .rte-resize-handle{opacity:1}.rte-resize-handle{background:#06c;border:1px solid #fff;box-shadow:0 1px 2px rgba(0,0,0,.15);opacity:0;position:absolute;transition:opacity .2s;z-index:1000}.rte-resize-handle:hover{background:#0052a3;opacity:1!important}.rte-resize-handle-nw{border-radius:50% 0 50% 0;cursor:nw-resize;height:8px;left:-4px;top:-4px;width:8px}.rte-resize-handle-ne{cursor:ne-resize;right:-4px;top:-4px}.rte-resize-handle-ne,.rte-resize-handle-sw{border-radius:0 50% 0 50%;height:8px;width:8px}.rte-resize-handle-sw{bottom:-4px;cursor:sw-resize;left:-4px}.rte-resize-handle-se{border-radius:50% 0 50% 0;bottom:-4px;cursor:se-resize;height:8px;right:-4px;width:8px}.rte-resize-handle-n{cursor:n-resize;top:-3px}.rte-resize-handle-n,.rte-resize-handle-s{border-radius:2px;height:4px;left:50%;transform:translateX(-50%);width:30px}.rte-resize-handle-s{bottom:-3px;cursor:s-resize}.rte-resize-handle-e{cursor:e-resize;right:-3px}.rte-resize-handle-e,.rte-resize-handle-w{border-radius:2px;height:30px;top:50%;transform:translateY(-50%);width:4px}.rte-resize-handle-w{cursor:w-resize;left:-3px}.rte-paste-options-menu{background:#fff;border:1px solid #ddd;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.15);overflow:hidden;position:absolute!important;z-index:10000!important}.rte-paste-options-content{align-items:center;display:flex;flex-direction:row;gap:2px;padding:4px}.rte-paste-option{align-items:center;background:transparent;border:none;border-radius:4px;cursor:pointer;display:flex;height:32px;justify-content:center;padding:0;transition:background-color .2s;width:32px}.rte-paste-option:hover{background-color:#f0f0f0}.rte-paste-option.rte-paste-close{border-left:1px solid #e0e0e0;margin-left:4px;padding-left:4px}.rte-paste-icon{align-items:center;display:flex;font-size:18px;justify-content:center;line-height:1}.rte-paste-option-desc,.rte-paste-option-title{display:none}.rte-container{display:flex;flex-direction:column;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:14px;line-height:1.5}.rte-editor-wrapper{cursor:text;flex:1;min-height:100%;overflow-y:auto}.rte-editor-wrapper h1{font-size:2em;font-weight:700;margin:.67em 0}.rte-editor-wrapper h2{font-size:1.5em;font-weight:700;margin:.75em 0}.rte-editor-wrapper h3{font-size:1.17em;font-weight:700;margin:.83em 0}.rte-editor-wrapper ol,.rte-editor-wrapper ul{margin:1em 0;padding-left:2em}.rte-editor-wrapper li{margin:.25em 0}.rte-editor-wrapper a{color:#06c;text-decoration:underline}.rte-editor-wrapper a:hover{color:#0052a3}.rte-editor-wrapper pre{border:1px solid #ddd;border-radius:4px;font-size:13px;line-height:1.4;margin:12px 0;overflow-x:auto;padding:12px}.rte-editor-wrapper code,.rte-editor-wrapper pre{background-color:#f5f5f5;font-family:Courier New,Courier,monospace}.rte-editor-wrapper code{border-radius:3px;font-size:.9em;padding:2px 4px}.rte-editor-wrapper pre code{background-color:transparent;padding:0}.rte-editor-wrapper [data-slate-placeholder]{opacity:.5;pointer-events:none;position:absolute}.rte-action-buttons{display:flex;flex-shrink:0;gap:8px}.rte-action-button{min-width:80px;white-space:nowrap}.rte-action-button:hover{opacity:.9}.rte-action-button:active{transform:scale(.98)}
|
package/dist/index.esm.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.rte-custom-color-picker{background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);min-width:240px;padding:32px 12px 12px;position:relative}.rte-color-picker-presets{display:grid;gap:4px;grid-template-columns:repeat(6,1fr);margin-bottom:12px}.rte-color-preset{border:1px solid #ddd;border-radius:4px;cursor:pointer;height:32px;padding:0;transition:transform .1s,box-shadow .1s;width:32px}.rte-color-preset:hover{box-shadow:0 2px 4px rgba(0,0,0,.2);position:relative;transform:scale(1.1);z-index:1}.rte-color-picker-input-group{align-items:center;display:flex;gap:8px}.rte-color-preview{border:1px solid #ddd;border-radius:4px;flex-shrink:0;height:40px;width:40px}.rte-color-hex-input{border:1px solid #ddd;border-radius:4px;flex:1;font-family:monospace;font-size:14px;padding:8px;text-transform:uppercase}.rte-color-hex-input:focus{border-color:#06c;box-shadow:0 0 0 2px rgba(0,102,204,.1);outline:none}.rte-color-native-input{bottom:60px;height:1px;left:50%;opacity:0;pointer-events:none;position:absolute;top:auto;transform:translateX(-50%);width:1px;z-index:-1}.rte-color-native-button{background:#f8f9fa;border:1px solid #ddd;border-radius:4px;cursor:pointer;font-size:18px;margin-top:8px;padding:8px;position:relative;transition:background-color .2s;width:100%}.rte-color-native-button:hover{background:#e9ecef}.rte-toolbar{align-items:center;background-color:#f8f9fa;display:flex;flex-wrap:nowrap;gap:4px;padding:8px 12px}.rte-toolbar-top{border-bottom:1px solid #e0e0e0}.rte-toolbar-bottom{border-top:1px solid #e0e0e0}.rte-toolbar-action-buttons{display:flex;flex-shrink:0;gap:8px;margin-left:auto}.rte-toolbar-select{background-color:#fff;border:1px solid #ddd;border-radius:4px;cursor:pointer;font-size:14px;margin-right:4px;padding:4px 8px}.rte-toolbar-button{align-items:center;background-color:transparent;border:none;border-radius:4px;color:#333;cursor:pointer;display:flex;font-size:16px;height:32px;justify-content:center;transition:background-color .2s;width:32px}.rte-toolbar-button:hover{background-color:#e0e0e0}.rte-toolbar-button.active{background-color:#d0d0d0;color:#000}.rte-toolbar-button:disabled{cursor:not-allowed;opacity:.5}.rte-toolbar-divider{background-color:#ddd;height:24px;margin:0 4px;width:1px}.rte-toolbar-group{position:relative}.rte-link-dialog-wrapper{overflow:visible;position:relative}.rte-link-dialog-wrapper .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-link-dialog{background:#fff;border:1px solid #ddd;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);min-width:320px;overflow:hidden;position:relative}.rte-link-dialog-content{display:flex;gap:8px;padding:12px}.rte-close-button{align-items:center;background:#fff;border:1px solid #ddd;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.15);color:#666;cursor:pointer;display:flex;font-size:18px;height:24px;justify-content:center;line-height:1;padding:0;position:absolute;right:-12px;top:-12px;transition:all .2s;width:24px;z-index:10001}.rte-close-button:hover{background-color:#f0f0f0;border-color:#999;box-shadow:0 2px 6px rgba(0,0,0,.2);color:#000;transform:scale(1.1)}.rte-close-button:active{transform:scale(.95)}.rte-link-dialog input{border:1px solid #ddd;border-radius:6px;flex:1;font-size:14px;outline:none;padding:10px 12px;transition:border-color .2s}.rte-link-dialog input:focus{border-color:#06c}.rte-link-dialog button{background-color:#06c;border:none;border-radius:6px;color:#fff;cursor:pointer;font-size:14px;font-weight:500;padding:10px 16px;transition:background-color .2s}.rte-link-dialog button:hover{background-color:#0052a3}.rte-link-dialog button:active{background-color:#004080}.rte-mention-list-wrapper{overflow:visible;position:relative}.rte-mention-list-wrapper .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-mention-list{background:#fff;border:1px solid #ddd;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);display:flex;flex-direction:column;max-height:350px;max-width:400px;min-width:280px;overflow:hidden;position:relative}.rte-mention-list input{background:#f8f9fa;border:none;border-bottom:1px solid #e0e0e0;border-radius:8px 8px 0 0;box-sizing:border-box;color:#333;font-size:14px;outline:none;padding:12px 16px;transition:background-color .2s;width:100%}.rte-mention-list input:focus{background:#fff;border-bottom-color:#06c}.rte-mention-list input::-moz-placeholder{color:#999}.rte-mention-list input::placeholder{color:#999}.rte-mention-items{max-height:280px;overflow-y:auto;padding:4px 0}.rte-mention-items::-webkit-scrollbar{width:6px}.rte-mention-items::-webkit-scrollbar-track{background:#f1f1f1}.rte-mention-items::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.rte-mention-items::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.rte-mention-item{align-items:center;border-bottom:1px solid #f0f0f0;cursor:pointer;display:flex;gap:12px;padding:10px 16px;transition:all .2s}.rte-mention-item:last-child{border-bottom:none}.rte-mention-item:hover{background-color:#f5f5f5}.rte-mention-item:active{background-color:#e8e8e8}.rte-mention-item img{border-radius:50%;flex-shrink:0;height:32px;-o-object-fit:cover;object-fit:cover;width:32px}.rte-mention-item span{color:#333;flex:1;font-size:14px}.rte-emoji-picker-container{margin-top:4px;overflow:visible;position:absolute;right:0;top:100%;z-index:1000}.rte-emoji-picker-container .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-emoji-picker-wrapper{border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);overflow:hidden}.rte-more-menu{background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);margin-top:4px;
|
|
1
|
+
.rte-custom-color-picker{background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);min-width:240px;padding:32px 12px 12px;position:relative}.rte-color-picker-presets{display:grid;gap:4px;grid-template-columns:repeat(6,1fr);margin-bottom:12px}.rte-color-preset{border:1px solid #ddd;border-radius:4px;cursor:pointer;height:32px;padding:0;transition:transform .1s,box-shadow .1s;width:32px}.rte-color-preset:hover{box-shadow:0 2px 4px rgba(0,0,0,.2);position:relative;transform:scale(1.1);z-index:1}.rte-color-picker-input-group{align-items:center;display:flex;gap:8px}.rte-color-preview{border:1px solid #ddd;border-radius:4px;flex-shrink:0;height:40px;width:40px}.rte-color-hex-input{border:1px solid #ddd;border-radius:4px;flex:1;font-family:monospace;font-size:14px;padding:8px;text-transform:uppercase}.rte-color-hex-input:focus{border-color:#06c;box-shadow:0 0 0 2px rgba(0,102,204,.1);outline:none}.rte-color-native-input{bottom:60px;height:1px;left:50%;opacity:0;pointer-events:none;position:absolute;top:auto;transform:translateX(-50%);width:1px;z-index:-1}.rte-color-native-button{background:#f8f9fa;border:1px solid #ddd;border-radius:4px;cursor:pointer;font-size:18px;margin-top:8px;padding:8px;position:relative;transition:background-color .2s;width:100%}.rte-color-native-button:hover{background:#e9ecef}.rte-toolbar{align-items:center;background-color:#f8f9fa;display:flex;flex-wrap:nowrap;gap:4px;padding:8px 12px}.rte-toolbar-top{border-bottom:1px solid #e0e0e0}.rte-toolbar-bottom{border-top:1px solid #e0e0e0}.rte-toolbar-action-buttons{display:flex;flex-shrink:0;gap:8px;margin-left:auto}.rte-toolbar-select{background-color:#fff;border:1px solid #ddd;border-radius:4px;cursor:pointer;font-size:14px;margin-right:4px;padding:4px 8px}.rte-toolbar-button{align-items:center;background-color:transparent;border:none;border-radius:4px;color:#333;cursor:pointer;display:flex;font-size:16px;height:32px;justify-content:center;transition:background-color .2s;width:32px}.rte-toolbar-button:hover{background-color:#e0e0e0}.rte-toolbar-button.active{background-color:#d0d0d0;color:#000}.rte-toolbar-button:disabled{cursor:not-allowed;opacity:.5}.rte-toolbar-divider{background-color:#ddd;height:24px;margin:0 4px;width:1px}.rte-toolbar-group{position:relative}.rte-link-dialog-wrapper{overflow:visible;position:relative}.rte-link-dialog-wrapper .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-link-dialog{background:#fff;border:1px solid #ddd;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);min-width:320px;overflow:hidden;position:relative}.rte-link-dialog-content{display:flex;gap:8px;padding:12px}.rte-close-button{align-items:center;background:#fff;border:1px solid #ddd;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.15);color:#666;cursor:pointer;display:flex;font-size:18px;height:24px;justify-content:center;line-height:1;padding:0;position:absolute;right:-12px;top:-12px;transition:all .2s;width:24px;z-index:10001}.rte-close-button:hover{background-color:#f0f0f0;border-color:#999;box-shadow:0 2px 6px rgba(0,0,0,.2);color:#000;transform:scale(1.1)}.rte-close-button:active{transform:scale(.95)}.rte-link-dialog input{border:1px solid #ddd;border-radius:6px;flex:1;font-size:14px;outline:none;padding:10px 12px;transition:border-color .2s}.rte-link-dialog input:focus{border-color:#06c}.rte-link-dialog button{background-color:#06c;border:none;border-radius:6px;color:#fff;cursor:pointer;font-size:14px;font-weight:500;padding:10px 16px;transition:background-color .2s}.rte-link-dialog button:hover{background-color:#0052a3}.rte-link-dialog button:active{background-color:#004080}.rte-mention-list-wrapper{overflow:visible;position:relative}.rte-mention-list-wrapper .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-mention-list{background:#fff;border:1px solid #ddd;border-radius:8px;box-shadow:0 4px 12px rgba(0,0,0,.15);display:flex;flex-direction:column;max-height:350px;max-width:400px;min-width:280px;overflow:hidden;position:relative}.rte-mention-list input{background:#f8f9fa;border:none;border-bottom:1px solid #e0e0e0;border-radius:8px 8px 0 0;box-sizing:border-box;color:#333;font-size:14px;outline:none;padding:12px 16px;transition:background-color .2s;width:100%}.rte-mention-list input:focus{background:#fff;border-bottom-color:#06c}.rte-mention-list input::-moz-placeholder{color:#999}.rte-mention-list input::placeholder{color:#999}.rte-mention-items{max-height:280px;overflow-y:auto;padding:4px 0}.rte-mention-items::-webkit-scrollbar{width:6px}.rte-mention-items::-webkit-scrollbar-track{background:#f1f1f1}.rte-mention-items::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:3px}.rte-mention-items::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.rte-mention-item{align-items:center;border-bottom:1px solid #f0f0f0;cursor:pointer;display:flex;gap:12px;padding:10px 16px;transition:all .2s}.rte-mention-item:last-child{border-bottom:none}.rte-mention-item:hover{background-color:#f5f5f5}.rte-mention-item:active{background-color:#e8e8e8}.rte-mention-item img{border-radius:50%;flex-shrink:0;height:32px;-o-object-fit:cover;object-fit:cover;width:32px}.rte-mention-item span{color:#333;flex:1;font-size:14px}.rte-emoji-picker-container{margin-top:4px;overflow:visible;position:absolute;right:0;top:100%;z-index:1000}.rte-emoji-picker-container .rte-close-button{position:absolute;right:-12px;top:-12px;z-index:10001}.rte-emoji-picker-wrapper{border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);overflow:hidden}.rte-more-menu{background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);margin-top:4px;max-width:220px;min-width:200px;overflow:visible;padding-top:8px;position:absolute;right:0;top:100%;z-index:1000}.rte-more-menu-content{padding:4px 0}.rte-more-menu-item{align-items:center;background:transparent;border:none;color:#333;cursor:pointer;display:flex;font-size:14px;gap:12px;padding:8px 16px;text-align:left;transition:background-color .2s;width:100%}.rte-more-menu-item:hover{background-color:#f0f0f0}.rte-menu-icon{display:inline-block;font-size:16px;text-align:center;width:20px}.rte-menu-divider{background-color:#e0e0e0;height:1px;margin:4px 0}.rte-color-picker{background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px rgba(0,0,0,.15);min-width:200px;padding:32px 8px 8px}.rte-resizable-container{display:inline-block;position:relative}.rte-resizable-container:hover .rte-resize-handle{opacity:1}.rte-resize-handle{background:#06c;border:1px solid #fff;box-shadow:0 1px 2px rgba(0,0,0,.15);opacity:0;position:absolute;transition:opacity .2s;z-index:1000}.rte-resize-handle:hover{background:#0052a3;opacity:1!important}.rte-resize-handle-nw{border-radius:50% 0 50% 0;cursor:nw-resize;height:8px;left:-4px;top:-4px;width:8px}.rte-resize-handle-ne{cursor:ne-resize;right:-4px;top:-4px}.rte-resize-handle-ne,.rte-resize-handle-sw{border-radius:0 50% 0 50%;height:8px;width:8px}.rte-resize-handle-sw{bottom:-4px;cursor:sw-resize;left:-4px}.rte-resize-handle-se{border-radius:50% 0 50% 0;bottom:-4px;cursor:se-resize;height:8px;right:-4px;width:8px}.rte-resize-handle-n{cursor:n-resize;top:-3px}.rte-resize-handle-n,.rte-resize-handle-s{border-radius:2px;height:4px;left:50%;transform:translateX(-50%);width:30px}.rte-resize-handle-s{bottom:-3px;cursor:s-resize}.rte-resize-handle-e{cursor:e-resize;right:-3px}.rte-resize-handle-e,.rte-resize-handle-w{border-radius:2px;height:30px;top:50%;transform:translateY(-50%);width:4px}.rte-resize-handle-w{cursor:w-resize;left:-3px}.rte-paste-options-menu{background:#fff;border:1px solid #ddd;border-radius:6px;box-shadow:0 4px 12px rgba(0,0,0,.15);overflow:hidden;position:absolute!important;z-index:10000!important}.rte-paste-options-content{align-items:center;display:flex;flex-direction:row;gap:2px;padding:4px}.rte-paste-option{align-items:center;background:transparent;border:none;border-radius:4px;cursor:pointer;display:flex;height:32px;justify-content:center;padding:0;transition:background-color .2s;width:32px}.rte-paste-option:hover{background-color:#f0f0f0}.rte-paste-option.rte-paste-close{border-left:1px solid #e0e0e0;margin-left:4px;padding-left:4px}.rte-paste-icon{align-items:center;display:flex;font-size:18px;justify-content:center;line-height:1}.rte-paste-option-desc,.rte-paste-option-title{display:none}.rte-container{display:flex;flex-direction:column;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;font-size:14px;line-height:1.5}.rte-editor-wrapper{cursor:text;flex:1;min-height:100%;overflow-y:auto}.rte-editor-wrapper h1{font-size:2em;font-weight:700;margin:.67em 0}.rte-editor-wrapper h2{font-size:1.5em;font-weight:700;margin:.75em 0}.rte-editor-wrapper h3{font-size:1.17em;font-weight:700;margin:.83em 0}.rte-editor-wrapper ol,.rte-editor-wrapper ul{margin:1em 0;padding-left:2em}.rte-editor-wrapper li{margin:.25em 0}.rte-editor-wrapper a{color:#06c;text-decoration:underline}.rte-editor-wrapper a:hover{color:#0052a3}.rte-editor-wrapper pre{border:1px solid #ddd;border-radius:4px;font-size:13px;line-height:1.4;margin:12px 0;overflow-x:auto;padding:12px}.rte-editor-wrapper code,.rte-editor-wrapper pre{background-color:#f5f5f5;font-family:Courier New,Courier,monospace}.rte-editor-wrapper code{border-radius:3px;font-size:.9em;padding:2px 4px}.rte-editor-wrapper pre code{background-color:transparent;padding:0}.rte-editor-wrapper [data-slate-placeholder]{opacity:.5;pointer-events:none;position:absolute}.rte-action-buttons{display:flex;flex-shrink:0;gap:8px}.rte-action-button{min-width:80px;white-space:nowrap}.rte-action-button:hover{opacity:.9}.rte-action-button:active{transform:scale(.98)}
|
package/dist/index.esm.js
CHANGED
|
@@ -35495,7 +35495,7 @@ const ColorPicker = ({ value, onChange, onClose }) => {
|
|
|
35495
35495
|
}, onMouseDown: (e) => e.stopPropagation(), title: "Open advanced color picker", children: "\uD83C\uDFA8 Advanced" })] }));
|
|
35496
35496
|
};
|
|
35497
35497
|
|
|
35498
|
-
const Toolbar = ({ editor, features = {}, onLinkAdd, onMediaUpload, onEmojiSelect, mentionUsers = [], onMentionSelect, tags = [], onTagSelect, tagPlaceholder = 'Search variables...', toolbarBackgroundColor, toolbarStyle, visibleButtons = [], position = 'top', actionButtons, }) => {
|
|
35498
|
+
const Toolbar = ({ editor, features = {}, onLinkAdd, onMediaUpload, onEmojiSelect, mentionUsers = [], onMentionSelect, tags = [], onTagSelect, tagPlaceholder = 'Search variables...', toolbarBackgroundColor, toolbarStyle, visibleButtons = [], moreMenuItems = [], position = 'top', actionButtons, }) => {
|
|
35499
35499
|
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
|
|
35500
35500
|
const [showMentionList, setShowMentionList] = useState(false);
|
|
35501
35501
|
const [showTagList, setShowTagList] = useState(false);
|
|
@@ -35600,13 +35600,13 @@ const Toolbar = ({ editor, features = {}, onLinkAdd, onMediaUpload, onEmojiSelec
|
|
|
35600
35600
|
return marks?.[type] || (type === 'color' ? '#000000' : '#ffff00');
|
|
35601
35601
|
};
|
|
35602
35602
|
// Calculate fixed position for modals based on button ref
|
|
35603
|
-
const getModalPosition = (buttonRef, modalWidth = 240) => {
|
|
35603
|
+
const getModalPosition = (buttonRef, modalWidth = 240, align = 'left') => {
|
|
35604
35604
|
if (!buttonRef.current)
|
|
35605
35605
|
return { top: 0, left: 0 };
|
|
35606
35606
|
// Get the actual button element inside the group (if it's a group wrapper)
|
|
35607
35607
|
const button = buttonRef.current.querySelector('button') || buttonRef.current;
|
|
35608
35608
|
const buttonRect = button.getBoundingClientRect();
|
|
35609
|
-
let left = buttonRect.left;
|
|
35609
|
+
let left = align === 'right' ? buttonRect.right - modalWidth : buttonRect.left;
|
|
35610
35610
|
let top = buttonRect.bottom + 4;
|
|
35611
35611
|
// Ensure modal stays within viewport
|
|
35612
35612
|
if (left + modalWidth > window.innerWidth) {
|
|
@@ -35739,6 +35739,12 @@ const Toolbar = ({ editor, features = {}, onLinkAdd, onMediaUpload, onEmojiSelec
|
|
|
35739
35739
|
}
|
|
35740
35740
|
return visibleButtons.includes(buttonName);
|
|
35741
35741
|
};
|
|
35742
|
+
const isMoreMenuItemVisible = (itemName) => {
|
|
35743
|
+
if (!moreMenuItems || moreMenuItems.length === 0) {
|
|
35744
|
+
return true;
|
|
35745
|
+
}
|
|
35746
|
+
return moreMenuItems.includes(itemName);
|
|
35747
|
+
};
|
|
35742
35748
|
return (jsxs("div", { className: `rte-toolbar rte-toolbar-${position}`, style: { backgroundColor: toolbarBackgroundColor, ...toolbarStyle }, children: [defaultFeatures.headings && isButtonVisible('headings') && (jsxs("select", { className: "rte-toolbar-select", onChange: (e) => {
|
|
35743
35749
|
if (e.target.value === 'paragraph') {
|
|
35744
35750
|
toggleBlock(editor, 'paragraph');
|
|
@@ -35847,7 +35853,7 @@ const Toolbar = ({ editor, features = {}, onLinkAdd, onMediaUpload, onEmojiSelec
|
|
|
35847
35853
|
e.preventDefault();
|
|
35848
35854
|
setShowLinkDialog(!showLinkDialog);
|
|
35849
35855
|
}, title: "Insert Link", children: "\uD83D\uDD17" }), showLinkDialog && (() => {
|
|
35850
|
-
const position = getModalPosition(linkButtonRef);
|
|
35856
|
+
const position = getModalPosition(linkButtonRef, 340, 'right');
|
|
35851
35857
|
return (jsxs("div", { className: "rte-link-dialog-wrapper", style: { position: 'fixed', top: `${position.top}px`, left: `${position.left}px`, zIndex: 10000 }, children: [jsx("button", { className: "rte-close-button", onClick: () => setShowLinkDialog(false), children: "\u00D7" }), jsx("div", { className: "rte-link-dialog", children: jsxs("div", { className: "rte-link-dialog-content", children: [jsx("input", { type: "text", placeholder: "Enter URL", value: linkUrl, onChange: (e) => setLinkUrl(e.target.value), onKeyDown: (e) => {
|
|
35852
35858
|
if (e.key === 'Enter') {
|
|
35853
35859
|
handleLinkSubmit();
|
|
@@ -35863,7 +35869,7 @@ const Toolbar = ({ editor, features = {}, onLinkAdd, onMediaUpload, onEmojiSelec
|
|
|
35863
35869
|
e.preventDefault();
|
|
35864
35870
|
setShowMentionList(!showMentionList);
|
|
35865
35871
|
}, title: "Mention", children: "@" }), showMentionList && (() => {
|
|
35866
|
-
const position = getModalPosition(mentionButtonRef);
|
|
35872
|
+
const position = getModalPosition(mentionButtonRef, 360, 'right');
|
|
35867
35873
|
return (jsxs("div", { className: "rte-mention-list-wrapper", style: { position: 'fixed', top: `${position.top}px`, left: `${position.left}px`, zIndex: 10000 }, children: [jsx("button", { className: "rte-close-button", onClick: () => setShowMentionList(false), children: "\u00D7" }), jsxs("div", { className: "rte-mention-list", children: [jsx("input", { type: "text", placeholder: "Search users...", value: mentionQuery, onChange: (e) => setMentionQuery(e.target.value), autoFocus: true }), jsx("div", { className: "rte-mention-items", children: filteredMentions.map((user) => (jsxs("div", { className: "rte-mention-item", onClick: () => {
|
|
35868
35874
|
onMentionSelect?.(user);
|
|
35869
35875
|
setShowMentionList(false);
|
|
@@ -35873,7 +35879,7 @@ const Toolbar = ({ editor, features = {}, onLinkAdd, onMediaUpload, onEmojiSelec
|
|
|
35873
35879
|
e.preventDefault();
|
|
35874
35880
|
setShowTagList(!showTagList);
|
|
35875
35881
|
}, title: "Insert Variable", children: "#" }), showTagList && (() => {
|
|
35876
|
-
const position = getModalPosition(tagButtonRef);
|
|
35882
|
+
const position = getModalPosition(tagButtonRef, 380, 'right');
|
|
35877
35883
|
return (jsxs("div", { className: "rte-mention-list-wrapper", style: { position: 'fixed', top: `${position.top}px`, left: `${position.left}px`, zIndex: 10000 }, children: [jsx("button", { className: "rte-close-button", onClick: () => setShowTagList(false), children: "\u00D7" }), jsxs("div", { className: "rte-mention-list", children: [jsx("input", { type: "text", placeholder: tagPlaceholder, value: tagQuery, onChange: (e) => setTagQuery(e.target.value), autoFocus: true }), jsx("div", { className: "rte-mention-items", children: filteredTags.map((tag) => (jsxs("div", { className: "rte-mention-item", onClick: () => handleTagSelect(tag), children: [jsx("span", { style: {
|
|
35878
35884
|
backgroundColor: tag.backgroundColor || '#fff3cd',
|
|
35879
35885
|
color: tag.color || '#856404',
|
|
@@ -35926,43 +35932,52 @@ const Toolbar = ({ editor, features = {}, onLinkAdd, onMediaUpload, onEmojiSelec
|
|
|
35926
35932
|
e.preventDefault();
|
|
35927
35933
|
setShowMoreMenu(!showMoreMenu);
|
|
35928
35934
|
}, title: "More Options", children: "\u22EF" }), showMoreMenu && (() => {
|
|
35929
|
-
const position = getModalPosition(moreMenuRef);
|
|
35930
|
-
|
|
35931
|
-
const
|
|
35932
|
-
const
|
|
35933
|
-
|
|
35935
|
+
const position = getModalPosition(moreMenuRef, 220, 'right');
|
|
35936
|
+
const showParagraph = isMoreMenuItemVisible('paragraph');
|
|
35937
|
+
const showCodeBlock = isMoreMenuItemVisible('codeBlock');
|
|
35938
|
+
const showClearFormatting = isMoreMenuItemVisible('clearFormatting');
|
|
35939
|
+
const showDecreaseIndent = isMoreMenuItemVisible('decreaseIndent');
|
|
35940
|
+
const showIncreaseIndent = isMoreMenuItemVisible('increaseIndent');
|
|
35941
|
+
const showHorizontalRule = isMoreMenuItemVisible('horizontalRule');
|
|
35942
|
+
const showUndo = isMoreMenuItemVisible('undo');
|
|
35943
|
+
const showRedo = isMoreMenuItemVisible('redo');
|
|
35944
|
+
const hasGroupOne = showParagraph || showCodeBlock || showClearFormatting;
|
|
35945
|
+
const hasGroupTwo = showDecreaseIndent || showIncreaseIndent;
|
|
35946
|
+
const hasGroupThree = showHorizontalRule;
|
|
35947
|
+
const hasGroupFour = showUndo || showRedo;
|
|
35948
|
+
return (jsxs("div", { className: "rte-more-menu", style: { position: 'fixed', top: `${position.top}px`, left: `${position.left}px`, zIndex: 10000 }, children: [jsx("button", { className: "rte-close-button", onClick: () => setShowMoreMenu(false), children: "\u00D7" }), jsxs("div", { className: "rte-more-menu-content", children: [showParagraph && (jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35934
35949
|
e.preventDefault();
|
|
35935
35950
|
toggleBlock(editor, 'paragraph');
|
|
35936
35951
|
setShowMoreMenu(false);
|
|
35937
|
-
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u00B6" }), jsx("span", { children: "Paragraph" })] }), jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35952
|
+
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u00B6" }), jsx("span", { children: "Paragraph" })] })), showCodeBlock && (jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35938
35953
|
e.preventDefault();
|
|
35939
35954
|
insertCodeBlock(editor);
|
|
35940
35955
|
setShowMoreMenu(false);
|
|
35941
|
-
}, children: [jsx("span", { className: "rte-menu-icon", children: '</>' }), jsx("span", { children: "Code" })] }), jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35956
|
+
}, children: [jsx("span", { className: "rte-menu-icon", children: '</>' }), jsx("span", { children: "Code" })] })), showClearFormatting && (jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35942
35957
|
e.preventDefault();
|
|
35943
35958
|
clearFormatting(editor);
|
|
35944
35959
|
setShowMoreMenu(false);
|
|
35945
|
-
}, children: [jsx("span", { className: "rte-menu-icon", children: "Ab\u0336" }), jsx("span", { children: "Clear all formatting" })] }), jsx("div", { className: "rte-menu-divider" }), jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35960
|
+
}, children: [jsx("span", { className: "rte-menu-icon", children: "Ab\u0336" }), jsx("span", { children: "Clear all formatting" })] })), hasGroupOne && (hasGroupTwo || hasGroupThree || hasGroupFour) && jsx("div", { className: "rte-menu-divider" }), showDecreaseIndent && (jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35946
35961
|
e.preventDefault();
|
|
35947
35962
|
decreaseIndent(editor);
|
|
35948
35963
|
setShowMoreMenu(false);
|
|
35949
|
-
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u25C0" }), jsx("span", { children: "Decrease indent" })] }), jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35964
|
+
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u25C0" }), jsx("span", { children: "Decrease indent" })] })), showIncreaseIndent && (jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35950
35965
|
e.preventDefault();
|
|
35951
35966
|
increaseIndent(editor);
|
|
35952
35967
|
setShowMoreMenu(false);
|
|
35953
|
-
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u25B6" }), jsx("span", { children: "Increase indent" })] }), jsx("div", { className: "rte-menu-divider" }), jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35968
|
+
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u25B6" }), jsx("span", { children: "Increase indent" })] })), hasGroupTwo && (hasGroupThree || hasGroupFour) && jsx("div", { className: "rte-menu-divider" }), showHorizontalRule && (jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35954
35969
|
e.preventDefault();
|
|
35955
35970
|
insertHorizontalRule(editor);
|
|
35956
35971
|
setShowMoreMenu(false);
|
|
35957
|
-
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u2500" }), jsx("span", { children: "Insert horizontal rule" })] }), jsx("div", { className: "rte-menu-divider" }), jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35972
|
+
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u2500" }), jsx("span", { children: "Insert horizontal rule" })] })), hasGroupThree && hasGroupFour && jsx("div", { className: "rte-menu-divider" }), showUndo && (jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35958
35973
|
e.preventDefault();
|
|
35959
35974
|
handleUndo();
|
|
35960
35975
|
setShowMoreMenu(false);
|
|
35961
|
-
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u21B6" }), jsx("span", { children: "Undo typing" })] }), jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35976
|
+
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u21B6" }), jsx("span", { children: "Undo typing" })] })), showRedo && (jsxs("button", { className: "rte-more-menu-item", onMouseDown: (e) => {
|
|
35962
35977
|
e.preventDefault();
|
|
35963
35978
|
handleRedo();
|
|
35964
35979
|
setShowMoreMenu(false);
|
|
35965
|
-
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u21B7" }), jsx("span", { children: "Repeat typing" })] })] })] }));
|
|
35980
|
+
}, children: [jsx("span", { className: "rte-menu-icon", children: "\u21B7" }), jsx("span", { children: "Repeat typing" })] }))] })] }));
|
|
35966
35981
|
})()] })), actionButtons && (jsx("div", { className: "rte-toolbar-action-buttons", children: actionButtons }))] }));
|
|
35967
35982
|
};
|
|
35968
35983
|
|
|
@@ -36411,7 +36426,7 @@ const initialValue = [
|
|
|
36411
36426
|
children: [{ text: '' }],
|
|
36412
36427
|
},
|
|
36413
36428
|
];
|
|
36414
|
-
const RichTextEditor = ({ value, defaultValue, onChange, placeholder = 'Type or @ to mention, # to tag, and notify someone.', height = '400px', width = '100%', borderColor = '#ddd', borderWidth = '1px', borderRadius = '4px', backgroundColor = '#fff', textColor = '#000', toolbarBackgroundColor = '#f8f9fa', headerBackgroundColor, headerBackgroundImage, features, mentionUsers = [], onMentionSelect, onLinkAdd, onMediaUpload, tags = [], onTagSelect, tagPlaceholder, showCharCount = false, maxCharCount, charCountPosition = 'bottom-right', resizable = false, minHeight = '200px', maxHeight = '400px', minWidth = '300px', maxWidth = '100%', toolbarPosition = 'both', topToolbarButtons = [], bottomToolbarButtons = [], actionButtonsPosition = 'none', cancelButton, submitButton, disabled = false, readOnly = false, className = '', style, }) => {
|
|
36429
|
+
const RichTextEditor = ({ value, defaultValue, onChange, placeholder = 'Type or @ to mention, # to tag, and notify someone.', height = '400px', width = '100%', borderColor = '#ddd', borderWidth = '1px', borderRadius = '4px', backgroundColor = '#fff', textColor = '#000', toolbarBackgroundColor = '#f8f9fa', headerBackgroundColor, headerBackgroundImage, features, mentionUsers = [], onMentionSelect, onLinkAdd, onMediaUpload, tags = [], onTagSelect, tagPlaceholder, showCharCount = false, maxCharCount, charCountPosition = 'bottom-right', resizable = false, minHeight = '200px', maxHeight = '400px', minWidth = '300px', maxWidth = '100%', toolbarPosition = 'both', topToolbarButtons = [], bottomToolbarButtons = [], moreMenuItems = [], actionButtonsPosition = 'none', cancelButton, submitButton, disabled = false, readOnly = false, className = '', style, }) => {
|
|
36415
36430
|
const editor = useMemo(() => {
|
|
36416
36431
|
const baseEditor = withHistory(withReact(createEditor()));
|
|
36417
36432
|
// Configure tags and mentions as inline void elements
|
|
@@ -36934,7 +36949,7 @@ const RichTextEditor = ({ value, defaultValue, onChange, placeholder = 'Type or
|
|
|
36934
36949
|
return (jsx("div", { className: `rte-container ${className}`, style: containerStyle, children: jsxs(Slate, { editor: editor, initialValue: editorValue, onValueChange: (newValue) => {
|
|
36935
36950
|
setEditorValue(newValue);
|
|
36936
36951
|
handleChange(newValue);
|
|
36937
|
-
}, children: [(toolbarPosition === 'top' || toolbarPosition === 'both') && (jsx(Toolbar, { editor: editor, features: features, onLinkAdd: handleLinkAdd, onMediaUpload: handleMediaUpload, onEmojiSelect: handleEmojiSelect, mentionUsers: mentionUsers, onMentionSelect: handleMentionSelect, tags: tags, onTagSelect: onTagSelect, tagPlaceholder: tagPlaceholder, toolbarBackgroundColor: headerBackgroundColor || toolbarBackgroundColor, toolbarStyle: toolbarStyle, visibleButtons: topToolbarButtons, position: "top", actionButtons: actionButtonsPosition === 'top-right' ? renderActionButtons() : undefined })), jsxs("div", { ref: editorWrapperRef, className: "rte-editor-wrapper", style: { ...editorStyle, position: 'relative' }, onClick: (e) => {
|
|
36952
|
+
}, children: [(toolbarPosition === 'top' || toolbarPosition === 'both') && (jsx(Toolbar, { editor: editor, features: features, onLinkAdd: handleLinkAdd, onMediaUpload: handleMediaUpload, onEmojiSelect: handleEmojiSelect, mentionUsers: mentionUsers, onMentionSelect: handleMentionSelect, tags: tags, onTagSelect: onTagSelect, tagPlaceholder: tagPlaceholder, toolbarBackgroundColor: headerBackgroundColor || toolbarBackgroundColor, toolbarStyle: toolbarStyle, visibleButtons: topToolbarButtons, moreMenuItems: moreMenuItems, position: "top", actionButtons: actionButtonsPosition === 'top-right' ? renderActionButtons() : undefined })), jsxs("div", { ref: editorWrapperRef, className: "rte-editor-wrapper", style: { ...editorStyle, position: 'relative' }, onClick: (e) => {
|
|
36938
36953
|
// Focus the editor when clicking anywhere in the wrapper
|
|
36939
36954
|
ReactEditor.focus(editor);
|
|
36940
36955
|
// If clicking on empty space (not on content), move cursor to end
|
|
@@ -37218,7 +37233,7 @@ const RichTextEditor = ({ value, defaultValue, onChange, placeholder = 'Type or
|
|
|
37218
37233
|
fontFamily: 'monospace',
|
|
37219
37234
|
fontSize: '0.85em',
|
|
37220
37235
|
}, children: item.value }), jsxs("div", { children: [jsx("div", { style: { fontWeight: 500 }, children: item.label }), item.description && (jsx("div", { style: { fontSize: '0.85em', color: '#666' }, children: item.description }))] })] })) }, autocompleteTarget.type === 'mention' ? item.id : item.id))) }));
|
|
37221
|
-
})()] }), (toolbarPosition === 'bottom' || toolbarPosition === 'both') && (jsx(Toolbar, { editor: editor, features: features, onLinkAdd: handleLinkAdd, onMediaUpload: handleMediaUpload, onEmojiSelect: handleEmojiSelect, mentionUsers: mentionUsers, onMentionSelect: handleMentionSelect, tags: tags, onTagSelect: onTagSelect, tagPlaceholder: tagPlaceholder, toolbarBackgroundColor: headerBackgroundColor || toolbarBackgroundColor, toolbarStyle: toolbarStyle, visibleButtons: bottomToolbarButtons, position: "bottom", actionButtons: actionButtonsPosition === 'bottom-right' ? renderActionButtons() : undefined }))] }) }));
|
|
37236
|
+
})()] }), (toolbarPosition === 'bottom' || toolbarPosition === 'both') && (jsx(Toolbar, { editor: editor, features: features, onLinkAdd: handleLinkAdd, onMediaUpload: handleMediaUpload, onEmojiSelect: handleEmojiSelect, mentionUsers: mentionUsers, onMentionSelect: handleMentionSelect, tags: tags, onTagSelect: onTagSelect, tagPlaceholder: tagPlaceholder, toolbarBackgroundColor: headerBackgroundColor || toolbarBackgroundColor, toolbarStyle: toolbarStyle, visibleButtons: bottomToolbarButtons, moreMenuItems: moreMenuItems, position: "bottom", actionButtons: actionButtonsPosition === 'bottom-right' ? renderActionButtons() : undefined }))] }) }));
|
|
37222
37237
|
};
|
|
37223
37238
|
|
|
37224
37239
|
export { RichTextEditor, RichTextEditor as default };
|