@innoviatech/lexical-text-editor 2.0.0 → 2.0.1
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 +2 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical-editor.css +1 -1
- package/dist/nodes/ImageNode.d.ts +10 -14
- package/editor_screenshot.png +0 -0
- package/innoviatech-lexical-text-editor-2.0.0.tgz +0 -0
- package/package.json +1 -1
- package/src/components/ContentPreview.tsx +0 -1
- package/src/nodes/ImageNode.tsx +68 -68
- package/src/styles/lexical-editor.css +5 -6
package/dist/lexical-editor.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
*{box-sizing:border-box;margin:0;padding:0}.lexical-text-editor *{box-sizing:border-box;font-family:inherit}.lexical-text-editor button{background:transparent;border:1px solid transparent;cursor:pointer}.lexical-text-editor a{color:#646cff;font-weight:500;text-decoration:inherit}.lexical-text-editor a:hover{color:#535bf2}.lexical-text-editor{background-color:#fff;border:1px solid #e5e7eb;border-radius:.5rem;color:#000;font-size:16px!important;padding-bottom:.5rem;scrollbar-color:#9ca3af transparent;scrollbar-width:thin}.lexical-text-editor input{background-color:#fff;color:#000;outline:none}.link-editor-buttons input{stroke:#000;background-color:#220909;color:#000;outline:none}.lexical-text-editor input:focus{border:1px solid #676666}.lexical-toolbar-wrapper{align-items:center;display:flex;flex-wrap:wrap;gap:6px;justify-content:center;row-gap:12px}.lexical-toolbar-wrapper.useScroll{flex-wrap:nowrap}.lexical-text-editor::-webkit-scrollbar{width:6px}.lexical-text-editor::-webkit-scrollbar-track{background:transparent}.lexical-text-editor::-webkit-scrollbar-thumb{background-color:#9ca3af;border-radius:3px}.lexical-text-editor::-webkit-scrollbar-thumb:hover{background-color:#6b7280}.lexical-text-editor [contenteditable=true]{outline:none}.lexical-text-editor h1{font-size:32px;font-weight:700;margin:8px 0}.lexical-text-editor h2{font-size:28.8px;font-weight:700;margin:8px 0}.lexical-text-editor h3{font-size:25.6px;font-weight:700;margin:3.2px 0}.lexical-text-editor h4{font-size:22.4px;font-weight:700;margin:3.2px 0}.lexical-text-editor h5{font-size:19.2px;font-weight:700;margin:3.2px 0}.lexical-text-editor h6{font-size:16px;font-weight:700;margin:3.2px 0}.scrollbar-thin{scrollbar-color:#a5acb6 transparent;scrollbar-width:thin}.scrollbar-thin::-webkit-scrollbar{height:4px;width:4px}.scrollbar-thin::-webkit-scrollbar-track{background:transparent}.scrollbar-thin::-webkit-scrollbar-thumb{background-color:#a5acb6;border-radius:9999px}.lexical-editor-container{box-sizing:border-box;position:relative}.lexical-toolbar-container{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;padding-left:.5rem;padding-right:.5rem}.lexical-editor-inner{height:100%;position:relative}.lexical-content-editable{background-color:#fff;box-sizing:border-box;color:#000;font-size:14px;height:100%;outline:0;overflow:auto;padding:8px;scrollbar-color:#9ca3af transparent;scrollbar-width:thin;text-align:start;width:100%}.lexical-placeholder{color:#999;font-size:14px;left:10px;pointer-events:none;position:absolute;top:8px;user-select:none}.lexical-content-editable::-webkit-scrollbar{height:8px;width:8px}.lexical-content-editable::-webkit-scrollbar-track{background:#f1f1f1;border-radius:4px}.lexical-content-editable::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:4px}.lexical-content-editable::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.lexical-bold{font-weight:700}.lexical-underline{text-decoration:underline}.lexical-italic{font-style:italic}.lexical-strikethrough{text-decoration:line-through}.lexical-underline-strikethrough{text-decoration:underline line-through}.lexical-uppercase{text-transform:uppercase}.lexical-lowercase{text-transform:lowercase}.lexical-capitalize{text-transform:capitalize}.lexical-code{background-color:#f3f4f6;border:1px solid #d1d5db;border-radius:.25rem;color:#000;font-family:monospace;font-size:.875rem;padding:0 .25rem}.lexical-paragraph{margin-bottom:.5rem}.lexical-list-ul{list-style-type:disc}.lexical-list-ol,.lexical-list-ul{list-style-position:inside;padding-left:1.5rem}.lexical-list-ol{list-style-type:decimal}.lexical-listitem{margin-bottom:.25rem}.lexical-quote{background-color:#f9fafb;border-bottom-right-radius:.25rem;border-left:4px solid #9ca3af;border-top-right-radius:.25rem;color:#374151;font-style:italic;padding-bottom:.5rem;padding-left:1rem;padding-top:.5rem}.lexical-link{color:#2563eb;text-decoration:underline}.lexical-link:hover{color:#1e40af}.lexical-text-editor .lexical-btn{align-items:center;background:#fff;border:none;border-radius:6px;color:#4b5563;cursor:pointer;display:inline-flex;font-size:14px;font-weight:500;gap:8px;height:32px;justify-content:flex-start;outline:none;padding:8px 12px;transition:all .15s ease;user-select:none;white-space:nowrap;width:100%}.lexical-text-editor .lexical-btn svg{flex-shrink:0;height:16px;pointer-events:none;width:16px}.lexical-text-editor .lexical-btn svg[class*=size-]{height:auto;width:auto}.lexical-text-editor .lexical-btn .label{margin-left:8px}.lexical-text-editor .lexical-btn.toolbar{background:#fff;color:#4b5563}.lexical-text-editor .lexical-btn.toolbar:hover{background:rgba(241,245,249,.8)}.lexical-text-editor .lexical-btn.toolbar-active{background:#f1f5f9;color:#111827}.lexical-text-editor .lexical-btn:disabled{opacity:.5;pointer-events:none}.lexical-text-editor .size-8{height:32px!important;width:32px!important}.lexical-text-editor .toolbar{align-items:center;background-color:#fff;border-radius:8px;color:#374151;cursor:pointer;display:inline-flex;justify-content:flex-start;transition:background .15s ease,border-color .15s ease}.lexical-text-editor .toolbar.icon{align-items:center;display:inline-flex;justify-content:center!important}.lexical-text-editor .toolbar:hover:not(:disabled){background-color:#f3f4f6}.lexical-text-editor .toolbarActive{align-items:center;background-color:#eef2ff;border-radius:.5rem;cursor:pointer;display:inline-flex;justify-content:center;padding:0}.lexical-text-editor button:disabled{background-color:#f9fafb;cursor:not-allowed;opacity:.5}.lexical-text-editor .popover-root{display:inline-block;position:relative}.lexical-text-editor .popover-trigger{display:inline-block}.lexical-text-editor .popover-content{animation:popoverFadeIn .15s ease;background:#fff;border-radius:6px;box-shadow:0 2px 6px rgba(0,0,0,.12),0 0 0 1px rgba(0,0,0,.04);padding:8px;position:absolute;top:calc(100% + 4px);z-index:9999}.lexical-text-editor .popover-content.align-start{left:0}.lexical-text-editor .popover-content.align-center{left:50%;transform:translateX(-50%)}.lexical-text-editor .popover-content.align-end{right:0}@keyframes popoverFadeIn{0%{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}.lexical-text-editor .heading-select{display:inline-block;position:relative}.lexical-text-editor .heading-trigger{background-color:#fff;border:1px solid #e5e7eb;height:32px;justify-content:space-between;padding:8px}.lexical-text-editor .heading-trigger .chevron{transition:transform .15s ease}.lexical-text-editor .heading-trigger .chevron.rotated{transform:rotate(180deg)}.lexical-text-editor .heading-dropdown{animation:dropdownFadeIn .15s ease;background:#fff;border-radius:6px;box-shadow:0 2px 6px rgba(0,0,0,.12),0 0 0 1px rgba(0,0,0,.04);display:flex;flex-direction:column;gap:4px;left:0;padding:8px;position:absolute;top:calc(100% + 4px);width:max-content;z-index:9999}@keyframes dropdownFadeIn{0%{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}.color-picker-wrapper{display:inline-block;position:relative}.toolbar:hover:not(:disabled){background-color:#f3f4f6}.lexical-color-popover{border-radius:.5rem;margin-top:10px;opacity:0;pointer-events:none;transform:scale(.95) translateY(-4px);transform-origin:top left;transition:opacity .15s ease,transform .15s ease;z-index:99}.lexical-color-popover.open{opacity:1;pointer-events:auto;transform:scale(1) translateY(0)}.lexical-text-editor-dialog{.lte-icon-btn{align-items:center;background:none;border:none;border-radius:4px;cursor:pointer;display:flex;padding:6px}.lte-icon-btn:hover{background:#e5e5e5}.lte-outline-btn{background:#f8f8f8;border:1px solid #ccc;border-radius:4px;color:#000;cursor:pointer;font-size:14px;margin:0 auto;padding:8px 12px;width:fit-content}.lte-outline-btn:hover{background:#eee}.lte-primary-btn{background-color:#2563eb!important;border:none;border-radius:4px;color:#fff;cursor:pointer;padding:8px 14px}.lte-primary-btn:hover{background:#1d4ed8}.lte-primary-btn:disabled{cursor:not-allowed;opacity:.5}.lte-input{background-color:#fff;border:1px solid #d0d0d0;border-radius:4px;padding:8px 10px;width:100%}.lte-divider{align-items:center;color:#777;display:flex;font-size:13px;margin:12px 0}.lte-divider:after,.lte-divider:before{background:#ccc;content:"";flex:1;height:1px}.lte-divider span{padding:0 8px}.lte-file-name{color:#666;font-size:13px}.lte-dialog-overlay{align-items:center;background:rgba(0,0,0,.5);display:flex;inset:0;justify-content:center;position:fixed;z-index:50}.lte-dialog{background:#fff;border-radius:8px;margin:10px;max-width:420px;padding:20px;position:relative;width:100%}.lte-dialog.preview{max-width:1024px;width:100%}.lte-dialog-header{color:#333;font-size:18px;font-weight:600;margin-bottom:10px}.lte-dialog-body{display:flex;flex-direction:column;gap:12px;padding:10px 0}.lte-dialog-footer{display:flex;justify-content:flex-end;margin-top:12px}.lte-dialog-close{background:none;border:none;color:#000;cursor:pointer;font-size:26px;opacity:.7;outline:none;padding:0;position:absolute;right:18px;top:10px}.lte-dialog-close:hover{opacity:1}.lte-hidden{display:none}}.lexical-text-editor .lte-toolbar-btn{align-items:center;background:#fff;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;display:flex;gap:4px;padding:6px 10px;transition:.15s ease;user-select:none}.lexical-text-editor .lte-toolbar-btn:hover{background:#f3f4f6}.lexical-text-editor .lte-toolbar-btn-active{background:#e0e7ff;border-color:#6366f1}.lexical-text-editor .lte-preview-container{background:#fff;border:1px solid #e5e7eb;border-radius:8px;max-height:80vh;min-height:400px;overflow-y:auto;padding:2vw;width:100%}.lexical-text-editor .lte-preview-title{border-bottom:2px solid #e5e7eb;font-size:15px;font-weight:600;margin-bottom:14px;padding-bottom:6px;text-align:start}.lexical-text-editor-html-preview{line-height:1.6;max-width:none;text-align:start}.lexical-text-editor-link.link-editor-container{align-items:center;background:#fff;border:1px solid #e5e7eb;border-radius:12px;bottom:-50px;box-shadow:0 4px 12px rgba(0,0,0,.12);display:flex;gap:8px;padding:6px 10px;position:absolute;right:20px;z-index:99}@media (min-width:640px){.lexical-text-editor-link.link-editor-container{bottom:-60px;padding:8px 14px}}.lexical-text-editor-link .link-editor-input-wrapper{flex:1;min-width:200px}.lexical-text-editor-link .link-editor-input{background-color:#fff;border:1px solid #d1d5db;border-radius:6px;font-size:14px;height:32px;outline:none;padding:4px 8px;width:100%}.lexical-text-editor-link .link-editor-input:focus{border-color:#2563eb}.lexical-text-editor-link .link-editor-url{color:#2563eb;display:block;font-size:14px;max-width:100%;overflow:hidden;text-align:start;text-decoration:underline;text-overflow:ellipsis;white-space:nowrap}.lexical-text-editor-link .link-editor-buttons{display:flex;gap:4px}.lexical-text-editor-link .link-editor-btn{align-items:center;background:transparent;border:none;border-radius:6px;cursor:pointer;display:flex;height:32px;justify-content:center;transition:background .2s ease;width:32px}.lexical-text-editor-link .link-editor-btn:hover{background:#f3f4f6}.Lexical-Tooltip-Wrapper{display:inline-block;position:relative}.Lexical-Tooltip-Tip{background:#5a5a5a;border-radius:4px;color:#fff;font-family:sans-serif;font-size:12px;left:50%;line-height:1;padding:8px 12px;position:absolute;transform:translateX(-50%);transition:all .5s;white-space:nowrap;z-index:100}.Lexical-Tooltip-Tip:before{border:6px solid transparent;content:" ";height:0;left:50%;margin-left:-6px;pointer-events:none;position:absolute;width:0}.Lexical-Tooltip-Tip.top{top:-35px}.Lexical-Tooltip-Tip.top:before{border-top-color:#5a5a5a;top:100%}.Lexical-Tooltip-Tip.right{left:calc(100% + 30px);top:50%;transform:translateX(0) translateY(-50%)}.Lexical-Tooltip-Tip.right:before{border-right-color:#5a5a5a;left:-6px;top:50%;transform:translateX(0) translateY(-50%)}.Lexical-Tooltip-Tip.bottom{bottom:-35px}.Lexical-Tooltip-Tip.bottom:before{border-bottom-color:#5a5a5a;bottom:100%}.Lexical-Tooltip-Tip.left{left:auto;right:calc(100% + 30px);top:50%;transform:translateX(0) translateY(-50%)}.Lexical-Tooltip-Tip.left:before{border-left-color:#5a5a5a;left:auto;right:-12px;top:50%;transform:translateX(0) translateY(-50%)}
|
|
1
|
+
.lexical-text-editor *{box-sizing:border-box;font-family:inherit;height:fit-content}.lexical-text-editor button{background:transparent;border:1px solid transparent;cursor:pointer}.lexical-text-editor a{color:#646cff;font-weight:500;text-decoration:inherit}.lexical-text-editor a:hover{color:#535bf2}.lexical-text-editor{background-color:#fff;border:1px solid #e5e7eb;border-radius:.5rem;color:#000;font-size:16px!important;padding-bottom:.5rem;scrollbar-color:#9ca3af transparent;scrollbar-width:thin}.lexical-text-editor input{background-color:#fff;color:#000;outline:none}.link-editor-buttons input{stroke:#000;background-color:#220909;color:#000;outline:none}.lexical-text-editor input:focus{border:1px solid #676666}.lexical-toolbar-wrapper{align-items:center;display:flex;flex-wrap:wrap;gap:6px;justify-content:center;row-gap:12px}.lexical-toolbar-wrapper.useScroll{flex-wrap:nowrap}.lexical-text-editor::-webkit-scrollbar{width:6px}.lexical-text-editor::-webkit-scrollbar-track{background:transparent}.lexical-text-editor::-webkit-scrollbar-thumb{background-color:#9ca3af;border-radius:3px}.lexical-text-editor::-webkit-scrollbar-thumb:hover{background-color:#6b7280}.lexical-text-editor [contenteditable=true]{outline:none}.lexical-text-editor h1{font-size:32px;font-weight:700;margin:8px 0}.lexical-text-editor h2{font-size:28.8px;font-weight:700;margin:8px 0}.lexical-text-editor h3{font-size:25.6px;font-weight:700;margin:3.2px 0}.lexical-text-editor h4{font-size:22.4px;font-weight:700;margin:3.2px 0}.lexical-text-editor h5{font-size:19.2px;font-weight:700;margin:3.2px 0}.lexical-text-editor h6{font-size:16px;font-weight:700;margin:3.2px 0}.scrollbar-thin{scrollbar-color:#a5acb6 transparent;scrollbar-width:thin}.scrollbar-thin::-webkit-scrollbar{height:4px;width:4px}.scrollbar-thin::-webkit-scrollbar-track{background:transparent}.scrollbar-thin::-webkit-scrollbar-thumb{background-color:#a5acb6;border-radius:9999px}.lexical-editor-container{box-sizing:border-box;position:relative}.lexical-toolbar-container{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;padding-left:.5rem;padding-right:.5rem}.lexical-editor-inner{height:100%;position:relative}.lexical-content-editable{background-color:#fff;box-sizing:border-box;color:#000;font-size:14px;height:100%;outline:0;overflow:auto;padding:8px;scrollbar-color:#9ca3af transparent;scrollbar-width:thin;text-align:start;width:100%}.lexical-placeholder{color:#999;font-size:14px;left:10px;pointer-events:none;position:absolute;top:8px;user-select:none}.lexical-content-editable::-webkit-scrollbar{height:8px;width:8px}.lexical-content-editable::-webkit-scrollbar-track{background:#f1f1f1;border-radius:4px}.lexical-content-editable::-webkit-scrollbar-thumb{background:#c1c1c1;border-radius:4px}.lexical-content-editable::-webkit-scrollbar-thumb:hover{background:#a8a8a8}.lexical-bold{font-weight:700}.lexical-underline{text-decoration:underline}.lexical-italic{font-style:italic}.lexical-strikethrough{text-decoration:line-through}.lexical-underline-strikethrough{text-decoration:underline line-through}.lexical-uppercase{text-transform:uppercase}.lexical-lowercase{text-transform:lowercase}.lexical-capitalize{text-transform:capitalize}.lexical-code{background-color:#f3f4f6;border:1px solid #d1d5db;border-radius:.25rem;color:#000;font-family:monospace;font-size:.875rem;padding:0 .25rem}.lexical-paragraph{margin-bottom:.5rem}.lexical-list-ul{list-style-type:disc}.lexical-list-ol,.lexical-list-ul{list-style-position:inside;padding-left:1.5rem}.lexical-list-ol{list-style-type:decimal}.lexical-listitem{margin-bottom:.25rem}.lexical-quote{background-color:#f9fafb;border-bottom-right-radius:.25rem;border-left:4px solid #9ca3af;border-top-right-radius:.25rem;color:#374151;font-style:italic;padding-bottom:.5rem;padding-left:1rem;padding-top:.5rem}.lexical-link{color:#2563eb;text-decoration:underline}.lexical-link:hover{color:#1e40af}.lexical-text-editor .lexical-btn{align-items:center;background:#fff;border:none;border-radius:6px;color:#4b5563;cursor:pointer;display:inline-flex;font-size:14px;font-weight:500;gap:8px;height:32px;justify-content:flex-start;outline:none;padding:8px 12px;transition:all .15s ease;user-select:none;white-space:nowrap;width:100%}.lexical-text-editor .lexical-btn svg{flex-shrink:0;height:16px;pointer-events:none;width:16px}.lexical-text-editor .lexical-btn svg[class*=size-]{height:auto;width:auto}.lexical-text-editor .lexical-btn .label{margin-left:8px}.lexical-text-editor .lexical-btn.toolbar{background:#fff;color:#4b5563}.lexical-text-editor .lexical-btn.toolbar:hover{background:rgba(241,245,249,.8)}.lexical-text-editor .lexical-btn.toolbar-active{background:#f1f5f9;color:#111827}.lexical-text-editor .lexical-btn:disabled{opacity:.5;pointer-events:none}.lexical-text-editor .size-8{height:32px!important;width:32px!important}.lexical-text-editor .toolbar{align-items:center;background-color:#fff;border-radius:8px;color:#374151;cursor:pointer;display:inline-flex;justify-content:flex-start;transition:background .15s ease,border-color .15s ease}.lexical-text-editor .toolbar.icon{align-items:center;display:inline-flex;justify-content:center!important}.lexical-text-editor .toolbar:hover:not(:disabled){background-color:#f3f4f6}.lexical-text-editor .toolbarActive{align-items:center;background-color:#eef2ff;border-radius:.5rem;cursor:pointer;display:inline-flex;justify-content:center;padding:0}.lexical-text-editor button:disabled{background-color:#f9fafb;cursor:not-allowed;opacity:.5}.lexical-text-editor .popover-root{display:inline-block;position:relative}.lexical-text-editor .popover-trigger{display:inline-block}.lexical-text-editor .popover-content{animation:popoverFadeIn .15s ease;background:#fff;border-radius:6px;box-shadow:0 2px 6px rgba(0,0,0,.12),0 0 0 1px rgba(0,0,0,.04);padding:8px;position:absolute;top:calc(100% + 4px);z-index:9999}.lexical-text-editor .popover-content.align-start{left:0}.lexical-text-editor .popover-content.align-center{left:50%;transform:translateX(-50%)}.lexical-text-editor .popover-content.align-end{right:0}@keyframes popoverFadeIn{0%{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}.lexical-text-editor .heading-select{display:inline-block;position:relative}.lexical-text-editor .heading-trigger{background-color:#fff;border:1px solid #e5e7eb;height:32px;justify-content:space-between;padding:8px}.lexical-text-editor .heading-trigger .chevron{transition:transform .15s ease}.lexical-text-editor .heading-trigger .chevron.rotated{transform:rotate(180deg)}.lexical-text-editor .heading-dropdown{animation:dropdownFadeIn .15s ease;background:#fff;border-radius:6px;box-shadow:0 2px 6px rgba(0,0,0,.12),0 0 0 1px rgba(0,0,0,.04);display:flex;flex-direction:column;gap:4px;left:0;padding:8px;position:absolute;top:calc(100% + 4px);width:max-content;z-index:9999}@keyframes dropdownFadeIn{0%{opacity:0;transform:translateY(-3px)}to{opacity:1;transform:translateY(0)}}.color-picker-wrapper{display:inline-block;position:relative}.toolbar:hover:not(:disabled){background-color:#f3f4f6}.lexical-color-popover{border-radius:.5rem;margin-top:10px;opacity:0;pointer-events:none;transform:scale(.95) translateY(-4px);transform-origin:top left;transition:opacity .15s ease,transform .15s ease;z-index:99}.lexical-color-popover.open{opacity:1;pointer-events:auto;transform:scale(1) translateY(0)}.lexical-text-editor-dialog{.lte-icon-btn{align-items:center;background:none;border:none;border-radius:4px;cursor:pointer;display:flex;padding:6px}.lte-icon-btn:hover{background:#e5e5e5}.lte-outline-btn{background:#f8f8f8;border:1px solid #ccc;border-radius:4px;color:#000;cursor:pointer;font-size:14px;margin:0 auto;padding:8px 12px;width:fit-content}.lte-outline-btn:hover{background:#eee}.lte-primary-btn{background-color:#2563eb!important;border:none;border-radius:4px;color:#fff;cursor:pointer;padding:8px 14px}.lte-primary-btn:hover{background:#1d4ed8}.lte-primary-btn:disabled{cursor:not-allowed;opacity:.5}.lte-input{background-color:#fff;border:1px solid #d0d0d0;border-radius:4px;padding:8px 10px;width:100%}.lte-divider{align-items:center;color:#777;display:flex;font-size:13px;margin:12px 0}.lte-divider:after,.lte-divider:before{background:#ccc;content:"";flex:1;height:1px}.lte-divider span{padding:0 8px}.lte-file-name{color:#666;font-size:13px}.lte-dialog-overlay{align-items:center;background:rgba(0,0,0,.5);display:flex;inset:0;justify-content:center;position:fixed;z-index:50}.lte-dialog{background:#fff;border-radius:8px;margin:10px;max-width:420px;padding:20px;position:relative;width:100%}.lte-dialog.preview{max-width:1024px;width:100%}.lte-dialog-header{color:#333;font-size:18px;font-weight:600;margin-bottom:10px}.lte-dialog-body{display:flex;flex-direction:column;gap:12px;padding:10px 0}.lte-dialog-footer{display:flex;justify-content:flex-end;margin-top:12px}.lte-dialog-close{background:none;border:none;color:#000;cursor:pointer;font-size:26px;opacity:.7;outline:none;padding:0;position:absolute;right:18px;top:10px}.lte-dialog-close:hover{opacity:1}.lte-hidden{display:none}}.lexical-text-editor .lte-toolbar-btn{align-items:center;background:#fff;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;display:flex;gap:4px;padding:6px 10px;transition:.15s ease;user-select:none}.lexical-text-editor .lte-toolbar-btn:hover{background:#f3f4f6}.lexical-text-editor .lte-toolbar-btn-active{background:#e0e7ff;border-color:#6366f1}.lexical-text-editor .lte-preview-container{background:#fff;border:1px solid #e5e7eb;border-radius:8px;max-height:80vh;min-height:400px;overflow-y:auto;padding:2vw;width:100%}.lexical-text-editor .lte-preview-title{border-bottom:2px solid #e5e7eb;font-size:15px;font-weight:600;margin-bottom:14px;padding-bottom:6px;text-align:start}.lexical-text-editor-html-preview{line-height:1.6;max-width:none;text-align:start}.lexical-text-editor-link.link-editor-container{align-items:center;background:#fff;border:1px solid #e5e7eb;border-radius:12px;bottom:-50px;box-shadow:0 4px 12px rgba(0,0,0,.12);display:flex;gap:8px;padding:6px 10px;position:absolute;right:20px;z-index:99}@media (min-width:640px){.lexical-text-editor-link.link-editor-container{bottom:-60px;padding:8px 14px}}.lexical-text-editor-link .link-editor-input-wrapper{flex:1;min-width:200px}.lexical-text-editor-link .link-editor-input{background-color:#fff;border:1px solid #d1d5db;border-radius:6px;font-size:14px;height:32px;outline:none;padding:4px 8px;width:100%}.lexical-text-editor-link .link-editor-input:focus{border-color:#2563eb}.lexical-text-editor-link .link-editor-url{color:#2563eb;display:block;font-size:14px;max-width:100%;overflow:hidden;text-align:start;text-decoration:underline;text-overflow:ellipsis;white-space:nowrap}.lexical-text-editor-link .link-editor-buttons{display:flex;gap:4px}.lexical-text-editor-link .link-editor-btn{align-items:center;background:transparent;border:none;border-radius:6px;cursor:pointer;display:flex;height:32px;justify-content:center;transition:background .2s ease;width:32px}.lexical-text-editor-link .link-editor-btn:hover{background:#f3f4f6}.Lexical-Tooltip-Wrapper{display:inline-block;position:relative}.Lexical-Tooltip-Tip{background:#5a5a5a;border-radius:4px;color:#fff;font-family:sans-serif;font-size:12px;left:50%;line-height:1;padding:8px 12px;position:absolute;transform:translateX(-50%);transition:all .5s;white-space:nowrap;z-index:100}.Lexical-Tooltip-Tip:before{border:6px solid transparent;content:" ";height:0;left:50%;margin-left:-6px;pointer-events:none;position:absolute;width:0}.Lexical-Tooltip-Tip.top{top:-35px}.Lexical-Tooltip-Tip.top:before{border-top-color:#5a5a5a;top:100%}.Lexical-Tooltip-Tip.right{left:calc(100% + 30px);top:50%;transform:translateX(0) translateY(-50%)}.Lexical-Tooltip-Tip.right:before{border-right-color:#5a5a5a;left:-6px;top:50%;transform:translateX(0) translateY(-50%)}.Lexical-Tooltip-Tip.bottom{bottom:-35px}.Lexical-Tooltip-Tip.bottom:before{border-bottom-color:#5a5a5a;bottom:100%}.Lexical-Tooltip-Tip.left{left:auto;right:calc(100% + 30px);top:50%;transform:translateX(0) translateY(-50%)}.Lexical-Tooltip-Tip.left:before{border-left-color:#5a5a5a;left:auto;right:-12px;top:50%;transform:translateX(0) translateY(-50%)}
|
|
@@ -9,35 +9,31 @@ export interface SerializedImageNode {
|
|
|
9
9
|
width?: number | "inherit";
|
|
10
10
|
height?: number | "inherit";
|
|
11
11
|
}
|
|
12
|
-
export
|
|
12
|
+
export type ImageNodePayload = {
|
|
13
|
+
src: string;
|
|
13
14
|
altText: string;
|
|
14
|
-
height?: number;
|
|
15
15
|
maxWidth?: number;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
16
|
+
width?: number | "inherit";
|
|
17
|
+
height?: number | "inherit";
|
|
18
|
+
};
|
|
19
|
+
export declare const $createImageNode: (payload: ImageNodePayload) => ImageNode;
|
|
19
20
|
export declare class ImageNode extends DecoratorNode<JSX.Element> {
|
|
20
21
|
__src: string;
|
|
21
22
|
__altText: string;
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
__width?: number | "inherit";
|
|
24
|
+
__height?: number | "inherit";
|
|
24
25
|
__maxWidth: number;
|
|
25
|
-
constructor({ src, altText, maxWidth, width, height, key, }?: {
|
|
26
|
-
src?: string;
|
|
27
|
-
altText?: string;
|
|
28
|
-
maxWidth?: number;
|
|
29
|
-
width?: "inherit" | number;
|
|
30
|
-
height?: "inherit" | number;
|
|
26
|
+
constructor({ src, altText, maxWidth, width, height, key, }?: ImageNodePayload & {
|
|
31
27
|
key?: NodeKey;
|
|
32
28
|
});
|
|
33
29
|
static getType(): string;
|
|
34
30
|
static clone(node: ImageNode): ImageNode;
|
|
35
31
|
createDOM(): HTMLElement;
|
|
32
|
+
updateDOM(prevNode: ImageNode): boolean;
|
|
36
33
|
exportDOM(): DOMExportOutput;
|
|
37
34
|
static importDOM(): DOMConversionMap | null;
|
|
38
35
|
exportJSON(): SerializedImageNode;
|
|
39
36
|
static importJSON(serializedNode: SerializedImageNode): ImageNode;
|
|
40
37
|
updateDimensions(width: number, height: number): void;
|
|
41
|
-
updateDOM(prevNode: ImageNode): boolean;
|
|
42
38
|
decorate(): JSX.Element;
|
|
43
39
|
}
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -25,7 +25,6 @@ export default function ContentPreviewDialog({
|
|
|
25
25
|
triggerLabel = "Preview",
|
|
26
26
|
}: ContentPreviewDialogProps) {
|
|
27
27
|
const [isOpen, setIsOpen] = useState(false);
|
|
28
|
-
console.log(value);
|
|
29
28
|
return (
|
|
30
29
|
<div className="lexical-text-editor-dialog">
|
|
31
30
|
{/* Trigger button */}
|
package/src/nodes/ImageNode.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "lexical";
|
|
10
10
|
import type { JSX } from "react";
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
export interface SerializedImageNode {
|
|
13
14
|
type: "image";
|
|
14
15
|
version: 1;
|
|
@@ -19,98 +20,96 @@ export interface SerializedImageNode {
|
|
|
19
20
|
height?: number | "inherit";
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
export
|
|
23
|
+
export type ImageNodePayload = {
|
|
24
|
+
src: string;
|
|
23
25
|
altText: string;
|
|
24
|
-
height?: number;
|
|
25
26
|
maxWidth?: number;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
27
|
+
width?: number | "inherit";
|
|
28
|
+
height?: number | "inherit";
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export const $createImageNode = (payload: ImageNodePayload) => {
|
|
29
34
|
return $applyNodeReplacement(new ImageNode(payload));
|
|
30
35
|
};
|
|
31
36
|
|
|
32
|
-
// const convertImageElement = (domNode: Node): DOMConversionOutput | null => {
|
|
33
|
-
// if (domNode instanceof HTMLImageElement) {
|
|
34
|
-
// const { src, alt } = domNode;
|
|
35
|
-
// const node = $createImageNode({ src, altText: alt });
|
|
36
|
-
// return { node };
|
|
37
|
-
// }
|
|
38
|
-
// return null;
|
|
39
|
-
// };
|
|
40
37
|
|
|
41
38
|
const convertImageElement = (domNode: Node): DOMConversionOutput | null => {
|
|
42
39
|
if (!(domNode instanceof HTMLImageElement)) return null;
|
|
43
40
|
|
|
44
41
|
const { src, alt } = domNode;
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
let
|
|
48
|
-
let height: number | "inherit" | undefined = undefined;
|
|
43
|
+
let width: number | "inherit" | undefined;
|
|
44
|
+
let height: number | "inherit" | undefined;
|
|
49
45
|
|
|
46
|
+
// Attributes
|
|
50
47
|
if (domNode.width) width = domNode.width;
|
|
51
48
|
if (domNode.height) height = domNode.height;
|
|
52
49
|
|
|
53
|
-
//
|
|
50
|
+
// Inline styles fallback
|
|
54
51
|
const style = domNode.style;
|
|
52
|
+
|
|
55
53
|
if ((!width || width === 0) && style.width) {
|
|
56
|
-
const parsed = parseInt(style.width);
|
|
57
|
-
if (!isNaN(parsed)) width = parsed;
|
|
54
|
+
const parsed = parseInt(style.width, 10);
|
|
55
|
+
if (!Number.isNaN(parsed)) width = parsed;
|
|
58
56
|
}
|
|
57
|
+
|
|
59
58
|
if ((!height || height === 0) && style.height) {
|
|
60
|
-
const parsed = parseInt(style.height);
|
|
61
|
-
if (!isNaN(parsed)) height = parsed;
|
|
59
|
+
const parsed = parseInt(style.height, 10);
|
|
60
|
+
if (!Number.isNaN(parsed)) height = parsed;
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
const node = $createImageNode({
|
|
65
64
|
src,
|
|
66
65
|
altText: alt,
|
|
67
|
-
width,
|
|
68
|
-
height,
|
|
66
|
+
width: width ?? "inherit",
|
|
67
|
+
height: height ?? "inherit",
|
|
69
68
|
});
|
|
70
69
|
|
|
71
70
|
return { node };
|
|
72
71
|
};
|
|
73
72
|
|
|
73
|
+
|
|
74
74
|
export class ImageNode extends DecoratorNode<JSX.Element> {
|
|
75
75
|
__src: string;
|
|
76
76
|
__altText: string;
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
__width?: number | "inherit";
|
|
78
|
+
__height?: number | "inherit";
|
|
79
79
|
__maxWidth: number;
|
|
80
80
|
|
|
81
|
-
constructor(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
key?: NodeKey;
|
|
95
|
-
} = {}) {
|
|
81
|
+
constructor(
|
|
82
|
+
{
|
|
83
|
+
src = "",
|
|
84
|
+
altText = "",
|
|
85
|
+
maxWidth = 1080,
|
|
86
|
+
width = "inherit",
|
|
87
|
+
height = "inherit",
|
|
88
|
+
key,
|
|
89
|
+
}: ImageNodePayload & { key?: NodeKey } = {
|
|
90
|
+
src: "",
|
|
91
|
+
altText: "",
|
|
92
|
+
}
|
|
93
|
+
) {
|
|
96
94
|
super(key);
|
|
97
|
-
this.__altText = altText;
|
|
98
95
|
this.__src = src;
|
|
96
|
+
this.__altText = altText;
|
|
99
97
|
this.__maxWidth = maxWidth;
|
|
100
|
-
this.__height = height;
|
|
101
98
|
this.__width = width;
|
|
99
|
+
this.__height = height;
|
|
102
100
|
}
|
|
103
101
|
|
|
102
|
+
|
|
104
103
|
static getType(): string {
|
|
105
104
|
return "image";
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
static clone(node: ImageNode): ImageNode {
|
|
109
108
|
return new ImageNode({
|
|
110
|
-
altText: node.__altText,
|
|
111
109
|
src: node.__src,
|
|
112
|
-
|
|
110
|
+
altText: node.__altText,
|
|
113
111
|
width: node.__width,
|
|
112
|
+
height: node.__height,
|
|
114
113
|
maxWidth: node.__maxWidth,
|
|
115
114
|
key: node.getKey(),
|
|
116
115
|
});
|
|
@@ -120,31 +119,37 @@ export class ImageNode extends DecoratorNode<JSX.Element> {
|
|
|
120
119
|
return document.createElement("span");
|
|
121
120
|
}
|
|
122
121
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (this.__width && this.__width !== "inherit") {
|
|
129
|
-
image.setAttribute("width", String(this.__width));
|
|
130
|
-
}
|
|
131
|
-
if (this.__height && this.__height !== "inherit") {
|
|
132
|
-
image.setAttribute("height", String(this.__height));
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return { element: image };
|
|
122
|
+
updateDOM(prevNode: ImageNode): boolean {
|
|
123
|
+
return (
|
|
124
|
+
prevNode.__width !== this.__width ||
|
|
125
|
+
prevNode.__height !== this.__height
|
|
126
|
+
);
|
|
138
127
|
}
|
|
139
128
|
|
|
140
129
|
|
|
130
|
+
exportDOM(): DOMExportOutput {
|
|
131
|
+
const img = document.createElement("img");
|
|
132
|
+
|
|
133
|
+
img.src = this.__src;
|
|
134
|
+
img.alt = this.__altText;
|
|
141
135
|
|
|
136
|
+
if (this.__width !== "inherit") {
|
|
137
|
+
img.width = this.__width ?? 0;
|
|
138
|
+
}
|
|
142
139
|
|
|
140
|
+
if (this.__height !== "inherit") {
|
|
141
|
+
img.height = this.__height ?? 0;
|
|
142
|
+
}
|
|
143
143
|
|
|
144
|
+
return { element: img };
|
|
145
|
+
}
|
|
144
146
|
|
|
145
147
|
static importDOM(): DOMConversionMap | null {
|
|
146
148
|
return {
|
|
147
|
-
img: () => ({
|
|
149
|
+
img: () => ({
|
|
150
|
+
conversion: convertImageElement,
|
|
151
|
+
priority: 1,
|
|
152
|
+
}),
|
|
148
153
|
};
|
|
149
154
|
}
|
|
150
155
|
|
|
@@ -170,17 +175,14 @@ export class ImageNode extends DecoratorNode<JSX.Element> {
|
|
|
170
175
|
});
|
|
171
176
|
}
|
|
172
177
|
|
|
178
|
+
|
|
173
179
|
updateDimensions(width: number, height: number) {
|
|
174
180
|
const writable = this.getWritable();
|
|
175
181
|
writable.__width = width;
|
|
176
182
|
writable.__height = height;
|
|
177
183
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
prevNode.__width !== this.__width ||
|
|
181
|
-
prevNode.__height !== this.__height
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
+
|
|
185
|
+
|
|
184
186
|
decorate(): JSX.Element {
|
|
185
187
|
return (
|
|
186
188
|
<ImageComponent
|
|
@@ -194,5 +196,3 @@ export class ImageNode extends DecoratorNode<JSX.Element> {
|
|
|
194
196
|
);
|
|
195
197
|
}
|
|
196
198
|
}
|
|
197
|
-
|
|
198
|
-
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
|
|
2
|
-
/* Minimal Reset */
|
|
3
2
|
|
|
4
|
-
*{
|
|
5
|
-
box-sizing: border-box;
|
|
6
|
-
margin: 0;
|
|
7
|
-
padding: 0;
|
|
8
|
-
}
|
|
9
3
|
.lexical-text-editor * {
|
|
10
4
|
box-sizing: border-box;
|
|
11
5
|
font-family: inherit;
|
|
12
6
|
}
|
|
13
7
|
|
|
8
|
+
.lexical-text-editor * {
|
|
9
|
+
height: fit-content;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
|
|
14
13
|
|
|
15
14
|
.lexical-text-editor button {
|
|
16
15
|
background: transparent;
|