react-latex-editor-custom-mhzn-v2 1.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/LICENSE +20 -0
- package/README.md +342 -0
- package/dist/components/CharacterCount.d.ts +6 -0
- package/dist/components/CharacterCount.d.ts.map +1 -0
- package/dist/components/Editor.d.ts +83 -0
- package/dist/components/Editor.d.ts.map +1 -0
- package/dist/components/EditorToolbar.d.ts +10 -0
- package/dist/components/EditorToolbar.d.ts.map +1 -0
- package/dist/components/ErrorBoundary.d.ts +20 -0
- package/dist/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/components/ImagePickerDialog.d.ts +15 -0
- package/dist/components/ImagePickerDialog.d.ts.map +1 -0
- package/dist/components/LoadingOverlay.d.ts +5 -0
- package/dist/components/LoadingOverlay.d.ts.map +1 -0
- package/dist/components/MathEquationDialog.d.ts +39 -0
- package/dist/components/MathEquationDialog.d.ts.map +1 -0
- package/dist/components/ModalPortal.d.ts +11 -0
- package/dist/components/ModalPortal.d.ts.map +1 -0
- package/dist/components/ResizableImageView.d.ts +22 -0
- package/dist/components/ResizableImageView.d.ts.map +1 -0
- package/dist/components/ResizableYoutubeView.d.ts +18 -0
- package/dist/components/ResizableYoutubeView.d.ts.map +1 -0
- package/dist/components/TableControls.d.ts +8 -0
- package/dist/components/TableControls.d.ts.map +1 -0
- package/dist/components/Viewer.d.ts +38 -0
- package/dist/components/Viewer.d.ts.map +1 -0
- package/dist/components/toolbars/AlignmentControls.d.ts +8 -0
- package/dist/components/toolbars/AlignmentControls.d.ts.map +1 -0
- package/dist/components/toolbars/BlockControls.d.ts +8 -0
- package/dist/components/toolbars/BlockControls.d.ts.map +1 -0
- package/dist/components/toolbars/ColorControls.d.ts +8 -0
- package/dist/components/toolbars/ColorControls.d.ts.map +1 -0
- package/dist/components/toolbars/FontControls.d.ts +8 -0
- package/dist/components/toolbars/FontControls.d.ts.map +1 -0
- package/dist/components/toolbars/HeadingControls.d.ts +8 -0
- package/dist/components/toolbars/HeadingControls.d.ts.map +1 -0
- package/dist/components/toolbars/HistoryControls.d.ts +8 -0
- package/dist/components/toolbars/HistoryControls.d.ts.map +1 -0
- package/dist/components/toolbars/ImageAlignmentControls.d.ts +13 -0
- package/dist/components/toolbars/ImageAlignmentControls.d.ts.map +1 -0
- package/dist/components/toolbars/ImageGroupAlignmentControls.d.ts +13 -0
- package/dist/components/toolbars/ImageGroupAlignmentControls.d.ts.map +1 -0
- package/dist/components/toolbars/ListControls.d.ts +8 -0
- package/dist/components/toolbars/ListControls.d.ts.map +1 -0
- package/dist/components/toolbars/SpecialFeaturesControls.d.ts +10 -0
- package/dist/components/toolbars/SpecialFeaturesControls.d.ts.map +1 -0
- package/dist/components/toolbars/TextFormattingControls.d.ts +8 -0
- package/dist/components/toolbars/TextFormattingControls.d.ts.map +1 -0
- package/dist/components/toolbars/ToolbarButton.d.ts +12 -0
- package/dist/components/toolbars/ToolbarButton.d.ts.map +1 -0
- package/dist/components/toolbars/ToolbarDivider.d.ts +3 -0
- package/dist/components/toolbars/ToolbarDivider.d.ts.map +1 -0
- package/dist/components/toolbars/YouTubeControls.d.ts +13 -0
- package/dist/components/toolbars/YouTubeControls.d.ts.map +1 -0
- package/dist/constants/config.d.ts +144 -0
- package/dist/constants/config.d.ts.map +1 -0
- package/dist/constants/editorConstants.d.ts +12 -0
- package/dist/constants/editorConstants.d.ts.map +1 -0
- package/dist/extensions/BackgroundColor.d.ts +12 -0
- package/dist/extensions/BackgroundColor.d.ts.map +1 -0
- package/dist/extensions/CustomTextStyle.d.ts +16 -0
- package/dist/extensions/CustomTextStyle.d.ts.map +1 -0
- package/dist/extensions/ImageGroup.d.ts +4 -0
- package/dist/extensions/ImageGroup.d.ts.map +1 -0
- package/dist/extensions/InlineMath.d.ts +11 -0
- package/dist/extensions/InlineMath.d.ts.map +1 -0
- package/dist/extensions/MathNode.d.ts +4 -0
- package/dist/extensions/MathNode.d.ts.map +1 -0
- package/dist/extensions/MathNodeView.d.ts +28 -0
- package/dist/extensions/MathNodeView.d.ts.map +1 -0
- package/dist/extensions/ResizableImageExtension.d.ts +3 -0
- package/dist/extensions/ResizableImageExtension.d.ts.map +1 -0
- package/dist/extensions/ResizableYoutubeExtension.d.ts +3 -0
- package/dist/extensions/ResizableYoutubeExtension.d.ts.map +1 -0
- package/dist/hooks/useEditorForceUpdate.d.ts +7 -0
- package/dist/hooks/useEditorForceUpdate.d.ts.map +1 -0
- package/dist/hooks/useEditorKeyboard.d.ts +10 -0
- package/dist/hooks/useEditorKeyboard.d.ts.map +1 -0
- package/dist/hooks/useEditorState.d.ts +38 -0
- package/dist/hooks/useEditorState.d.ts.map +1 -0
- package/dist/hooks/useResponsive.d.ts +2 -0
- package/dist/hooks/useResponsive.d.ts.map +1 -0
- package/dist/index.cjs.js +131 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +23223 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.html +6 -0
- package/dist/react-latex-editor-custom-mhzn-v2.css +1 -0
- package/dist/styles.d.ts +1 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/types/editor.d.ts +87 -0
- package/dist/types/editor.d.ts.map +1 -0
- package/dist/types/mathlive.d.ts +25 -0
- package/dist/types/mathlive.d.ts.map +1 -0
- package/dist/utils/contentStats.d.ts +13 -0
- package/dist/utils/contentStats.d.ts.map +1 -0
- package/dist/utils/editorConfig.d.ts +23 -0
- package/dist/utils/editorConfig.d.ts.map +1 -0
- package/dist/utils/editorUtils.d.ts +23 -0
- package/dist/utils/editorUtils.d.ts.map +1 -0
- package/dist/utils/helpers.d.ts +58 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/media.d.ts +30 -0
- package/dist/utils/media.d.ts.map +1 -0
- package/dist/utils/svgDom.d.ts +19 -0
- package/dist/utils/svgDom.d.ts.map +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +124 -0
package/dist/index.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.resizable-image-wrapper{display:block!important;width:100%!important;margin:0 auto}.resizable-image-container{position:relative;display:inline-block!important;line-height:0;max-width:100%;min-width:40px;min-height:40px;overflow:visible;margin:4px}.resizable-image-container.display-block{display:block}.resizable-image-container.display-inline-block{display:inline-block;vertical-align:middle;margin:0 .5rem}.resizable-image-wrapper{width:100%!important;display:block!important}.resizable-image-wrapper-align-left{text-align:left!important}.resizable-image-wrapper-align-center{text-align:center!important}.resizable-image-wrapper-align-right{text-align:right!important}.resizable-image-container.align-left,.resizable-image-container.align-right,.resizable-image-container.align-center{display:inline-block!important}.resizable-image-container.ProseMirror-selectednode{outline:2px dashed #a5b4fc;outline-offset:2px}.resizable-image-container .editor-image{width:100%;height:auto}.resize-handle-left,.resize-handle-right{position:absolute;top:50%;transform:translateY(-50%);width:8px;height:40px;background-color:#3b82f6;border:1px solid white;border-radius:4px;cursor:ew-resize;z-index:10;display:none;opacity:.8;transition:all .2s ease}.resize-handle-left{left:-12px}.resize-handle-right{right:-12px}.resize-handle-left:hover,.resize-handle-right:hover{opacity:1;width:10px}.ProseMirror-selectednode .resize-handle-left,.ProseMirror-selectednode .resize-handle-right{display:block}.resizable-youtube-wrapper{position:relative;display:inline-block;max-width:100%;margin:4px}.resizable-youtube-container{position:relative;display:inline-block;background:#000;border-radius:8px;overflow:hidden;box-shadow:0 2px 8px #00000014;max-width:100%}.resizable-youtube-container iframe{display:block;width:100%;height:100%;border:none;border-radius:8px;background:#000}.resize-handle{position:absolute;width:10px;height:10px;background-color:#3b82f6;border:1px solid #fff;border-radius:2px;opacity:.85;z-index:10;transition:box-shadow .2s}.resize-handle-bottom-right{bottom:-5px;right:-5px;cursor:nwse-resize}.resize-handle-bottom-left{bottom:-5px;left:-5px;cursor:nesw-resize}.resize-handle-top-right{top:-5px;right:-5px;cursor:nesw-resize}.resize-handle-top-left{top:-5px;left:-5px;cursor:nwse-resize}.resize-handle:hover{box-shadow:0 0 0 2px #2563eb33}.ProseMirror-selectednode .resize-handle{display:block}.alignment-controls{position:absolute;top:-34px;left:0;display:flex;gap:5px;background:#fff;border:1px solid #e2e8f0;border-radius:4px;padding:2px 6px;box-shadow:0 2px 8px #0000000a;z-index:20}.alignment-controls button{background:none;border:none;color:#3b82f6;font-size:16px;cursor:pointer;padding:2px 6px;border-radius:3px;transition:background .2s}.alignment-controls button:hover{background:#e0e7ef}.alignment-controls button.is-active{background:#2563eb;color:#fff}:root{--editor-border-color: #e2e8f0;--editor-background: #ffffff;--editor-text-color: #213547;--editor-focus-color: #3b82f6;--editor-hover-color: #f1f5f9;--toolbar-background: #f8fafc;--toolbar-border-color: #e2e8f0;--toolbar-button-hover: #e2e8f0;--toolbar-button-active: #dbeafe;--editor-font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;--editor-font-size: 15px;--editor-line-height: 1.7;--editor-padding: 1.25rem;--toolbar-padding: .75rem;--border-radius: .75rem;--transition-duration: .2s}.custom-editor{border:1px solid var(--editor-border-color);border-radius:var(--border-radius);background:var(--editor-background);transition:border-color var(--transition-duration) ease;display:flex;flex-direction:column;min-height:300px;position:relative;font-family:var(--editor-font-family);font-size:var(--editor-font-size);line-height:var(--editor-line-height);box-shadow:0 2px 12px #0000000a}.custom-editor:focus-within{border-color:var(--editor-focus-color);box-shadow:0 0 0 3px #3b82f61a}.toolbar{--tb-size: 32px;--tb-icon: 16px;--tb-fg: #3f3f46;--tb-fg-active: #0f766e;--tb-bg-hover: #f4f4f5;--tb-bg-active: #ccfbf1;--tb-border: #d4d4d8;--tb-divider: #e4e4e7;--tb-group-bg: #ffffff;display:block;padding:8px;background:#f4f4f5;border-bottom:1px solid var(--tb-border);border-radius:.75rem .75rem 0 0;position:sticky;top:0;z-index:2;margin-bottom:0}.toolbar-row,.toolbar-content{display:flex;flex-wrap:wrap;align-items:center;gap:6px;width:100%;min-height:var(--tb-size)}.toolbar-group{display:inline-flex;align-items:stretch;gap:0;padding:2px;margin:0;border:1px solid var(--tb-border);background:var(--tb-group-bg);border-radius:8px;flex-wrap:nowrap;box-shadow:0 1px 1px #18181b0a}.toolbar-divider{display:none}.toolbar-button{display:inline-flex;align-items:center;justify-content:center;width:var(--tb-size);height:var(--tb-size);min-width:var(--tb-size);padding:0;margin:0;border:1px solid transparent;border-radius:5px;background:transparent;color:var(--tb-fg);cursor:pointer;transition:background .12s ease,color .12s ease,border-color .12s ease;flex-shrink:0;position:relative}.toolbar-group>.toolbar-button+.toolbar-button,.toolbar-group>.toolbar-color+.toolbar-button,.toolbar-group>.toolbar-button+.toolbar-color,.toolbar-group>.toolbar-color+.toolbar-color,.toolbar-group>.toolbar-select+.toolbar-select,.toolbar-group>select+select{box-shadow:inset 1px 0 0 var(--tb-divider)}.toolbar-button svg{width:var(--tb-icon);height:var(--tb-icon);display:block;pointer-events:none}.toolbar-button:hover:not(:disabled):not(.is-disabled){background:var(--tb-bg-hover);color:#18181b;border-color:#d4d4d8}.toolbar-button:focus-visible{outline:2px solid #0f766e;outline-offset:1px;z-index:1}.toolbar-button.is-active{background:var(--tb-bg-active);color:var(--tb-fg-active);border-color:#99f6e4}.toolbar-button:disabled,.toolbar-button.is-disabled{opacity:.35;cursor:not-allowed;background:transparent;color:var(--tb-fg);border-color:transparent}.toolbar-select,.toolbar-group select{height:var(--tb-size);min-height:var(--tb-size);max-height:var(--tb-size);padding:0 28px 0 10px;margin:0;border:1px solid transparent;border-radius:5px;background-color:transparent;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 8px center;color:var(--tb-fg);font-size:13px;font-weight:500;line-height:1;cursor:pointer;appearance:none;-webkit-appearance:none;box-shadow:none;outline:none;transition:background-color .12s ease,border-color .12s ease}.toolbar-select:hover:not(:disabled),.toolbar-group select:hover:not(:disabled){background-color:var(--tb-bg-hover);border-color:#d4d4d8}.toolbar-select:focus,.toolbar-group select:focus{background-color:#fff;border-color:#0f766e;z-index:1}.toolbar-select:disabled,.toolbar-group select:disabled{opacity:.4;cursor:not-allowed}.toolbar-select-font{width:118px}.toolbar-select-size{width:68px;padding-left:8px}.toolbar-select-heading{width:112px}.toolbar-font-controls{gap:0;padding:2px}.toolbar-color{position:relative;display:inline-flex;align-items:center;justify-content:center;width:var(--tb-size);height:var(--tb-size);border:1px solid transparent;border-radius:5px;cursor:pointer;overflow:hidden;flex-shrink:0}.toolbar-color:hover{background:var(--tb-bg-hover);border-color:#d4d4d8}.toolbar-color input[type=color]{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;border:none;padding:0}.toolbar-color-icon{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:13px;font-weight:700;line-height:1;color:var(--tb-fg);pointer-events:none;font-family:Georgia,Times New Roman,serif}.toolbar-color-icon i{display:block;width:14px;height:3px;border-radius:1px;background:#18181b}.toolbar-color-icon-bg{width:16px;height:16px;border-radius:3px;border:1px solid var(--tb-border);background:#fff;overflow:hidden}.toolbar-color-icon-bg i{width:100%;height:100%;border-radius:0}.tooltip-container{position:relative;display:inline-flex}.tooltip{display:none}@media (max-width: 768px){.toolbar{--tb-size: 30px;padding:6px}.toolbar-row,.toolbar-content{gap:5px}.toolbar-select-font{width:100px}.toolbar-select-heading{width:96px}}.editor-content{flex:1;padding:var(--editor-padding);outline:none;min-height:200px}.ProseMirror{outline:none;word-wrap:break-word;white-space:pre-wrap;-webkit-font-variant-ligatures:none;font-variant-ligatures:none}.ProseMirror p{margin:.5em 0}.ProseMirror p.is-editor-empty:first-child:before,.ProseMirror p.is-empty:first-child:before{content:attr(data-placeholder);float:left;color:#adb5bd;pointer-events:none;height:0}.math-node-wrapper-inline{display:inline-block;vertical-align:middle;margin:0 .15em;line-height:1.2;max-width:100%}.math-node-wrapper-block{display:block;width:100%;text-align:center;margin:.35em 0;padding:.15em 0;line-height:1.35}math-field{font-size:1.1em;line-height:1.2}math-field[data-latex-display-mode=true]{display:inline-block;text-align:center;margin:0}.math-node-wrapper-inline,.math-node-wrapper-block,.math-node-wrapper-inline math-field,.math-node-wrapper-block math-field,math-field{max-width:100%;box-sizing:border-box;overflow-wrap:anywhere;word-break:break-word;white-space:normal}.ProseMirror table{border-collapse:collapse;margin:0;overflow:hidden;table-layout:fixed;width:100%}.ProseMirror table td,.ProseMirror table th{border:2px solid #ced4da;box-sizing:border-box;min-width:1em;padding:3px 5px;position:relative;vertical-align:top}.ProseMirror table th{background-color:#f1f3f4;font-weight:700;text-align:left}.ProseMirror table .selectedCell:after{background:#c8c8ff66;content:"";inset:0;pointer-events:none;position:absolute;z-index:2}.ProseMirror img{max-width:100%;height:auto}.ProseMirror img.ProseMirror-selectednode{outline:2px solid var(--editor-focus-color)}.ProseMirror pre{background:#0d1117;border-radius:.375rem;color:#c9d1d9;font-family:ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace;padding:.75rem 1rem;margin:.5em 0;overflow-x:auto}.ProseMirror code{background:none;color:inherit;font-size:.8em;padding:.25em;border-radius:.25rem}.ProseMirror pre code{background:none;color:inherit;font-size:.8em;padding:0}.ProseMirror blockquote{border-left:3px solid #ddd;margin:.5em 0;padding-left:1em;color:#666}.ProseMirror ul,.ProseMirror ol{padding-left:1.5em;margin:.5em 0}.ProseMirror li{margin:.25em 0}.ProseMirror a{color:var(--editor-focus-color);text-decoration:underline}.ProseMirror a:hover{text-decoration:none}.ProseMirror h1,.ProseMirror h2,.ProseMirror h3,.ProseMirror h4,.ProseMirror h5,.ProseMirror h6{margin:.5em 0;font-weight:600;line-height:1.25}.ProseMirror h1{font-size:2em}.ProseMirror h2{font-size:1.5em}.ProseMirror h3{font-size:1.25em}.ProseMirror h4{font-size:1em}.ProseMirror h5{font-size:.875em}.ProseMirror h6{font-size:.85em}.ProseMirror hr{border:none;border-top:2px solid var(--toolbar-border-color);margin:1em 0}.ProseMirror ul[data-type=taskList]{list-style:none;padding:0}.ProseMirror ul[data-type=taskList] li{display:flex;align-items:flex-start;margin:.25em 0}.ProseMirror ul[data-type=taskList] li>label{margin-right:.5em;-webkit-user-select:none;user-select:none}.ProseMirror ul[data-type=taskList] li>div{flex:1}.loading-overlay{position:absolute;inset:0;background:#fffc;display:flex;align-items:center;justify-content:center;z-index:1000;border-radius:var(--border-radius)}.loading-spinner{width:40px;height:40px;border:4px solid var(--toolbar-border-color);border-top:4px solid var(--editor-focus-color);border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.error-message{padding:.75rem 1rem;background-color:#fee2e2;color:#dc2626;border-radius:var(--border-radius);font-size:.875rem;margin-bottom:1rem;border:1px solid #fecaca;display:flex;justify-content:space-between;align-items:center}.error-close{background:none;border:none;color:inherit;font-size:1.25rem;cursor:pointer;padding:.25rem;line-height:1;opacity:.7;transition:opacity var(--transition-duration) ease;border-radius:.25rem}.error-close:hover{opacity:1;background-color:#0000001a}.table-controls{display:flex;gap:.5rem;padding:.5rem;background:var(--toolbar-background);border-top:1px solid var(--toolbar-border-color);border-radius:0 0 var(--border-radius) var(--border-radius);flex-wrap:wrap}.table-controls button{padding:.25rem .5rem;border:1px solid var(--toolbar-border-color);background:var(--editor-background);color:var(--editor-text-color);border-radius:.25rem;cursor:pointer;font-size:12px;transition:all var(--transition-duration) ease}.table-controls button:hover{background:var(--toolbar-button-hover)}.character-count{padding:.5rem .75rem;text-align:right;font-size:12px;color:#64748b;border-top:1px solid var(--toolbar-border-color);background:var(--toolbar-background);border-radius:0 0 var(--border-radius) var(--border-radius);position:relative;z-index:1}.character-count.is-near-limit{color:#d97706}.character-count.is-over-limit{color:#dc2626;font-weight:600}.editor-shell{width:100%}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.image-dialog-overlay{position:fixed;inset:0;background:#0f172a8c;display:flex;align-items:center;justify-content:center;z-index:2147483000;padding:1rem;overflow:auto}.image-dialog{background:#fff;border-radius:.75rem;padding:1.25rem;width:min(520px,calc(100vw - 2rem));max-width:min(520px,calc(100vw - 2rem));max-height:min(90vh,720px);overflow:auto;box-shadow:0 24px 48px #0f172a33;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color:#0f172a}.image-dialog h3{margin:0 0 1rem;font-size:1.1rem;color:#0f172a}.image-dialog input[type=url]{width:100%;box-sizing:border-box;padding:.65rem .75rem;border:1px solid #e2e8f0;border-radius:.5rem;font-size:14px}.image-dialog-buttons{display:flex;gap:.5rem;justify-content:flex-end;margin-top:.75rem}.image-dialog-buttons button{padding:.5rem .9rem;border-radius:.4rem;border:1px solid #e2e8f0;background:#fff;cursor:pointer;font-size:14px}.image-dialog-buttons button[type=submit]{background:#2563eb;border-color:#2563eb;color:#fff}.image-dialog-buttons button[type=submit]:disabled{opacity:.6;cursor:not-allowed}.image-dialog-error{color:#dc2626;font-size:13px;margin:.5rem 0 0}.image-dialog-divider{display:flex;align-items:center;gap:.75rem;margin:1rem 0;color:#94a3b8;font-size:12px;text-transform:uppercase;letter-spacing:.04em}.image-dialog-divider:before,.image-dialog-divider:after{content:"";flex:1;height:1px;background:#e2e8f0}.image-dialog-upload{text-align:center}.image-dialog-upload-btn{width:100%;padding:.65rem 1rem;border-radius:.5rem;border:1px dashed #cbd5e1;background:#f8fafc;color:#334155;cursor:pointer;font-size:14px}.image-dialog-upload-btn:hover{border-color:#93c5fd;background:#eff6ff}.image-dialog-tabs{display:flex;gap:.25rem;margin-bottom:.85rem;padding:.2rem;background:#f4f4f5;border-radius:.5rem}.image-dialog-tab{flex:1;border:none;background:transparent;color:#71717a;font:inherit;font-size:.85rem;font-weight:500;padding:.45rem .5rem;border-radius:.4rem;cursor:pointer}.image-dialog-tab.is-active{background:#fff;color:#0f766e;box-shadow:0 1px 2px #18181b14}.image-dialog-svg-input{width:100%;box-sizing:border-box;padding:.75rem;border:1px solid #e2e8f0;border-radius:.5rem;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:13px;line-height:1.45;resize:vertical;min-height:180px;max-height:50vh}.resizable-image-container.is-svg{background:linear-gradient(45deg,#f4f4f5 25%,transparent 25%) 0 0 / 12px 12px,linear-gradient(-45deg,#f4f4f5 25%,transparent 25%) 0 6px / 12px 12px,linear-gradient(45deg,transparent 75%,#f4f4f5 75%) 6px -6px / 12px 12px,linear-gradient(-45deg,transparent 75%,#f4f4f5 75%) -6px 0 / 12px 12px;background-color:#fff;border:1px solid #e4e4e7;border-radius:6px;padding:4px;width:100%!important;max-width:100%;height:auto;display:block!important;box-sizing:border-box}.resizable-image-container.is-svg .inline-svg-host{display:block;width:100%;max-width:100%;height:auto;line-height:0}.resizable-image-container.is-svg .inline-svg-host>svg{display:block;width:100%;max-width:100%;height:auto}.resizable-image-container.is-svg .inline-svg-host>svg>svg{display:unset;width:unset;height:unset;max-width:unset}.svg-badge{position:absolute;top:6px;left:6px;z-index:5;padding:2px 6px;border-radius:4px;background:#0f766eeb;color:#ecfdf5;font-size:10px;font-weight:700;letter-spacing:.04em;pointer-events:none}.error-message{display:flex;align-items:center;justify-content:space-between;gap:.75rem;margin-top:.5rem;padding:.65rem .85rem;border-radius:.5rem;background:#fef2f2;border:1px solid #fecaca;color:#991b1b;font-size:14px}.error-message p{margin:0}.error-close{border:none;background:transparent;color:inherit;font-size:1.25rem;line-height:1;cursor:pointer}@media (max-width: 768px){.toolbar{--tb-size: 30px;padding:4px 6px}.editor-content{padding:.75rem}.ProseMirror h1{font-size:1.75em}.ProseMirror h2{font-size:1.375em}.ProseMirror h3{font-size:1.125em}}@media (max-width: 480px){.toolbar{flex-direction:column;align-items:stretch}.toolbar-group{justify-content:center}.editor-content{padding:.5rem}}.toolbar-button:focus-visible{outline:2px solid #0f766e;outline-offset:1px}.toolbar-button:focus:not(:focus-visible){outline:none}.ProseMirror ::selection{background:#3b82f633}.ProseMirror .resizable-image-wrapper,.ProseMirror p .resizable-image-wrapper,.ProseMirror>.resizable-image-wrapper,.resizable-image-wrapper{width:100%!important;display:block!important;margin:0!important;padding:0!important;box-sizing:border-box!important;clear:both!important}.ProseMirror p:has(.resizable-image-wrapper){text-align:inherit!important}.ProseMirror .resizable-image-wrapper-align-left,.ProseMirror p .resizable-image-wrapper-align-left,.ProseMirror>.resizable-image-wrapper-align-left,.resizable-image-wrapper-align-left,.resizable-image-wrapper[data-align=left],.resizable-image-wrapper[style*="text-align: left"],.resizable-image-wrapper[style*="text-align:left"],.resizable-image-wrapper[style*="textAlign: left"],.resizable-image-wrapper[style*="textAlign:left"]{text-align:left!important}.ProseMirror .resizable-image-wrapper-align-center,.ProseMirror p .resizable-image-wrapper-align-center,.ProseMirror>.resizable-image-wrapper-align-center,.resizable-image-wrapper-align-center,.resizable-image-wrapper[data-align=center],.resizable-image-wrapper[style*="text-align: center"],.resizable-image-wrapper[style*="text-align:center"],.resizable-image-wrapper[style*="textAlign: center"],.resizable-image-wrapper[style*="textAlign:center"]{text-align:center!important}.ProseMirror .resizable-image-wrapper-align-right,.ProseMirror p .resizable-image-wrapper-align-right,.ProseMirror>.resizable-image-wrapper-align-right,.resizable-image-wrapper-align-right,.resizable-image-wrapper[data-align=right],.resizable-image-wrapper[style*="text-align: right"],.resizable-image-wrapper[style*="text-align:right"],.resizable-image-wrapper[style*="textAlign: right"],.resizable-image-wrapper[style*="textAlign:right"]{text-align:right!important}.ProseMirror .resizable-image-container,.ProseMirror p .resizable-image-container,.ProseMirror>.resizable-image-container,.resizable-image-container{position:relative!important;display:inline-block!important;max-width:100%!important;margin:4px!important;vertical-align:top!important;line-height:0!important}.resizable-image-container img{max-width:100%;height:auto;display:block}.resizable-image-container .resize-handle{position:absolute;width:10px;height:10px;background:var(--editor-focus-color);border:1px solid white;border-radius:2px;z-index:10;box-sizing:border-box}.resizable-image-container .resize-handle-bottom-right{bottom:-5px;right:-5px;cursor:nwse-resize}.resizable-image-container .resize-handle-bottom-left{bottom:-5px;left:-5px;cursor:nesw-resize}.resizable-image-container .resize-handle-top-right{top:-5px;right:-5px;cursor:nesw-resize}.resizable-image-container .resize-handle-top-left{top:-5px;left:-5px;cursor:nwse-resize}.resizable-image-container .alignment-controls,.resizable-youtube-container .alignment-controls{position:absolute;top:-34px;left:0;display:flex;gap:4px;background:#fff;border:1px solid #e2e8f0;border-radius:4px;padding:2px;z-index:20;box-shadow:0 2px 8px #0f172a14}.resizable-image-container .alignment-controls button,.resizable-youtube-container .alignment-controls button{border:none;background:transparent;cursor:pointer;padding:2px 6px;border-radius:2px;color:#334155}.resizable-image-container .alignment-controls button.is-active,.resizable-youtube-container .alignment-controls button.is-active{background:#2563eb;color:#fff}.resizable-image-container iframe{border:none;max-width:100%}.math-symbol-toolbar{display:flex;flex-wrap:wrap;gap:.25rem;margin-bottom:1rem;padding:.5rem;background:var(--toolbar-background);border-radius:.25rem;border:1px solid var(--toolbar-border-color)}.math-symbol-tab{padding:.25rem .5rem;border:none;background:transparent;color:var(--editor-text-color);cursor:pointer;border-radius:.25rem;font-size:12px;transition:background-color var(--transition-duration) ease}.math-symbol-tab.active{background:var(--editor-focus-color);color:#fff}.math-symbol-tab:hover:not(.active){background:var(--toolbar-button-hover)}.math-symbol-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(40px,1fr));gap:.25rem;margin-top:.5rem}.math-symbol-button{padding:.5rem;border:1px solid var(--editor-border-color);background:var(--editor-background);color:var(--editor-text-color);border-radius:.25rem;cursor:pointer;font-size:14px;transition:all var(--transition-duration) ease;text-align:center;min-height:40px;display:flex;align-items:center;justify-content:center}.math-symbol-button:hover{background:var(--toolbar-button-hover);border-color:var(--editor-focus-color)}@media (prefers-reduced-motion: reduce){*{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}@media (prefers-contrast: high){.custom-editor{border-width:2px}.toolbar-button.is-active{outline:1px solid currentColor}}.math-field-display{background:#f8fafc;border-radius:4px;padding:2px 6px;min-width:24px;min-height:1.5em;display:inline-block;box-shadow:0 1px 2px #3b82f60a;pointer-events:none;-webkit-user-select:none;user-select:none}.math-node-wrapper.is-selected .math-field-display{outline:2px solid #99f6e4;outline-offset:2px}.math-node-wrapper-block .math-field-display{padding:.25rem .65rem}math-field::part(virtual-keyboard-toggle){display:none!important}.ML__keyboard{display:none!important}.custom-editor .character-count{display:flex;align-items:center;justify-content:space-between;gap:.75rem;margin:0;padding:.45rem .85rem;border-top:1px solid var(--toolbar-border-color);border-radius:0 0 var(--border-radius) var(--border-radius);background:#fafafa;color:#71717a;font-size:12px}.character-count-extras{color:#a1a1aa;font-variant-numeric:tabular-nums}.math-node-wrapper-block{display:block;width:100%;text-align:center;margin:.85em 0;padding:.35em 0}.math-node-wrapper-block .math-field-display{display:inline-block;max-width:100%;padding:.35rem .75rem}.math-dialog-overlay{position:fixed;inset:0;background-color:#0f172a8c;display:flex;justify-content:center;align-items:center;z-index:2147483000;animation:rleOverlayFadeIn .2s ease-out;overflow:auto;padding:1rem}@keyframes rleOverlayFadeIn{0%{opacity:0}to{opacity:1}}.math-dialog{background:#fff;border-radius:10px;box-shadow:0 24px 48px #0f172a33;width:min(700px,calc(100vw - 2rem));max-width:min(700px,calc(100vw - 2rem));max-height:min(90vh,920px);overflow:hidden;display:flex;flex-direction:column;position:relative;font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;color:#0f172a}.math-dialog-header{padding:12px 16px;border-bottom:1px solid #e2e8f0;display:flex;justify-content:space-between;align-items:center;background:#f8fafc;border-radius:10px 10px 0 0;flex-shrink:0}.math-dialog-header h3{margin:0;font-size:1.05rem;color:#0f172a;font-weight:600}.close-button{background:none;border:none;font-size:1.35rem;line-height:1;color:#64748b;cursor:pointer;padding:4px 8px;border-radius:6px;transition:background .2s,color .2s}.close-button:hover{background:#0f172a0f;color:#0f172a}.math-toolbar-tabs{display:flex;flex-wrap:wrap;gap:4px;padding:8px 12px;background:#f8fafc;border-bottom:1px solid #e2e8f0;max-width:100%}.tab-button{padding:6px 12px;border:none;background:none;color:#64748b;cursor:pointer;border-radius:6px;font-size:.82rem;transition:background .2s,color .2s;white-space:nowrap}.tab-button:hover{background:#0f172a0f;color:#0f172a}.tab-button.active{background:#2563eb;color:#fff}.math-toolbar-container{padding:10px 12px;border-bottom:1px solid #e2e8f0;max-height:140px;overflow-y:auto;flex-shrink:0}.math-toolbar-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(36px,1fr));gap:8px;padding:2px}.math-symbol-button{aspect-ratio:1;min-width:36px;border:1px solid #e2e8f0;background:#fff;border-radius:6px;cursor:pointer;font-size:.95rem;display:flex;align-items:center;justify-content:center;transition:background .2s,border-color .2s}.math-symbol-button:hover{background:#f1f5f9;border-color:#cbd5e1}.math-examples{padding:10px 12px;border-bottom:1px solid #e2e8f0;max-height:180px;overflow-y:auto;flex-shrink:0}.math-examples h4{margin:0 0 8px;color:#334155;font-size:.82rem;font-weight:600;text-transform:uppercase;letter-spacing:.03em}.equation-buttons{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}.equation-buttons:last-child{margin-bottom:0}.equation-buttons button{padding:5px 10px;border:1px solid #e2e8f0;background:#fff;border-radius:6px;cursor:pointer;font-size:.78rem;transition:background .2s;white-space:nowrap;color:#334155}.equation-buttons button:hover{background:#f1f5f9}.math-editor{padding:12px 16px;border-bottom:1px solid #e2e8f0;flex-shrink:0}.math-dialog-math-field{width:100%!important;min-height:52px!important;font-size:1.05rem!important;padding:10px 12px!important;border:2px solid #e2e8f0!important;border-radius:8px!important;background-color:#fff!important;transition:border-color .2s,box-shadow .2s!important;display:block!important;box-sizing:border-box!important}.math-dialog-math-field:focus{border-color:#2563eb!important;box-shadow:0 0 0 3px #2563eb26!important;outline:none!important}.math-display-mode-toggle{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 16px 10px;font-size:.82rem;color:#475569;flex-shrink:0}.math-display-mode-toggle label{display:inline-flex;align-items:center;gap:6px;cursor:pointer}.math-dialog-hint{color:#94a3b8;font-size:.75rem}.math-dialog-footer{padding:10px 16px;display:flex;justify-content:flex-end;gap:8px;background:#f8fafc;border-radius:0 0 10px 10px;flex-shrink:0}.cancel-button,.save-button{padding:8px 16px;border-radius:6px;font-size:.85rem;cursor:pointer;transition:background .2s,border-color .2s}.cancel-button{background:#fff;border:1px solid #e2e8f0;color:#475569}.save-button{background:#2563eb;border:none;color:#fff}.cancel-button:hover{background:#f8fafc}.save-button:hover{background:#1d4ed8}.save-button:disabled{background:#94a3b8;cursor:not-allowed;opacity:.7}.math-dialog::-webkit-scrollbar,.math-toolbar-grid::-webkit-scrollbar,.math-examples::-webkit-scrollbar{width:6px}.math-dialog::-webkit-scrollbar-thumb,.math-toolbar-grid::-webkit-scrollbar-thumb,.math-examples::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:999px}@media (max-width: 640px){.math-dialog{width:calc(100vw - 1rem);max-width:calc(100vw - 1rem);max-height:94vh}.math-toolbar-tabs{flex-wrap:nowrap;overflow-x:auto}.math-examples{max-height:130px}.math-display-mode-toggle{flex-direction:column;align-items:flex-start;gap:6px}}.editor-viewer{width:100%;padding:0rem;border-radius:1rem;white-space:pre-wrap;font-size:1rem;line-height:1.6;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;tab-size:4;-moz-tab-size:4;-o-tab-size:4}.editor-viewer,.viewer-content{max-width:100%;box-sizing:border-box;overflow-wrap:anywhere;word-break:break-word}.viewer-content p{margin:.75em 0;min-height:1.5em}.viewer-math-block{display:block;width:100%;margin:.5em 0;text-align:center;overflow-x:auto;padding:.15rem 0}.viewer-math-inline{display:inline;padding:0 .1em}.viewer-content .resizable-youtube-wrapper,.viewer-content iframe{max-width:100%;margin:1rem 0}.viewer-content p:empty:before{content:"";display:inline-block}.viewer-content h1,.viewer-content h2,.viewer-content h3,.viewer-content h4,.viewer-content h5,.viewer-content h6{margin:1.2em 0 .6em;line-height:1.3;font-weight:600;page-break-after:avoid;color:#111827}.viewer-content h1{font-size:2em}.viewer-content h2{font-size:1.5em}.viewer-content h3{font-size:1.25em}.viewer-content h4{font-size:1.1em}.viewer-content h5{font-size:1em}.viewer-content h6{font-size:.9em}.viewer-content ul,.viewer-content ol{margin:.75em 0;padding-left:1.5em}.viewer-content li{margin:.25em 0;padding-left:.25em}.viewer-content li>p{margin:.25em 0}.viewer-content blockquote{margin:1em 0;padding:.5em 1em;border-left:4px solid #ddd;background:#f9f9f9}.viewer-content blockquote>*:first-child{margin-top:0}.viewer-content blockquote>*:last-child{margin-bottom:0}.viewer-content pre{margin:1em 0;padding:1em;overflow-x:auto;background:#f5f5f5;border-radius:4px;font-size:.9em;line-height:1.5}.viewer-content code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:.9em;padding:.2em .4em;border-radius:3px;background:#f5f5f5}.viewer-content pre code{padding:0;background:none;border-radius:0}.viewer-content img{max-width:100%;height:auto;margin:1em 0;display:block;border-radius:.5rem;border:1px solid #e5e7eb}.viewer-content .resizable-image-wrapper{width:100%;display:block;margin:1em 0}.viewer-content .resizable-image-wrapper-align-left{text-align:left}.viewer-content .resizable-image-wrapper-align-center{text-align:center}.viewer-content .resizable-image-wrapper-align-right{text-align:right}.viewer-content .resizable-image-container{display:inline-block;position:relative;max-width:100%}.viewer-content .resizable-image-container img{display:block;margin:0}.viewer-content .resizable-image-container.is-svg,.viewer-content .resizable-image-container.is-svg .inline-svg-host{display:block;width:100%;max-width:100%;height:auto;margin:0;box-sizing:border-box}.viewer-content .resizable-image-container.is-svg>svg,.viewer-content .resizable-image-container.is-svg .inline-svg-host>svg{display:block;width:100%;max-width:100%;height:auto;margin:0 auto;box-sizing:border-box}.viewer-content .resizable-image-container.is-svg svg svg,.viewer-content .resizable-image-container.is-svg .inline-svg-host svg svg{display:unset;width:unset;height:unset;max-width:unset;margin:0}.viewer-content table{width:100%;border-collapse:collapse;margin:1em 0;border:1px solid #ddd}.viewer-content th,.viewer-content td{padding:.5em;border:1px solid #ddd;min-width:2em}.viewer-content th{font-weight:600;text-align:left;background:#f5f5f5}.viewer-content a{color:#06c;text-decoration:underline;word-break:break-word}.viewer-content a:hover,.viewer-content a:focus{text-decoration:none;outline:none}.viewer-content math-field{display:inline-block;vertical-align:middle;margin:0 .2em}.viewer-content .katex{font-size:1.1em;line-height:1.2}.viewer-content .katex-display{margin:1em 0;overflow-x:auto;overflow-y:hidden;padding:.5em 0}.viewer-content math-field,.viewer-content .katex,.viewer-content .katex *{max-width:100%;box-sizing:border-box;overflow-wrap:anywhere;word-break:break-word;white-space:normal}.viewer-content :focus{outline:2px solid #0066cc;outline-offset:2px}.viewer-content :focus:not(:focus-visible){outline:none}.viewer-content ::selection{background:#b3d4fc;text-shadow:none}@media print{.editor-viewer{font-size:12pt;line-height:1.5}.viewer-content a{text-decoration:underline}.viewer-content a[href]:after{content:" (" attr(href) ")";font-size:.8em}.viewer-content pre,.viewer-content blockquote{page-break-inside:avoid}}@media (max-width: 768px){.editor-viewer{padding:0rem;border-radius:.5rem;font-size:.9375rem}.viewer-content h1{font-size:1.5em}.viewer-content h2{font-size:1.15em}.viewer-content h3{font-size:1em}.viewer-content pre{padding:.75em}}@media (max-width: 480px){.editor-viewer{padding:0rem;font-size:.875rem}.viewer-content h1{font-size:1.35em}.viewer-content h2{font-size:1.05em}.viewer-content h3{font-size:.95em}.viewer-content pre{padding:.5em}.viewer-content blockquote{padding:.5em .75em}}@media (prefers-color-scheme: dark){.editor-viewer,.viewer-content,.viewer-content h1,.viewer-content h2,.viewer-content h3,.viewer-content blockquote,.viewer-content pre,.viewer-content code,.viewer-content th,.viewer-content td,.viewer-content a{background:#fff;color:#374151;border-color:#e5e7eb}}.viewer-content div[data-youtube-video] iframe{display:block;max-width:100%;border-radius:8px;background:#000}
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,iCAAiC,CAAC;AACzC,OAAO,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common types and interfaces for the React LaTeX Editor
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Editor content format
|
|
6
|
+
*/
|
|
7
|
+
export type EditorContent = string | Record<string, any>;
|
|
8
|
+
/**
|
|
9
|
+
* Editor theme configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface EditorTheme {
|
|
12
|
+
primaryColor?: string;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
textColor?: string;
|
|
15
|
+
borderColor?: string;
|
|
16
|
+
focusColor?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Math equation format
|
|
20
|
+
*/
|
|
21
|
+
export interface MathEquation {
|
|
22
|
+
latex: string;
|
|
23
|
+
displayMode?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Image / SVG insert payload for the editor
|
|
27
|
+
*/
|
|
28
|
+
export interface ImageInsertItem {
|
|
29
|
+
src: string;
|
|
30
|
+
alt?: string;
|
|
31
|
+
width?: string;
|
|
32
|
+
height?: string;
|
|
33
|
+
/** Mark as SVG figure (auto-detected from src when omitted) */
|
|
34
|
+
mediaType?: "image" | "svg";
|
|
35
|
+
/** Raw inline SVG markup (preserved in getHTML() output) */
|
|
36
|
+
svgContent?: string;
|
|
37
|
+
align?: "left" | "center" | "right";
|
|
38
|
+
}
|
|
39
|
+
export type ImageInsertInput = string | string[] | ImageInsertItem | ImageInsertItem[];
|
|
40
|
+
/**
|
|
41
|
+
* Image configuration
|
|
42
|
+
*/
|
|
43
|
+
export interface ImageConfig {
|
|
44
|
+
src: string;
|
|
45
|
+
alt?: string;
|
|
46
|
+
width?: string;
|
|
47
|
+
height?: string;
|
|
48
|
+
align?: "left" | "center" | "right";
|
|
49
|
+
mediaType?: "image" | "svg";
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Editor state
|
|
53
|
+
*/
|
|
54
|
+
export interface EditorState {
|
|
55
|
+
content: string;
|
|
56
|
+
isEmpty: boolean;
|
|
57
|
+
isFocused: boolean;
|
|
58
|
+
characterCount?: number;
|
|
59
|
+
wordCount?: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Editor event handlers
|
|
63
|
+
*/
|
|
64
|
+
export interface EditorEventHandlers {
|
|
65
|
+
onChange?: (content: string) => void;
|
|
66
|
+
onFocus?: () => void;
|
|
67
|
+
onBlur?: () => void;
|
|
68
|
+
onImageSelectionRequest?: () => void;
|
|
69
|
+
onError?: (error: Error) => void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Export options for editor content
|
|
73
|
+
*/
|
|
74
|
+
export interface ExportOptions {
|
|
75
|
+
format: "html" | "json" | "text" | "markdown";
|
|
76
|
+
includeStyles?: boolean;
|
|
77
|
+
prettyPrint?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Editor validation result
|
|
81
|
+
*/
|
|
82
|
+
export interface ValidationResult {
|
|
83
|
+
isValid: boolean;
|
|
84
|
+
errors?: string[];
|
|
85
|
+
warnings?: string[];
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/types/editor.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC5B,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;CACrC;AAED,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,MAAM,EAAE,GACR,eAAe,GACf,eAAe,EAAE,CAAC;AAEtB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,uBAAuB,CAAC,EAAE,MAAM,IAAI,CAAC;IACrC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface MathfieldElement extends HTMLElement {
|
|
2
|
+
value: string;
|
|
3
|
+
menuItems: any[];
|
|
4
|
+
virtualKeyboardMode?: string;
|
|
5
|
+
mathMode?: string;
|
|
6
|
+
smartMode?: boolean;
|
|
7
|
+
smartFence?: boolean;
|
|
8
|
+
smartSuperscript?: boolean;
|
|
9
|
+
smartSubscript?: boolean;
|
|
10
|
+
smartOperator?: boolean;
|
|
11
|
+
smartFraction?: boolean;
|
|
12
|
+
smartSqrt?: boolean;
|
|
13
|
+
smartBracket?: boolean;
|
|
14
|
+
smartParen?: boolean;
|
|
15
|
+
smartQuote?: boolean;
|
|
16
|
+
smartSpace?: boolean;
|
|
17
|
+
smartCommand?: boolean;
|
|
18
|
+
menuToggle?: string;
|
|
19
|
+
menuToggleVisible?: boolean;
|
|
20
|
+
fontsDirectory?: string | null;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}
|
|
23
|
+
export declare const ensureMathLiveLoaded: () => Promise<void>;
|
|
24
|
+
export default MathfieldElement;
|
|
25
|
+
//# sourceMappingURL=mathlive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mathlive.d.ts","sourceRoot":"","sources":["../../src/types/mathlive.ts"],"names":[],"mappings":"AAGA,OAAO,UAAU,CAAC;AAGlB,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAGD,eAAO,MAAM,oBAAoB,QAAO,OAAO,CAAC,IAAI,CASnD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
export interface EditorContentStats {
|
|
3
|
+
characters: number;
|
|
4
|
+
words: number;
|
|
5
|
+
equations: number;
|
|
6
|
+
images: number;
|
|
7
|
+
videos: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Content stats that include atom nodes TipTap's CharacterCount skips (math, media).
|
|
11
|
+
*/
|
|
12
|
+
export declare function getEditorContentStats(editor: Editor | null): EditorContentStats;
|
|
13
|
+
//# sourceMappingURL=contentStats.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contentStats.d.ts","sourceRoot":"","sources":["../../src/utils/contentStats.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,kBAAkB,CA6C/E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { EditorView } from '@tiptap/pm/view';
|
|
2
|
+
export interface EditorExtensionOptions {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
characterLimit?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Get editor extensions configuration
|
|
8
|
+
*/
|
|
9
|
+
export declare function getEditorExtensions(options?: EditorExtensionOptions): (import('@tiptap/core').Node<any, any> | import('@tiptap/core').Extension<any, any> | import('@tiptap/core').Mark<any, any>)[];
|
|
10
|
+
export declare function getEditorProps({ className, placeholder, }: {
|
|
11
|
+
className?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
}): {
|
|
14
|
+
attributes: {
|
|
15
|
+
class: string;
|
|
16
|
+
"aria-label": string;
|
|
17
|
+
"aria-placeholder": string;
|
|
18
|
+
spellcheck: string;
|
|
19
|
+
};
|
|
20
|
+
handlePaste: (view: EditorView, event: ClipboardEvent) => boolean;
|
|
21
|
+
handleDrop: (view: EditorView, event: DragEvent) => boolean;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=editorConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorConfig.d.ts","sourceRoot":"","sources":["../../src/utils/editorConfig.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIlD,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAkDD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,sBAA2B,kIA0GvE;AAED,wBAAgB,cAAc,CAAC,EAC7B,SAAc,EACd,WAA+B,GAChC,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;;;;wBAQuB,UAAU,SAAS,cAAc;uBAgDlC,UAAU,SAAS,SAAS;EAyBlD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { ImageInsertInput } from '../types/editor';
|
|
3
|
+
export declare function setFontSize(editor: Editor | null, size: number | string): void;
|
|
4
|
+
export declare function setBackgroundColor(editor: Editor | null, color: string): void;
|
|
5
|
+
export declare function setFontFamily(editor: Editor | null, family: string): void;
|
|
6
|
+
export declare function insertTable(editor: Editor | null, rows?: number, cols?: number, withHeaderRow?: boolean): void;
|
|
7
|
+
export declare function addImage(editor: Editor | null, urls: ImageInsertInput): void;
|
|
8
|
+
/**
|
|
9
|
+
* Insert an SVG figure from markup, a data/http URL, or a File.
|
|
10
|
+
* Intended for npm consumers using a custom file picker.
|
|
11
|
+
*/
|
|
12
|
+
export declare function insertSvg(editor: Editor | null, source: string | File, options?: {
|
|
13
|
+
alt?: string;
|
|
14
|
+
width?: string;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Convert FileList / File[] (from your own <input type="file">) and insert.
|
|
18
|
+
* Handles SVG + raster images. Prefer this over blob URLs for persistence.
|
|
19
|
+
*/
|
|
20
|
+
export declare function addImagesFromFiles(editor: Editor | null, files: FileList | File[]): Promise<void>;
|
|
21
|
+
export declare function insertMath(editor: Editor | null, latex: string, displayMode?: boolean): void;
|
|
22
|
+
export declare function validateAndInsertImage(editor: Editor | null, url: string): Promise<void>;
|
|
23
|
+
//# sourceMappingURL=editorUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorUtils.d.ts","sourceRoot":"","sources":["../../src/utils/editorUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAE,gBAAgB,EAAmB,MAAM,iBAAiB,CAAC;AASzE,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,QAOvE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,QAGtE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,QASlE;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,IAAI,SAAI,EACR,IAAI,SAAI,EACR,aAAa,UAAO,QAIrB;AA4BD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,EAAE,gBAAgB,QAyCrE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACzC,OAAO,CAAC,IAAI,CAAC,CAqCf;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,GACvB,OAAO,CAAC,IAAI,CAAC,CAcf;AAED,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,KAAK,EAAE,MAAM,EACb,WAAW,UAAQ,QAqBpB;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,iBAwBxE"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility helpers for the React LaTeX Editor
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Validate LaTeX syntax (brace balance + basic sanity checks)
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateLatex(latex: string): {
|
|
8
|
+
isValid: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Escape HTML special characters (safe for inserting untrusted text into HTML)
|
|
13
|
+
*/
|
|
14
|
+
export declare function sanitizeHtml(html: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Extract plain text from HTML
|
|
17
|
+
*/
|
|
18
|
+
export declare function extractTextFromHtml(html: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Count words in text
|
|
21
|
+
*/
|
|
22
|
+
export declare function countWords(text: string): number;
|
|
23
|
+
/**
|
|
24
|
+
* Format file size
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatFileSize(bytes: number): string;
|
|
27
|
+
/**
|
|
28
|
+
* Debounce function for performance optimization
|
|
29
|
+
*/
|
|
30
|
+
export declare function debounce<T extends (...args: never[]) => void>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
31
|
+
/**
|
|
32
|
+
* Throttle function for performance optimization
|
|
33
|
+
*/
|
|
34
|
+
export declare function throttle<T extends (...args: never[]) => void>(func: T, limit: number): (...args: Parameters<T>) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Check if browser supports features needed by the editor
|
|
37
|
+
*/
|
|
38
|
+
export declare function checkBrowserSupport(): {
|
|
39
|
+
supported: boolean;
|
|
40
|
+
missingFeatures: string[];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Deep clone a JSON-serializable value
|
|
44
|
+
*/
|
|
45
|
+
export declare function deepClone<T>(obj: T): T;
|
|
46
|
+
/**
|
|
47
|
+
* Check if HTML content is empty (ignoring empty paragraphs / whitespace)
|
|
48
|
+
*/
|
|
49
|
+
export declare function isContentEmpty(html: string): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Generate unique ID
|
|
52
|
+
*/
|
|
53
|
+
export declare function generateId(prefix?: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Normalize a user-entered URL (adds https:// when missing a scheme)
|
|
56
|
+
*/
|
|
57
|
+
export declare function normalizeUrl(url: string): string;
|
|
58
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAoCA;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAajD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQxD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAYpD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,EAC3D,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,GACX,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAYlC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,IAAI,EAC3D,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,MAAM,GACZ,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAoBlC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B,CAuBA;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAKtC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIpD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,SAAQ,GAAG,MAAM,CAKjD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKhD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { getEditorProps } from './editorConfig';
|
|
2
|
+
import { setFontSize, setBackgroundColor, setFontFamily, insertTable, addImage, insertSvg, addImagesFromFiles, insertMath, validateAndInsertImage } from './editorUtils';
|
|
3
|
+
export { getEditorProps, setFontSize, setBackgroundColor, setFontFamily, insertTable, addImage, insertSvg, addImagesFromFiles, insertMath, validateAndInsertImage, };
|
|
4
|
+
export { normalizeUrl } from './helpers';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACvB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,QAAQ,EACR,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,sBAAsB,GACvB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare function isSupportedImageFile(file: File): boolean;
|
|
2
|
+
export declare function isSvgFile(file: File): boolean;
|
|
3
|
+
export declare function isSvgSource(src: string): boolean;
|
|
4
|
+
export declare function isLikelySvgMarkup(text: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Sanitize pasted SVG markup (strip scripts, event handlers, etc.),
|
|
7
|
+
* then normalize the root SVG for responsive CSS sizing.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sanitizeSvgMarkup(raw: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Encode SVG as a data URL (legacy / URL-based SVG only).
|
|
12
|
+
*/
|
|
13
|
+
export declare function svgMarkupToDataUrl(raw: string): string;
|
|
14
|
+
export declare function readSvgFileAsMarkup(file: File): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* File picker accept string — MIME types + extensions for broader OS support
|
|
17
|
+
*/
|
|
18
|
+
export declare const IMAGE_ACCEPT = "image/jpeg,image/jpg,image/png,image/gif,image/webp,image/svg+xml,.svg,.jpg,.jpeg,.png,.gif,.webp";
|
|
19
|
+
/** SVG-only accept string for the dedicated Upload SVG toolbar button */
|
|
20
|
+
export declare const SVG_ACCEPT = "image/svg+xml,.svg";
|
|
21
|
+
export { dataUrlToSvgMarkup } from './svgDom';
|
|
22
|
+
export declare function assertImageFileSize(file: File): void;
|
|
23
|
+
export declare function fileToDataUrl(file: File): Promise<string>;
|
|
24
|
+
export declare function filesToImageSources(files: FileList | File[]): Promise<Array<{
|
|
25
|
+
src: string;
|
|
26
|
+
alt: string;
|
|
27
|
+
isSvg: boolean;
|
|
28
|
+
svgContent?: string;
|
|
29
|
+
}>>;
|
|
30
|
+
//# sourceMappingURL=media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/utils/media.ts"],"names":[],"mappings":"AAKA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAUxD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAM7C;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOhD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMvD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA4BrD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAa/D;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,sGAC4E,CAAC;AAEtG,yEAAyE;AACzE,eAAO,MAAM,UAAU,uBAAuB,CAAC;AAE/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAMpD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAOzD;AAED,wBAAsB,mBAAmB,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,EAAE,GAAG,OAAO,CAC1E,KAAK,CAAC;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CACzE,CAmCA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DOMOutputSpec } from '@tiptap/pm/model';
|
|
2
|
+
/**
|
|
3
|
+
* Convert a DOM element tree into a ProseMirror DOMOutputSpec (for getHTML()).
|
|
4
|
+
*/
|
|
5
|
+
export declare function elementToDOMOutputSpec(element: Element): DOMOutputSpec;
|
|
6
|
+
/**
|
|
7
|
+
* Make a root SVG fluid: ensure viewBox + preserveAspectRatio, strip fixed
|
|
8
|
+
* root width/height so CSS can size it. Nested child <svg> layers are untouched.
|
|
9
|
+
*/
|
|
10
|
+
export declare function normalizeSvgForResponsive(svgMarkup: string): string;
|
|
11
|
+
/** Parse SVG markup into a ProseMirror DOMOutputSpec (responsive-normalized). */
|
|
12
|
+
export declare function svgMarkupToDOMOutputSpec(svgMarkup: string): DOMOutputSpec;
|
|
13
|
+
export declare function extractSvgMarkupFromElement(element: Element): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Decode legacy data:image/svg+xml sources back to markup when possible.
|
|
16
|
+
* Returns responsive-normalized markup when decoding succeeds.
|
|
17
|
+
*/
|
|
18
|
+
export declare function dataUrlToSvgMarkup(src: string): string | null;
|
|
19
|
+
//# sourceMappingURL=svgDom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svgDom.d.ts","sourceRoot":"","sources":["../../src/utils/svgDom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,aAAa,CAuBtE;AAYD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAqDnE;AAED,iFAAiF;AACjF,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAWzE;AAED,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAa3E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAqB7D"}
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-latex-editor-custom-mhzn-v2",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A professional React rich text editor with mathematical equation support, built on TipTap with MathLive integration. Production-ready with TypeScript support, accessibility features, and industrial-grade error handling.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.cjs.js",
|
|
7
|
+
"module": "dist/index.esm.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.esm.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"default": "./dist/index.cjs.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"./styles": {
|
|
22
|
+
"types": "./dist/styles.d.ts",
|
|
23
|
+
"import": "./dist/react-latex-editor.css",
|
|
24
|
+
"require": "./dist/react-latex-editor.css"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"scripts": {
|
|
31
|
+
"dev": "vite",
|
|
32
|
+
"build": "vite build",
|
|
33
|
+
"preview": "vite preview",
|
|
34
|
+
"prepublishOnly": "npm run build",
|
|
35
|
+
"type-check": "tsc --noEmit",
|
|
36
|
+
"lint": "tsc --noEmit",
|
|
37
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,css}\""
|
|
38
|
+
},
|
|
39
|
+
"keywords": [
|
|
40
|
+
"react",
|
|
41
|
+
"rich-text-editor",
|
|
42
|
+
"tiptap",
|
|
43
|
+
"math",
|
|
44
|
+
"mathematical-equations",
|
|
45
|
+
"mathlive",
|
|
46
|
+
"typescript",
|
|
47
|
+
"editor",
|
|
48
|
+
"wysiwyg",
|
|
49
|
+
"content-editor",
|
|
50
|
+
"latex",
|
|
51
|
+
"mathematics",
|
|
52
|
+
"formula-editor"
|
|
53
|
+
],
|
|
54
|
+
"author": "bablu22 <https://github.com/bablu22>",
|
|
55
|
+
"license": "MIT",
|
|
56
|
+
"repository": {
|
|
57
|
+
"type": "git",
|
|
58
|
+
"url": "https://github.com/muhzinasrori/react-latex-editor-from-bablu-mia.git"
|
|
59
|
+
},
|
|
60
|
+
"bugs": {
|
|
61
|
+
"url": "https://github.com/muhzinasrori/react-latex-editor-from-bablu-mia/issues"
|
|
62
|
+
},
|
|
63
|
+
"homepage": "https://github.com/muhzinasrori/react-latex-editor-from-bablu-mia#readme",
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
66
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
70
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
71
|
+
"@types/node": "^24.0.4",
|
|
72
|
+
"@types/react": "^19.1.8",
|
|
73
|
+
"@types/react-dom": "^19.1.6",
|
|
74
|
+
"@vitejs/plugin-react": "^4.6.0",
|
|
75
|
+
"react": "^18.2.0",
|
|
76
|
+
"react-dom": "^18.2.0",
|
|
77
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
78
|
+
"typescript": "^5.8.3",
|
|
79
|
+
"vite": "^7.0.0",
|
|
80
|
+
"vite-plugin-dts": "^4.5.4"
|
|
81
|
+
},
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"@tiptap/core": "2.27.2",
|
|
84
|
+
"@tiptap/extension-blockquote": "2.27.2",
|
|
85
|
+
"@tiptap/extension-character-count": "2.27.2",
|
|
86
|
+
"@tiptap/extension-code-block-lowlight": "2.27.2",
|
|
87
|
+
"@tiptap/extension-color": "2.27.2",
|
|
88
|
+
"@tiptap/extension-dropcursor": "2.27.2",
|
|
89
|
+
"@tiptap/extension-floating-menu": "2.27.2",
|
|
90
|
+
"@tiptap/extension-gapcursor": "2.27.2",
|
|
91
|
+
"@tiptap/extension-hard-break": "2.27.2",
|
|
92
|
+
"@tiptap/extension-heading": "2.27.2",
|
|
93
|
+
"@tiptap/extension-highlight": "2.27.2",
|
|
94
|
+
"@tiptap/extension-history": "2.27.2",
|
|
95
|
+
"@tiptap/extension-horizontal-rule": "2.27.2",
|
|
96
|
+
"@tiptap/extension-image": "2.27.2",
|
|
97
|
+
"@tiptap/extension-link": "2.27.2",
|
|
98
|
+
"@tiptap/extension-placeholder": "2.27.2",
|
|
99
|
+
"@tiptap/extension-strike": "2.27.2",
|
|
100
|
+
"@tiptap/extension-subscript": "2.27.2",
|
|
101
|
+
"@tiptap/extension-superscript": "2.27.2",
|
|
102
|
+
"@tiptap/extension-table": "2.27.2",
|
|
103
|
+
"@tiptap/extension-table-cell": "2.27.2",
|
|
104
|
+
"@tiptap/extension-table-header": "2.27.2",
|
|
105
|
+
"@tiptap/extension-table-row": "2.27.2",
|
|
106
|
+
"@tiptap/extension-task-item": "2.27.2",
|
|
107
|
+
"@tiptap/extension-task-list": "2.27.2",
|
|
108
|
+
"@tiptap/extension-text-align": "2.27.2",
|
|
109
|
+
"@tiptap/extension-text-style": "2.27.2",
|
|
110
|
+
"@tiptap/extension-underline": "2.27.2",
|
|
111
|
+
"@tiptap/extension-youtube": "2.27.2",
|
|
112
|
+
"@tiptap/pm": "2.27.2",
|
|
113
|
+
"@tiptap/react": "2.27.2",
|
|
114
|
+
"@tiptap/starter-kit": "2.27.2",
|
|
115
|
+
"lowlight": "^3.3.0",
|
|
116
|
+
"mathlive": "^0.105.3"
|
|
117
|
+
},
|
|
118
|
+
"engines": {
|
|
119
|
+
"node": ">=16.0.0"
|
|
120
|
+
},
|
|
121
|
+
"sideEffects": [
|
|
122
|
+
"*.css"
|
|
123
|
+
]
|
|
124
|
+
}
|