diff --git a/index.html b/index.html index 472a3e5..06efb5f 100644 --- a/index.html +++ b/index.html @@ -3,9 +3,9 @@ - + - 杭州余杭逸文设计工作室 + 逸文设计工作室 diff --git a/package.json b/package.json index 5f4b041..81adb39 100644 --- a/package.json +++ b/package.json @@ -21,10 +21,12 @@ "react-dom": "^19.0.0" }, "devDependencies": { + "@kevisual/codemirror": "^0.0.12", "@tailwindcss/vite": "^4.0.15", "@types/react": "^19.0.0", "@types/react-dom": "^19.0.0", "@vitejs/plugin-react": "^4.3.4", + "react-toastify": "^11.0.5", "tailwindcss": "^4.0.15", "vite": "^6.2.3" } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3f14fdf..f4891b4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,6 +21,9 @@ importers: specifier: ^19.0.0 version: 19.0.0(react@19.0.0) devDependencies: + '@kevisual/codemirror': + specifier: ^0.0.12 + version: 0.0.12 '@tailwindcss/vite': specifier: ^4.0.15 version: 4.0.15(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)) @@ -33,6 +36,9 @@ importers: '@vitejs/plugin-react': specifier: ^4.3.4 version: 4.3.4(vite@6.2.3(jiti@2.4.2)(lightningcss@1.29.2)) + react-toastify: + specifier: ^11.0.5 + version: 11.0.5(react-dom@19.0.0(react@19.0.0))(react@19.0.0) tailwindcss: specifier: ^4.0.15 version: 4.0.15 @@ -125,6 +131,42 @@ packages: resolution: {integrity: sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==} engines: {node: '>=6.9.0'} + '@codemirror/autocomplete@6.18.6': + resolution: {integrity: sha512-PHHBXFomUs5DF+9tCOM/UoW6XQ4R44lLNNhRaW9PKPTU0D7lIjRg3ElxaJnTwsl/oHiR93WSXDBrekhoUGCPtg==} + + '@codemirror/commands@6.8.1': + resolution: {integrity: sha512-KlGVYufHMQzxbdQONiLyGQDUW0itrLZwq3CcY7xpv9ZLRHqzkBSoteocBHtMCoY7/Ci4xhzSrToIeLg7FxHuaw==} + + '@codemirror/lang-css@6.3.1': + resolution: {integrity: sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==} + + '@codemirror/lang-html@6.4.9': + resolution: {integrity: sha512-aQv37pIMSlueybId/2PVSP6NPnmurFDVmZwzc7jszd2KAF8qd4VBbvNYPXWQq90WIARjsdVkPbw29pszmHws3Q==} + + '@codemirror/lang-javascript@6.2.4': + resolution: {integrity: sha512-0WVmhp1QOqZ4Rt6GlVGwKJN3KW7Xh4H2q8ZZNGZaP6lRdxXJzmjm4FqvmOojVj6khWJHIb9sp7U/72W7xQgqAA==} + + '@codemirror/lang-json@6.0.2': + resolution: {integrity: sha512-x2OtO+AvwEHrEwR0FyyPtfDUiloG3rnVTSZV1W8UteaLL8/MajQd8DpvUb2YVzC+/T18aSDv0H9mu+xw0EStoQ==} + + '@codemirror/lang-markdown@6.3.3': + resolution: {integrity: sha512-1fn1hQAPWlSSMCvnF810AkhWpNLkJpl66CRfIy3vVl20Sl4NwChkorCHqpMtNbXr1EuMJsrDnhEpjZxKZ2UX3A==} + + '@codemirror/language@6.11.1': + resolution: {integrity: sha512-5kS1U7emOGV84vxC+ruBty5sUgcD0te6dyupyRVG2zaSjhTDM73LhVKUtVwiqSe6QwmEoA4SCiU8AKPFyumAWQ==} + + '@codemirror/lint@6.8.5': + resolution: {integrity: sha512-s3n3KisH7dx3vsoeGMxsbRAgKe4O1vbrnKBClm99PU0fWxmxsx5rR2PfqQgIt+2MMJBHbiJ5rfIdLYfB9NNvsA==} + + '@codemirror/search@6.5.11': + resolution: {integrity: sha512-KmWepDE6jUdL6n8cAAqIpRmLPBZ5ZKnicE8oGU/s3QrAVID+0VhLFrzUucVKHG5035/BSykhExDL/Xm7dHthiA==} + + '@codemirror/state@6.5.2': + resolution: {integrity: sha512-FVqsPqtPWKVVL3dPSxy8wEF/ymIEuVzF1PK3VbUgrxXpJUSHQWWZz4JMToquRxnkw+36LTamCZG2iua2Ptq0fA==} + + '@codemirror/view@6.37.2': + resolution: {integrity: sha512-XD3LdgQpxQs5jhOOZ2HRVT+Rj59O4Suc7g2ULvZ+Yi8eCkickrkZ5JFuoDhs2ST1mNI5zSsNYgR3NGa4OUrbnw==} + '@esbuild/aix-ppc64@0.25.1': resolution: {integrity: sha512-kfYGy8IdzTGy+z0vFGvExZtxkFlA4zAxgKEahG9KE1ScBjpQnFsNOX8KTU5ojNru5ed5CVoJYXFtoxaq5nFbjQ==} engines: {node: '>=18'} @@ -293,6 +335,36 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + '@kevisual/codemirror@0.0.12': + resolution: {integrity: sha512-W0m9WbP0p6Z/w/xlQGb5ek7QEqg66CEIr1AJRsCkh+24NcWKEV5x0WhusXtJFC0oxGlGmPIz9rKUttc9In6ZeA==} + + '@lezer/common@1.2.3': + resolution: {integrity: sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA==} + + '@lezer/css@1.2.1': + resolution: {integrity: sha512-2F5tOqzKEKbCUNraIXc0f6HKeyKlmMWJnBB0i4XW6dJgssrZO/YlZ2pY5xgyqDleqqhiNJ3dQhbrV2aClZQMvg==} + + '@lezer/highlight@1.2.1': + resolution: {integrity: sha512-Z5duk4RN/3zuVO7Jq0pGLJ3qynpxUVsh7IbUbGj88+uV2ApSAn6kWg2au3iJb+0Zi7kKtqffIESgNcRXWZWmSA==} + + '@lezer/html@1.3.10': + resolution: {integrity: sha512-dqpT8nISx/p9Do3AchvYGV3qYc4/rKr3IBZxlHmpIKam56P47RSHkSF5f13Vu9hebS1jM0HmtJIwLbWz1VIY6w==} + + '@lezer/javascript@1.5.1': + resolution: {integrity: sha512-ATOImjeVJuvgm3JQ/bpo2Tmv55HSScE2MTPnKRMRIPx2cLhHGyX2VnqpHhtIV1tVzIjZDbcWQm+NCTF40ggZVw==} + + '@lezer/json@1.0.3': + resolution: {integrity: sha512-BP9KzdF9Y35PDpv04r0VeSTKDeox5vVr3efE7eBbx3r4s3oNLfunchejZhjArmeieBH+nVOpgIiBJpEAv8ilqQ==} + + '@lezer/lr@1.4.2': + resolution: {integrity: sha512-pu0K1jCIdnQ12aWNaAVU5bzi7Bd1w54J3ECgANPmYLtQKP0HBj2cE/5coBD66MT10xbtIuUr7tg0Shbsvk0mDA==} + + '@lezer/markdown@1.4.3': + resolution: {integrity: sha512-kfw+2uMrQ/wy/+ONfrH83OkdFNM0ye5Xq96cLlaCy7h5UT9FO54DU4oRoIc0CSBh5NWmWuiIJA7NGLMJbQ+Oxg==} + + '@marijn/find-cluster-break@1.0.2': + resolution: {integrity: sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==} + '@rollup/rollup-android-arm-eabi@4.37.0': resolution: {integrity: sha512-l7StVw6WAa8l3vA1ov80jyetOAEo1FtHvZDbzXDO/02Sq/QVvqlHkYoFwDJPIMj0GKiistsBudfx5tGFnwYWDQ==} cpu: [arm] @@ -512,9 +584,15 @@ packages: resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} engines: {node: '>=6'} + codemirror@6.0.2: + resolution: {integrity: sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==} + convert-source-map@2.0.0: resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + crelt@1.0.6: + resolution: {integrity: sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==} + csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} @@ -547,6 +625,9 @@ packages: resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} engines: {node: '>=6'} + eventemitter3@5.0.1: + resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -670,6 +751,11 @@ packages: resolution: {integrity: sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==} engines: {node: ^10 || ^12 || >=14} + prettier@3.6.0: + resolution: {integrity: sha512-ujSB9uXHJKzM/2GBuE0hBOUgC77CN3Bnpqa+g80bkv3T3A93wL/xlzDATHhnhkzifz/UE2SNOvmbTz5hSkDlHw==} + engines: {node: '>=14'} + hasBin: true + react-dom@19.0.0: resolution: {integrity: sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==} peerDependencies: @@ -679,6 +765,12 @@ packages: resolution: {integrity: sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==} engines: {node: '>=0.10.0'} + react-toastify@11.0.5: + resolution: {integrity: sha512-EpqHBGvnSTtHYhCPLxML05NLY2ZX0JURbAdNYa6BUkk+amz4wbKBQvoKQAB0ardvSarUBuY4Q4s1sluAzZwkmA==} + peerDependencies: + react: ^18 || ^19 + react-dom: ^18 || ^19 + react@19.0.0: resolution: {integrity: sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==} engines: {node: '>=0.10.0'} @@ -699,6 +791,9 @@ packages: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} + style-mod@4.1.2: + resolution: {integrity: sha512-wnD1HyVqpJUI2+eKZ+eo1UwghftP6yuFheBqqe+bWCotBjC2K1YnteJILRMs3SM4V/0dLEW1SC27MWP5y+mwmw==} + tailwindcss@4.0.15: resolution: {integrity: sha512-6ZMg+hHdMJpjpeCCFasX7K+U615U9D+7k5/cDK/iRwl6GptF24+I/AbKgOnXhVKePzrEyIXutLv36n4cRsq3Sg==} @@ -752,6 +847,9 @@ packages: yaml: optional: true + w3c-keyname@2.2.8: + resolution: {integrity: sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==} + yallist@3.1.1: resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} @@ -872,6 +970,97 @@ snapshots: '@babel/helper-string-parser': 7.25.9 '@babel/helper-validator-identifier': 7.25.9 + '@codemirror/autocomplete@6.18.6': + dependencies: + '@codemirror/language': 6.11.1 + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.37.2 + '@lezer/common': 1.2.3 + + '@codemirror/commands@6.8.1': + dependencies: + '@codemirror/language': 6.11.1 + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.37.2 + '@lezer/common': 1.2.3 + + '@codemirror/lang-css@6.3.1': + dependencies: + '@codemirror/autocomplete': 6.18.6 + '@codemirror/language': 6.11.1 + '@codemirror/state': 6.5.2 + '@lezer/common': 1.2.3 + '@lezer/css': 1.2.1 + + '@codemirror/lang-html@6.4.9': + dependencies: + '@codemirror/autocomplete': 6.18.6 + '@codemirror/lang-css': 6.3.1 + '@codemirror/lang-javascript': 6.2.4 + '@codemirror/language': 6.11.1 + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.37.2 + '@lezer/common': 1.2.3 + '@lezer/css': 1.2.1 + '@lezer/html': 1.3.10 + + '@codemirror/lang-javascript@6.2.4': + dependencies: + '@codemirror/autocomplete': 6.18.6 + '@codemirror/language': 6.11.1 + '@codemirror/lint': 6.8.5 + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.37.2 + '@lezer/common': 1.2.3 + '@lezer/javascript': 1.5.1 + + '@codemirror/lang-json@6.0.2': + dependencies: + '@codemirror/language': 6.11.1 + '@lezer/json': 1.0.3 + + '@codemirror/lang-markdown@6.3.3': + dependencies: + '@codemirror/autocomplete': 6.18.6 + '@codemirror/lang-html': 6.4.9 + '@codemirror/language': 6.11.1 + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.37.2 + '@lezer/common': 1.2.3 + '@lezer/markdown': 1.4.3 + + '@codemirror/language@6.11.1': + dependencies: + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.37.2 + '@lezer/common': 1.2.3 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + style-mod: 4.1.2 + + '@codemirror/lint@6.8.5': + dependencies: + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.37.2 + crelt: 1.0.6 + + '@codemirror/search@6.5.11': + dependencies: + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.37.2 + crelt: 1.0.6 + + '@codemirror/state@6.5.2': + dependencies: + '@marijn/find-cluster-break': 1.0.2 + + '@codemirror/view@6.37.2': + dependencies: + '@codemirror/state': 6.5.2 + crelt: 1.0.6 + style-mod: 4.1.2 + w3c-keyname: 2.2.8 + '@esbuild/aix-ppc64@0.25.1': optional: true @@ -964,6 +1153,62 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 + '@kevisual/codemirror@0.0.12': + dependencies: + '@codemirror/autocomplete': 6.18.6 + '@codemirror/commands': 6.8.1 + '@codemirror/lang-css': 6.3.1 + '@codemirror/lang-html': 6.4.9 + '@codemirror/lang-javascript': 6.2.4 + '@codemirror/lang-json': 6.0.2 + '@codemirror/lang-markdown': 6.3.3 + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.37.2 + codemirror: 6.0.2 + eventemitter3: 5.0.1 + prettier: 3.6.0 + + '@lezer/common@1.2.3': {} + + '@lezer/css@1.2.1': + dependencies: + '@lezer/common': 1.2.3 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/highlight@1.2.1': + dependencies: + '@lezer/common': 1.2.3 + + '@lezer/html@1.3.10': + dependencies: + '@lezer/common': 1.2.3 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/javascript@1.5.1': + dependencies: + '@lezer/common': 1.2.3 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/json@1.0.3': + dependencies: + '@lezer/common': 1.2.3 + '@lezer/highlight': 1.2.1 + '@lezer/lr': 1.4.2 + + '@lezer/lr@1.4.2': + dependencies: + '@lezer/common': 1.2.3 + + '@lezer/markdown@1.4.3': + dependencies: + '@lezer/common': 1.2.3 + '@lezer/highlight': 1.2.1 + + '@marijn/find-cluster-break@1.0.2': {} + '@rollup/rollup-android-arm-eabi@4.37.0': optional: true @@ -1138,8 +1383,20 @@ snapshots: clsx@2.1.1: {} + codemirror@6.0.2: + dependencies: + '@codemirror/autocomplete': 6.18.6 + '@codemirror/commands': 6.8.1 + '@codemirror/language': 6.11.1 + '@codemirror/lint': 6.8.5 + '@codemirror/search': 6.5.11 + '@codemirror/state': 6.5.2 + '@codemirror/view': 6.37.2 + convert-source-map@2.0.0: {} + crelt@1.0.6: {} + csstype@3.1.3: {} debug@4.4.0: @@ -1185,6 +1442,8 @@ snapshots: escalade@3.2.0: {} + eventemitter3@5.0.1: {} + fsevents@2.3.3: optional: true @@ -1269,6 +1528,8 @@ snapshots: picocolors: 1.1.1 source-map-js: 1.2.1 + prettier@3.6.0: {} + react-dom@19.0.0(react@19.0.0): dependencies: react: 19.0.0 @@ -1276,6 +1537,12 @@ snapshots: react-refresh@0.14.2: {} + react-toastify@11.0.5(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + dependencies: + clsx: 2.1.1 + react: 19.0.0 + react-dom: 19.0.0(react@19.0.0) + react@19.0.0: {} rollup@4.37.0: @@ -1310,6 +1577,8 @@ snapshots: source-map-js@1.2.1: {} + style-mod@4.1.2: {} + tailwindcss@4.0.15: {} tapable@2.2.1: {} @@ -1330,4 +1599,6 @@ snapshots: jiti: 2.4.2 lightningcss: 1.29.2 + w3c-keyname@2.2.8: {} + yallist@3.1.1: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..efc037a --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +onlyBuiltDependencies: + - esbuild diff --git a/src/App.tsx b/src/App.tsx index 75d350b..385fc11 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,34 +1,43 @@ -import { Github, Mail, Phone, MapPin, ChevronDown, ExternalLink, Shield, Book, Globe, Brain } from 'lucide-react'; - -export const App = () => { +import { Mail, Phone, MapPin, Book, Globe, Brain, Save } from 'lucide-react'; +import { chain, TextEditor } from './components/TextEditor'; +// import { ToastContainer } from 'react-toastify'; +// @ts-ignore +import Logo from './assets/logo-1.png'; +export const Main = () => { return (
{/* Hero Section */} -
-
- - - - {/* About Section */} -
-
-

