eddyter 1.3.41 → 1.3.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/ai/index.d.ts +10 -1
- package/dist/assets/style.css +85 -0
- package/dist/{html2pdf.bundle-85e30143.js → html2pdf.bundle-2448d0c9.js} +2 -2
- package/dist/{html2pdf.bundle-85e30143.js.map → html2pdf.bundle-2448d0c9.js.map} +1 -1
- package/dist/{html2pdf.bundle.min-eb51bd12.js → html2pdf.bundle.min-4c9e3abf.js} +2 -2
- package/dist/{html2pdf.bundle.min-eb51bd12.js.map → html2pdf.bundle.min-4c9e3abf.js.map} +1 -1
- package/dist/{index-0632c8fb.js → index-5a175541.js} +2 -2
- package/dist/{index-0632c8fb.js.map → index-5a175541.js.map} +1 -1
- package/dist/{index-7b5e3701.js → index-9ff3d80c.js} +193 -54
- package/dist/index-9ff3d80c.js.map +1 -0
- package/dist/{index-f679e2a3.js → index-ef9100c2.js} +18 -5
- package/dist/index-ef9100c2.js.map +1 -0
- package/dist/index.js +11 -11
- package/package.json +1 -1
- package/dist/index-7b5e3701.js.map +0 -1
- package/dist/index-f679e2a3.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
3
3
|
import { $getNodeByKey } from "lexical";
|
|
4
|
-
import { a as createLucideIcon, D as Download, T as Trash2, F as FileText, $ as $isFileNode } from "./index-
|
|
4
|
+
import { a as createLucideIcon, D as Download, T as Trash2, F as FileText, $ as $isFileNode } from "./index-9ff3d80c.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "axios";
|
|
7
7
|
import "react-dom";
|
|
@@ -187,4 +187,4 @@ const FileView = ({ src, fileName, fileSize, nodeKey }) => {
|
|
|
187
187
|
export {
|
|
188
188
|
FileView as default
|
|
189
189
|
};
|
|
190
|
-
//# sourceMappingURL=index-
|
|
190
|
+
//# sourceMappingURL=index-5a175541.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-0632c8fb.js","sources":["../../../node_modules/lucide-react/dist/esm/icons/file-archive.js","../../../node_modules/lucide-react/dist/esm/icons/file.js","../src/components/FileView/index.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.344.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst FileArchive = createLucideIcon(\"FileArchive\", [\n [\"path\", { d: \"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v18\", key: \"1oywqq\" }],\n [\"path\", { d: \"M14 2v4a2 2 0 0 0 2 2h4\", key: \"tnqrlb\" }],\n [\"circle\", { cx: \"10\", cy: \"20\", r: \"2\", key: \"1xzdoj\" }],\n [\"path\", { d: \"M10 7V6\", key: \"dljcrl\" }],\n [\"path\", { d: \"M10 12v-1\", key: \"v7bkov\" }],\n [\"path\", { d: \"M10 18v-2\", key: \"1cjy8d\" }]\n]);\n\nexport { FileArchive as default };\n//# sourceMappingURL=file-archive.js.map\n","/**\n * @license lucide-react v0.344.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst File = createLucideIcon(\"File\", [\n [\"path\", { d: \"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\", key: \"1rqfz7\" }],\n [\"path\", { d: \"M14 2v4a2 2 0 0 0 2 2h4\", key: \"tnqrlb\" }]\n]);\n\nexport { File as default };\n//# sourceMappingURL=file.js.map\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { $getNodeByKey } from \"lexical\";\nimport { Download, File as FileIcon, FileArchive, FileText, Trash2 } from \"lucide-react\";\nimport React from \"react\";\nimport { $isFileNode } from \"src/nodes/FileNode\";\n\ninterface FileViewProps {\n src: string;\n fileName: string;\n fileSize?: number;\n nodeKey: string;\n}\n\n// Helper to format file size\nconst formatFileSize = (bytes?: number): string => {\n if (!bytes) return \"\";\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;\n};\n\n// Helper to get file extension\nconst getFileExtension = (fileName: string): string => {\n const parts = fileName.split(\".\");\n return parts.length > 1 ? parts[parts.length - 1].toLowerCase() : \"\";\n};\n\n// Helper to get icon based on file type\nconst getFileIcon = (fileName: string) => {\n const ext = getFileExtension(fileName);\n\n if ([\"pdf\", \"doc\", \"docx\", \"txt\", \"odt\"].includes(ext)) {\n return <FileText className=\"cteditor-w-8 cteditor-h-8 cteditor-text-blue-500\" />;\n }\n if ([\"zip\", \"rar\", \"7z\", \"tar\", \"gz\"].includes(ext)) {\n return <FileArchive className=\"cteditor-w-8 cteditor-h-8 cteditor-text-orange-500\" />;\n }\n return <FileIcon className=\"cteditor-w-8 cteditor-h-8 cteditor-text-gray-500\" />;\n};\n\nconst FileView: React.FC<FileViewProps> = ({ src, fileName, fileSize, nodeKey }) => {\n const [editor] = useLexicalComposerContext();\n\n // Validate props to prevent errors\n if (!src || !fileName) {\n console.error('FileView: Missing required props', { src, fileName, fileSize, nodeKey });\n return (\n <div className=\"cteditor-inline-flex cteditor-items-center cteditor-gap-3 cteditor-px-4 cteditor-py-3 cteditor-my-2 cteditor-border cteditor-border-destructive cteditor-rounded-lg cteditor-bg-destructive/10\">\n <div className=\"cteditor-text-sm cteditor-text-destructive\">\n Error loading file\n </div>\n </div>\n );\n }\n\n const handleDownload = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n try {\n // Check if it's a data URL (base64)\n if (src.startsWith('data:')) {\n // Convert data URL to blob for proper download\n const arr = src.split(',');\n const mimeMatch = arr[0].match(/:(.*?);/);\n const mime = mimeMatch ? mimeMatch[1] : 'application/octet-stream';\n const bstr = atob(arr[1]);\n let n = bstr.length;\n const u8arr = new Uint8Array(n);\n\n while (n--) {\n u8arr[n] = bstr.charCodeAt(n);\n }\n\n const blob = new Blob([u8arr], { type: mime });\n const blobUrl = URL.createObjectURL(blob);\n\n const link = document.createElement(\"a\");\n link.href = blobUrl;\n link.download = fileName;\n link.style.display = \"none\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n\n // Clean up the blob URL after a delay\n setTimeout(() => URL.revokeObjectURL(blobUrl), 100);\n } else {\n // Regular URL - just download directly\n const link = document.createElement(\"a\");\n link.href = src;\n link.download = fileName;\n link.style.display = \"none\";\n link.target = \"_blank\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n }\n } catch (error) {\n console.error(\"Error downloading file:\", error);\n // Fallback: try to open in new tab\n window.open(src, '_blank');\n }\n };\n\n const handleDeleteFile = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isFileNode(node)) {\n node.remove();\n }\n });\n };\n\n return (\n <div\n className=\"cteditor-inline-flex cteditor-items-center cteditor-gap-3 cteditor-py-1 cteditor-px-2 cteditor-my-2 cteditor-border cteditor-border-border cteditor-rounded-lg cteditor-bg-background hover:cteditor-bg-accent/50 cteditor-transition-colors cteditor-cursor-pointer cteditor-max-w-md\"\n onClick={handleDownload}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n handleDownload(e as any);\n }\n }}\n >\n {/* File Icon */}\n <div className=\"cteditor-flex-shrink-0 *:cteditor-size-5\">\n {getFileIcon(fileName)}\n </div>\n\n {/* File Info */}\n <div className=\"cteditor-flex-1 cteditor-min-w-0\">\n <div className=\"cteditor-font-medium cteditor-text-xs cteditor-text-foreground cteditor-truncate\">\n {fileName}\n </div>\n {fileSize && (\n <div className=\"cteditor-text-xs cteditor-text-muted-foreground\">\n {formatFileSize(fileSize)}\n </div>\n )}\n </div>\n\n {/* Action Buttons - Download and Delete */}\n <div className=\"cteditor-flex cteditor-gap-1 cteditor-flex-shrink-0\">\n <button\n onClick={handleDownload}\n className=\"cteditor-p-1 cteditor-rounded-md hover:cteditor-bg-accent cteditor-transition-colors\"\n aria-label=\"Download file\"\n title=\"Download file\"\n >\n <Download className=\"cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground\" />\n </button>\n <button\n onClick={handleDeleteFile}\n className=\"cteditor-p-1 cteditor-rounded-md hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors\"\n aria-label=\"Delete file\"\n title=\"Delete file\"\n >\n <Trash2 className=\"cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground\" />\n </button>\n </div>\n </div>\n );\n};\n\nexport default FileView;\n"],"names":["FileIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAM,cAAc,iBAAiB,eAAe;AAAA,EAClD,CAAC,QAAQ,EAAE,GAAG,oDAAoD,KAAK,SAAQ,CAAE;AAAA,EACjF,CAAC,QAAQ,EAAE,GAAG,2BAA2B,KAAK,SAAQ,CAAE;AAAA,EACxD,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,KAAK,KAAK,UAAU;AAAA,EACxD,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC,CAAC,QAAQ,EAAE,GAAG,aAAa,KAAK,SAAQ,CAAE;AAAA,EAC1C,CAAC,QAAQ,EAAE,GAAG,aAAa,KAAK,SAAQ,CAAE;AAC5C,CAAC;AChBD;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAM,OAAO,iBAAiB,QAAQ;AAAA,EACpC,CAAC,QAAQ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ucide-react/dist/esm/icons/file-archive.js","../../../node_modules/lucide-react/dist/esm/icons/file.js","../src/components/FileView/index.tsx"],"sourcesContent":["/**\n * @license lucide-react v0.344.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst FileArchive = createLucideIcon(\"FileArchive\", [\n [\"path\", { d: \"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v18\", key: \"1oywqq\" }],\n [\"path\", { d: \"M14 2v4a2 2 0 0 0 2 2h4\", key: \"tnqrlb\" }],\n [\"circle\", { cx: \"10\", cy: \"20\", r: \"2\", key: \"1xzdoj\" }],\n [\"path\", { d: \"M10 7V6\", key: \"dljcrl\" }],\n [\"path\", { d: \"M10 12v-1\", key: \"v7bkov\" }],\n [\"path\", { d: \"M10 18v-2\", key: \"1cjy8d\" }]\n]);\n\nexport { FileArchive as default };\n//# sourceMappingURL=file-archive.js.map\n","/**\n * @license lucide-react v0.344.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst File = createLucideIcon(\"File\", [\n [\"path\", { d: \"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z\", key: \"1rqfz7\" }],\n [\"path\", { d: \"M14 2v4a2 2 0 0 0 2 2h4\", key: \"tnqrlb\" }]\n]);\n\nexport { File as default };\n//# sourceMappingURL=file.js.map\n","import { useLexicalComposerContext } from \"@lexical/react/LexicalComposerContext\";\nimport { $getNodeByKey } from \"lexical\";\nimport { Download, File as FileIcon, FileArchive, FileText, Trash2 } from \"lucide-react\";\nimport React from \"react\";\nimport { $isFileNode } from \"src/nodes/FileNode\";\n\ninterface FileViewProps {\n src: string;\n fileName: string;\n fileSize?: number;\n nodeKey: string;\n}\n\n// Helper to format file size\nconst formatFileSize = (bytes?: number): string => {\n if (!bytes) return \"\";\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;\n};\n\n// Helper to get file extension\nconst getFileExtension = (fileName: string): string => {\n const parts = fileName.split(\".\");\n return parts.length > 1 ? parts[parts.length - 1].toLowerCase() : \"\";\n};\n\n// Helper to get icon based on file type\nconst getFileIcon = (fileName: string) => {\n const ext = getFileExtension(fileName);\n\n if ([\"pdf\", \"doc\", \"docx\", \"txt\", \"odt\"].includes(ext)) {\n return <FileText className=\"cteditor-w-8 cteditor-h-8 cteditor-text-blue-500\" />;\n }\n if ([\"zip\", \"rar\", \"7z\", \"tar\", \"gz\"].includes(ext)) {\n return <FileArchive className=\"cteditor-w-8 cteditor-h-8 cteditor-text-orange-500\" />;\n }\n return <FileIcon className=\"cteditor-w-8 cteditor-h-8 cteditor-text-gray-500\" />;\n};\n\nconst FileView: React.FC<FileViewProps> = ({ src, fileName, fileSize, nodeKey }) => {\n const [editor] = useLexicalComposerContext();\n\n // Validate props to prevent errors\n if (!src || !fileName) {\n console.error('FileView: Missing required props', { src, fileName, fileSize, nodeKey });\n return (\n <div className=\"cteditor-inline-flex cteditor-items-center cteditor-gap-3 cteditor-px-4 cteditor-py-3 cteditor-my-2 cteditor-border cteditor-border-destructive cteditor-rounded-lg cteditor-bg-destructive/10\">\n <div className=\"cteditor-text-sm cteditor-text-destructive\">\n Error loading file\n </div>\n </div>\n );\n }\n\n const handleDownload = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n try {\n // Check if it's a data URL (base64)\n if (src.startsWith('data:')) {\n // Convert data URL to blob for proper download\n const arr = src.split(',');\n const mimeMatch = arr[0].match(/:(.*?);/);\n const mime = mimeMatch ? mimeMatch[1] : 'application/octet-stream';\n const bstr = atob(arr[1]);\n let n = bstr.length;\n const u8arr = new Uint8Array(n);\n\n while (n--) {\n u8arr[n] = bstr.charCodeAt(n);\n }\n\n const blob = new Blob([u8arr], { type: mime });\n const blobUrl = URL.createObjectURL(blob);\n\n const link = document.createElement(\"a\");\n link.href = blobUrl;\n link.download = fileName;\n link.style.display = \"none\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n\n // Clean up the blob URL after a delay\n setTimeout(() => URL.revokeObjectURL(blobUrl), 100);\n } else {\n // Regular URL - just download directly\n const link = document.createElement(\"a\");\n link.href = src;\n link.download = fileName;\n link.style.display = \"none\";\n link.target = \"_blank\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n }\n } catch (error) {\n console.error(\"Error downloading file:\", error);\n // Fallback: try to open in new tab\n window.open(src, '_blank');\n }\n };\n\n const handleDeleteFile = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey);\n if ($isFileNode(node)) {\n node.remove();\n }\n });\n };\n\n return (\n <div\n className=\"cteditor-inline-flex cteditor-items-center cteditor-gap-3 cteditor-py-1 cteditor-px-2 cteditor-my-2 cteditor-border cteditor-border-border cteditor-rounded-lg cteditor-bg-background hover:cteditor-bg-accent/50 cteditor-transition-colors cteditor-cursor-pointer cteditor-max-w-md\"\n onClick={handleDownload}\n role=\"button\"\n tabIndex={0}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n handleDownload(e as any);\n }\n }}\n >\n {/* File Icon */}\n <div className=\"cteditor-flex-shrink-0 *:cteditor-size-5\">\n {getFileIcon(fileName)}\n </div>\n\n {/* File Info */}\n <div className=\"cteditor-flex-1 cteditor-min-w-0\">\n <div className=\"cteditor-font-medium cteditor-text-xs cteditor-text-foreground cteditor-truncate\">\n {fileName}\n </div>\n {fileSize && (\n <div className=\"cteditor-text-xs cteditor-text-muted-foreground\">\n {formatFileSize(fileSize)}\n </div>\n )}\n </div>\n\n {/* Action Buttons - Download and Delete */}\n <div className=\"cteditor-flex cteditor-gap-1 cteditor-flex-shrink-0\">\n <button\n onClick={handleDownload}\n className=\"cteditor-p-1 cteditor-rounded-md hover:cteditor-bg-accent cteditor-transition-colors\"\n aria-label=\"Download file\"\n title=\"Download file\"\n >\n <Download className=\"cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground\" />\n </button>\n <button\n onClick={handleDeleteFile}\n className=\"cteditor-p-1 cteditor-rounded-md hover:cteditor-bg-destructive hover:cteditor-text-destructive-foreground cteditor-transition-colors\"\n aria-label=\"Delete file\"\n title=\"Delete file\"\n >\n <Trash2 className=\"cteditor-w-4 cteditor-h-4 cteditor-text-muted-foreground\" />\n </button>\n </div>\n </div>\n );\n};\n\nexport default FileView;\n"],"names":["FileIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAM,cAAc,iBAAiB,eAAe;AAAA,EAClD,CAAC,QAAQ,EAAE,GAAG,oDAAoD,KAAK,SAAQ,CAAE;AAAA,EACjF,CAAC,QAAQ,EAAE,GAAG,2BAA2B,KAAK,SAAQ,CAAE;AAAA,EACxD,CAAC,UAAU,EAAE,IAAI,MAAM,IAAI,MAAM,GAAG,KAAK,KAAK,UAAU;AAAA,EACxD,CAAC,QAAQ,EAAE,GAAG,WAAW,KAAK,SAAQ,CAAE;AAAA,EACxC,CAAC,QAAQ,EAAE,GAAG,aAAa,KAAK,SAAQ,CAAE;AAAA,EAC1C,CAAC,QAAQ,EAAE,GAAG,aAAa,KAAK,SAAQ,CAAE;AAC5C,CAAC;AChBD;AAAA;AAAA;AAAA;AAAA;AAAA;AASA,MAAM,OAAO,iBAAiB,QAAQ;AAAA,EACpC,CAAC,QAAQ,EAAE,GAAG,8DAA8D,KAAK,SAAQ,CAAE;AAAA,EAC3F,CAAC,QAAQ,EAAE,GAAG,2BAA2B,KAAK,SAAQ,CAAE;AAC1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AAA,MACd;AAAA,IAAA,CACD;AAAA,EAAA;AAID,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,SAAS;AAAA,MACT,MAAK;AAAA,MACL,UAAU;AAAA,MACV,WAAW,CAAC,MAAM;AAChB,YAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;AACtC,YAAE,eAAe;AACjB,yBAAe,CAAQ;AAAA,QACzB;AAAA,MACF;AAAA,MAGA,UAAA;AAAA,QAAA,oBAAC,OAAI,EAAA,WAAU,4CACZ,UAAA,YAAY,QAAQ,GACvB;AAAA,QAGA,qBAAC,OAAI,EAAA,WAAU,oCACb,UAAA;AAAA,UAAC,oBAAA,OAAA,EAAI,WAAU,oFACZ,UACH,UAAA;AAAA,UACC,YACE,oBAAA,OAAA,EAAI,WAAU,mDACZ,UAAA,eAAe,QAAQ,GAC1B;AAAA,QAAA,GAEJ;AAAA,QAGA,qBAAC,OAAI,EAAA,WAAU,uDACb,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAS;AAAA,cACT,WAAU;AAAA,cACV,cAAW;AAAA,cACX,OAAM;AAAA,cAEN,UAAA,oBAAC,UAAS,EAAA,WAAU,2DAA2D,CAAA;AAAA,YAAA;AAAA,UACjF;AAAA,UACA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,SAAS;AAAA,cACT,WAAU;AAAA,cACV,cAAW;AAAA,cACX,OAAM;AAAA,cAEN,UAAA,oBAAC,QAAO,EAAA,WAAU,2DAA2D,CAAA;AAAA,YAAA;AAAA,UAC/E;AAAA,QAAA,GACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;","x_google_ignoreList":[0,1]}
|
|
@@ -2065,6 +2065,58 @@ const Toaster = /* @__PURE__ */ React__default.forwardRef(function Toaster2(prop
|
|
|
2065
2065
|
}))
|
|
2066
2066
|
);
|
|
2067
2067
|
});
|
|
2068
|
+
let ApiKeyRequiredError$1 = class ApiKeyRequiredError extends Error {
|
|
2069
|
+
constructor(message, code) {
|
|
2070
|
+
super(message);
|
|
2071
|
+
__publicField(this, "code");
|
|
2072
|
+
this.name = "ApiKeyRequiredError";
|
|
2073
|
+
this.code = code;
|
|
2074
|
+
}
|
|
2075
|
+
};
|
|
2076
|
+
let CreditError$1 = class CreditError extends Error {
|
|
2077
|
+
constructor(message, code) {
|
|
2078
|
+
super(message);
|
|
2079
|
+
__publicField(this, "code");
|
|
2080
|
+
this.name = "CreditError";
|
|
2081
|
+
this.code = code;
|
|
2082
|
+
}
|
|
2083
|
+
};
|
|
2084
|
+
function handleApiError(error) {
|
|
2085
|
+
var _a, _b;
|
|
2086
|
+
const responseData = (_a = error == null ? void 0 : error.response) == null ? void 0 : _a.data;
|
|
2087
|
+
if (responseData) {
|
|
2088
|
+
const { code, message } = responseData;
|
|
2089
|
+
if (code === "API_KEYS_REQUIRED" || code === "NO_API_KEYS_CONFIGURED") {
|
|
2090
|
+
throw new ApiKeyRequiredError$1(
|
|
2091
|
+
message || "Please upload at least one AI provider API key (OpenAI, Anthropic, or Grok).",
|
|
2092
|
+
code
|
|
2093
|
+
);
|
|
2094
|
+
}
|
|
2095
|
+
if (code === "API_KEYS_DISABLED") {
|
|
2096
|
+
throw new ApiKeyRequiredError$1(
|
|
2097
|
+
message || "Your API keys are currently disabled. Please enable them to use AI features.",
|
|
2098
|
+
code
|
|
2099
|
+
);
|
|
2100
|
+
}
|
|
2101
|
+
if (((_b = error == null ? void 0 : error.response) == null ? void 0 : _b.status) === 500 && (message == null ? void 0 : message.includes("BYOK_NO_"))) {
|
|
2102
|
+
const userMessage = message.replace(/^BYOK_NO_\w+:\s*/, "");
|
|
2103
|
+
throw new ApiKeyRequiredError$1(userMessage, "BYOK_API_KEY_REQUIRED");
|
|
2104
|
+
}
|
|
2105
|
+
if (code === "INSUFFICIENT_CREDITS") {
|
|
2106
|
+
throw new CreditError$1("Insufficient credits. Please purchase more credits.", code);
|
|
2107
|
+
}
|
|
2108
|
+
if (code === "NO_ACTIVE_SUBSCRIPTION") {
|
|
2109
|
+
throw new CreditError$1("No active subscription. Please subscribe to continue.", code);
|
|
2110
|
+
}
|
|
2111
|
+
if (code === "SUBSCRIPTION_EXPIRED") {
|
|
2112
|
+
throw new CreditError$1("Your subscription has expired. Please renew to continue.", code);
|
|
2113
|
+
}
|
|
2114
|
+
if (message) {
|
|
2115
|
+
throw new Error(message);
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
throw error;
|
|
2119
|
+
}
|
|
2068
2120
|
const AiJsonResponse = async ({ content, apiKey }) => {
|
|
2069
2121
|
try {
|
|
2070
2122
|
const res = await backendAPI.post(
|
|
@@ -2075,7 +2127,7 @@ const AiJsonResponse = async ({ content, apiKey }) => {
|
|
|
2075
2127
|
return res.data;
|
|
2076
2128
|
} catch (error) {
|
|
2077
2129
|
console.error("Error in AiJsonResponse:", error);
|
|
2078
|
-
|
|
2130
|
+
handleApiError(error);
|
|
2079
2131
|
}
|
|
2080
2132
|
};
|
|
2081
2133
|
const AiEditorAction = async ({
|
|
@@ -2092,7 +2144,7 @@ const AiEditorAction = async ({
|
|
|
2092
2144
|
return res.data;
|
|
2093
2145
|
} catch (error) {
|
|
2094
2146
|
console.error("Error in AiEditorAction:", error);
|
|
2095
|
-
|
|
2147
|
+
handleApiError(error);
|
|
2096
2148
|
}
|
|
2097
2149
|
};
|
|
2098
2150
|
const AiTextEnhance = async ({ content, apiKey }) => {
|
|
@@ -2105,7 +2157,7 @@ const AiTextEnhance = async ({ content, apiKey }) => {
|
|
|
2105
2157
|
return res.data;
|
|
2106
2158
|
} catch (error) {
|
|
2107
2159
|
console.error("Error in AiTextEnhance:", error);
|
|
2108
|
-
|
|
2160
|
+
handleApiError(error);
|
|
2109
2161
|
}
|
|
2110
2162
|
};
|
|
2111
2163
|
const GetCreditsInfo = async ({ apiKey }) => {
|
|
@@ -2142,13 +2194,13 @@ const AiTextTransform = async ({ content, apiKey }) => {
|
|
|
2142
2194
|
return res.data;
|
|
2143
2195
|
} catch (error) {
|
|
2144
2196
|
console.error("Error in AiTextTransform:", error);
|
|
2145
|
-
|
|
2197
|
+
handleApiError(error);
|
|
2146
2198
|
}
|
|
2147
2199
|
};
|
|
2148
2200
|
const AI_ACTION_COMMAND = createCommand(
|
|
2149
2201
|
"AI_ACTION_COMMAND"
|
|
2150
2202
|
);
|
|
2151
|
-
const ImageView = React__default.lazy(() => import("./index-
|
|
2203
|
+
const ImageView = React__default.lazy(() => import("./index-ef9100c2.js"));
|
|
2152
2204
|
function isGoogleDocCheckboxImg(img) {
|
|
2153
2205
|
return img.parentElement != null && img.parentElement.tagName === "LI" && img.previousSibling === null && img.getAttribute("aria-roledescription") === "checkbox";
|
|
2154
2206
|
}
|
|
@@ -8590,7 +8642,22 @@ const ImageGenerationDialog = ({
|
|
|
8590
8642
|
handleClose();
|
|
8591
8643
|
} catch (error) {
|
|
8592
8644
|
console.error("Error generating image:", error);
|
|
8593
|
-
|
|
8645
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
8646
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
8647
|
+
toast.error(title, {
|
|
8648
|
+
description: error.message,
|
|
8649
|
+
duration: 8e3
|
|
8650
|
+
});
|
|
8651
|
+
} else if (error instanceof CreditError$1) {
|
|
8652
|
+
toast.error("Credits Issue", {
|
|
8653
|
+
description: error.message,
|
|
8654
|
+
duration: 8e3
|
|
8655
|
+
});
|
|
8656
|
+
} else {
|
|
8657
|
+
toast.error("Image generation failed", {
|
|
8658
|
+
description: error instanceof Error ? error.message : "An error occurred"
|
|
8659
|
+
});
|
|
8660
|
+
}
|
|
8594
8661
|
}
|
|
8595
8662
|
};
|
|
8596
8663
|
const handleClose = () => {
|
|
@@ -9069,9 +9136,22 @@ const AIRephrasePlugin = () => {
|
|
|
9069
9136
|
} catch (error) {
|
|
9070
9137
|
console.error("Error in AI stream:", error);
|
|
9071
9138
|
toast.dismiss(loadingToastId);
|
|
9072
|
-
|
|
9073
|
-
|
|
9074
|
-
|
|
9139
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
9140
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
9141
|
+
toast.error(title, {
|
|
9142
|
+
description: error.message,
|
|
9143
|
+
duration: 8e3
|
|
9144
|
+
});
|
|
9145
|
+
} else if (error instanceof CreditError$1) {
|
|
9146
|
+
toast.error("Credits Issue", {
|
|
9147
|
+
description: error.message,
|
|
9148
|
+
duration: 8e3
|
|
9149
|
+
});
|
|
9150
|
+
} else {
|
|
9151
|
+
toast.error(`${actionName} failed`, {
|
|
9152
|
+
description: error instanceof Error ? error.message : "An error occurred"
|
|
9153
|
+
});
|
|
9154
|
+
}
|
|
9075
9155
|
return false;
|
|
9076
9156
|
}
|
|
9077
9157
|
};
|
|
@@ -9130,9 +9210,22 @@ const AIRephrasePlugin = () => {
|
|
|
9130
9210
|
} catch (error) {
|
|
9131
9211
|
console.error("Error in translation:", error);
|
|
9132
9212
|
toast.dismiss(loadingToastId);
|
|
9133
|
-
|
|
9134
|
-
|
|
9135
|
-
|
|
9213
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
9214
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
9215
|
+
toast.error(title, {
|
|
9216
|
+
description: error.message,
|
|
9217
|
+
duration: 8e3
|
|
9218
|
+
});
|
|
9219
|
+
} else if (error instanceof CreditError$1) {
|
|
9220
|
+
toast.error("Credits Issue", {
|
|
9221
|
+
description: error.message,
|
|
9222
|
+
duration: 8e3
|
|
9223
|
+
});
|
|
9224
|
+
} else {
|
|
9225
|
+
toast.error("Translation failed", {
|
|
9226
|
+
description: error instanceof Error ? error.message : "An error occurred"
|
|
9227
|
+
});
|
|
9228
|
+
}
|
|
9136
9229
|
return false;
|
|
9137
9230
|
}
|
|
9138
9231
|
};
|
|
@@ -9187,9 +9280,22 @@ const AIRephrasePlugin = () => {
|
|
|
9187
9280
|
} catch (error) {
|
|
9188
9281
|
console.error("Error in tone adjustment:", error);
|
|
9189
9282
|
toast.dismiss(loadingToastId);
|
|
9190
|
-
|
|
9191
|
-
|
|
9192
|
-
|
|
9283
|
+
if (error instanceof ApiKeyRequiredError$1) {
|
|
9284
|
+
const title = error.code === "API_KEYS_DISABLED" ? "API Keys Disabled" : "API Key Required";
|
|
9285
|
+
toast.error(title, {
|
|
9286
|
+
description: error.message,
|
|
9287
|
+
duration: 8e3
|
|
9288
|
+
});
|
|
9289
|
+
} else if (error instanceof CreditError$1) {
|
|
9290
|
+
toast.error("Credits Issue", {
|
|
9291
|
+
description: error.message,
|
|
9292
|
+
duration: 8e3
|
|
9293
|
+
});
|
|
9294
|
+
} else {
|
|
9295
|
+
toast.error("Tone adjustment failed", {
|
|
9296
|
+
description: error instanceof Error ? error.message : "An error occurred"
|
|
9297
|
+
});
|
|
9298
|
+
}
|
|
9193
9299
|
return false;
|
|
9194
9300
|
}
|
|
9195
9301
|
};
|
|
@@ -16430,7 +16536,7 @@ const EmbedComponent = ({ url, displayType, alignment, width: initialWidth, heig
|
|
|
16430
16536
|
}
|
|
16431
16537
|
);
|
|
16432
16538
|
};
|
|
16433
|
-
const FileComponent = React$1.lazy(() => import("./index-
|
|
16539
|
+
const FileComponent = React$1.lazy(() => import("./index-5a175541.js"));
|
|
16434
16540
|
function convertFileElement(domNode) {
|
|
16435
16541
|
if (domNode instanceof HTMLDivElement) {
|
|
16436
16542
|
const dataUrl = domNode.getAttribute("data-lexical-file-src");
|
|
@@ -19388,7 +19494,7 @@ const useEditorToolbar = () => {
|
|
|
19388
19494
|
clearFormatting
|
|
19389
19495
|
};
|
|
19390
19496
|
};
|
|
19391
|
-
class
|
|
19497
|
+
class ApiKeyRequiredError2 extends Error {
|
|
19392
19498
|
constructor(message, code) {
|
|
19393
19499
|
super(message);
|
|
19394
19500
|
__publicField(this, "code");
|
|
@@ -19412,7 +19518,7 @@ const getAssemblyAIToken = async (apiKey) => {
|
|
|
19412
19518
|
if (responseData) {
|
|
19413
19519
|
const { code, message } = responseData;
|
|
19414
19520
|
if (code === "API_KEYS_REQUIRED" || code === "ASSEMBLYAI_KEY_REQUIRED" || code === "NO_API_KEYS_CONFIGURED") {
|
|
19415
|
-
throw new
|
|
19521
|
+
throw new ApiKeyRequiredError2(message || "API key configuration required", code);
|
|
19416
19522
|
}
|
|
19417
19523
|
if (code === "INSUFFICIENT_CREDITS") {
|
|
19418
19524
|
throw new Error("Insufficient credits for voice transcription. Please purchase more credits.");
|
|
@@ -19430,7 +19536,7 @@ const getAssemblyAIToken = async (apiKey) => {
|
|
|
19430
19536
|
throw error;
|
|
19431
19537
|
}
|
|
19432
19538
|
};
|
|
19433
|
-
class
|
|
19539
|
+
class CreditError2 extends Error {
|
|
19434
19540
|
constructor(message, code) {
|
|
19435
19541
|
super(message);
|
|
19436
19542
|
__publicField(this, "code");
|
|
@@ -19450,7 +19556,7 @@ const endVoiceSession = async (durationSeconds, apiKey) => {
|
|
|
19450
19556
|
});
|
|
19451
19557
|
const data = res.data;
|
|
19452
19558
|
if (data.credits && !data.credits.success) {
|
|
19453
|
-
throw new
|
|
19559
|
+
throw new CreditError2(
|
|
19454
19560
|
data.message || "Credit deduction failed",
|
|
19455
19561
|
data.code || data.credits.error || "CREDIT_DEDUCTION_FAILED"
|
|
19456
19562
|
);
|
|
@@ -19462,10 +19568,10 @@ const endVoiceSession = async (durationSeconds, apiKey) => {
|
|
|
19462
19568
|
if (responseData) {
|
|
19463
19569
|
const { code, message } = responseData;
|
|
19464
19570
|
if (code === "INSUFFICIENT_CREDITS") {
|
|
19465
|
-
throw new
|
|
19571
|
+
throw new CreditError2("Insufficient credits. Please purchase more credits.", code);
|
|
19466
19572
|
}
|
|
19467
19573
|
if (code === "CREDIT_DEDUCTION_FAILED") {
|
|
19468
|
-
throw new
|
|
19574
|
+
throw new CreditError2(message || "Failed to deduct credits", code);
|
|
19469
19575
|
}
|
|
19470
19576
|
if (message) {
|
|
19471
19577
|
throw new Error(message);
|
|
@@ -19611,7 +19717,7 @@ const useVoiceToText = ({ onTranscriptUpdate, onSessionEnd, apiKey }) => {
|
|
|
19611
19717
|
}
|
|
19612
19718
|
setIsRecording(true);
|
|
19613
19719
|
} catch (err) {
|
|
19614
|
-
if (err instanceof
|
|
19720
|
+
if (err instanceof ApiKeyRequiredError2) {
|
|
19615
19721
|
toast.error("API Key Required", {
|
|
19616
19722
|
description: "Please upload your AssemblyAI key in License Section > Manage API keys > API Keys to configure your keys.",
|
|
19617
19723
|
duration: 5e3
|
|
@@ -19721,7 +19827,7 @@ const useVoiceToText = ({ onTranscriptUpdate, onSessionEnd, apiKey }) => {
|
|
|
19721
19827
|
}
|
|
19722
19828
|
} catch (error2) {
|
|
19723
19829
|
console.error("Failed to end voice session:", error2);
|
|
19724
|
-
if (error2 instanceof
|
|
19830
|
+
if (error2 instanceof CreditError2) {
|
|
19725
19831
|
toast.error("Credit Error", {
|
|
19726
19832
|
description: error2.message,
|
|
19727
19833
|
duration: 5e3
|
|
@@ -20982,7 +21088,7 @@ const useVoiceRecording = (apiKey) => {
|
|
|
20982
21088
|
setIsRecording(true);
|
|
20983
21089
|
updateCursorStyle(true);
|
|
20984
21090
|
} catch (err) {
|
|
20985
|
-
if (err instanceof
|
|
21091
|
+
if (err instanceof ApiKeyRequiredError2) {
|
|
20986
21092
|
toast.error("API Key Required", {
|
|
20987
21093
|
description: "Please upload your AssemblyAI key in License Section > Manage API keys > API Keys to configure your keys.",
|
|
20988
21094
|
duration: 5e3
|
|
@@ -21087,7 +21193,7 @@ const useVoiceRecording = (apiKey) => {
|
|
|
21087
21193
|
await endVoiceSession(finalElapsedTime, apiKeyRef.current);
|
|
21088
21194
|
} catch (error2) {
|
|
21089
21195
|
console.error("Failed to end voice session:", error2);
|
|
21090
|
-
if (error2 instanceof
|
|
21196
|
+
if (error2 instanceof CreditError2) {
|
|
21091
21197
|
toast.error("Credit Error", {
|
|
21092
21198
|
description: error2.message,
|
|
21093
21199
|
duration: 5e3
|
|
@@ -21226,10 +21332,10 @@ const PDF_CONFIG = {
|
|
|
21226
21332
|
};
|
|
21227
21333
|
const loadHtml2Pdf = async () => {
|
|
21228
21334
|
try {
|
|
21229
|
-
const mod = await import("./html2pdf.bundle.min-
|
|
21335
|
+
const mod = await import("./html2pdf.bundle.min-4c9e3abf.js").then((n) => n.h);
|
|
21230
21336
|
return (mod == null ? void 0 : mod.default) || mod;
|
|
21231
21337
|
} catch {
|
|
21232
|
-
const mod2 = await import("./html2pdf.bundle-
|
|
21338
|
+
const mod2 = await import("./html2pdf.bundle-2448d0c9.js").then((n) => n.h);
|
|
21233
21339
|
return (mod2 == null ? void 0 : mod2.default) || mod2;
|
|
21234
21340
|
}
|
|
21235
21341
|
};
|
|
@@ -28565,6 +28671,12 @@ function normalizeCodeNodeLineBreaks(codeNode) {
|
|
|
28565
28671
|
node.remove();
|
|
28566
28672
|
}
|
|
28567
28673
|
});
|
|
28674
|
+
let lastChild = codeNode.getLastChild();
|
|
28675
|
+
while (lastChild && $isLineBreakNode(lastChild)) {
|
|
28676
|
+
const toRemove = lastChild;
|
|
28677
|
+
lastChild = toRemove.getPreviousSibling();
|
|
28678
|
+
toRemove.remove();
|
|
28679
|
+
}
|
|
28568
28680
|
}
|
|
28569
28681
|
function CodeBlockNormalizerPlugin() {
|
|
28570
28682
|
const [editor] = useLexicalComposerContext();
|
|
@@ -39575,7 +39687,7 @@ const WordCountPlugin = () => {
|
|
|
39575
39687
|
] }),
|
|
39576
39688
|
/* @__PURE__ */ jsxs("span", { className: "cteditor-text-[10px] cteditor-text-gray-400", children: [
|
|
39577
39689
|
"v",
|
|
39578
|
-
"1.3.
|
|
39690
|
+
"1.3.42"
|
|
39579
39691
|
] })
|
|
39580
39692
|
] });
|
|
39581
39693
|
};
|
|
@@ -40027,6 +40139,10 @@ function applyGenericSafeStyles(container, codeBlockStyles) {
|
|
|
40027
40139
|
function applyCodeSyntaxHighlighting(container, codeBlockStyles) {
|
|
40028
40140
|
const codeBlocks = container.querySelectorAll('code, pre[data-language], pre[data-highlight-language], pre[spellcheck="false"]');
|
|
40029
40141
|
codeBlocks.forEach((codeBlock) => {
|
|
40142
|
+
const htmlCodeBlock = codeBlock;
|
|
40143
|
+
if (htmlCodeBlock.classList.contains("PlaygroundEditorTheme__textCode") || htmlCodeBlock.classList.contains("bg-foreground/15") || htmlCodeBlock.querySelector(".PlaygroundEditorTheme__textCode") || htmlCodeBlock.querySelector('[class*="textCode"]')) {
|
|
40144
|
+
return;
|
|
40145
|
+
}
|
|
40030
40146
|
const spans = codeBlock.querySelectorAll("span");
|
|
40031
40147
|
spans.forEach((span) => {
|
|
40032
40148
|
const htmlSpan = span;
|
|
@@ -40047,6 +40163,9 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40047
40163
|
const codeBlocks = container.querySelectorAll('code, pre[data-language], pre[data-highlight-language], pre[spellcheck="false"]');
|
|
40048
40164
|
codeBlocks.forEach((codeBlock) => {
|
|
40049
40165
|
const htmlCodeBlock = codeBlock;
|
|
40166
|
+
if (htmlCodeBlock.classList.contains("PlaygroundEditorTheme__textCode") || htmlCodeBlock.classList.contains("bg-foreground/15") || htmlCodeBlock.querySelector(".PlaygroundEditorTheme__textCode") || htmlCodeBlock.querySelector('[class*="textCode"]')) {
|
|
40167
|
+
return;
|
|
40168
|
+
}
|
|
40050
40169
|
const brElements = Array.from(htmlCodeBlock.querySelectorAll("br"));
|
|
40051
40170
|
const toRemove = [];
|
|
40052
40171
|
for (let i2 = 0; i2 < brElements.length - 1; i2++) {
|
|
@@ -40058,6 +40177,12 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40058
40177
|
}
|
|
40059
40178
|
}
|
|
40060
40179
|
toRemove.forEach((br) => br.remove());
|
|
40180
|
+
let lastChild = htmlCodeBlock.lastChild;
|
|
40181
|
+
while (lastChild && lastChild.nodeName === "BR") {
|
|
40182
|
+
const toRemove2 = lastChild;
|
|
40183
|
+
lastChild = lastChild.previousSibling;
|
|
40184
|
+
toRemove2.remove();
|
|
40185
|
+
}
|
|
40061
40186
|
const brCount = htmlCodeBlock.querySelectorAll("br").length;
|
|
40062
40187
|
const lineCount = brCount + 1;
|
|
40063
40188
|
const lineNumbers = [];
|
|
@@ -40066,7 +40191,7 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40066
40191
|
}
|
|
40067
40192
|
const lineNumbersStr = lineNumbers.join("\n");
|
|
40068
40193
|
const maxDigits = lineCount.toString().length;
|
|
40069
|
-
const gutterWidth = Math.max(
|
|
40194
|
+
const gutterWidth = Math.max(25, maxDigits * 8) + 16;
|
|
40070
40195
|
const gutter = container.ownerDocument.createElement("div");
|
|
40071
40196
|
gutter.className = "code-line-numbers";
|
|
40072
40197
|
gutter.textContent = lineNumbersStr;
|
|
@@ -40080,7 +40205,7 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40080
40205
|
"vertical-align: top",
|
|
40081
40206
|
`width: ${gutterWidth}px`,
|
|
40082
40207
|
`min-width: ${gutterWidth}px`,
|
|
40083
|
-
"padding:
|
|
40208
|
+
"padding: 8px",
|
|
40084
40209
|
`background-color: ${gutterBg}`,
|
|
40085
40210
|
`color: ${gutterColor}`,
|
|
40086
40211
|
"text-align: right",
|
|
@@ -40088,8 +40213,8 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40088
40213
|
`font-size: ${fontSize}`,
|
|
40089
40214
|
`line-height: ${lineHeight}`,
|
|
40090
40215
|
"border-right: 1px solid #404040",
|
|
40091
|
-
"border-top-left-radius:
|
|
40092
|
-
"border-bottom-left-radius:
|
|
40216
|
+
"border-top-left-radius: 6px",
|
|
40217
|
+
"border-bottom-left-radius: 6px",
|
|
40093
40218
|
"user-select: none",
|
|
40094
40219
|
"white-space: pre",
|
|
40095
40220
|
"box-sizing: border-box"
|
|
@@ -40099,7 +40224,7 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40099
40224
|
codeContent.style.cssText = [
|
|
40100
40225
|
"display: table-cell",
|
|
40101
40226
|
"vertical-align: top",
|
|
40102
|
-
"padding:
|
|
40227
|
+
"padding: 8px 8px 8px 12px",
|
|
40103
40228
|
`font-family: ${fontFamily}`,
|
|
40104
40229
|
`font-size: ${fontSize}`,
|
|
40105
40230
|
`line-height: ${lineHeight}`,
|
|
@@ -40118,8 +40243,9 @@ function processCodeBlocks(container, codeBlockStyles) {
|
|
|
40118
40243
|
"width: 100%",
|
|
40119
40244
|
`background-color: ${codeBlockBg}`,
|
|
40120
40245
|
`color: ${codeBlockText}`,
|
|
40121
|
-
"border-radius:
|
|
40122
|
-
"
|
|
40246
|
+
"border-radius: 6px",
|
|
40247
|
+
"border: 1px solid #404040",
|
|
40248
|
+
"margin: 8px 0",
|
|
40123
40249
|
"overflow: hidden"
|
|
40124
40250
|
].join("; ");
|
|
40125
40251
|
htmlCodeBlock.appendChild(gutter);
|
|
@@ -40306,18 +40432,29 @@ function preprocessInitialContent(html) {
|
|
|
40306
40432
|
let body = doc.body;
|
|
40307
40433
|
if (body.children.length === 1) {
|
|
40308
40434
|
const firstChild = body.children[0];
|
|
40309
|
-
if (firstChild.tagName === "DIV" &&
|
|
40435
|
+
if (firstChild.tagName === "DIV" && // New export wrapper with background-color and color
|
|
40436
|
+
(firstChild.style.backgroundColor && firstChild.style.color && firstChild.style.padding || // Editor content wrapper class
|
|
40437
|
+
firstChild.classList.contains("editor-content-wrapper"))) {
|
|
40310
40438
|
const innerHtml = firstChild.innerHTML;
|
|
40311
40439
|
doc = parser.parseFromString(innerHtml, "text/html");
|
|
40312
40440
|
body = doc.body;
|
|
40313
40441
|
}
|
|
40314
40442
|
}
|
|
40315
|
-
const
|
|
40316
|
-
|
|
40317
|
-
|
|
40318
|
-
|
|
40319
|
-
|
|
40320
|
-
|
|
40443
|
+
const styleElements = body.querySelectorAll("style");
|
|
40444
|
+
styleElements.forEach((style) => style.remove());
|
|
40445
|
+
const blockTags = ["H1", "H2", "H3", "H4", "H5", "H6", "P", "DIV", "PRE", "CODE", "BLOCKQUOTE", "UL", "OL", "TABLE"];
|
|
40446
|
+
const allSpans = Array.from(body.querySelectorAll("span"));
|
|
40447
|
+
allSpans.forEach((span) => {
|
|
40448
|
+
var _a;
|
|
40449
|
+
if (span.textContent && span.textContent.trim() === "" && span.textContent.length > 0) {
|
|
40450
|
+
const prev = span.previousElementSibling;
|
|
40451
|
+
const next = span.nextElementSibling;
|
|
40452
|
+
if (prev && next && blockTags.includes(prev.tagName) && blockTags.includes(next.tagName)) {
|
|
40453
|
+
const spacerParagraph = doc.createElement("p");
|
|
40454
|
+
spacerParagraph.className = "PlaygroundEditorTheme__paragraph";
|
|
40455
|
+
spacerParagraph.innerHTML = "<br>";
|
|
40456
|
+
(_a = span.parentNode) == null ? void 0 : _a.replaceChild(spacerParagraph, span);
|
|
40457
|
+
}
|
|
40321
40458
|
}
|
|
40322
40459
|
});
|
|
40323
40460
|
const tables = doc.querySelectorAll("table");
|
|
@@ -41335,11 +41472,13 @@ export {
|
|
|
41335
41472
|
$isFileNode as $,
|
|
41336
41473
|
AlignLeftIcon as A,
|
|
41337
41474
|
Button as B,
|
|
41338
|
-
|
|
41475
|
+
CreditError$1 as C,
|
|
41339
41476
|
Download as D,
|
|
41340
41477
|
ExternalLink as E,
|
|
41341
41478
|
FileText as F,
|
|
41479
|
+
useReactNativeBridge as G,
|
|
41342
41480
|
HtmlViewProvider as H,
|
|
41481
|
+
editorConfig as I,
|
|
41343
41482
|
LocalStoragePlugin$1 as L,
|
|
41344
41483
|
Sparkles as S,
|
|
41345
41484
|
Trash2 as T,
|
|
@@ -41358,16 +41497,16 @@ export {
|
|
|
41358
41497
|
AlignRightIcon as m,
|
|
41359
41498
|
Type as n,
|
|
41360
41499
|
AiJsonResponse as o,
|
|
41361
|
-
|
|
41362
|
-
|
|
41363
|
-
|
|
41364
|
-
|
|
41500
|
+
ApiKeyRequiredError$1 as p,
|
|
41501
|
+
EditorProvider as q,
|
|
41502
|
+
useEditor as r,
|
|
41503
|
+
ConfigurableEditorWithAuth as s,
|
|
41365
41504
|
toast as t,
|
|
41366
41505
|
useHtmlView as u,
|
|
41367
|
-
|
|
41368
|
-
|
|
41369
|
-
|
|
41370
|
-
|
|
41371
|
-
|
|
41506
|
+
ConfigurableEditor as v,
|
|
41507
|
+
verifyApiKey as w,
|
|
41508
|
+
LinkPreviewHover as x,
|
|
41509
|
+
ContentPreview as y,
|
|
41510
|
+
isReactNativeWebView as z
|
|
41372
41511
|
};
|
|
41373
|
-
//# sourceMappingURL=index-
|
|
41512
|
+
//# sourceMappingURL=index-9ff3d80c.js.map
|