|
1 | 1 | <script setup lang="ts"> |
2 | | -import LogicFlow from '@logicflow/core' |
3 | | -import { DndPanel, SelectionSelect, Snapshot } from '@logicflow/extension' |
4 | 2 | import FluentEditor, { CollaborationModule, generateTableUp, generateTableUpShortKeyMenu } from '@opentiny/fluent-editor' |
5 | 3 | import HeaderList from 'quill-header-list' |
6 | 4 | import { createSelectBox, defaultCustomSelect, TableMenuContextmenu, TableResizeLine, TableResizeScale, TableSelection, TableUp } from 'quill-table-up' |
7 | | -import SimpleMindMap from 'simple-mind-map' |
8 | | -import Themes from 'simple-mind-map-plugin-themes' |
9 | | -import Drag from 'simple-mind-map/src/plugins/Drag.js' |
10 | | -import Export from 'simple-mind-map/src/plugins/Export.js' |
11 | | -import { nodeIconList } from 'simple-mind-map/src/svg/icons' |
12 | 5 | import { onMounted, ref } from 'vue' |
13 | | -import '@logicflow/core/lib/style/index.css' |
14 | | -import '@logicflow/extension/lib/style/index.css' |
| 6 | +
|
| 7 | +// 协同编辑 |
| 8 | +import * as Y from 'yjs' |
| 9 | +import { IndexeddbPersistence } from 'y-indexeddb' |
| 10 | +import { Awareness } from 'y-protocols/awareness' |
| 11 | +import { QuillBinding } from 'y-quill' |
| 12 | +import { WebsocketProvider } from 'y-websocket' |
| 13 | +import QuillCursors from 'quill-cursors' |
15 | 14 |
|
16 | 15 | FluentEditor.register({ 'modules/header-list': HeaderList }, true) |
17 | 16 | FluentEditor.register({ 'modules/table-up': generateTableUp(TableUp) }, true) |
@@ -107,7 +106,6 @@ const TOOLBAR_CONFIG = [ |
107 | 106 | ], |
108 | 107 | [{ list: 'check' }, 'link', 'blockquote', 'divider'], |
109 | 108 | [{ 'table-up': [] }, 'header-list'], |
110 | | - ['mind-map', 'flow-chart'], |
111 | 109 | ] |
112 | 110 |
|
113 | 111 | onMounted(() => { |
@@ -142,28 +140,19 @@ onMounted(() => { |
142 | 140 | return result |
143 | 141 | }, |
144 | 142 | }, |
145 | | - 'mind-map': { |
146 | | - deps: { |
147 | | - SimpleMindMap, |
148 | | - Themes, |
149 | | - Drag, |
150 | | - Export, |
151 | | - nodeIconList, |
152 | | - }, |
153 | | - }, |
154 | | - 'flow-chart': { |
| 143 | + 'collaborative-editing': { |
155 | 144 | deps: { |
156 | | - LogicFlow, |
157 | | - DndPanel, |
158 | | - SelectionSelect, |
159 | | - Snapshot, |
| 145 | + Y, |
| 146 | + Awareness, |
| 147 | + QuillBinding, |
| 148 | + QuillCursors, |
| 149 | + WebsocketProvider, |
| 150 | + IndexeddbPersistence, |
160 | 151 | }, |
161 | | - }, |
162 | | - 'collaborative-editing': { |
163 | 152 | provider: { |
164 | 153 | type: 'websocket', |
165 | 154 | options: { |
166 | | - serverUrl: 'wss://120.26.92.145:1234', |
| 155 | + serverUrl: 'wss://ai.opentiny.design/tiny-editor/', |
167 | 156 | roomName: ROOM_NAME, |
168 | 157 | }, |
169 | 158 | }, |
|
0 commit comments