react-lite-rich-text-editor 1.1.9 → 1.1.10

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/dist/index.cjs.js CHANGED
@@ -411,7 +411,7 @@ function styleInject(css, ref) {
411
411
  }
412
412
  }
413
413
 
414
- var css_248z = ".rte-container{background-color:#fff;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 1px 3px rgba(0,0,0,.05);overflow:hidden;transition:all .2s cubic-bezier(.4,0,.2,1)}.rte-container:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.1)}.rte-toolbar{align-items:center;background-color:#f9fafb;border-bottom:1px solid #f3f4f6;display:flex;flex-wrap:wrap;gap:4px;padding:8px}.rte-toolbar-button{align-items:center;background:transparent;border:none;border-radius:6px;color:#4b5563;cursor:pointer;display:flex;height:32px;justify-content:center;padding:0;transition:all .15s ease;width:32px}.rte-toolbar-button:hover{background-color:#f3f4f6;color:#111827}.rte-toolbar-button.active{background-color:#eff6ff;color:#2563eb}.rte-toolbar-button:disabled{cursor:not-allowed;opacity:.5}.rte-toolbar-button-danger:hover{background-color:#fef2f2!important;color:#dc2626!important}.rte-toolbar-select{background-color:#fff;border:1px solid #e5e7eb;border-radius:6px;color:#374151;cursor:pointer;font-size:14px;height:32px;outline:none;padding:0 8px;transition:border-color .15s ease}.rte-toolbar-select:hover{border-color:#d1d5db}.rte-toolbar-select:focus{border-color:#3b82f6}.rte-heading-select{width:112px}.rte-toolbar-button-text{font-size:12px;font-weight:700;min-width:32px;padding:0 8px;width:auto}.rte-color-picker-label{align-items:center;border-radius:6px;cursor:pointer;display:flex;height:32px;justify-content:center;position:relative;transition:background-color .15s ease;width:32px}.rte-color-picker-label:hover{background-color:#f3f4f6}.rte-color-input{cursor:pointer;height:100%;inset:0;opacity:0;position:absolute;width:100%}.rte-bg-color-picker-label .rte-bg-color-swatch{align-items:center;border:1px solid #d1d5db;border-radius:4px;display:inline-flex;font-size:11px;font-weight:700;height:18px;justify-content:center;line-height:1;pointer-events:none;width:18px}.rte-media-width-custom{align-items:center;display:flex;gap:2px}.rte-media-width-input{border:1px solid #e5e7eb;border-radius:4px;color:#374151;font-size:11px;height:28px;outline:none;padding:0 6px;width:56px}.rte-media-width-input:focus{border-color:#3b82f6}.rte-media-width-unit{background:#fff;border:1px solid #e5e7eb;border-radius:4px;color:#374151;cursor:pointer;font-size:11px;height:28px;outline:none;padding:0 4px;width:44px}.rte-media-width-apply{color:#2563eb!important;font-size:13px!important;font-weight:700;height:28px;min-width:28px!important;padding:0 6px!important}.rte-media-width-apply:hover{background-color:#eff6ff!important}.rte-area-highlight-mode .rte-content{cursor:crosshair}.rte-area-highlight-block{box-decoration-break:clone;-webkit-box-decoration-break:clone;box-sizing:border-box;display:block}.rte-area-highlight-hint{background:rgba(37,99,235,.92);border-radius:999px;color:#fff;font-size:11px;font-weight:600;left:50%;padding:4px 10px;pointer-events:none;position:absolute;top:8px;transform:translateX(-50%);white-space:nowrap;z-index:5}.rte-marquee-preview{border:2px dashed;border-radius:2px;box-sizing:border-box;pointer-events:none;position:absolute;z-index:6}.rte-area-highlight-toggle{min-width:32px;padding:0 6px!important;width:auto!important}.rte-area-highlight-icon{border:2px dashed;border-radius:2px;box-sizing:border-box;display:block;height:14px;width:14px}.rte-content{color:#1f2937;font-family:inherit;font-size:16px;line-height:1.6;min-height:150px;outline:none;overflow-y:auto;padding:12px;word-break:break-word}.rte-content-wrapper{position:relative}.rte-placeholder{color:#9ca3af;font-size:16px;line-height:1.6;pointer-events:none;position:absolute;top:12px;user-select:none}.rte-content ul{list-style-type:disc;margin-left:1.5rem}.rte-content ol{list-style-type:decimal;margin-left:1.5rem}.rte-content blockquote{background:#f8fafc;border-left:4px solid #bfdbfe;border-radius:0 8px 8px 0;color:#475569;margin:12px 0;padding:8px 14px}.rte-content img{border-radius:8px;display:block;height:auto;max-width:100%}.rte-content table{border-collapse:collapse;margin:16px 0;width:100%}.rte-content td,.rte-content th{border:1px solid #e5e7eb;min-width:40px;padding:12px;word-break:break-word}.video-container{border-radius:12px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1);display:block;height:0;line-height:0;margin:16px 0;max-width:100%;overflow:hidden;padding-bottom:56.25%;position:relative;width:100%}.video-container iframe{height:100%;left:0;position:absolute;top:0;width:100%}.rte-modal-overlay{align-items:center;animation:rte-fade-in .2s ease-out;backdrop-filter:blur(4px);background-color:rgba(0,0,0,.5);display:flex;inset:0;justify-content:center;position:fixed;z-index:9999}.rte-modal{animation:rte-zoom-in .2s ease-out;background-color:#fff;border:1px solid #f3f4f6;border-radius:16px;box-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 10px 10px -5px rgba(0,0,0,.04);display:flex;flex-direction:column;gap:16px;max-width:400px;padding:0;width:100%}.rte-modal-title{color:#111827;flex:1;font-size:18px;font-weight:600;margin:0;text-align:center}.rte-modal-header{align-items:center;border-bottom:1px solid #f3f4f6;display:flex;justify-content:space-between;padding:20px 24px 16px}.rte-form-group{display:flex;flex-direction:column;gap:8px;padding:16px 24px}.rte-label{color:#374151;font-size:14px;font-weight:600}.rte-input{border:1px solid #d1d5db;border-radius:8px;box-sizing:border-box;font-size:14px;outline:none;padding:8px 12px;transition:all .15s ease;width:100%}.rte-input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.1)}.rte-modal-actions{border-top:1px solid #f3f4f6;display:flex;gap:12px;justify-content:flex-end;padding:16px 24px 20px}.rte-button{border:none;border-radius:8px;cursor:pointer;font-weight:500;padding:8px 16px;transition:all .15s ease}.rte-button-secondary{background-color:#f3f4f6;color:#4b5563}.rte-button-secondary:hover{background-color:#e5e7eb}.rte-button-primary{background-color:#2563eb;box-shadow:0 1px 2px rgba(0,0,0,.05);color:#fff}.rte-button-primary:hover{background-color:#1d4ed8}.rte-button-primary:disabled{cursor:not-allowed;opacity:.5}.rte-spinner-container{align-items:center;display:flex;justify-content:center;padding:16px}.rte-spinner{animation:rte-spin .8s linear infinite;border:3px solid #eff6ff;border-radius:50%;border-top-color:#3b82f6;height:32px;width:32px}@keyframes rte-spin{to{transform:rotate(1turn)}}@keyframes rte-fade-in{0%{opacity:0}to{opacity:1}}@keyframes rte-zoom-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.image-container{box-sizing:border-box;display:block;line-height:0;margin:16px 0;max-width:100%;position:relative}.image-container.image-align-center,.video-container.image-align-center{margin-left:auto;margin-right:auto}.image-container.image-align-left,.video-container.image-align-left{margin-left:0;margin-right:auto}.image-container.image-align-right,.video-container.image-align-right{margin-left:auto;margin-right:0}.image-container.rte-media-selected,.video-container.rte-media-selected{border-radius:12px;outline:2px solid #3b82f6;outline-offset:2px}.image-media-frame{display:block;line-height:0;max-width:100%;position:relative;width:100%}.image-media-frame img{border-radius:12px;display:block;height:auto;margin:0;max-width:100%;width:auto}.image-container[data-width-percent] .image-media-frame,.image-container[data-width-percent] .image-media-frame img{width:100%}.image-container[data-width-px] .image-media-frame,.image-container[data-width-px] .image-media-frame img{height:auto;width:100%}.image-delete-button{align-items:center;background:#ef4444;border:3px solid #fff;border-radius:9999px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);color:#fff;cursor:pointer;display:none;font-size:18px;font-weight:700;height:26px;justify-content:center;line-height:1;padding:0;pointer-events:none;position:absolute;right:0;top:0;transform:translate(50%,-50%);transition:all .2s cubic-bezier(.4,0,.2,1);width:26px;z-index:50}.rte-content.rte-is-editable.rte-is-focused .image-delete-button,.rte-content.rte-is-editable.rte-is-focused .video-delete-button{display:flex;pointer-events:auto}.rte-content.rte-is-editable .video-container.rte-media-selected iframe{pointer-events:none}.image-delete-button:hover{background:#b91c1c;box-shadow:0 10px 15px -3px rgba(0,0,0,.1);transform:translate(50%,-50%) scale(1.1)}.media-resize-handle{background:#3b82f6;border:2px solid #fff;border-radius:3px;bottom:2px;box-shadow:0 1px 3px rgba(15,23,42,.2);cursor:nwse-resize;height:12px;pointer-events:auto;position:absolute;right:2px;width:12px;z-index:60}.media-resize-handle:hover{background:#2563eb}.video-container .media-resize-handle{bottom:6px;right:6px}.video-container .video-delete-button{z-index:70}.rte-table-delete-btn,.rte-table-delete-hover{align-items:center;display:flex;justify-content:center}.rte-table-delete-btn{background:#fff;border:1px solid #ef4444;border-radius:6px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);color:#ef4444;cursor:pointer;height:28px;padding:0;transition:all .2s ease;width:28px}.rte-table-delete-btn:hover{background:#ef4444;color:#fff;transform:scale(1.1)}.rte-table-delete-btn:active{transform:scale(.95)}.rte-media-toolbar{align-items:center;background:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);display:flex;flex-wrap:wrap;gap:2px;max-width:calc(100% - 16px);padding:4px;pointer-events:auto}.rte-media-toolbar button{align-items:center;background:transparent;border:none;border-radius:4px;color:#4b5563;cursor:pointer;display:flex;font-size:11px;font-weight:600;height:28px;justify-content:center;min-width:28px;padding:0 6px;transition:all .15s ease}.rte-media-toolbar button.active,.rte-media-toolbar button:hover{background-color:#eff6ff;color:#2563eb}.rte-media-toolbar button.danger{color:#ef4444}.rte-media-toolbar button.danger:hover{background-color:#fef2f2;color:#dc2626}.rte-media-toolbar-divider{background:#e5e7eb;height:18px;margin:0 2px;width:1px}.image-container:after{clear:both;content:\"\";display:table}.rte-footer{background-color:#fcfcfd;border-top:1px solid #f3f4f6;display:flex;justify-content:flex-end;padding:6px 16px;user-select:none}.rte-footer-content{align-items:center;color:#9ca3af;display:flex;font-size:11px;gap:10px;letter-spacing:.025em}.rte-footer-separator{color:#e5e7eb;font-size:14px;line-height:1}.rte-footer-item b{color:#6b7280;font-weight:600}";
414
+ var css_248z = ".rte-container{background-color:#fff;border:1px solid #e5e7eb;border-radius:12px;box-shadow:0 1px 3px rgba(0,0,0,.05);overflow:hidden;transition:all .2s cubic-bezier(.4,0,.2,1)}.rte-container:focus-within{border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.1)}.rte-toolbar{align-items:center;background-color:#f9fafb;border-bottom:1px solid #f3f4f6;display:flex;flex-wrap:wrap;gap:4px;padding:8px}.rte-toolbar-button{align-items:center;background:transparent;border:none;border-radius:6px;color:#4b5563;cursor:pointer;display:flex;height:32px;justify-content:center;padding:0;transition:all .15s ease;width:32px}.rte-toolbar-button:hover{background-color:#f3f4f6;color:#111827}.rte-toolbar-button.active{background-color:#eff6ff;color:#2563eb}.rte-toolbar-button:disabled{cursor:not-allowed;opacity:.5}.rte-toolbar-button-danger:hover{background-color:#fef2f2!important;color:#dc2626!important}.rte-toolbar-select{background-color:#fff;border:1px solid #e5e7eb;border-radius:6px;color:#374151;cursor:pointer;font-size:14px;height:32px;outline:none;padding:0 8px;transition:border-color .15s ease}.rte-toolbar-select:hover{border-color:#d1d5db}.rte-toolbar-select:focus{border-color:#3b82f6}.rte-heading-select{width:112px}.rte-toolbar-button-text{font-size:12px;font-weight:700;min-width:32px;padding:0 8px;width:auto}.rte-color-picker-label{align-items:center;border-radius:6px;cursor:pointer;display:flex;height:32px;justify-content:center;position:relative;transition:background-color .15s ease;width:32px}.rte-color-picker-label:hover{background-color:#f3f4f6}.rte-color-input{cursor:pointer;height:100%;inset:0;opacity:0;position:absolute;width:100%}.rte-bg-color-picker-label .rte-bg-color-swatch{align-items:center;border:1px solid #d1d5db;border-radius:4px;display:inline-flex;font-size:11px;font-weight:700;height:18px;justify-content:center;line-height:1;pointer-events:none;width:18px}.rte-bg-color-swatch-none{background-color:#fff;background-image:linear-gradient(45deg,#d1d5db 25%,transparent 0,transparent 75%,#d1d5db 0),linear-gradient(45deg,#d1d5db 25%,transparent 0,transparent 75%,#d1d5db 0);background-position:0 0,4px 4px;background-size:8px 8px}.rte-bg-color-clear{position:relative}.rte-bg-color-clear-icon{align-items:center;display:inline-flex;font-size:11px;font-weight:700;height:14px;justify-content:center;line-height:1;position:relative;width:14px}.rte-bg-color-clear-icon:after{background:currentColor;border-radius:1px;content:\"\";height:2px;left:-1px;position:absolute;right:-1px;top:50%;transform:rotate(-35deg)}.rte-media-width-custom{align-items:center;display:flex;gap:2px}.rte-media-width-input{border:1px solid #e5e7eb;border-radius:4px;color:#374151;font-size:11px;height:28px;outline:none;padding:0 6px;width:56px}.rte-media-width-input:focus{border-color:#3b82f6}.rte-media-width-unit{background:#fff;border:1px solid #e5e7eb;border-radius:4px;color:#374151;cursor:pointer;font-size:11px;height:28px;outline:none;padding:0 4px;width:44px}.rte-media-width-apply{color:#2563eb!important;font-size:13px!important;font-weight:700;height:28px;min-width:28px!important;padding:0 6px!important}.rte-media-width-apply:hover{background-color:#eff6ff!important}.rte-area-highlight-mode .rte-content{cursor:crosshair}.rte-area-highlight-block{box-decoration-break:clone;-webkit-box-decoration-break:clone;box-sizing:border-box;display:block;max-width:100%}.rte-area-highlight-block>blockquote,.rte-area-highlight-block>div,.rte-area-highlight-block>h1,.rte-area-highlight-block>h2,.rte-area-highlight-block>h3,.rte-area-highlight-block>h4,.rte-area-highlight-block>h5,.rte-area-highlight-block>h6,.rte-area-highlight-block>p{margin-bottom:0;margin-top:0}.rte-area-highlight-block>*+*{margin-top:.25em}.rte-area-highlight-hint{background:rgba(37,99,235,.92);border-radius:999px;color:#fff;font-size:11px;font-weight:600;left:50%;padding:4px 10px;pointer-events:none;position:absolute;top:8px;transform:translateX(-50%);white-space:nowrap;z-index:5}.rte-marquee-preview{border:2px dashed;border-radius:2px;box-sizing:border-box;pointer-events:none;position:absolute;z-index:6}.rte-area-highlight-toggle{min-width:32px;padding:0 6px!important;width:auto!important}.rte-area-highlight-icon{border:2px dashed;border-radius:2px;box-sizing:border-box;display:block;height:14px;width:14px}.rte-content{color:#1f2937;font-family:inherit;font-size:16px;line-height:1.6;min-height:150px;outline:none;overflow-y:auto;padding:12px;word-break:break-word}.rte-content-wrapper{position:relative}.rte-placeholder{color:#9ca3af;font-size:16px;line-height:1.6;pointer-events:none;position:absolute;top:12px;user-select:none}.rte-content ul{list-style-type:disc;margin-left:1.5rem}.rte-content ol{list-style-type:decimal;margin-left:1.5rem}.rte-content blockquote{background:#f8fafc;border-left:4px solid #bfdbfe;border-radius:0 8px 8px 0;color:#475569;margin:12px 0;padding:8px 14px}.rte-content img{border-radius:8px;display:block;height:auto;max-width:100%}.rte-content table{border-collapse:collapse;margin:16px 0;width:100%}.rte-content td,.rte-content th{border:1px solid #e5e7eb;min-width:40px;padding:12px;word-break:break-word}.video-container{border-radius:12px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1);display:block;height:0;line-height:0;margin:16px 0;max-width:100%;overflow:hidden;padding-bottom:56.25%;position:relative;width:100%}.video-container iframe{height:100%;left:0;position:absolute;top:0;width:100%}.rte-modal-overlay{align-items:center;animation:rte-fade-in .2s ease-out;backdrop-filter:blur(4px);background-color:rgba(0,0,0,.5);display:flex;inset:0;justify-content:center;position:fixed;z-index:9999}.rte-modal{animation:rte-zoom-in .2s ease-out;background-color:#fff;border:1px solid #f3f4f6;border-radius:16px;box-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 10px 10px -5px rgba(0,0,0,.04);display:flex;flex-direction:column;gap:16px;max-width:400px;padding:0;width:100%}.rte-modal-title{color:#111827;flex:1;font-size:18px;font-weight:600;margin:0;text-align:center}.rte-modal-header{align-items:center;border-bottom:1px solid #f3f4f6;display:flex;justify-content:space-between;padding:20px 24px 16px}.rte-form-group{display:flex;flex-direction:column;gap:8px;padding:16px 24px}.rte-label{color:#374151;font-size:14px;font-weight:600}.rte-input{border:1px solid #d1d5db;border-radius:8px;box-sizing:border-box;font-size:14px;outline:none;padding:8px 12px;transition:all .15s ease;width:100%}.rte-input:focus{border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.1)}.rte-modal-actions{border-top:1px solid #f3f4f6;display:flex;gap:12px;justify-content:flex-end;padding:16px 24px 20px}.rte-button{border:none;border-radius:8px;cursor:pointer;font-weight:500;padding:8px 16px;transition:all .15s ease}.rte-button-secondary{background-color:#f3f4f6;color:#4b5563}.rte-button-secondary:hover{background-color:#e5e7eb}.rte-button-primary{background-color:#2563eb;box-shadow:0 1px 2px rgba(0,0,0,.05);color:#fff}.rte-button-primary:hover{background-color:#1d4ed8}.rte-button-primary:disabled{cursor:not-allowed;opacity:.5}.rte-spinner-container{align-items:center;display:flex;justify-content:center;padding:16px}.rte-spinner{animation:rte-spin .8s linear infinite;border:3px solid #eff6ff;border-radius:50%;border-top-color:#3b82f6;height:32px;width:32px}@keyframes rte-spin{to{transform:rotate(1turn)}}@keyframes rte-fade-in{0%{opacity:0}to{opacity:1}}@keyframes rte-zoom-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.image-container{box-sizing:border-box;display:block;line-height:0;margin:16px 0;max-width:100%;position:relative}.image-container.image-align-center,.video-container.image-align-center{margin-left:auto;margin-right:auto}.image-container.image-align-left,.video-container.image-align-left{margin-left:0;margin-right:auto}.image-container.image-align-right,.video-container.image-align-right{margin-left:auto;margin-right:0}.image-container.rte-media-selected,.video-container.rte-media-selected{border-radius:12px;outline:2px solid #3b82f6;outline-offset:2px}.image-media-frame{display:block;line-height:0;max-width:100%;position:relative;width:100%}.image-media-frame img{border-radius:12px;display:block;height:auto;margin:0;max-width:100%;width:auto}.image-container[data-width-percent] .image-media-frame,.image-container[data-width-percent] .image-media-frame img{width:100%}.image-container[data-width-px] .image-media-frame,.image-container[data-width-px] .image-media-frame img{height:auto;width:100%}.image-delete-button{align-items:center;background:#ef4444;border:3px solid #fff;border-radius:9999px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);color:#fff;cursor:pointer;display:none;font-size:18px;font-weight:700;height:26px;justify-content:center;line-height:1;padding:0;pointer-events:none;position:absolute;right:0;top:0;transform:translate(50%,-50%);transition:all .2s cubic-bezier(.4,0,.2,1);width:26px;z-index:50}.rte-content.rte-is-editable.rte-is-focused .image-delete-button,.rte-content.rte-is-editable.rte-is-focused .video-delete-button{display:flex;pointer-events:auto}.rte-content.rte-is-editable .video-container.rte-media-selected iframe{pointer-events:none}.image-delete-button:hover{background:#b91c1c;box-shadow:0 10px 15px -3px rgba(0,0,0,.1);transform:translate(50%,-50%) scale(1.1)}.media-resize-handle{background:#3b82f6;border:2px solid #fff;border-radius:3px;bottom:2px;box-shadow:0 1px 3px rgba(15,23,42,.2);cursor:nwse-resize;height:12px;pointer-events:auto;position:absolute;right:2px;width:12px;z-index:60}.media-resize-handle:hover{background:#2563eb}.video-container .media-resize-handle{bottom:6px;right:6px}.video-container .video-delete-button{z-index:70}.rte-table-delete-btn,.rte-table-delete-hover{align-items:center;display:flex;justify-content:center}.rte-table-delete-btn{background:#fff;border:1px solid #ef4444;border-radius:6px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);color:#ef4444;cursor:pointer;height:28px;padding:0;transition:all .2s ease;width:28px}.rte-table-delete-btn:hover{background:#ef4444;color:#fff;transform:scale(1.1)}.rte-table-delete-btn:active{transform:scale(.95)}.rte-media-toolbar{align-items:center;background:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -1px rgba(0,0,0,.06);display:flex;flex-wrap:wrap;gap:2px;max-width:calc(100% - 16px);padding:4px;pointer-events:auto}.rte-media-toolbar button{align-items:center;background:transparent;border:none;border-radius:4px;color:#4b5563;cursor:pointer;display:flex;font-size:11px;font-weight:600;height:28px;justify-content:center;min-width:28px;padding:0 6px;transition:all .15s ease}.rte-media-toolbar button.active,.rte-media-toolbar button:hover{background-color:#eff6ff;color:#2563eb}.rte-media-toolbar button.danger{color:#ef4444}.rte-media-toolbar button.danger:hover{background-color:#fef2f2;color:#dc2626}.rte-media-toolbar-divider{background:#e5e7eb;height:18px;margin:0 2px;width:1px}.image-container:after{clear:both;content:\"\";display:table}.rte-footer{background-color:#fcfcfd;border-top:1px solid #f3f4f6;display:flex;justify-content:flex-end;padding:6px 16px;user-select:none}.rte-footer-content{align-items:center;color:#9ca3af;display:flex;font-size:11px;gap:10px;letter-spacing:.025em}.rte-footer-separator{color:#e5e7eb;font-size:14px;line-height:1}.rte-footer-item b{color:#6b7280;font-weight:600}";
415
415
  styleInject(css_248z);
