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.esm.js CHANGED
@@ -409,7 +409,7 @@ function styleInject(css, ref) {
409
409
  }
410
410
  }
411
411
 
412
- 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}";
412
+ 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}";
413
413
  styleInject(css_248z);
414
414
 
415
415
  // Helper functions for HTML escaping
@@ -421,6 +421,82 @@ const escapeAttr = str => escapeHtml(str).replace(/"/g, """);
421
421
 
422
422
  // URL detection regex
423
423
  const URL_REGEX = /(https?:\/\/[^\s]+)/g;
424
+ const TRANSPARENT_BACKGROUNDS = new Set(["", "transparent", "initial", "inherit", "rgba(0, 0, 0, 0)", "rgb(0, 0, 0, 0)"]);
425
+ const isTransparentBackground = value => {
426
+ if (!value) return true;
427
+ const normalized = value.trim().toLowerCase();
428
+ if (TRANSPARENT_BACKGROUNDS.has(normalized)) return true;
429
+ const match = normalized.match(/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*([\d.]+))?\s*\)$/);
430
+ if ((match === null || match === void 0 ? void 0 : match[4]) !== undefined && parseFloat(match[4]) === 0) return true;
431
+ return false;
432
+ };
433
+ const unwrapNode = element => {
434
+ const parent = element.parentNode;
435
+ if (!parent) return;
436
+ while (element.firstChild) {
437
+ parent.insertBefore(element.firstChild, element);
438
+ }
439
+ parent.removeChild(element);
440
+ };
441
+ const unwrapAreaHighlightBlock = block => {
442
+ var _block$classList;
443
+ if (!(block !== null && block !== void 0 && (_block$classList = block.classList) !== null && _block$classList !== void 0 && _block$classList.contains("rte-area-highlight-block"))) return;
444
+ const parent = block.parentNode;
445
+ if (!parent) return;
446
+ const fragment = document.createDocumentFragment();
447
+ while (block.firstChild) {
448
+ fragment.appendChild(block.firstChild);
449
+ }
450
+ parent.insertBefore(fragment, block);
451
+ parent.removeChild(block);
452
+ };
453
+ const stripInlineBackground = element => {
454
+ if (!(element instanceof HTMLElement)) return;
455
+ if (element.classList.contains("rte-block-highlight")) {
456
+ element.classList.remove("rte-block-highlight");
457
+ }
458
+ if (element.tagName === "MARK") {
459
+ unwrapNode(element);
460
+ return;
461
+ }
462
+ const hadBackground = element.style.backgroundColor && !isTransparentBackground(element.style.backgroundColor) || element.style.background && !isTransparentBackground(element.style.background);
463
+ if (!hadBackground) return;
464
+ element.style.backgroundColor = "";
465
+ element.style.background = "";
466
+ if (!element.getAttribute("style")) {
467
+ element.removeAttribute("style");
468
+ }
469
+ const tag = element.tagName;
470
+ if ((tag === "SPAN" || tag === "FONT") && !element.className && element.attributes.length === 0) {
471
+ unwrapNode(element);
472
+ }
473
+ };
474
+ const collectElementsInRange = (range, root) => {
475
+ const elements = [];
476
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_ELEMENT);
477
+ let node = walker.currentNode;
478
+ while (node) {
479
+ if (range.intersectsNode(node)) {
480
+ elements.push(node);
481
+ }
482
+ node = walker.nextNode();
483
+ }
484
+ return elements;
485
+ };
486
+ const elementHasRemovableBackground = element => {
487
+ var _element$style, _element$style2;
488
+ if (!(element instanceof HTMLElement)) return false;
489
+ if (element.classList.contains("rte-area-highlight-block")) return true;
490
+ if (element.classList.contains("rte-block-highlight")) return true;
491
+ if (element.tagName === "MARK") return true;
492
+ if ((_element$style = element.style) !== null && _element$style !== void 0 && _element$style.backgroundColor && !isTransparentBackground(element.style.backgroundColor)) {
493
+ return true;
494
+ }
495
+ if ((_element$style2 = element.style) !== null && _element$style2 !== void 0 && _element$style2.background && !isTransparentBackground(element.style.background)) {
496
+ return true;
497
+ }
498
+ return false;
499
+ };
424
500
  const rectsIntersect = (a, b) => !(a.right < b.left || a.left > b.right || a.bottom < b.top || a.top > b.bottom);
