@innoviatech/lexical-text-editor 2.0.7 → 3.0.0
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 +390 -288
- package/dist/components/AlignmentSelectionList.js +19 -0
- package/dist/components/ColorPicker.js +30 -0
- package/dist/components/ContentPreview.js +11 -0
- package/dist/components/DisplayControls.d.ts +16 -0
- package/dist/components/DropdownList.js +18 -0
- package/dist/components/FindReplaceModal.d.ts +11 -0
- package/dist/components/FindReplaceModal.js +120 -0
- package/dist/components/FontSelectionList.d.ts +17 -0
- package/dist/components/FontSelectionList.js +17 -0
- package/dist/components/HeadingSelectionList.js +19 -0
- package/dist/components/ImageComponent.js +111 -0
- package/dist/components/InsertDropdownList.js +17 -0
- package/dist/components/LexicalTextEditor.d.ts +10 -0
- package/dist/components/LexicalTextEditor.js +128 -0
- package/dist/components/LinkModal.js +47 -0
- package/dist/components/Separator.js +4 -0
- package/dist/components/SourceView.d.ts +13 -0
- package/dist/components/SourceView.js +50 -0
- package/dist/components/StatusBar.d.ts +14 -0
- package/dist/components/StatusBar.js +30 -0
- package/dist/components/ToolbarOverflowModal.d.ts +15 -0
- package/dist/components/common/Dialog.js +27 -0
- package/dist/components/common/Popover.d.ts +10 -1
- package/dist/components/common/Popover.js +37 -0
- package/dist/components/common/Tooltip.d.ts +7 -0
- package/dist/components/common/Tooltip.js +20 -0
- package/dist/components/ui/button.js +35 -0
- package/dist/components/ui/command.js +33 -0
- package/dist/components/ui/dialog.js +35 -0
- package/dist/components/ui/input.js +6 -0
- package/dist/components/ui/popover.js +16 -0
- package/dist/components/ui/scroll-area.js +12 -0
- package/dist/components/ui/tooltip.js +16 -0
- package/dist/constants/index.d.ts +23 -1
- package/dist/constants/index.js +224 -0
- package/dist/index.d.ts +10 -0
- 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/lib/utils.js +5 -0
- package/dist/nodes/ExtendedTextNode.js +140 -0
- package/dist/nodes/ImageNode.js +149 -0
- package/dist/nodes/VideoNode.js +80 -0
- package/dist/nodes/YoutubeNode.js +64 -0
- package/dist/plugins/CodeBlockPlugin.d.ts +1 -0
- package/dist/plugins/CodeBlockPlugin.js +88 -0
- package/dist/plugins/ColorPlugin.js +47 -0
- package/dist/plugins/CustomOnChangePlugin.js +33 -0
- package/dist/plugins/FontFamilyPlugin.d.ts +1 -0
- package/dist/plugins/FontFamilyPlugin.js +53 -0
- package/dist/plugins/FontSizePlugin.d.ts +1 -0
- package/dist/plugins/FontSizePlugin.js +48 -0
- package/dist/plugins/ImagePlugin.js +91 -0
- package/dist/plugins/ListPlugin.js +44 -0
- package/dist/plugins/TablePlugin.d.ts +1 -0
- package/dist/plugins/TablePlugin.js +92 -0
- package/dist/plugins/ToolbarPlugin.d.ts +13 -1
- package/dist/plugins/ToolbarPlugin.js +381 -0
- package/dist/plugins/VideoPlugin.js +49 -0
- package/dist/plugins/YoutubePlugin.js +30 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/editor_screenshot.png +0 -0
- package/package.json +11 -4
- package/googlebd703883f12c69e4.html +0 -1
- package/rollup.config.js +0 -55
- package/src/components/AlignmentSelectionList.tsx +0 -61
- package/src/components/ColorPicker.tsx +0 -66
- package/src/components/ContentPreview.tsx +0 -51
- package/src/components/DropdownList.tsx +0 -57
- package/src/components/HeadingSelectionList.tsx +0 -61
- package/src/components/ImageComponent.tsx +0 -206
- package/src/components/InsertDropdownList.tsx +0 -36
- package/src/components/LexicalTextEditor.tsx +0 -119
- package/src/components/LinkModal.tsx +0 -127
- package/src/components/Separator.tsx +0 -7
- package/src/components/common/Dialog.tsx +0 -47
- package/src/components/common/Popover.tsx +0 -87
- package/src/components/common/Tooltip.tsx +0 -43
- package/src/components/ui/button.tsx +0 -58
- package/src/components/ui/command.tsx +0 -183
- package/src/components/ui/dialog.tsx +0 -142
- package/src/components/ui/input.tsx +0 -21
- package/src/components/ui/popover.tsx +0 -46
- package/src/components/ui/scroll-area.tsx +0 -56
- package/src/components/ui/tooltip.tsx +0 -59
- package/src/constants/index.tsx +0 -177
- package/src/index.ts +0 -6
- package/src/lib/utils.ts +0 -6
- package/src/nodes/ExtendedTextNode.tsx +0 -174
- package/src/nodes/ImageNode.tsx +0 -232
- package/src/nodes/VideoNode.tsx +0 -134
- package/src/nodes/YoutubeNode.tsx +0 -101
- package/src/plugins/ColorPlugin.tsx +0 -85
- package/src/plugins/CustomOnChangePlugin.tsx +0 -50
- package/src/plugins/ImagePlugin.tsx +0 -189
- package/src/plugins/ListPlugin.tsx +0 -58
- package/src/plugins/ToolbarPlugin.tsx +0 -500
- package/src/plugins/VideoPlugin.tsx +0 -100
- package/src/plugins/YoutubePlugin.tsx +0 -83
- package/src/styles/lexical-editor.css +0 -1053
- package/src/types/global.d.ts +0 -34
- package/src/types/other.d.ts +0 -11
- package/src/types/react-icons.d.ts +0 -11
- package/tailwind.config.js +0 -10
- package/tsconfig.json +0 -32
package/dist/lexical-editor.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.lexical-text-editor *{box-sizing:border-box;font-family:inherit}.lexical-text-editor{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;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-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;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}.lexical-text-editor{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;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}@supports not (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-text-editor.lexical-dark .scrollbar-thin{scrollbar-color:#4b5563 transparent}.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-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;font-size:14px;height:100%;outline:0;overflow:auto;padding:8px;scrollbar-color:#9ca3af transparent;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{scrollbar-color:#c1c1c1 transparent;scrollbar-width:thin}@supports not (scrollbar-width:thin){.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-text-editor.lexical-dark .lexical-content-editable{scrollbar-color:#4b5563 transparent}.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-content-editable .lexical-code-block,.lexical-text-editor .lexical-code-block{background-color:#f3f4f6;border:1px solid #d1d5db;border-radius:.375rem;color:#111827;display:block;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;line-height:1.6;margin:8px 0;overflow-x:auto;padding:12px 14px;white-space:pre-wrap;word-break:break-word}.lexical-code-block .lexical-code-token-keyword{color:#c7254e;font-weight:600}.lexical-code-block .lexical-code-token-string{color:#2e7d32}.lexical-code-block .lexical-code-token-number{color:#b26a00}.lexical-code-block .lexical-code-token-comment{color:#6b7280;font-style:italic}.lexical-code-block .lexical-code-token-function{color:#6f42c1}.lexical-code-block .lexical-code-token-operator{color:#d63384}.lexical-code-block .lexical-code-token-punctuation{color:#374151}.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-content-editable hr.lexical-hr,.lexical-text-editor hr.lexical-hr{border:none;border-top:2px solid #d1d5db;cursor:pointer;margin:12px 0}.lexical-content-editable table.lexical-table,.lexical-text-editor table.lexical-table{border-collapse:collapse;margin:8px 0;table-layout:fixed;width:max-content}.lexical-table td.lexical-table-cell,.lexical-table th.lexical-table-cell{border:1px solid #d1d5db;min-width:75px;padding:6px 10px;position:relative;vertical-align:top}.lexical-table td.lexical-table-cell.lexical-table-header-cell,.lexical-table th.lexical-table-cell{background-color:#f3f4f6;font-weight:600}.lexical-table td.lexical-table-cell.selected,.lexical-table th.lexical-table-cell.selected{background-color:#e0e7ff}.lexical-listitem.lexical-indent,.lexical-paragraph.lexical-indent,.lexical-quote.lexical-indent{margin-left:40px}.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:40px;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.toolbar-active:hover:not(:disabled){background:#e2e8f0;color:#111827}.lexical-text-editor.lexical-dark .lexical-btn.toolbar-active:hover:not(:disabled){background:var(--lte-surface-hover);color:var(--lte-text)}.lexical-text-editor .lexical-btn:disabled{opacity:.5;pointer-events:none}.lexical-text-editor .size-10{height:40px!important;width:40px!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 .font-trigger svg:not(.chevron),.lexical-text-editor .heading-trigger svg:not(.chevron),.lexical-text-editor button.icon svg{height:20px;width:20px}.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 .font-trigger,.lexical-text-editor .heading-trigger{background-color:#fff;border:1px solid #e5e7eb;height:40px;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:200}.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%)}.lexical-text-editor .lexical-status-bar{align-items:center;border-top:1px solid #e5e7eb;color:#6b7280;display:flex;flex-wrap:wrap;font-size:12px;gap:4px 16px;justify-content:flex-end;padding:6px 12px}.lexical-text-editor .lexical-status-bar-right{margin-left:auto;margin-right:0}.lexical-text-editor .lexical-display-controls{align-items:center;display:flex;gap:6px}.lexical-text-editor .lte-mini-seg{border:1px solid #e5e7eb;border-radius:6px;display:flex;gap:2px;padding:2px}.lexical-text-editor .lte-mini-btn{align-items:center;background:transparent;border:1px solid transparent;border-radius:4px;color:#6b7280;cursor:pointer;display:inline-flex;font-size:13px;height:24px;justify-content:center;transition:background .15s ease,color .15s ease;width:24px}.lexical-text-editor .lte-mini-btn svg{pointer-events:none}.lexical-text-editor .lte-mini-btn:hover{background:var(--lte-surface-hover);color:#374151}.lexical-text-editor .lte-mini-btn.active{background:var(--lte-surface-active);color:#111827}.lexical-text-editor.lexical-dark .lexical-status-bar-right{border-top:none}.lexical-text-editor.lexical-dark .lte-mini-seg{border-color:var(--lte-border,#374151)}.lexical-text-editor.lexical-dark .lte-mini-btn{color:var(--lte-text-muted)}.lexical-text-editor.lexical-dark .lte-mini-btn.active,.lexical-text-editor.lexical-dark .lte-mini-btn:hover{background:var(--lte-surface-hover);color:var(--lte-text)}.lexical-text-editor .lexical-display-controls{flex-wrap:wrap;row-gap:4px}.lexical-text-editor .lte-mini-seg{flex-wrap:wrap}@media (max-width:560px){.lexical-text-editor .lexical-status-bar{font-size:11px;gap:4px 10px;padding:6px 8px}.lexical-text-editor .lte-mini-btn{font-size:12px;height:22px;width:22px}}.lexical-text-editor .lexical-source-view{display:flex;flex-direction:column;gap:6px}.lexical-text-editor .lexical-source-textarea{background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;box-sizing:border-box;color:#1f2937;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;height:500px;line-height:1.5;outline:none;padding:10px;resize:vertical;width:100%}.lexical-text-editor .lexical-source-textarea:focus{border-color:#3b82f6}.lexical-text-editor .lexical-source-actions{display:flex;gap:6px}.lexical-text-editor .lexical-find-replace{background:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.12);display:flex;flex-direction:column;gap:8px;min-width:300px;padding:10px;position:absolute;right:12px;top:calc(100% - 4px);z-index:400}.lexical-text-editor .lexical-fr-row{align-items:center;display:flex;gap:6px}.lexical-text-editor .lexical-fr-input{border:1px solid #e5e7eb;border-radius:6px;flex:1;font-size:13px;height:30px;outline:none;padding:0 8px}.lexical-text-editor .lexical-fr-input:focus{border-color:#3b82f6}.lexical-text-editor .lexical-fr-count{color:#6b7280;font-size:12px;white-space:nowrap}.lexical-text-editor .lexical-fr-case{align-items:center;color:#6b7280;cursor:pointer;display:flex;font-size:12px;gap:4px}.lexical-text-editor.lexical-fullscreen{background:#fff;inset:0;margin:0;overflow:auto;padding:12px;position:fixed;z-index:9999}.lexical-text-editor{--lte-surface:#fff;--lte-surface-raised:#f9fafb;--lte-surface-hover:#f3f4f6;--lte-surface-active:#eef2ff;--lte-border:#e5e7eb;--lte-border-strong:#d1d5db;--lte-text:#111827;--lte-text-body:#374151;--lte-text-muted:#6b7280;--lte-shadow:0 2px 6px rgba(0,0,0,.12),0 0 0 1px rgba(0,0,0,.04)}.lexical-text-editor.lexical-dark{--lte-surface:#111827;--lte-surface-raised:#1f2937;--lte-surface-hover:#374151;--lte-surface-active:#374151;--lte-border:#374151;--lte-border-strong:#4b5563;--lte-text:#f3f4f6;--lte-text-body:#d1d5db;--lte-text-muted:#9ca3af;--lte-shadow:0 2px 6px rgba(0,0,0,.5),0 0 0 1px hsla(0,0%,100%,.06);background-color:var(--lte-surface);border-color:var(--lte-border);color:var(--lte-text);color-scheme:dark;scrollbar-color:var(--lte-text-muted) transparent}.lexical-text-editor.lexical-dark input{background-color:var(--lte-surface-raised);color:var(--lte-text)}.lexical-text-editor.lexical-dark input:focus{border:1px solid var(--lte-border-strong)}.lexical-text-editor.lexical-dark .lexical-btn{background:var(--lte-surface-raised);color:var(--lte-text-body)}.lexical-text-editor.lexical-dark .toolbar{background-color:var(--lte-surface-raised);color:var(--lte-text-body)}.lexical-text-editor.lexical-dark .toolbar:hover:not(:disabled){background-color:var(--lte-surface-hover)}.lexical-text-editor.lexical-dark .toolbarActive{background-color:var(--lte-surface-active);color:var(--lte-text)}.lexical-text-editor.lexical-dark button:disabled{background-color:var(--lte-surface-raised)}.lexical-text-editor.lexical-dark .font-trigger,.lexical-text-editor.lexical-dark .heading-trigger{background-color:var(--lte-surface-raised);border-color:var(--lte-border)}.lexical-text-editor.lexical-dark .heading-dropdown,.lexical-text-editor.lexical-dark .popover-content{background:var(--lte-surface-raised);box-shadow:var(--lte-shadow)}.lexical-text-editor.lexical-dark .lexical-content-editable{background-color:var(--lte-surface);color:var(--lte-text)}.lexical-text-editor.lexical-dark .lexical-placeholder{color:var(--lte-text-muted)}.lexical-text-editor.lexical-dark .lexical-code{background-color:var(--lte-surface-raised);border-color:var(--lte-border-strong);color:var(--lte-text)}.lexical-text-editor.lexical-dark .lexical-code-block{background-color:var(--lte-surface-raised);border-color:var(--lte-border-strong);color:#e5e7eb}.lexical-text-editor.lexical-dark .lexical-code-block .lexical-code-token-keyword{color:#fb7185}.lexical-text-editor.lexical-dark .lexical-code-block .lexical-code-token-string{color:#4ade80}.lexical-text-editor.lexical-dark .lexical-code-block .lexical-code-token-number{color:#fbbf24}.lexical-text-editor.lexical-dark .lexical-code-block .lexical-code-token-comment{color:#9ca3af}.lexical-text-editor.lexical-dark .lexical-code-block .lexical-code-token-function{color:#c084fc}.lexical-text-editor.lexical-dark .lexical-quote{background-color:var(--lte-surface-raised);border-left-color:var(--lte-text-muted);color:var(--lte-text-body)}.lexical-text-editor.lexical-dark .lexical-link,.lexical-text-editor.lexical-dark a{color:#60a5fa}.lexical-text-editor.lexical-dark .lexical-link:hover,.lexical-text-editor.lexical-dark a:hover{color:#93c5fd}.lexical-text-editor.lexical-dark hr.lexical-hr{border-top-color:var(--lte-border-strong)}.lexical-text-editor.lexical-dark .lexical-table td.lexical-table-cell,.lexical-text-editor.lexical-dark .lexical-table th.lexical-table-cell{border-color:var(--lte-border-strong)}.lexical-text-editor.lexical-dark .lexical-table td.lexical-table-cell.lexical-table-header-cell,.lexical-text-editor.lexical-dark .lexical-table th.lexical-table-cell{background-color:var(--lte-surface-raised)}.lexical-text-editor.lexical-dark .lexical-table td.lexical-table-cell.selected,.lexical-text-editor.lexical-dark .lexical-table th.lexical-table-cell.selected{background-color:var(--lte-surface-hover)}.lexical-text-editor.lexical-dark .lexical-status-bar{border-top-color:var(--lte-border);color:var(--lte-text-muted)}.lexical-text-editor.lexical-dark .lexical-source-textarea{background:var(--lte-surface-raised);border-color:var(--lte-border);color:var(--lte-text-body)}.lexical-text-editor.lexical-dark .lexical-source-textarea:focus{border-color:#3b82f6}.lexical-text-editor.lexical-dark .lexical-find-replace{background:var(--lte-surface-raised);border-color:var(--lte-border);box-shadow:0 8px 24px rgba(0,0,0,.45)}.lexical-text-editor.lexical-dark .lexical-fr-input{background:var(--lte-surface);border-color:var(--lte-border-strong);color:var(--lte-text)}.lexical-text-editor.lexical-dark .lexical-fr-case,.lexical-text-editor.lexical-dark .lexical-fr-count{color:var(--lte-text-muted)}.lexical-text-editor.lexical-dark .link-editor-container{background:var(--lte-surface-raised);border-color:var(--lte-border)}.lexical-text-editor.lexical-dark .lexical-text-editor-link .link-editor-input{background-color:var(--lte-surface);border-color:var(--lte-border-strong);color:var(--lte-text)}.lexical-text-editor.lexical-dark .lexical-text-editor-link .link-editor-url{color:#60a5fa}.lexical-text-editor.lexical-dark .lte-dialog{background:var(--lte-surface-raised)}.lexical-text-editor.lexical-dark .lte-dialog-close,.lexical-text-editor.lexical-dark .lte-dialog-header{color:var(--lte-text)}.lexical-text-editor.lexical-dark .lte-input{background-color:var(--lte-surface);border-color:var(--lte-border-strong);color:var(--lte-text)}.lexical-text-editor.lexical-dark .lte-outline-btn{background:var(--lte-surface-raised);border-color:var(--lte-border-strong);color:var(--lte-text)}.lexical-text-editor.lexical-dark .lte-icon-btn:hover,.lexical-text-editor.lexical-dark .lte-outline-btn:hover{background:var(--lte-surface-hover)}.lexical-text-editor.lexical-dark .lte-divider,.lexical-text-editor.lexical-dark .lte-file-name{color:var(--lte-text-muted)}.lexical-text-editor.lexical-dark .lte-preview-container{background:var(--lte-surface);border-color:var(--lte-border)}.lexical-text-editor.lexical-dark .lte-preview-title{border-bottom-color:var(--lte-border);color:var(--lte-text)}.lexical-toolbar-wrapper .lte-toolbar-row{align-items:center;display:flex;flex-wrap:nowrap;gap:6px;min-width:0;width:100%}.lexical-toolbar-wrapper .lte-toolbar-row.lte-nowrap{justify-content:flex-start;justify-content:safe center;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}.lexical-toolbar-wrapper .lte-toolbar-row.lte-nowrap>*{flex-shrink:0}.lexical-toolbar-wrapper .lte-toolbar-row.lte-nowrap::-webkit-scrollbar{display:none}.lexical-toolbar-wrapper .lte-toolbar-row.lte-wrap{flex-wrap:wrap;justify-content:flex-start;overflow-x:visible;overflow-y:visible;row-gap:6px}.lexical-toolbar-wrapper .lte-toolbar-row.useScroll{overflow-x:auto;overflow-y:hidden;scrollbar-width:none}.lexical-toolbar-wrapper .lte-toolbar-row.useScroll::-webkit-scrollbar{display:none}.lexical-toolbar-wrapper .lte-toolbar-row.useScroll>*{flex-shrink:0}.lexical-toolbar-wrapper .lte-custom-scrollbar{background:#eef0f3;border-radius:9999px;box-sizing:border-box;cursor:pointer;display:flex;height:5px;width:100%}.lexical-toolbar-wrapper .lte-custom-scrollbar-thumb{background:#c1c5cd;border-radius:9999px;cursor:grab;height:5px;min-width:24px;touch-action:none}.lexical-toolbar-wrapper .lte-custom-scrollbar-thumb:active{cursor:grabbing}.lexical-text-editor.lexical-dark .lte-custom-scrollbar{background:var(--lte-surface-hover)}.lexical-text-editor.lexical-dark .lte-custom-scrollbar-thumb{background:var(--lte-text-muted)}.lexical-text-editor .lte-overflow-panel{background:#fff;border:1px solid #e5e7eb;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.15);max-width:calc(100% - 24px);padding:10px;position:absolute;right:12px;top:calc(100% - 4px);width:max-content;z-index:300}.lexical-text-editor .lte-overflow-grid{align-items:center;display:flex;flex-wrap:wrap;gap:6px}.lexical-text-editor .lte-overflow-item{align-items:center;display:flex;gap:6px}.lexical-text-editor.lexical-dark .lte-overflow-panel{background:var(--lte-surface-raised);border-color:var(--lte-border);box-shadow:0 8px 24px rgba(0,0,0,.45)}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { $applyNodeReplacement, $isTextNode, TextNode } from 'lexical';
|
|
2
|
+
export class ExtendedTextNode extends TextNode {
|
|
3
|
+
constructor(text, key) {
|
|
4
|
+
super(text, key);
|
|
5
|
+
}
|
|
6
|
+
static getType() {
|
|
7
|
+
return 'extended-text';
|
|
8
|
+
}
|
|
9
|
+
static clone(node) {
|
|
10
|
+
return new ExtendedTextNode(node.__text, node.__key);
|
|
11
|
+
}
|
|
12
|
+
static importDOM() {
|
|
13
|
+
const importers = TextNode.importDOM();
|
|
14
|
+
return {
|
|
15
|
+
...importers,
|
|
16
|
+
span: () => ({
|
|
17
|
+
conversion: patchStyleConversion(importers?.span),
|
|
18
|
+
priority: 1
|
|
19
|
+
}),
|
|
20
|
+
div: () => ({
|
|
21
|
+
conversion: patchStyleConversion(importers?.div),
|
|
22
|
+
priority: 1
|
|
23
|
+
}),
|
|
24
|
+
p: () => ({
|
|
25
|
+
conversion: patchStyleConversion(importers?.p),
|
|
26
|
+
priority: 1
|
|
27
|
+
}),
|
|
28
|
+
b: () => ({
|
|
29
|
+
conversion: patchStyleConversion(importers?.b),
|
|
30
|
+
priority: 1
|
|
31
|
+
}),
|
|
32
|
+
strong: () => ({
|
|
33
|
+
conversion: patchStyleConversion(importers?.strong),
|
|
34
|
+
priority: 1
|
|
35
|
+
}),
|
|
36
|
+
i: () => ({
|
|
37
|
+
conversion: patchStyleConversion(importers?.i),
|
|
38
|
+
priority: 1
|
|
39
|
+
}),
|
|
40
|
+
em: () => ({
|
|
41
|
+
conversion: patchStyleConversion(importers?.em),
|
|
42
|
+
priority: 1
|
|
43
|
+
}),
|
|
44
|
+
u: () => ({
|
|
45
|
+
conversion: patchStyleConversion(importers?.u),
|
|
46
|
+
priority: 1
|
|
47
|
+
}),
|
|
48
|
+
s: () => ({
|
|
49
|
+
conversion: patchStyleConversion(importers?.s),
|
|
50
|
+
priority: 1
|
|
51
|
+
}),
|
|
52
|
+
strike: () => ({
|
|
53
|
+
conversion: patchStyleConversion(importers?.strike),
|
|
54
|
+
priority: 1
|
|
55
|
+
}),
|
|
56
|
+
code: () => ({
|
|
57
|
+
conversion: patchStyleConversion(importers?.code),
|
|
58
|
+
priority: 1
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
static importJSON(serializedNode) {
|
|
63
|
+
return $createExtendedTextNode().updateFromJSON(serializedNode);
|
|
64
|
+
}
|
|
65
|
+
isSimpleText() {
|
|
66
|
+
return this.__type === 'extended-text' && this.__mode === 0;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export function $createExtendedTextNode(text = '') {
|
|
70
|
+
return $applyNodeReplacement(new ExtendedTextNode(text));
|
|
71
|
+
}
|
|
72
|
+
export function $isExtendedTextNode(node) {
|
|
73
|
+
return node instanceof ExtendedTextNode;
|
|
74
|
+
}
|
|
75
|
+
// Helper function to patch style conversion
|
|
76
|
+
function patchStyleConversion(originalDOMConverter) {
|
|
77
|
+
return (node) => {
|
|
78
|
+
const original = originalDOMConverter?.(node);
|
|
79
|
+
if (!original) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
const originalOutput = original.conversion(node);
|
|
83
|
+
if (!originalOutput) {
|
|
84
|
+
return originalOutput;
|
|
85
|
+
}
|
|
86
|
+
// Extract all style properties
|
|
87
|
+
const style = node.style;
|
|
88
|
+
const styleAttributes = [];
|
|
89
|
+
if (style.backgroundColor) {
|
|
90
|
+
styleAttributes.push(`background-color: ${style.backgroundColor}`);
|
|
91
|
+
}
|
|
92
|
+
if (style.color) {
|
|
93
|
+
styleAttributes.push(`color: ${style.color}`);
|
|
94
|
+
}
|
|
95
|
+
if (style.fontFamily) {
|
|
96
|
+
styleAttributes.push(`font-family: ${style.fontFamily}`);
|
|
97
|
+
}
|
|
98
|
+
if (style.fontWeight) {
|
|
99
|
+
styleAttributes.push(`font-weight: ${style.fontWeight}`);
|
|
100
|
+
}
|
|
101
|
+
if (style.fontSize) {
|
|
102
|
+
styleAttributes.push(`font-size: ${style.fontSize}`);
|
|
103
|
+
}
|
|
104
|
+
if (style.fontStyle) {
|
|
105
|
+
styleAttributes.push(`font-style: ${style.fontStyle}`);
|
|
106
|
+
}
|
|
107
|
+
if (style.textDecoration) {
|
|
108
|
+
styleAttributes.push(`text-decoration: ${style.textDecoration}`);
|
|
109
|
+
}
|
|
110
|
+
if (style.whiteSpace) {
|
|
111
|
+
styleAttributes.push(`white-space: ${style.whiteSpace}`);
|
|
112
|
+
}
|
|
113
|
+
if (style.textAlign) {
|
|
114
|
+
styleAttributes.push(`text-align: ${style.textAlign}`);
|
|
115
|
+
}
|
|
116
|
+
const inlineStyle = node.getAttribute('style');
|
|
117
|
+
if (inlineStyle) {
|
|
118
|
+
// Parse the style string to avoid duplicates
|
|
119
|
+
const stylePairs = inlineStyle.split(';').filter(pair => pair.trim());
|
|
120
|
+
stylePairs.forEach(pair => {
|
|
121
|
+
const [property] = pair.split(':').map(s => s.trim());
|
|
122
|
+
if (property && !styleAttributes.some(attr => attr.startsWith(property))) {
|
|
123
|
+
styleAttributes.push(pair.trim());
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
...originalOutput,
|
|
129
|
+
forChild: (lexicalNode, parent) => {
|
|
130
|
+
const originalForChild = originalOutput?.forChild ?? ((x) => x);
|
|
131
|
+
const result = originalForChild(lexicalNode, parent);
|
|
132
|
+
if ($isTextNode(result) && styleAttributes.length > 0) {
|
|
133
|
+
const styleString = styleAttributes.join('; ');
|
|
134
|
+
return result.setStyle(styleString);
|
|
135
|
+
}
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ImageComponent } from "../components/ImageComponent";
|
|
3
|
+
import { DecoratorNode, $applyNodeReplacement, } from "lexical";
|
|
4
|
+
export const $createImageNode = (payload) => {
|
|
5
|
+
return $applyNodeReplacement(new ImageNode(payload));
|
|
6
|
+
};
|
|
7
|
+
const convertImageElement = (domNode) => {
|
|
8
|
+
if (!(domNode instanceof HTMLImageElement))
|
|
9
|
+
return null;
|
|
10
|
+
const { src, alt } = domNode;
|
|
11
|
+
let width;
|
|
12
|
+
let height;
|
|
13
|
+
// Attributes
|
|
14
|
+
if (domNode.width)
|
|
15
|
+
width = domNode.width;
|
|
16
|
+
if (domNode.height)
|
|
17
|
+
height = domNode.height;
|
|
18
|
+
// Inline styles fallback
|
|
19
|
+
const style = domNode.style;
|
|
20
|
+
if ((!width || width === 0) && style.width) {
|
|
21
|
+
const parsed = parseInt(style.width, 10);
|
|
22
|
+
if (!Number.isNaN(parsed))
|
|
23
|
+
width = parsed;
|
|
24
|
+
}
|
|
25
|
+
if ((!height || height === 0) && style.height) {
|
|
26
|
+
const parsed = parseInt(style.height, 10);
|
|
27
|
+
if (!Number.isNaN(parsed))
|
|
28
|
+
height = parsed;
|
|
29
|
+
}
|
|
30
|
+
const node = $createImageNode({
|
|
31
|
+
src,
|
|
32
|
+
altText: alt,
|
|
33
|
+
width: width ?? "inherit",
|
|
34
|
+
height: height ?? "inherit",
|
|
35
|
+
});
|
|
36
|
+
return { node };
|
|
37
|
+
};
|
|
38
|
+
export class ImageNode extends DecoratorNode {
|
|
39
|
+
constructor({ src = "", altText = "", maxWidth = 1080, width = "inherit", height = "inherit", caption = "", key, } = {
|
|
40
|
+
src: "",
|
|
41
|
+
altText: "",
|
|
42
|
+
}) {
|
|
43
|
+
super(key);
|
|
44
|
+
this.__src = src;
|
|
45
|
+
this.__altText = altText;
|
|
46
|
+
this.__maxWidth = maxWidth;
|
|
47
|
+
this.__width = width;
|
|
48
|
+
this.__height = height;
|
|
49
|
+
this.__caption = caption;
|
|
50
|
+
}
|
|
51
|
+
static getType() {
|
|
52
|
+
return "image";
|
|
53
|
+
}
|
|
54
|
+
static clone(node) {
|
|
55
|
+
return new ImageNode({
|
|
56
|
+
src: node.__src,
|
|
57
|
+
altText: node.__altText,
|
|
58
|
+
width: node.__width,
|
|
59
|
+
height: node.__height,
|
|
60
|
+
maxWidth: node.__maxWidth,
|
|
61
|
+
caption: node.__caption,
|
|
62
|
+
key: node.getKey(),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
createDOM() {
|
|
66
|
+
return document.createElement("span");
|
|
67
|
+
}
|
|
68
|
+
updateDOM(prevNode) {
|
|
69
|
+
return (prevNode.__width !== this.__width ||
|
|
70
|
+
prevNode.__height !== this.__height);
|
|
71
|
+
}
|
|
72
|
+
exportDOM() {
|
|
73
|
+
const img = document.createElement("img");
|
|
74
|
+
img.src = this.__src;
|
|
75
|
+
img.alt = this.__altText;
|
|
76
|
+
if (this.__width !== "inherit") {
|
|
77
|
+
img.width = this.__width ?? 0;
|
|
78
|
+
}
|
|
79
|
+
if (this.__height !== "inherit") {
|
|
80
|
+
img.height = this.__height ?? 0;
|
|
81
|
+
}
|
|
82
|
+
if (this.__caption) {
|
|
83
|
+
const figure = document.createElement("figure");
|
|
84
|
+
const figcaption = document.createElement("figcaption");
|
|
85
|
+
figcaption.textContent = this.__caption;
|
|
86
|
+
figure.appendChild(img);
|
|
87
|
+
figure.appendChild(figcaption);
|
|
88
|
+
return { element: figure };
|
|
89
|
+
}
|
|
90
|
+
return { element: img };
|
|
91
|
+
}
|
|
92
|
+
static importDOM() {
|
|
93
|
+
return {
|
|
94
|
+
img: () => ({
|
|
95
|
+
conversion: convertImageElement,
|
|
96
|
+
priority: 1,
|
|
97
|
+
}),
|
|
98
|
+
figure: () => ({
|
|
99
|
+
conversion: (node) => {
|
|
100
|
+
const img = node.querySelector("img");
|
|
101
|
+
if (!img)
|
|
102
|
+
return null;
|
|
103
|
+
const figcaption = node.querySelector("figcaption");
|
|
104
|
+
const caption = figcaption?.textContent || "";
|
|
105
|
+
const result = convertImageElement(img);
|
|
106
|
+
if (result?.node instanceof ImageNode && caption) {
|
|
107
|
+
result.node.__caption = caption;
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
110
|
+
},
|
|
111
|
+
priority: 1,
|
|
112
|
+
}),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
exportJSON() {
|
|
116
|
+
return {
|
|
117
|
+
type: "image",
|
|
118
|
+
version: 1,
|
|
119
|
+
src: this.__src,
|
|
120
|
+
altText: this.__altText,
|
|
121
|
+
maxWidth: this.__maxWidth,
|
|
122
|
+
width: this.__width,
|
|
123
|
+
height: this.__height,
|
|
124
|
+
caption: this.__caption,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
static importJSON(serializedNode) {
|
|
128
|
+
return new ImageNode({
|
|
129
|
+
src: serializedNode.src,
|
|
130
|
+
altText: serializedNode.altText,
|
|
131
|
+
maxWidth: serializedNode.maxWidth,
|
|
132
|
+
width: serializedNode.width,
|
|
133
|
+
height: serializedNode.height,
|
|
134
|
+
caption: serializedNode.caption,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
updateDimensions(width, height) {
|
|
138
|
+
const writable = this.getWritable();
|
|
139
|
+
writable.__width = width;
|
|
140
|
+
writable.__height = height;
|
|
141
|
+
}
|
|
142
|
+
setCaption(caption) {
|
|
143
|
+
const writable = this.getWritable();
|
|
144
|
+
writable.__caption = caption;
|
|
145
|
+
}
|
|
146
|
+
decorate() {
|
|
147
|
+
return (_jsx(ImageComponent, { src: this.__src, altText: this.__altText, nodeKey: this.getKey(), width: this.__width, height: this.__height, maxWidth: this.__maxWidth, caption: this.__caption }));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DecoratorNode, } from "lexical";
|
|
3
|
+
export const $createVideoNode = ({ id, provider, }) => {
|
|
4
|
+
return new VideoNode({ id, provider });
|
|
5
|
+
};
|
|
6
|
+
const ID_ATTR = "data-lexical-video";
|
|
7
|
+
const PROVIDER_ATTR = "data-provider";
|
|
8
|
+
const HEIGHT = "315px";
|
|
9
|
+
const WIDTH = "560px";
|
|
10
|
+
const getEmbedLink = (id, provider) => {
|
|
11
|
+
if (provider === "drive") {
|
|
12
|
+
return `https://drive.google.com/file/d/${id}/preview`;
|
|
13
|
+
}
|
|
14
|
+
return `https://www.youtube-nocookie.com/embed/${id}`;
|
|
15
|
+
};
|
|
16
|
+
const convertVideoElement = (domNode) => {
|
|
17
|
+
const id = domNode?.getAttribute(ID_ATTR);
|
|
18
|
+
const provider = domNode?.getAttribute(PROVIDER_ATTR) ?? "youtube";
|
|
19
|
+
if (!id)
|
|
20
|
+
return null;
|
|
21
|
+
const node = $createVideoNode({ id, provider });
|
|
22
|
+
return { node };
|
|
23
|
+
};
|
|
24
|
+
export class VideoNode extends DecoratorNode {
|
|
25
|
+
constructor({ id, provider, key, }) {
|
|
26
|
+
super(key);
|
|
27
|
+
this.__id = id;
|
|
28
|
+
this.__provider = provider;
|
|
29
|
+
}
|
|
30
|
+
static getType() {
|
|
31
|
+
return "video";
|
|
32
|
+
}
|
|
33
|
+
static clone(node) {
|
|
34
|
+
return new VideoNode({
|
|
35
|
+
id: node.__id,
|
|
36
|
+
provider: node.__provider,
|
|
37
|
+
key: node.getKey(),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
static importJSON(serializedNode) {
|
|
41
|
+
return $createVideoNode({
|
|
42
|
+
id: serializedNode.id,
|
|
43
|
+
provider: serializedNode.provider,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
exportJSON() {
|
|
47
|
+
return {
|
|
48
|
+
id: this.__id,
|
|
49
|
+
provider: this.__provider,
|
|
50
|
+
type: "video",
|
|
51
|
+
version: 1,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
updateDOM() {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
decorate() {
|
|
58
|
+
return (_jsx("iframe", { height: HEIGHT, width: WIDTH, src: getEmbedLink(this.__id, this.__provider), frameBorder: "0", allowFullScreen: true }));
|
|
59
|
+
}
|
|
60
|
+
createDOM() {
|
|
61
|
+
return document.createElement("div");
|
|
62
|
+
}
|
|
63
|
+
exportDOM() {
|
|
64
|
+
const iframe = document.createElement("iframe");
|
|
65
|
+
iframe.setAttribute(ID_ATTR, this.__id);
|
|
66
|
+
iframe.setAttribute(PROVIDER_ATTR, this.__provider);
|
|
67
|
+
iframe.setAttribute("height", HEIGHT);
|
|
68
|
+
iframe.setAttribute("width", WIDTH);
|
|
69
|
+
iframe.setAttribute("src", getEmbedLink(this.__id, this.__provider));
|
|
70
|
+
return { element: iframe };
|
|
71
|
+
}
|
|
72
|
+
static importDOM() {
|
|
73
|
+
return {
|
|
74
|
+
iframe: () => ({
|
|
75
|
+
conversion: convertVideoElement,
|
|
76
|
+
priority: 0,
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DecoratorNode, } from "lexical";
|
|
3
|
+
export const $createYoutubeNode = ({ id }) => {
|
|
4
|
+
return new YoutubeNode({ id });
|
|
5
|
+
};
|
|
6
|
+
const ID_ATTR = "data-lexical-youtube";
|
|
7
|
+
const HEIGHT = "315px";
|
|
8
|
+
const WIDTH = "560px";
|
|
9
|
+
const getYoutubeLink = (id) => `https://www.youtube-nocookie.com/embed/${id}`;
|
|
10
|
+
const convertYoutubeElement = (domNode) => {
|
|
11
|
+
const id = domNode?.getAttribute(ID_ATTR);
|
|
12
|
+
if (!id)
|
|
13
|
+
return null;
|
|
14
|
+
const node = $createYoutubeNode({ id });
|
|
15
|
+
return { node };
|
|
16
|
+
};
|
|
17
|
+
export class YoutubeNode extends DecoratorNode {
|
|
18
|
+
constructor({ id, key }) {
|
|
19
|
+
super(key);
|
|
20
|
+
this.__id = id;
|
|
21
|
+
}
|
|
22
|
+
static getType() {
|
|
23
|
+
return "youtube";
|
|
24
|
+
}
|
|
25
|
+
static clone(node) {
|
|
26
|
+
return new YoutubeNode({
|
|
27
|
+
id: node.__id,
|
|
28
|
+
key: node.getKey(),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
// Correctly typed importJSON
|
|
32
|
+
static importJSON(serializedNode) {
|
|
33
|
+
return $createYoutubeNode({ id: serializedNode.id });
|
|
34
|
+
}
|
|
35
|
+
exportJSON() {
|
|
36
|
+
return {
|
|
37
|
+
id: this.__id,
|
|
38
|
+
type: "youtube",
|
|
39
|
+
version: 1,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
decorate() {
|
|
43
|
+
return (_jsx("iframe", { height: HEIGHT, width: WIDTH, src: getYoutubeLink(this.__id), frameBorder: "0", allowFullScreen: true }));
|
|
44
|
+
}
|
|
45
|
+
createDOM() {
|
|
46
|
+
return document.createElement("div");
|
|
47
|
+
}
|
|
48
|
+
exportDOM() {
|
|
49
|
+
const iframe = document.createElement("iframe");
|
|
50
|
+
iframe.setAttribute(ID_ATTR, this.__id);
|
|
51
|
+
iframe.setAttribute("height", HEIGHT);
|
|
52
|
+
iframe.setAttribute("width", WIDTH);
|
|
53
|
+
iframe.setAttribute("src", getYoutubeLink(this.__id));
|
|
54
|
+
return { element: iframe };
|
|
55
|
+
}
|
|
56
|
+
static importDOM() {
|
|
57
|
+
return {
|
|
58
|
+
iframe: () => ({
|
|
59
|
+
conversion: convertYoutubeElement,
|
|
60
|
+
priority: 0,
|
|
61
|
+
}),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function CodeBlockPlugin(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
|
+
import { $createParagraphNode, $getSelection, $isRangeSelection, SELECTION_CHANGE_COMMAND, } from "lexical";
|
|
4
|
+
import { $setBlocksType } from "@lexical/selection";
|
|
5
|
+
import { $createCodeNode, $isCodeNode } from "@lexical/code";
|
|
6
|
+
import { useEffect, useRef, useState } from "react";
|
|
7
|
+
import { mergeRegister } from "@lexical/utils";
|
|
8
|
+
import { CODE_BLOCK_LANGUAGES, LOW_PRIORIRTY } from "../constants";
|
|
9
|
+
import { HiChevronDown } from "react-icons/hi2";
|
|
10
|
+
import { IoCodeSlashOutline } from "react-icons/io5";
|
|
11
|
+
import { Popover, PopoverContent, PopoverTrigger, } from "../components/common/Popover";
|
|
12
|
+
export default function CodeBlockPlugin() {
|
|
13
|
+
const [editor] = useLexicalComposerContext();
|
|
14
|
+
const [isActive, setIsActive] = useState(false);
|
|
15
|
+
const [language, setLanguage] = useState(null);
|
|
16
|
+
const [open, setOpen] = useState(false);
|
|
17
|
+
const triggerRef = useRef(null);
|
|
18
|
+
const contentRef = useRef(null);
|
|
19
|
+
const updateState = () => {
|
|
20
|
+
const selection = $getSelection();
|
|
21
|
+
if ($isRangeSelection(selection)) {
|
|
22
|
+
const anchorNode = selection.anchor.getNode();
|
|
23
|
+
const element = anchorNode.getKey() === "root"
|
|
24
|
+
? anchorNode
|
|
25
|
+
: anchorNode.getTopLevelElementOrThrow();
|
|
26
|
+
const isCode = $isCodeNode(element);
|
|
27
|
+
setIsActive(isCode);
|
|
28
|
+
if (isCode)
|
|
29
|
+
setLanguage(element.getLanguage() ?? null);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
return mergeRegister(editor.registerUpdateListener(({ editorState }) => {
|
|
34
|
+
editorState.read(() => {
|
|
35
|
+
updateState();
|
|
36
|
+
});
|
|
37
|
+
}), editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
|
|
38
|
+
updateState();
|
|
39
|
+
return false;
|
|
40
|
+
}, LOW_PRIORIRTY));
|
|
41
|
+
}, [editor]);
|
|
42
|
+
const toggleCodeBlock = (lang) => {
|
|
43
|
+
editor.update(() => {
|
|
44
|
+
const selection = $getSelection();
|
|
45
|
+
if (!$isRangeSelection(selection))
|
|
46
|
+
return;
|
|
47
|
+
const anchorNode = selection.anchor.getNode();
|
|
48
|
+
const element = anchorNode.getKey() === "root"
|
|
49
|
+
? anchorNode
|
|
50
|
+
: anchorNode.getTopLevelElementOrThrow();
|
|
51
|
+
if ($isCodeNode(element)) {
|
|
52
|
+
$setBlocksType(selection, () => $createParagraphNode());
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
const languageToUse = lang ?? language ?? "javascript";
|
|
56
|
+
$setBlocksType(selection, () => $createCodeNode(languageToUse));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const applyLanguage = (lang) => {
|
|
61
|
+
setLanguage(lang);
|
|
62
|
+
editor.update(() => {
|
|
63
|
+
const selection = $getSelection();
|
|
64
|
+
if (!$isRangeSelection(selection))
|
|
65
|
+
return;
|
|
66
|
+
const anchorNode = selection.anchor.getNode();
|
|
67
|
+
const element = anchorNode.getKey() === "root"
|
|
68
|
+
? anchorNode
|
|
69
|
+
: anchorNode.getTopLevelElementOrThrow();
|
|
70
|
+
if ($isCodeNode(element))
|
|
71
|
+
element.setLanguage(lang);
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const activeLabel = CODE_BLOCK_LANGUAGES.find((l) => l.id === language)?.label ?? "Plain Text";
|
|
75
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { triggerRef: triggerRef, children: _jsxs("button", { type: "button", className: `lexical-btn heading-trigger ${isActive ? "toolbar-active" : "toolbar"}`, onClick: () => setOpen((prev) => !prev), children: [_jsx(IoCodeSlashOutline, {}), _jsx("span", { children: activeLabel }), _jsx(HiChevronDown, { className: `chevron ${open ? "rotated" : ""}` })] }) }), _jsx(PopoverContent, { open: open, align: "start", onClose: () => setOpen(false), contentRef: contentRef, children: _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 5 }, children: [_jsxs("button", { type: "button", className: `lexical-btn ${isActive ? "toolbar-active" : "toolbar"}`, onClick: () => {
|
|
76
|
+
toggleCodeBlock();
|
|
77
|
+
setOpen(false);
|
|
78
|
+
}, style: { minWidth: 150 }, children: [_jsx(IoCodeSlashOutline, {}), _jsx("span", { className: "label", children: isActive ? "Remove Code Block" : "Code Block" })] }), _jsx("div", { className: "w-full h-[1px] bg-gray-200 my-1" }), _jsx("div", { style: {
|
|
79
|
+
display: "flex",
|
|
80
|
+
flexDirection: "column",
|
|
81
|
+
gap: 5,
|
|
82
|
+
maxHeight: 260,
|
|
83
|
+
overflowY: "auto",
|
|
84
|
+
}, children: CODE_BLOCK_LANGUAGES.map(({ id, label }) => (_jsx("button", { type: "button", className: `lexical-btn ${language === id ? "toolbar-active" : "toolbar"}`, onClick: () => {
|
|
85
|
+
applyLanguage(id);
|
|
86
|
+
setOpen(false);
|
|
87
|
+
}, style: { minWidth: 150 }, children: _jsx("span", { className: "label", children: label }) }, id))) })] }) })] }));
|
|
88
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import ColorPicker from '../components/ColorPicker';
|
|
3
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
4
|
+
import { $getSelection, $isRangeSelection, SELECTION_CHANGE_COMMAND } from 'lexical';
|
|
5
|
+
import { $patchStyleText, $getSelectionStyleValueForProperty } from '@lexical/selection';
|
|
6
|
+
import { useEffect, useState } from 'react';
|
|
7
|
+
import { mergeRegister } from '@lexical/utils';
|
|
8
|
+
import { LOW_PRIORIRTY } from '../constants';
|
|
9
|
+
import { AiOutlineBgColors, AiOutlineFontColors } from 'react-icons/ai';
|
|
10
|
+
import TooltipX from '../components/common/Tooltip';
|
|
11
|
+
export default function ColorPlugin() {
|
|
12
|
+
const [editor] = useLexicalComposerContext();
|
|
13
|
+
const [{ color, bgColor }, setColors] = useState({
|
|
14
|
+
color: '#000',
|
|
15
|
+
bgColor: '#fff'
|
|
16
|
+
});
|
|
17
|
+
const updateToolbar = () => {
|
|
18
|
+
const selection = $getSelection();
|
|
19
|
+
if ($isRangeSelection(selection)) {
|
|
20
|
+
const color = $getSelectionStyleValueForProperty(selection, "color", "#000");
|
|
21
|
+
const bgColor = $getSelectionStyleValueForProperty(selection, "background", "#fff");
|
|
22
|
+
setColors({ color, bgColor });
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
return mergeRegister(editor.registerUpdateListener(({ editorState }) => {
|
|
27
|
+
editorState.read(() => {
|
|
28
|
+
updateToolbar();
|
|
29
|
+
});
|
|
30
|
+
}), editor.registerCommand(SELECTION_CHANGE_COMMAND, () => {
|
|
31
|
+
updateToolbar();
|
|
32
|
+
return false;
|
|
33
|
+
}, LOW_PRIORIRTY));
|
|
34
|
+
}, [editor]);
|
|
35
|
+
const updateColor = ({ property, color }) => {
|
|
36
|
+
editor.update(() => {
|
|
37
|
+
const selection = $getSelection();
|
|
38
|
+
if (selection)
|
|
39
|
+
$patchStyleText(selection, { [property]: color });
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
return (_jsxs(_Fragment, { children: [_jsx(TooltipX, { content: "Font Color", direction: "bottom", children: _jsx(ColorPicker, { color: color, onChange: (color) => {
|
|
43
|
+
updateColor({ property: 'color', color });
|
|
44
|
+
}, icon: _jsx(AiOutlineFontColors, {}) }) }), _jsx(TooltipX, { content: "Background Color", direction: "bottom", children: _jsx(ColorPicker, { color: bgColor, onChange: (color) => {
|
|
45
|
+
updateColor({ property: 'background', color });
|
|
46
|
+
}, icon: _jsx(AiOutlineBgColors, {}) }) })] }));
|
|
47
|
+
}
|