416
416
 
417
417
  // Helper functions for HTML escaping
@@ -423,6 +423,82 @@ const escapeAttr = str => escapeHtml(str).replace(/"/g, """);
423
423
 
424
424
  // URL detection regex
425
425
  const URL_REGEX = /(https?:\/\/[^\s]+)/g;
426
+ const TRANSPARENT_BACKGROUNDS = new Set(["", "transparent", "initial", "inherit", "rgba(0, 0, 0, 0)", "rgb(0, 0, 0, 0)"]);
427
+ const isTransparentBackground = value => {
428
+ if (!value) return true;
429
+ const normalized = value.trim().toLowerCase();
430
+ if (TRANSPARENT_BACKGROUNDS.has(normalized)) return true;
431
+ const match = normalized.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)$/);
432
+ if ((match === null || match === void 0 ? void 0 : match[4]) !== undefined && parseFloat(match[4]) === 0) return true;
433
+ return false;
434
+ };
435
+ const unwrapNode = element => {
436
+ const parent = element.parentNode;
437
+ if (!parent) return;
438
+ while (element.firstChild) {
439
+ parent.insertBefore(element.firstChild, element);
440
+ }
441
+ parent.removeChild(element);
442
+ };
443
+ const unwrapAreaHighlightBlock = block => {
444
+ var _block$classList;
445
+ if (!(block !== null && block !== void 0 && (_block$classList = block.classList) !== null && _block$classList !== void 0 && _block$classList.contains("rte-area-highlight-block"))) return;
446
+ const parent = block.parentNode;
447
+ if (!parent) return;
448
+ const fragment = document.createDocumentFragment();
449
+ while (block.firstChild) {
450
+ fragment.appendChild(block.firstChild);
451
+ }
452
+ parent.insertBefore(fragment, block);
453
+ parent.removeChild(block);
454
+ };
455
+ const stripInlineBackground = element => {
456
+ if (!(element instanceof HTMLElement)) return;
457
+ if (element.classList.contains("rte-block-highlight")) {
458
+ element.classList.remove("rte-block-highlight");
459
+ }
460
+ if (element.tagName === "MARK") {
461
+ unwrapNode(element);
462
+ return;
463
+ }
464
+ const hadBackground = element.style.backgroundColor && !isTransparentBackground(element.style.backgroundColor) || element.style.background && !isTransparentBackground(element.style.background);
465
+ if (!hadBackground) return;
466
+ element.style.backgroundColor = "";
467
+ element.style.background = "";
468
+ if (!element.getAttribute("style")) {
469
+ element.removeAttribute("style");
470
+ }
471
+ const tag = element.tagName;
472
+ if ((tag === "SPAN" || tag === "FONT") && !element.className && element.attributes.length === 0) {
473
+ unwrapNode(element);
474
+ }
475
+ };
476
+ const collectElementsInRange = (range, root) => {
477
+ const elements = [];
478
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
479
+ let node = walker.currentNode;
480
+ while (node) {
481
+ if (range.intersectsNode(node)) {
482
+ elements.push(node);
483
+ }
484
+ node = walker.nextNode();
485
+ }
486
+ return elements;
487
+ };
488
+ const elementHasRemovableBackground = element => {
489
+ var _element$style, _element$style2;
490
+ if (!(element instanceof HTMLElement)) return false;
491
+ if (element.classList.contains("rte-area-highlight-block")) return true;
492
+ if (element.classList.contains("rte-block-highlight")) return true;
493
+ if (element.tagName === "MARK") return true;
494
+ if ((_element$style = element.style) !== null && _element$style !== void 0 && _element$style.backgroundColor && !isTransparentBackground(element.style.backgroundColor)) {
495
+ return true;
496
+ }
497
+ if ((_element$style2 = element.style) !== null && _element$style2 !== void 0 && _element$style2.background && !isTransparentBackground(element.style.background)) {
498
+ return true;
499
+ }
500
+ return false;
501
+ };
426
502
  const rectsIntersect = (a, b) => !(a.right < b.left || a.left > b.right || a.bottom < b.top || a.top > b.bottom);