425
501
  const caretRangeFromClientPoint = (x, y) => {
426
502
  var _document$caretPositi, _document;
@@ -459,38 +535,74 @@ const getIntersectingBlocks = (editor, clientRect) => {
459
535
  });
460
536
  return candidates.filter(el => !candidates.some(other => other !== el && other.contains(el)));
461
537
  };
462
- const insertAreaHighlightRegion = (editor, clientRect, color) => {
463
- const editorRect = editor.getBoundingClientRect();
464
- const clipped = clipRectToBounds(clientRect, editorRect);
538
+ const isHighlightableBlock = block => {
539
+ const text = (block.textContent || "").replace(/[\u00A0\u200B\s]/g, "");
540
+ if (text.length > 0) return true;
541
+ return !!block.querySelector("img, table, iframe, .image-container, .video-container, svg");
542
+ };
543
+ const createAreaHighlightWrapper = (color, textAlign, clipped, editorRect) => {
465
544
  const widthPx = Math.max(40, Math.round(clipped.width));
466
545
  const heightPx = Math.max(24, Math.round(clipped.height));
467
546
  const region = document.createElement("div");
468
547
  region.className = "rte-area-highlight-block";
469
548
  region.style.backgroundColor = color;
470
- region.style.minHeight = `${heightPx}px`;
549
+ region.style.display = "block";
471
550
  region.style.width = `${widthPx}px`;
551
+ region.style.minHeight = `${heightPx}px`;
472
552
  region.style.maxWidth = "100%";
473
- region.style.boxSizing = "border-box";
474
- region.style.padding = "12px";
553
+ region.style.padding = "6px 10px";
475
554
  region.style.borderRadius = "4px";
476
- region.style.margin = "8px 0";
477
- region.style.display = "block";
478
- const blocks = getIntersectingBlocks(editor, clipped);
555
+ region.style.margin = "4px 0";
556
+ region.style.boxSizing = "border-box";
557
+ if (textAlign === "center") {
558
+ region.style.marginLeft = "auto";
559
+ region.style.marginRight = "auto";
560
+ } else if (textAlign === "right" || textAlign === "end") {
561
+ region.style.marginLeft = "auto";
562
+ region.style.marginRight = "0";
563
+ } else {
564
+ const leftOffset = Math.max(0, Math.round(clipped.left - editorRect.left));
565
+ region.style.marginLeft = `${leftOffset}px`;
566
+ region.style.marginRight = "auto";
567
+ }
568
+ return region;
569
+ };
570
+ const insertAreaHighlightRegion = (editor, clientRect, color) => {
571
+ var _alignNode;
572
+ const editorRect = editor.getBoundingClientRect();
573
+ const clipped = clipRectToBounds(clientRect, editorRect);
574
+ const blocks = getIntersectingBlocks(editor, clipped).filter(isHighlightableBlock);
479
575
  if (blocks.length > 0) {
480
576
  const first = blocks[0];
577
+ const textAlign = window.getComputedStyle(first).textAlign;
578
+ const region = createAreaHighlightWrapper(color, textAlign, clipped, editorRect);
579
+ let totalBlockHeight = 0;
580
+ blocks.forEach(block => {
581
+ totalBlockHeight += block.getBoundingClientRect().height;
582
+ });
583
+ const targetHeight = Math.max(24, Math.round(clipped.height));
584
+ const innerPadding = 12;
585
+ const extraVertical = Math.max(0, targetHeight - totalBlockHeight - innerPadding);
586
+ if (extraVertical > 0) {
587
+ const pad = Math.round(extraVertical / 2);
588
+ region.style.paddingTop = `${6 + pad}px`;
589
+ region.style.paddingBottom = `${6 + pad}px`;
590
+ }
481
591
  if (first.parentNode) {
482
592
  first.parentNode.insertBefore(region, first);
483
593
  } else {
484
594
  editor.appendChild(region);
485
595
  }
486
596
  blocks.forEach(block => {
487
- block.style.backgroundColor = "";
488
- block.style.borderRadius = "";
489
597
  region.appendChild(block);
490
598
  });
491
599
  return true;
492
600
  }
493
601
  const insertRange = caretRangeFromClientPoint(clipped.left + clipped.width / 2, clipped.top + Math.min(8, clipped.height / 2)) || caretRangeFromClientPoint(clipped.left + 4, clipped.top + 4);
602
+ let alignNode = insertRange === null || insertRange === void 0 ? void 0 : insertRange.startContainer;
603
+ if (((_alignNode = alignNode) === null || _alignNode === void 0 ? void 0 : _alignNode.nodeType) === 3) alignNode = alignNode.parentNode;
604
+ const textAlign = alignNode instanceof HTMLElement ? window.getComputedStyle(alignNode).textAlign : "left";
605
+ const region = createAreaHighlightWrapper(color, textAlign, clipped, editorRect);
494
606
  region.innerHTML = "&nbsp;";
495
607
  if (insertRange && editor.contains(insertRange.startContainer)) {
496
608
  insertRange.collapse(true);
@@ -845,6 +957,42 @@ function RichTextEditor({
845
957
  const computedColor = window.getComputedStyle(sel.anchorNode.nodeType === 3 ? sel.anchorNode.parentNode : sel.anchorNode).color;
846
958
  return rgbToHex(computedColor);
847
959
  };
960
+ const getBackgroundColorAtCursor = () => {
961
+ const sel = window.getSelection();
962
+ if (!sel || !sel.rangeCount || !editorRef.current) return null;
963
+ let node = sel.anchorNode;
964
+ if (node.nodeType === 3) node = node.parentNode;
965
+ while (node && node !== editorRef.current) {
966
+ if (node.nodeType === 1) {
967
+ var _node$classList, _node$classList2, _node$style;
968
+ if ((_node$classList = node.classList) !== null && _node$classList !== void 0 && _node$classList.contains("rte-area-highlight-block")) {
969
+ const bg = node.style.backgroundColor;
970
+ return bg && !isTransparentBackground(bg) ? rgbToHex(bg) : null;
971
+ }
972
+ if ((_node$classList2 = node.classList) !== null && _node$classList2 !== void 0 && _node$classList2.contains("rte-block-highlight")) {
973
+ const bg = node.style.backgroundColor;
974
+ return bg && !isTransparentBackground(bg) ? rgbToHex(bg) : null;
975
+ }
976
+ const inlineBg = (_node$style = node.style) === null || _node$style === void 0 ? void 0 : _node$style.backgroundColor;
977
+ if (inlineBg && !isTransparentBackground(inlineBg)) {
978
+ return rgbToHex(inlineBg);
979
+ }
980
+ if (node.tagName === "MARK") {
981
+ const markBg = window.getComputedStyle(node).backgroundColor;
982
+ return markBg && !isTransparentBackground(markBg) ? rgbToHex(markBg) : null;
983
+ }
984
+ }
985
+ node = node.parentNode;
986
+ }
987
+ return null;
988
+ };
989
+ const syncBackgroundColorState = () => {
990
+ const activeBg = getBackgroundColorAtCursor();
991
+ setHasActiveTextBackground(!!activeBg);
992
+ if (activeBg) {
993
+ setBgColor(activeBg);
994
+ }
995
+ };
848
996
  const stripEditorChrome = root => {
849
997
  root.querySelectorAll(".image-delete-button, .video-delete-button, .video-edit-overlay, .media-resize-handle").forEach(element => element.remove());
850
998
  root.querySelectorAll(".rte-media-selected").forEach(element => {
@@ -1124,12 +1272,14 @@ function RichTextEditor({
1124
1272
  setIsUnderline(isParentStyle(container, "U", "underline"));
1125
1273
  const computedColor = window.getComputedStyle(container).color;
1126
1274
  setFontColor(rgbToHex(computedColor));
1275
+ syncBackgroundColorState();
1127
1276
  } else {
1128
1277
  setIsBold(document.queryCommandState("bold"));
1129
1278
  setIsItalic(document.queryCommandState("italic"));
1130
1279
  setIsUnderline(document.queryCommandState("underline"));
1131
1280
  const computedColor = window.getComputedStyle(container).color;
1132
1281
  setFontColor(rgbToHex(computedColor));
1282
+ syncBackgroundColorState();
1133
1283
  }
1134
1284
 
1135
1285
  // 3. Current Font Size
@@ -1156,6 +1306,7 @@ function RichTextEditor({
1156
1306
  };
1157
1307
  const [fontColor, setFontColor] = useState("#000000");
1158
1308
  const [bgColor, setBgColor] = useState("#ffff00");
1309
+ const [hasActiveTextBackground, setHasActiveTextBackground] = useState(false);
1159
1310
  useEffect(() => {
1160
1311
  bgColorRef.current = bgColor;
1161
1312
  }, [bgColor]);
@@ -1178,6 +1329,7 @@ function RichTextEditor({
1178
1329
  };
1179
1330
  const applyBackgroundColor = color => {
1180
1331
  setBgColor(color);
1332
+ setHasActiveTextBackground(true);
1181
1333
  focus();
1182
1334
  restoreSavedSelection();
1183
1335
  document.execCommand("styleWithCSS", false, true);
@@ -1187,6 +1339,85 @@ function RichTextEditor({
1187
1339
  document.execCommand("styleWithCSS", false, false);
1188
1340
  triggerChange();
1189
1341
  };
1342
+ const clearMediaHighlightStyles = editor => {
1343
+ editor.querySelectorAll(".image-container, .video-container, td, th").forEach(element => {
1344
+ if (!editor.contains(element)) return;
1345
+ if (!element.style.backgroundColor && !element.style.padding && !element.style.borderRadius) {
1346
+ return;
1347
+ }
1348
+ element.style.backgroundColor = "";
1349
+ element.style.padding = "";
1350
+ element.style.borderRadius = "";
1351
+ if (!element.getAttribute("style")) {
1352
+ element.removeAttribute("style");
1353
+ }
1354
+ });
1355
+ };
1356
+ const removeBackgroundColor = () => {
1357
+ const editor = editorRef.current;
1358
+ if (!editor) return;
1359
+ focus();
1360
+ restoreSavedSelection();
1361
+ const sel = window.getSelection();
1362
+ const range = sel !== null && sel !== void 0 && sel.rangeCount ? sel.getRangeAt(0) : null;
1363
+ document.execCommand("styleWithCSS", false, true);
1364
+ document.execCommand("hiliteColor", false, "transparent");
1365
+ document.execCommand("backColor", false, "transparent");
1366
+ document.execCommand("styleWithCSS", false, false);
1367
+ const processElement = element => {
1368
+ var _element$classList, _element$classList2, _element$classList3;
1369
+ if (!editor.contains(element)) return;
1370
+ if ((_element$classList = element.classList) !== null && _element$classList !== void 0 && _element$classList.contains("rte-area-highlight-block")) {
1371
+ unwrapAreaHighlightBlock(element);
1372
+ return;
1373
+ }
1374
+ 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")) {
1375
+ element.style.backgroundColor = "";
1376
+ element.style.padding = "";
1377
+ element.style.borderRadius = "";
1378
+ if (!element.getAttribute("style")) {
1379
+ element.removeAttribute("style");
1380
+ }
1381
+ return;
1382
+ }
1383
+ stripInlineBackground(element);
1384
+ };
1385
+ if (range && editor.contains(range.commonAncestorContainer)) {
1386
+ const elements = collectElementsInRange(range, editor).filter(elementHasRemovableBackground).reverse();
1387
+ elements.forEach(processElement);
1388
+ if (range.collapsed) {
1389
+ let node = range.startContainer;
1390
+ if (node.nodeType === 3) node = node.parentNode;
1391
+ while (node && node !== editor) {
1392
+ if (elementHasRemovableBackground(node)) {
1393
+ processElement(node);
1394
+ break;
1395
+ }
1396
+ node = node.parentNode;
1397
+ }
1398
+ }
1399
+ } else {
1400
+ [...editor.querySelectorAll(".rte-area-highlight-block")].forEach(unwrapAreaHighlightBlock);
1401
+ [...editor.querySelectorAll("mark")].forEach(mark => unwrapNode(mark));
1402
+ [...editor.querySelectorAll("[style*='background']")].forEach(element => {
1403
+ if (editor.contains(element)) {
1404
+ stripInlineBackground(element);
1405
+ }
1406
+ });
1407
+ }
1408
+ clearMediaHighlightStyles(editor);
1409
+ editor.querySelectorAll("span[style], font[style]").forEach(element => {
1410
+ if (!editor.contains(element)) return;
1411
+ if (!element.style.backgroundColor && !element.style.background) {
1412
+ if (!element.getAttribute("style")) {
1413
+ unwrapNode(element);
1414
+ }
1415
+ }
1416
+ });
1417
+ setHasActiveTextBackground(false);
1418
+ triggerChange();
1419
+ focus();
1420
+ };
1190
1421
  const applyMarqueeHighlight = useCallback((clientRect, color) => {
1191
1422
  const editor = editorRef.current;
1192
1423
  if (!editor || clientRect.width < 10 || clientRect.height < 10) {
@@ -1199,6 +1430,9 @@ function RichTextEditor({
1199
1430
  return;
1200
1431
  }
1201
1432
  insertAreaHighlightRegion(editor, clippedRect, color);
1433
+ setAreaHighlightMode(false);
1434
+ setMarqueePreview(null);
1435
+ areaDragRef.current = null;
1202
1436
  editor.querySelectorAll("td, th").forEach(cell => {
1203
1437
  if (!editor.contains(cell)) return;
1204
1438
  if (cell.closest(".rte-area-highlight-block")) return;
@@ -2006,12 +2240,7 @@ function RichTextEditor({
2006
2240
  setCurrentFontSize("16");
2007
2241
  setCurrentLineHeight("");
2008
2242
  setFontColor("#000000");
2009
- setBgColor("#ffff00");
2010
- document.execCommand("styleWithCSS", false, true);
2011
- document.execCommand("hiliteColor", false, "transparent");
2012
- document.execCommand("backColor", false, "transparent");
2013
- document.execCommand("styleWithCSS", false, false);
2014
- triggerChange();
2243
+ removeBackgroundColor();
2015
2244
  focus();
2016
2245
  };
2017
2246
  const deleteTextBeforeCursorInBlock = (block, range, selection) => {
@@ -2621,10 +2850,12 @@ function RichTextEditor({
2621
2850
  title: areaHighlightMode ? "Highlight color for area selection" : "Text background color",
2622
2851
  className: "rte-color-picker-label rte-bg-color-picker-label"
2623
2852
  }, /*#__PURE__*/React.createElement("span", {
2624
- className: "rte-bg-color-swatch",
2625
- style: {
2853
+ className: `rte-bg-color-swatch${hasActiveTextBackground ? "" : " rte-bg-color-swatch-none"}`,
2854
+ style: hasActiveTextBackground ? {
2626
2855
  backgroundColor: bgColor,
2627
2856
  color: fontColor
2857
+ } : {
2858
+ color: fontColor
2628
2859
  }
2629
2860
  }, "A"), /*#__PURE__*/React.createElement("input", {
2630
2861
  type: "color",
@@ -2644,6 +2875,19 @@ function RichTextEditor({
2644
2875
  },
2645
2876
  className: "rte-color-input"
2646
2877
  })), /*#__PURE__*/React.createElement("button", {
2878
+ type: "button",
2879
+ title: "Remove background color",
2880
+ className: `rte-toolbar-button rte-bg-color-clear${hasActiveTextBackground ? " active" : ""}`,
2881
+ onMouseDown: e => {
2882
+ e.preventDefault();
2883
+ e.stopPropagation();
2884
+ saveSelection();
2885
+ removeBackgroundColor();
2886
+ }
2887
+ }, /*#__PURE__*/React.createElement("span", {
2888
+ className: "rte-bg-color-clear-icon",
2889
+ "aria-hidden": "true"
2890
+ }, "A")), /*#__PURE__*/React.createElement("button", {
2647
2891
  type: "button",
2648
2892
  title: "Area highlight \u2014 drag to select a box (like screenshot)",
2649
2893
  className: `rte-toolbar-button rte-area-highlight-toggle${areaHighlightMode ? " active" : ""}`,