关于我们

-
-

我们是一个独立开发团队,致力于提供高质量的软件产品。我们的使命是通过创新技术,让用户的工作和生活更加便捷。

-
-
-

我们的使命

-
    -
  • ✓ 提供高质量的软件产品
  • -
  • ✓ 不断创新,满足用户需求
  • -
  • ✓ 提供优质的售后服务
  • -
  • ✓ 保护用户隐私
  • -
-
-
-

我们的愿景

-
    -
  • ✓ 创立更简单,方便的网页助手
  • -
  • ✓ 成为用户信赖的软件品牌
  • -
  • ✓ 持续创新发展
  • -
  • ✓ 提供卓越的用户体验
  • -
-
+

临时网页

+

当个网页助手,帮助您快速生成临时网页

@@ -91,11 +70,11 @@ export const App = () => {

联系我们

-
+
- envision@kevisual.cn + kevisual@kevisual.cn
@@ -103,7 +82,7 @@ export const App = () => {
- 浙江省杭州市余杭区闲林街道天日山西路230号A区3楼2954室 + 浙江省杭州市
@@ -126,11 +105,6 @@ export const App = () => { 功能 -
  • - - 关于我们 - -
  • 联系方式 @@ -142,12 +116,12 @@ export const App = () => {

    法律信息

  • @@ -179,4 +150,11 @@ export const App = () => { ); }; -export default App; +export const App = () => { + return ( + <> + {/* */} + + + ); +}; diff --git a/src/assets/logo-1.png b/src/assets/logo-1.png new file mode 100644 index 0000000..a6da81c Binary files /dev/null and b/src/assets/logo-1.png differ diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx new file mode 100644 index 0000000..35b14bc --- /dev/null +++ b/src/components/Icon.tsx @@ -0,0 +1,7 @@ +export const Github = () => { + return ( + + ); +}; diff --git a/src/components/TextEditor.tsx b/src/components/TextEditor.tsx new file mode 100644 index 0000000..28a5508 --- /dev/null +++ b/src/components/TextEditor.tsx @@ -0,0 +1,39 @@ +import { createEditor } from '@kevisual/codemirror'; +import { Chain } from '@kevisual/codemirror/utils'; +import { useEffect, useRef } from 'react'; + +export const chain = new Chain(); +type TextEditorProps = { + content: string; + chain?: Chain; +}; +export const TextEditor = ({ content, chain }: TextEditorProps) => { + const editorElRef = useRef(null); + const editorRef = useRef>(null); + useEffect(() => { + initEditor(); + return () => { + if (editorRef.current) { + chain?.destroy?.(); + } + }; + }, []); + useEffect(() => { + if (editorRef.current) { + chain?.setContent?.(content); + } + }, [content]); + const initEditor = async () => { + if (!editorElRef.current) return; + const editor = createEditor(editorElRef.current, { + type: 'html', + }); + const cmScroller = editorElRef.current.querySelector('.cm-scroller'); + if (cmScroller) { + cmScroller.classList.add('scrollbar'); + } + chain?.setEditor?.(editor); + editorRef.current = editor; + }; + return
    ; +};