File tree Expand file tree Collapse file tree 4 files changed +92
-38
lines changed
Expand file tree Collapse file tree 4 files changed +92
-38
lines changed Original file line number Diff line number Diff line change 1- # create-svelte
2-
3- Everything you need to build a Svelte project, powered by [ ` create-svelte ` ] ( https://github.com/sveltejs/kit/tree/main/packages/create-svelte ) .
4-
5- ## Creating a project
6-
7- If you're seeing this, you've probably already done this step. Congrats!
8-
9- ``` bash
10- # create a new project in the current directory
11- npm create svelte@latest
12-
13- # create a new project in my-app
14- npm create svelte@latest my-app
15- ```
16-
17- ## Developing
18-
19- Once you've created a project and installed dependencies with ` npm install ` (or ` pnpm install ` or ` yarn ` ), start a development server:
20-
21- ``` bash
22- npm run dev
23-
24- # or start the server and open the app in a new browser tab
25- npm run dev -- --open
26- ```
27-
28- ## Building
29-
30- To create a production version of your app:
31-
32- ``` bash
33- npm run build
34- ```
35-
36- You can preview the production build with ` npm run preview ` .
37-
38- > To deploy your app, you may need to install an [ adapter] ( https://kit.svelte.dev/docs/adapters ) for your target environment.
1+ # AiEditor integrates with Svelte
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ export default defineConfig({
5555 { text : '与 React 整合' , link : '/zh/aieditor-with-react' } ,
5656 { text : '与 Vue3 整合' , link : '/zh/aieditor-with-vue3' } ,
5757 { text : '与 Vue2 整合' , link : '/zh/aieditor-with-vue2' } ,
58+ { text : '与 Svelte 整合' , link : '/zh/aieditor-with-svelte' } ,
5859 { text : '与 Layui 整合' , link : '/zh/aieditor-with-layui' } ,
5960 ]
6061 } ,
@@ -137,6 +138,7 @@ export default defineConfig({
137138 { text : 'Integrate with React' , link : '/aieditor-with-react' } ,
138139 { text : 'Integrate with Vue3' , link : '/aieditor-with-vue3' } ,
139140 { text : 'Integrate with Vue2' , link : '/aieditor-with-vue2' } ,
141+ { text : 'Integrate with Svelte' , link : '/aieditor-with-svelte' } ,
140142 ]
141143 } ,
142144 {
Original file line number Diff line number Diff line change 1+ # AiEditor integrates with Svelte
2+
3+
4+ In Svelte, the sample code for using AIEditor is as follows:
5+
6+
7+ ``` html
8+ <script lang =" ts" >
9+ import {onDestroy , onMount } from ' svelte' ;
10+ import " aieditor/dist/style.css"
11+ import type {AiEditor } from " aieditor" ;
12+
13+ let aieditor: AiEditor;
14+ onMount (async () => {
15+ import (' aieditor' ).then (({AiEditor}) => {
16+ aieditor = new AiEditor ({
17+ element: " #editor" ,
18+ placeholder: " Click to Input Content..." ,
19+ content: ' AiEditor is an Open Source Rich Text Editor Designed for AI. ' ,
20+ })
21+ })
22+ });
23+
24+ onDestroy (() => {
25+ aieditor && aieditor .destroy ();
26+ });
27+ </script >
28+
29+ <svelte:head >
30+ <title >AIEditor Demo for Svelte</title >
31+ </svelte:head >
32+
33+ <div >
34+ <h1 >AIEditor Demo for Svelte</h1 >
35+ <div id =" editor" ></div >
36+ </div >
37+
38+ <style >
39+ #editor {
40+ height : 600px ;
41+ }
42+ </style >
43+ ```
44+
45+ The code is at: https://github.com/aieditor-team/AiEditor/tree/main/demos/svelte-ts
Original file line number Diff line number Diff line change 1+ # AiEditor 与 Svelte 整合
2+
3+
4+ 在 Svelte 中,使用 AIEditor 的示例代码如下:
5+
6+ ``` html
7+ <script lang =" ts" >
8+ import {onDestroy , onMount } from ' svelte' ;
9+ import " aieditor/dist/style.css"
10+ import type {AiEditor } from " aieditor" ;
11+
12+ let aieditor: AiEditor;
13+ onMount (async () => {
14+ import (' aieditor' ).then (({AiEditor}) => {
15+ aieditor = new AiEditor ({
16+ element: " #editor" ,
17+ placeholder: " Click to Input Content..." ,
18+ content: ' AiEditor is an Open Source Rich Text Editor Designed for AI. ' ,
19+ })
20+ })
21+ });
22+
23+ onDestroy (() => {
24+ aieditor && aieditor .destroy ();
25+ });
26+ </script >
27+
28+ <svelte:head >
29+ <title >AIEditor Demo for Svelte</title >
30+ </svelte:head >
31+
32+ <div >
33+ <h1 >AIEditor Demo for Svelte</h1 >
34+ <div id =" editor" ></div >
35+ </div >
36+
37+ <style >
38+ #editor {
39+ height : 600px ;
40+ }
41+ </style >
42+ ```
43+
44+ 完整代码在: https://github.com/aieditor-team/AiEditor/tree/main/demos/svelte-ts
You can’t perform that action at this time.
0 commit comments