427
503
  const caretRangeFromClientPoint = (x, y) => {
428
504
  var _document$caretPositi, _document;
@@ -461,38 +537,74 @@ const getIntersectingBlocks = (editor, clientRect) => {
461
537
  });
462
538
  return candidates.filter(el => !candidates.some(other => other !== el && other.contains(el)));
463
539
  };
464
- const insertAreaHighlightRegion = (editor, clientRect, color) => {
465
- const editorRect = editor.getBoundingClientRect();
466
- const clipped = clipRectToBounds(clientRect, editorRect);
540
+ const isHighlightableBlock = block => {
541
+ const text = (block.textContent || "").replace(/[\u00A0\u200B\s]/g, "");
542
+ if (text.length > 0) return true;
543
+ return !!block.querySelector("img, table, iframe, .image-container, .video-container, svg");
544
+ };
545
+ const createAreaHighlightWrapper = (color, textAlign, clipped, editorRect) => {
467
546
  const widthPx = Math.max(40, Math.round(clipped.width));
468
547
  const heightPx = Math.max(24, Math.round(clipped.height));
469
548
  const region = document.createElement("div");
470
549
  region.className = "rte-area-highlight-block";
471
550
  region.style.backgroundColor = color;
472
- region.style.minHeight = `${heightPx}px`;
551
+ region.style.display = "block";
473
552
  region.style.width = `${widthPx}px`;
553
+ region.style.minHeight = `${heightPx}px`;
474
554
  region.style.maxWidth = "100%";
475
- region.style.boxSizing = "border-box";
476
- region.style.padding = "12px";
555
+ region.style.padding = "6px 10px";
477
556
  region.style.borderRadius = "4px";
478
- region.style.margin = "8px 0";
479
- region.style.display = "block";
480
- const blocks = getIntersectingBlocks(editor, clipped);
557
+ region.style.margin = "4px 0";
558
+ region.style.boxSizing = "border-box";
559
+ if (textAlign === "center") {
560
+ region.style.marginLeft = "auto";
561
+ region.style.marginRight = "auto";
562
+ } else if (textAlign === "right" || textAlign === "end") {
563
+ region.style.marginLeft = "auto";
564
+ region.style.marginRight = "0";
565
+ } else {
566
+ const leftOffset = Math.max(0, Math.round(clipped.left - editorRect.left));
567
+ region.style.marginLeft = `${leftOffset}px`;
568
+ region.style.marginRight = "auto";
569
+ }
570
+ return region;
571
+ };
572
+ const insertAreaHighlightRegion = (editor, clientRect, color) => {
573
+ var _alignNode;
574
+ const editorRect = editor.getBoundingClientRect();
575
+ const clipped = clipRectToBounds(clientRect, editorRect);
576
+ const blocks = getIntersectingBlocks(editor, clipped).filter(isHighlightableBlock);
481
577
  if (blocks.length > 0) {
482
578
  const first = blocks[0];
579
+ const textAlign = window.getComputedStyle(first).textAlign;
580
+ const region = createAreaHighlightWrapper(color, textAlign, clipped, editorRect);
581
+ let totalBlockHeight = 0;
582
+ blocks.forEach(block => {
583
+ totalBlockHeight += block.getBoundingClientRect().height;
584
+ });
585
+ const targetHeight = Math.max(24, Math.round(clipped.height));
586
+ const innerPadding = 12;
587
+ const extraVertical = Math.max(0, targetHeight - totalBlockHeight - innerPadding);
588
+ if (extraVertical > 0) {
589
+ const pad = Math.round(extraVertical / 2);
590
+ region.style.paddingTop = `${6 + pad}px`;
591
+ region.style.paddingBottom = `${6 + pad}px`;
592
+ }
483
593
  if (first.parentNode) {
484
594
  first.parentNode.insertBefore(region, first);
485
595
  } else {
486
596
  editor.appendChild(region);
487
597
  }
488
598
  blocks.forEach(block => {
489
- block.style.backgroundColor = "";
490
- block.style.borderRadius = "";
491
599
  region.appendChild(block);
492
600
  });
493
601
  return true;
494
602
  }
495
603
  const insertRange = caretRangeFromClientPoint(clipped.left + clipped.width / 2, clipped.top + Math.min(8, clipped.height / 2)) || caretRangeFromClientPoint(clipped.left + 4, clipped.top + 4);
604
+ let alignNode = insertRange === null || insertRange === void 0 ? void 0 : insertRange.startContainer;
605
+ if (((_alignNode = alignNode) === null || _alignNode === void 0 ? void 0 : _alignNode.nodeType) === 3) alignNode = alignNode.parentNode;
606
+ const textAlign = alignNode instanceof HTMLElement ? window.getComputedStyle(alignNode).textAlign : "left";
607
+ const region = createAreaHighlightWrapper(color, textAlign, clipped, editorRect);
496
608
  region.innerHTML = "&nbsp;";
497
609
  if (insertRange && editor.contains(insertRange.startContainer)) {
498
610
  insertRange.collapse(true);
@@ -847,6 +959,42 @@ function RichTextEditor({
847
959
  const computedColor = window.getComputedStyle(sel.anchorNode.nodeType === 3 ? sel.anchorNode.parentNode : sel.anchorNode).color;
848
960
  return rgbToHex(computedColor);
849
961
  };
962
+ const getBackgroundColorAtCursor = () => {
963
+ const sel = window.getSelection();
964
+ if (!sel || !sel.rangeCount || !editorRef.current) return null;
965
+ let node = sel.anchorNode;
966
+ if (node.nodeType === 3) node = node.parentNode;
967
+ while (node && node !== editorRef.current) {
968
+ if (node.nodeType === 1) {
969
+ var _node$classList, _node$classList2, _node$style;
970
+ if ((_node$classList = node.classList) !== null && _node$classList !== void 0 && _node$classList.contains("rte-area-highlight-block")) {
971
+ const bg = node.style.backgroundColor;
972
+ return bg && !isTransparentBackground(bg) ? rgbToHex(bg) : null;
973
+ }
974
+ if ((_node$classList2 = node.classList) !== null && _node$classList2 !== void 0 && _node$classList2.contains("rte-block-highlight")) {
975
+ const bg = node.style.backgroundColor;
976
+ return bg && !isTransparentBackground(bg) ? rgbToHex(bg) : null;
977
+ }
978
+ const inlineBg = (_node$style = node.style) === null || _node$style === void 0 ? void 0 : _node$style.backgroundColor;
979
+ if (inlineBg && !isTransparentBackground(inlineBg)) {
980
+ return rgbToHex(inlineBg);
981
+ }
982
+ if (node.tagName === "MARK") {
983
+ const markBg = window.getComputedStyle(node).backgroundColor;
984
+ return markBg && !isTransparentBackground(markBg) ? rgbToHex(markBg) : null;
985
+ }
986
+ }
987
+ node = node.parentNode;
988
+ }
989
+ return null;
990
+ };
991
+ const syncBackgroundColorState = () => {
992
+ const activeBg = getBackgroundColorAtCursor();
993
+ setHasActiveTextBackground(!!activeBg);
994
+ if (activeBg) {
995
+ setBgColor(activeBg);
996
+ }
997
+ };
850
998
  const stripEditorChrome = root => {
851
999
  root.querySelectorAll(".image-delete-button, .video-delete-button, .video-edit-overlay, .media-resize-handle").forEach(element => element.remove());
852
1000
  root.querySelectorAll(".rte-media-selected").forEach(element => {
@@ -1126,12 +1274,14 @@ function RichTextEditor({
1126
1274
  setIsUnderline(isParentStyle(container, "U", "underline"));
1127
1275
  const computedColor = window.getComputedStyle(container).color;
1128
1276
  setFontColor(rgbToHex(computedColor));
1277
+ syncBackgroundColorState();
1129
1278
  } else {
1130
1279
  setIsBold(document.queryCommandState("bold"));
1131
1280
  setIsItalic(document.queryCommandState("italic"));
1132
1281
  setIsUnderline(document.queryCommandState("underline"));
1133
1282
  const computedColor = window.getComputedStyle(container).color;
1134
1283
  setFontColor(rgbToHex(computedColor));
1284
+ syncBackgroundColorState();
1135
1285
  }
1136
1286
 
1137
1287
  // 3. Current Font Size
@@ -1158,6 +1308,7 @@ function RichTextEditor({
1158
1308
  };
1159
1309
  const [fontColor, setFontColor] = React.useState("#000000");
1160
1310
  const [bgColor, setBgColor] = React.useState("#ffff00");
1311
+ const [hasActiveTextBackground, setHasActiveTextBackground] = React.useState(false);
1161
1312
  React.useEffect(() => {
1162
1313
  bgColorRef.current = bgColor;
1163
1314
  }, [bgColor]);
@@ -1180,6 +1331,7 @@ function RichTextEditor({
1180
1331
  };
1181
1332
  const applyBackgroundColor = color => {
1182
1333
  setBgColor(color);
1334
+ setHasActiveTextBackground(true);
1183
1335
  focus();
1184
1336
  restoreSavedSelection();
1185
1337
  document.execCommand("styleWithCSS", false, true);
@@ -1189,6 +1341,85 @@ function RichTextEditor({
1189
1341
  document.execCommand("styleWithCSS", false, false);
1190
1342
  triggerChange();
1191
1343
  };
1344
+ const clearMediaHighlightStyles = editor => {
1345
+ editor.querySelectorAll(".image-container, .video-container, td, th").forEach(element => {
1346
+ if (!editor.contains(element)) return;
1347
+ if (!element.style.backgroundColor && !element.style.padding && !element.style.borderRadius) {
1348
+ return;
1349
+ }
1350
+ element.style.backgroundColor = "";
1351
+ element.style.padding = "";
1352
+ element.style.borderRadius = "";
1353
+ if (!element.getAttribute("style")) {
1354
+ element.removeAttribute("style");
1355
+ }
1356
+ });
1357
+ };
1358
+ const removeBackgroundColor = () => {
1359
+ const editor = editorRef.current;
1360
+ if (!editor) return;
1361
+ focus();
1362
+ restoreSavedSelection();
1363
+ const sel = window.getSelection();
1364
+ const range = sel !== null && sel !== void 0 && sel.rangeCount ? sel.getRangeAt(0) : null;
1365
+ document.execCommand("styleWithCSS", false, true);
1366
+ document.execCommand("hiliteColor", false, "transparent");
1367
+ document.execCommand("backColor", false, "transparent");
1368
+ document.execCommand("styleWithCSS", false, false);
1369
+ const processElement = element => {
1370
+ var _element$classList, _element$classList2, _element$classList3;
1371
+ if (!editor.contains(element)) return;
1372
+ if ((_element$classList = element.classList) !== null && _element$classList !== void 0 && _element$classList.contains("rte-area-highlight-block")) {
1373
+ unwrapAreaHighlightBlock(element);
1374
+ return;
1375
+ }
1376
+ if ((_element$classList2 = element.classList) !== null && _element$classList2 !== void 0 && _element$classList2.contains("image-container") || (_element$classList3 = element.classList) !== null && _element$classList3 !== void 0 && _element$classList3.contains("video-container")) {
1377
+ element.style.backgroundColor = "";
1378
+ element.style.padding = "";
1379
+ element.style.borderRadius = "";
1380
+ if (!element.getAttribute("style")) {
1381
+ element.removeAttribute("style");
1382
+ }
1383
+ return;
1384
+ }
1385
+ stripInlineBackground(element);
1386
+ };
1387
+ if (range && editor.contains(range.commonAncestorContainer)) {
1388
+ const elements = collectElementsInRange(range, editor).filter(elementHasRemovableBackground).reverse();
1389
+ elements.forEach(processElement);
1390
+ if (range.collapsed) {
1391
+ let node = range.startContainer;
1392
+ if (node.nodeType === 3) node = node.parentNode;
1393
+ while (node && node !== editor) {
1394
+ if (elementHasRemovableBackground(node)) {
1395
+ processElement(node);
1396
+ break;
1397
+ }
1398
+ node = node.parentNode;
1399
+ }
1400
+ }
1401
+ } else {
1402
+ [...editor.querySelectorAll(".rte-area-highlight-block")].forEach(unwrapAreaHighlightBlock);
1403
+ [...editor.querySelectorAll("mark")].forEach(mark => unwrapNode(mark));
1404
+ [...editor.querySelectorAll("[style*='background']")].forEach(element => {
1405
+ if (editor.contains(element)) {
1406
+ stripInlineBackground(element);
1407
+ }
1408
+ });
1409
+ }
1410
+ clearMediaHighlightStyles(editor);
1411
+ editor.querySelectorAll("span[style], font[style]").forEach(element => {
1412
+ if (!editor.contains(element)) return;
1413
+ if (!element.style.backgroundColor && !element.style.background) {
1414
+ if (!element.getAttribute("style")) {
1415
+ unwrapNode(element);
1416
+ }
1417
+ }
1418
+ });
1419
+ setHasActiveTextBackground(false);
1420
+ triggerChange();
1421
+ focus();
1422
+ };
1192
1423
  const applyMarqueeHighlight = React.useCallback((clientRect, color) => {
1193
1424
  const editor = editorRef.current;
1194
1425
  if (!editor || clientRect.width < 10 || clientRect.height < 10) {
@@ -1201,6 +1432,9 @@ function RichTextEditor({
1201
1432
  return;
1202
1433
  }
1203
1434
  insertAreaHighlightRegion(editor, clippedRect, color);
1435
+ setAreaHighlightMode(false);
1436
+ setMarqueePreview(null);
1437
+ areaDragRef.current = null;
1204
1438
  editor.querySelectorAll("td, th").forEach(cell => {
1205
1439
  if (!editor.contains(cell)) return;
1206
1440
  if (cell.closest(".rte-area-highlight-block")) return;
@@ -2008,12 +2242,7 @@ function RichTextEditor({
2008
2242
  setCurrentFontSize("16");
2009
2243
  setCurrentLineHeight("");
2010
2244
  setFontColor("#000000");
2011
- setBgColor("#ffff00");
2012
- document.execCommand("styleWithCSS", false, true);
2013
- document.execCommand("hiliteColor", false, "transparent");
2014
- document.execCommand("backColor", false, "transparent");
2015
- document.execCommand("styleWithCSS", false, false);
2016
- triggerChange();
2245
+ removeBackgroundColor();
2017
2246
  focus();
2018
2247
  };
2019
2248
  const deleteTextBeforeCursorInBlock = (block, range, selection) => {
@@ -2623,10 +2852,12 @@ function RichTextEditor({
2623
2852
  title: areaHighlightMode ? "Highlight color for area selection" : "Text background color",
2624
2853
  className: "rte-color-picker-label rte-bg-color-picker-label"
2625
2854
  }, /*#__PURE__*/React.createElement("span", {
2626
- className: "rte-bg-color-swatch",
2627
- style: {
2855
+ className: `rte-bg-color-swatch${hasActiveTextBackground ? "" : " rte-bg-color-swatch-none"}`,
2856
+ style: hasActiveTextBackground ? {
2628
2857
  backgroundColor: bgColor,
2629
2858
  color: fontColor
2859
+ } : {
2860
+ color: fontColor
2630
2861
  }
2631
2862
  }, "A"), /*#__PURE__*/React.createElement("input", {
2632
2863
  type: "color",
@@ -2646,6 +2877,19 @@ function RichTextEditor({
2646
2877
  },
2647
2878
  className: "rte-color-input"
2648
2879
  })), /*#__PURE__*/React.createElement("button", {
2880
+ type: "button",
2881
+ title: "Remove background color",
2882
+ className: `rte-toolbar-button rte-bg-color-clear${hasActiveTextBackground ? " active" : ""}`,
2883
+ onMouseDown: e => {
2884
+ e.preventDefault();
2885
+ e.stopPropagation();
2886
+ saveSelection();
2887
+ removeBackgroundColor();
2888
+ }
2889
+ }, /*#__PURE__*/React.createElement("span", {
2890
+ className: "rte-bg-color-clear-icon",
2891
+ "aria-hidden": "true"
2892
+ }, "A")), /*#__PURE__*/React.createElement("button", {
2649
2893
  type: "button",
2650
2894
  title: "Area highlight \u2014 drag to select a box (like screenshot)",
2651
2895
  className: `rte-toolbar-button rte-area-highlight-toggle${areaHighlightMode ? " active" : ""}`,