@opentiny/fluent-editor 4.0.0-alpha.11 → 4.0.0-alpha.12
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/es/modules/collaborative-editing/awareness/awareness.es.js +6 -7
- package/es/modules/collaborative-editing/awareness/awareness.es.js.map +1 -1
- package/es/modules/collaborative-editing/awareness/y-indexeddb.es.js +7 -3
- package/es/modules/collaborative-editing/awareness/y-indexeddb.es.js.map +1 -1
- package/es/modules/collaborative-editing/collaborative-editing.es.js +13 -8
- package/es/modules/collaborative-editing/collaborative-editing.es.js.map +1 -1
- package/es/modules/collaborative-editing/provider/providerRegistry.es.js.map +1 -1
- package/es/modules/collaborative-editing/provider/webrtc.es.js +8 -4
- package/es/modules/collaborative-editing/provider/webrtc.es.js.map +1 -1
- package/es/modules/collaborative-editing/provider/websocket.es.js +6 -4
- package/es/modules/collaborative-editing/provider/websocket.es.js.map +1 -1
- package/es/modules/mind-map/modules/control-panel.es.js +3 -2
- package/es/modules/mind-map/modules/control-panel.es.js.map +1 -1
- package/lib/modules/collaborative-editing/awareness/awareness.cjs.js +6 -24
- package/lib/modules/collaborative-editing/awareness/awareness.cjs.js.map +1 -1
- package/lib/modules/collaborative-editing/awareness/y-indexeddb.cjs.js +7 -3
- package/lib/modules/collaborative-editing/awareness/y-indexeddb.cjs.js.map +1 -1
- package/lib/modules/collaborative-editing/collaborative-editing.cjs.js +19 -31
- package/lib/modules/collaborative-editing/collaborative-editing.cjs.js.map +1 -1
- package/lib/modules/collaborative-editing/provider/providerRegistry.cjs.js.map +1 -1
- package/lib/modules/collaborative-editing/provider/webrtc.cjs.js +10 -23
- package/lib/modules/collaborative-editing/provider/webrtc.cjs.js.map +1 -1
- package/lib/modules/collaborative-editing/provider/websocket.cjs.js +10 -25
- package/lib/modules/collaborative-editing/provider/websocket.cjs.js.map +1 -1
- package/lib/modules/mind-map/modules/control-panel.cjs.js +3 -2
- package/lib/modules/mind-map/modules/control-panel.cjs.js.map +1 -1
- package/package.json +1 -38
- package/patches/quill@2.0.3.patch +33 -0
- package/scripts/apply-patches.cjs +248 -0
- package/types/modules/collaborative-editing/awareness/awareness.d.ts +2 -2
- package/types/modules/collaborative-editing/awareness/y-indexeddb.d.ts +3 -2
- package/types/modules/collaborative-editing/collaborative-editing.d.ts +4 -3
- package/types/modules/collaborative-editing/provider/providerRegistry.d.ts +2 -1
- package/types/modules/collaborative-editing/provider/webrtc.d.ts +5 -4
- package/types/modules/collaborative-editing/provider/websocket.d.ts +6 -5
- package/types/modules/collaborative-editing/types.d.ts +17 -1
- package/types/modules/mind-map/options.d.ts +1 -0
- package/lib/modules/flow-chart/style/flow-chart.css +0 -185
- package/lib/modules/mind-map/style/mind-map.css +0 -224
- /package/{es/modules/flow-chart/style/flow-chart.css → flow-chart.css} +0 -0
- /package/{es/modules/mind-map/style/mind-map.css → mind-map.css} +0 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
const { execSync } = require('node:child_process')
|
|
2
|
+
const fs = require('node:fs')
|
|
3
|
+
const path = require('node:path')
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* 应用 Quill 补丁脚本
|
|
7
|
+
* 功能:修复 Quill 编辑器输入法状态下的批处理问题,提升中文输入体验
|
|
8
|
+
*
|
|
9
|
+
* 自动应用:安装包时 postinstall 脚本自动应用,支持所有包管理器-受限于 postinstall 规则暂未实现
|
|
10
|
+
*
|
|
11
|
+
* 手动应用:在项目根目录执行
|
|
12
|
+
* node node_modules/@opentiny/fluent-editor/scripts/apply-patches.cjs
|
|
13
|
+
*
|
|
14
|
+
* 工作原理:
|
|
15
|
+
* 1. 检测包管理器类型(pnpm/npm/yarn)
|
|
16
|
+
* 2. 自动检测 Quill 安装位置
|
|
17
|
+
* 3. 根据包管理器类型应用不同的补丁策略
|
|
18
|
+
*
|
|
19
|
+
* 注意事项:
|
|
20
|
+
* - 补丁是幂等的,多次运行无副作用
|
|
21
|
+
* - 需要 node_modules 写入权限
|
|
22
|
+
* - 不影响其他包或项目的补丁
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
// 获取包管理器
|
|
26
|
+
function detectPackageManager() {
|
|
27
|
+
try {
|
|
28
|
+
const lockFiles = {
|
|
29
|
+
'pnpm-lock.yaml': 'pnpm',
|
|
30
|
+
'yarn.lock': 'yarn',
|
|
31
|
+
'package-lock.json': 'npm',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
for (const [file, manager] of Object.entries(lockFiles)) {
|
|
35
|
+
if (fs.existsSync(file)) return manager
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const userAgent = process.env.npm_config_user_agent || ''
|
|
39
|
+
if (userAgent.includes('pnpm')) return 'pnpm'
|
|
40
|
+
if (userAgent.includes('yarn')) return 'yarn'
|
|
41
|
+
if (userAgent.includes('npm')) return 'npm'
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return 'npm'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return 'npm'
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 拷贝 patches 文件
|
|
51
|
+
function copyPatchFile() {
|
|
52
|
+
const packageManager = detectPackageManager()
|
|
53
|
+
// 把 patch 文件复制到哪里
|
|
54
|
+
const dest = `patches/${packageManager === 'pnpm' ? 'quill@2.0.3.patch' : 'quill+2.0.3.patch'}`
|
|
55
|
+
|
|
56
|
+
// 文件存在直接返回
|
|
57
|
+
if (fs.existsSync(dest)) {
|
|
58
|
+
return true
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// 复制 patch 文件的路径
|
|
62
|
+
const src = path.resolve(__dirname, '../patches/quill@2.0.3.patch')
|
|
63
|
+
|
|
64
|
+
if (fs.existsSync(src)) {
|
|
65
|
+
fs.mkdirSync('patches', { recursive: true })
|
|
66
|
+
|
|
67
|
+
if (packageManager === 'pnpm') {
|
|
68
|
+
fs.copyFileSync(src, dest)
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
let content = fs.readFileSync(src, 'utf-8')
|
|
72
|
+
content = content.replaceAll('core/editor.js', 'node_modules/quill/core/editor.js')
|
|
73
|
+
fs.writeFileSync(dest, content)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
console.log(`✅ 已复制 patch 文件到 ${dest}`)
|
|
77
|
+
return true
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
console.log(`⚠️ 未找到 patch 文件,请手动创建 ${dest}`)
|
|
81
|
+
return false
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// pnpm 应用 patch 文件
|
|
86
|
+
function setupPnpmPatch() {
|
|
87
|
+
try {
|
|
88
|
+
const packageJsonPath = 'package.json'
|
|
89
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
90
|
+
console.log('⚠️ 未找到 package.json')
|
|
91
|
+
return false
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
|
95
|
+
|
|
96
|
+
// 检查是否已经有 pnpm.patchedDependencies 配置
|
|
97
|
+
if (packageJson.pnpm?.patchedDependencies?.['quill@2.0.3']) {
|
|
98
|
+
console.log('✅ pnpm patchedDependencies 已配置')
|
|
99
|
+
return true
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// 添加 pnpm.patchedDependencies 配置
|
|
103
|
+
if (!packageJson.pnpm) {
|
|
104
|
+
packageJson.pnpm = {}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (!packageJson.pnpm.patchedDependencies) {
|
|
108
|
+
packageJson.pnpm.patchedDependencies = {}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
packageJson.pnpm.patchedDependencies['quill@2.0.3'] = 'patches/quill@2.0.3.patch'
|
|
112
|
+
|
|
113
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
|
114
|
+
console.log('✅ 已添加 pnpm patchedDependencies 配置')
|
|
115
|
+
|
|
116
|
+
try {
|
|
117
|
+
execSync('pnpm install', { stdio: 'inherit' })
|
|
118
|
+
console.log('✅ pnpm patch quill@2.0.3 应用成功!')
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
console.warn('❌ pnpm patch 命令执行失败:', error.message)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return true
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
console.error('❌ pnpm 补丁配置失败:', error.message)
|
|
128
|
+
return false
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// npm、yarn 应用 patch 文件
|
|
133
|
+
function applyPatchPackage() {
|
|
134
|
+
try {
|
|
135
|
+
const packageManager = detectPackageManager()
|
|
136
|
+
|
|
137
|
+
// 检查 patch-package 是否安装
|
|
138
|
+
let patchPackageInstalled = false
|
|
139
|
+
try {
|
|
140
|
+
require.resolve('patch-package')
|
|
141
|
+
patchPackageInstalled = true
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
// patch-package 未安装
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (!patchPackageInstalled) {
|
|
148
|
+
console.log('📦 正在安装 patch-package...')
|
|
149
|
+
try {
|
|
150
|
+
const installCommand = packageManager === 'yarn' ? 'yarn add --dev patch-package' : 'npm install --save-dev patch-package'
|
|
151
|
+
execSync(installCommand, { stdio: 'inherit' })
|
|
152
|
+
console.log('✅ patch-package 安装成功')
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
console.error('❌ patch-package 安装失败:', error.message)
|
|
156
|
+
return false
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// 应用补丁
|
|
161
|
+
console.log('🔄 正在应用 patch...')
|
|
162
|
+
try {
|
|
163
|
+
execSync('npx patch-package', { stdio: 'inherit' })
|
|
164
|
+
console.log('✅ 补丁应用成功')
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
console.error('❌ 补丁应用失败:', error.message)
|
|
168
|
+
return false
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// 添加 postinstall 脚本
|
|
172
|
+
const packageJsonPath = 'package.json'
|
|
173
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
|
174
|
+
|
|
175
|
+
if (!packageJson.scripts) {
|
|
176
|
+
packageJson.scripts = {}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (!packageJson.scripts.postinstall || !packageJson.scripts.postinstall.includes('patch-package')) {
|
|
180
|
+
const existingPostinstall = packageJson.scripts.postinstall || ''
|
|
181
|
+
packageJson.scripts.postinstall = existingPostinstall ? `${existingPostinstall} && npx patch-package` : 'npx patch-package'
|
|
182
|
+
|
|
183
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
|
184
|
+
console.log('✅ 已更新 postinstall 脚本')
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return true
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
console.error('❌ patch-package 应用失败:', error.message)
|
|
191
|
+
return false
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function handlePatchFailure() {
|
|
196
|
+
console.log(`
|
|
197
|
+
❌ 补丁处理失败,请尝试手动安装
|
|
198
|
+
|
|
199
|
+
🔧 手动安装:
|
|
200
|
+
在项目根目录执行:
|
|
201
|
+
node node_modules/@opentiny/fluent-editor/scripts/apply-patches.cjs
|
|
202
|
+
|
|
203
|
+
⚠️ 注意:未应用补丁可能影响中文输入体验
|
|
204
|
+
`)
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function applyQuillPatch() {
|
|
208
|
+
const packageManager = detectPackageManager()
|
|
209
|
+
console.log(`🔍 检测到包管理器: ${packageManager}`)
|
|
210
|
+
console.log('📋 准备 patch 文件...')
|
|
211
|
+
|
|
212
|
+
if (!copyPatchFile()) return handlePatchFailure()
|
|
213
|
+
|
|
214
|
+
let strategy
|
|
215
|
+
if (packageManager == 'pnpm') {
|
|
216
|
+
strategy = {
|
|
217
|
+
label: '📦 使用 pnpm 补丁策略...',
|
|
218
|
+
handler: setupPnpmPatch,
|
|
219
|
+
successMsg: '✅ quill@2.0.3.patch 补丁配置已完成',
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
strategy = {
|
|
224
|
+
label: '📦 使用 patch-package 补丁策略...',
|
|
225
|
+
handler: applyPatchPackage,
|
|
226
|
+
successMsg: '🎉 补丁处理完成',
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (!strategy) {
|
|
231
|
+
console.log('❌ 不支持的包管理器,仅支持 pnpm、yarn、npm')
|
|
232
|
+
handlePatchFailure()
|
|
233
|
+
return
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
console.log(strategy.label)
|
|
237
|
+
// 调用处理函数
|
|
238
|
+
const success = strategy.handler()
|
|
239
|
+
|
|
240
|
+
if (success) {
|
|
241
|
+
console.log(strategy.successMsg)
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
handlePatchFailure()
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
applyQuillPatch()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { default as QuillCursors } from 'quill-cursors';
|
|
2
2
|
import { Awareness } from 'y-protocols/awareness';
|
|
3
3
|
import { default as FluentEditor } from '../../../core/fluent-editor';
|
|
4
|
-
import * as Y from 'yjs';
|
|
4
|
+
import type * as Y from 'yjs';
|
|
5
5
|
export interface AwarenessState {
|
|
6
6
|
name?: string;
|
|
7
7
|
color?: string;
|
|
@@ -25,4 +25,4 @@ export interface AwarenessOptions {
|
|
|
25
25
|
timeout?: number | undefined;
|
|
26
26
|
}
|
|
27
27
|
export declare function setupAwareness(options?: AwarenessOptions, defaultAwareness?: Awareness): Awareness | null;
|
|
28
|
-
export declare function bindAwarenessToCursors(awareness: Awareness, cursorsModule: QuillCursors, quill: FluentEditor, yText: Y.Text): (() => void) | void;
|
|
28
|
+
export declare function bindAwarenessToCursors(awareness: Awareness, cursorsModule: QuillCursors, quill: FluentEditor, yText: Y.Text, Yjs: typeof Y): (() => void) | void;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { IndexeddbPersistence } from 'y-indexeddb';
|
|
2
|
+
import type * as Y from 'yjs';
|
|
3
|
+
export declare function setupIndexedDB(doc: Y.Doc, IndexeddbPersistenceClass?: typeof IndexeddbPersistence): () => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { default as QuillCursors } from 'quill-cursors';
|
|
2
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
1
3
|
import { default as FluentEditor } from '../../fluent-editor';
|
|
2
4
|
import { UnifiedProvider } from './provider/providerRegistry';
|
|
3
5
|
import { YjsOptions } from './types';
|
|
4
|
-
import
|
|
5
|
-
import { Awareness } from 'y-protocols/awareness';
|
|
6
|
-
import * as Y from 'yjs';
|
|
6
|
+
import type * as Y from 'yjs';
|
|
7
7
|
export declare class CollaborativeEditor {
|
|
8
8
|
quill: FluentEditor;
|
|
9
9
|
options: YjsOptions;
|
|
@@ -13,6 +13,7 @@ export declare class CollaborativeEditor {
|
|
|
13
13
|
private cursors;
|
|
14
14
|
private cleanupBindings;
|
|
15
15
|
private clearIndexedDB;
|
|
16
|
+
private deps;
|
|
16
17
|
constructor(quill: FluentEditor, options: YjsOptions);
|
|
17
18
|
getAwareness(): Awareness;
|
|
18
19
|
getProvider(): UnifiedProvider;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Awareness } from 'y-protocols/awareness';
|
|
2
|
-
import { ProviderEventHandlers } from '../types';
|
|
2
|
+
import { CollaborativeEditingDeps, ProviderEventHandlers } from '../types';
|
|
3
3
|
import type * as Y from 'yjs';
|
|
4
4
|
export type ProviderRegistry = Record<string, ProviderConstructor>;
|
|
5
5
|
export type ProviderConstructor<T = any> = new (props: ProviderConstructorProps<T>) => UnifiedProvider;
|
|
@@ -7,6 +7,7 @@ export type ProviderConstructorProps<T = any> = {
|
|
|
7
7
|
options: T;
|
|
8
8
|
awareness?: Awareness;
|
|
9
9
|
doc?: Y.Doc;
|
|
10
|
+
deps?: CollaborativeEditingDeps;
|
|
10
11
|
} & ProviderEventHandlers;
|
|
11
12
|
export interface UnifiedProvider extends ProviderEventHandlers {
|
|
12
13
|
awareness: Awareness;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Awareness } from 'y-protocols/awareness';
|
|
2
|
-
import { ProviderEventHandlers } from '../types';
|
|
3
|
-
import { UnifiedProvider } from './providerRegistry';
|
|
4
2
|
import { WebrtcProvider } from 'y-webrtc';
|
|
5
|
-
import
|
|
3
|
+
import { CollaborativeEditingDeps, ProviderEventHandlers } from '../types';
|
|
4
|
+
import { UnifiedProvider } from './providerRegistry';
|
|
5
|
+
import type * as Y from 'yjs';
|
|
6
6
|
export interface WebRTCProviderOptions {
|
|
7
7
|
roomName: string;
|
|
8
8
|
filterBcConns?: boolean;
|
|
@@ -25,10 +25,11 @@ export declare class WebRTCProviderWrapper implements UnifiedProvider {
|
|
|
25
25
|
connect: () => void;
|
|
26
26
|
destroy: () => void;
|
|
27
27
|
disconnect: () => void;
|
|
28
|
-
constructor({ awareness, doc, options, onConnect, onDisconnect, onError, onSyncChange, }: {
|
|
28
|
+
constructor({ awareness, doc, options, onConnect, onDisconnect, onError, onSyncChange, deps, }: {
|
|
29
29
|
options: WebRTCProviderOptions;
|
|
30
30
|
awareness?: Awareness;
|
|
31
31
|
doc?: Y.Doc;
|
|
32
|
+
deps?: CollaborativeEditingDeps;
|
|
32
33
|
} & ProviderEventHandlers);
|
|
33
34
|
get isConnected(): boolean;
|
|
34
35
|
get isSynced(): boolean;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ProviderEventHandlers } from '../types';
|
|
2
|
-
import { UnifiedProvider } from './providerRegistry';
|
|
3
1
|
import { Awareness } from 'y-protocols/awareness';
|
|
4
2
|
import { WebsocketProvider } from 'y-websocket';
|
|
5
|
-
import
|
|
3
|
+
import { CollaborativeEditingDeps, ProviderEventHandlers } from '../types';
|
|
4
|
+
import { UnifiedProvider } from './providerRegistry';
|
|
5
|
+
import type * as Y from 'yjs';
|
|
6
6
|
export interface WebsocketProviderOptions {
|
|
7
7
|
serverUrl: string;
|
|
8
8
|
roomName: string;
|
|
9
9
|
connect?: boolean;
|
|
10
|
-
awareness?:
|
|
10
|
+
awareness?: Awareness;
|
|
11
11
|
params?: Record<string, string>;
|
|
12
12
|
protocols?: string[];
|
|
13
13
|
WebSocketPolyfill?: typeof WebSocket;
|
|
@@ -29,10 +29,11 @@ export declare class WebsocketProviderWrapper implements UnifiedProvider {
|
|
|
29
29
|
connect: () => void;
|
|
30
30
|
destroy: () => void;
|
|
31
31
|
disconnect: () => void;
|
|
32
|
-
constructor({ awareness, doc, options, onConnect, onDisconnect, onError, onSyncChange, }: {
|
|
32
|
+
constructor({ awareness, doc, options, onConnect, onDisconnect, onError, onSyncChange, deps, }: {
|
|
33
33
|
options: WebsocketProviderOptions;
|
|
34
34
|
awareness?: Awareness;
|
|
35
35
|
doc?: Y.Doc;
|
|
36
|
+
deps?: CollaborativeEditingDeps;
|
|
36
37
|
} & ProviderEventHandlers);
|
|
37
38
|
get isConnected(): boolean;
|
|
38
39
|
get isSynced(): boolean;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { default as QuillCursors } from 'quill-cursors';
|
|
2
|
+
import { IndexeddbPersistence } from 'y-indexeddb';
|
|
3
|
+
import { Awareness } from 'y-protocols/awareness';
|
|
4
|
+
import { QuillBinding } from 'y-quill';
|
|
5
|
+
import { WebrtcProvider } from 'y-webrtc';
|
|
6
|
+
import { WebsocketProvider } from 'y-websocket';
|
|
1
7
|
import { AwarenessOptions } from './awareness';
|
|
2
8
|
import { WebRTCProviderOptions, WebsocketProviderOptions } from './provider';
|
|
3
9
|
import type * as Y from 'yjs';
|
|
@@ -24,14 +30,24 @@ export type CustomProviderConfig = BaseYjsProviderConfig & {
|
|
|
24
30
|
type: string;
|
|
25
31
|
};
|
|
26
32
|
export type CursorsConfig = boolean | object;
|
|
33
|
+
export interface CollaborativeEditingDeps {
|
|
34
|
+
Y: typeof Y;
|
|
35
|
+
Awareness: typeof Awareness;
|
|
36
|
+
QuillBinding: typeof QuillBinding;
|
|
37
|
+
QuillCursors: typeof QuillCursors;
|
|
38
|
+
WebsocketProvider?: typeof WebsocketProvider;
|
|
39
|
+
WebrtcProvider?: typeof WebrtcProvider;
|
|
40
|
+
IndexeddbPersistence?: typeof IndexeddbPersistence;
|
|
41
|
+
}
|
|
27
42
|
export interface YjsOptions {
|
|
28
43
|
ydoc?: Y.Doc;
|
|
29
44
|
provider: (WebRTCProviderConfig | WebsocketProviderConfig | CustomProviderConfig);
|
|
30
45
|
awareness?: AwarenessOptions;
|
|
31
46
|
offline?: boolean;
|
|
32
47
|
cursors?: CursorsConfig;
|
|
48
|
+
deps?: CollaborativeEditingDeps;
|
|
33
49
|
onConnect?: () => void;
|
|
34
50
|
onDisconnect?: () => void;
|
|
35
|
-
onError?: (error:
|
|
51
|
+
onError?: (error: Error) => void;
|
|
36
52
|
onSyncChange?: (isSynced: boolean) => void;
|
|
37
53
|
}
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
.ql-flow-chart-item {
|
|
2
|
-
position: relative;
|
|
3
|
-
width: 100%;
|
|
4
|
-
height: 100%;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.ql-flow-chart-control {
|
|
9
|
-
position: absolute;
|
|
10
|
-
top: 8px;
|
|
11
|
-
right: 50px;
|
|
12
|
-
display: none;
|
|
13
|
-
gap: 6px;
|
|
14
|
-
white-space: nowrap;
|
|
15
|
-
pointer-events: auto;
|
|
16
|
-
padding: 5px 5px;
|
|
17
|
-
background-color: rgba(255, 255, 255, 0.85);
|
|
18
|
-
border-radius: 8px;
|
|
19
|
-
box-shadow: 0 3px 15px rgba(0, 0, 0, 0.15);
|
|
20
|
-
}
|
|
21
|
-
.ql-flow-chart-control .ql-flow-chart-control-item {
|
|
22
|
-
align-items: center;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
justify-content: center;
|
|
27
|
-
padding: 5px 5px;
|
|
28
|
-
border-radius: inherit;
|
|
29
|
-
transition: all 0.2s ease;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.ql-flow-chart-item .lf-dndpanel {
|
|
33
|
-
display: none;
|
|
34
|
-
top: 15%;
|
|
35
|
-
}
|
|
36
|
-
.ql-flow-chart-item .lf-dndpanel .ql-flow-chart-control-item {
|
|
37
|
-
height: 35.99px;
|
|
38
|
-
align-items: center;
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
display: flex;
|
|
41
|
-
flex-direction: column;
|
|
42
|
-
justify-content: center;
|
|
43
|
-
padding: 5px 5px;
|
|
44
|
-
border-radius: inherit;
|
|
45
|
-
transition: all 0.2s ease;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.ql-flow-chart-control-icon {
|
|
49
|
-
width: 16px;
|
|
50
|
-
height: 16px;
|
|
51
|
-
margin-right: 6px;
|
|
52
|
-
display: flex;
|
|
53
|
-
align-items: center;
|
|
54
|
-
justify-content: center;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.ql-flow-chart-control-item i {
|
|
58
|
-
background-size: cover;
|
|
59
|
-
display: inline-block;
|
|
60
|
-
height: 20px;
|
|
61
|
-
vertical-align: middle;
|
|
62
|
-
width: 20px;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.ql-flow-chart-control-item.disabled {
|
|
66
|
-
opacity: 0.5;
|
|
67
|
-
cursor: not-allowed;
|
|
68
|
-
pointer-events: none;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.ql-flow-chart-control-item:hover {
|
|
72
|
-
background-color: #efefef;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.ql-flow-chart .lf-dndpanel .lf-dnd-text {
|
|
76
|
-
font-size: 12px;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.ql-flow-chart-edge-panel {
|
|
80
|
-
width: 130px;
|
|
81
|
-
position: absolute;
|
|
82
|
-
left: 50px;
|
|
83
|
-
top: 220px;
|
|
84
|
-
padding: 3px;
|
|
85
|
-
z-index: 1000;
|
|
86
|
-
max-height: 400px;
|
|
87
|
-
background-color: rgba(255, 255, 255, 0.85);
|
|
88
|
-
border-radius: 8px;
|
|
89
|
-
box-shadow: 0 3px 15px rgba(0, 0, 0, 0.15);
|
|
90
|
-
}
|
|
91
|
-
.ql-flow-chart-edge-panel .ql-flow-chart-edge-item {
|
|
92
|
-
width: 30px;
|
|
93
|
-
height: 30px;
|
|
94
|
-
display: flex;
|
|
95
|
-
align-items: center;
|
|
96
|
-
justify-content: center;
|
|
97
|
-
cursor: pointer;
|
|
98
|
-
border: 1px solid #eee;
|
|
99
|
-
border-radius: inherit;
|
|
100
|
-
padding: 2px;
|
|
101
|
-
transition: box-shadow 0.3s ease;
|
|
102
|
-
}
|
|
103
|
-
.ql-flow-chart-edge-panel .ql-flow-chart-edge-item .ql-flow-chart-edge-type-icon {
|
|
104
|
-
width: 20px;
|
|
105
|
-
height: 20px;
|
|
106
|
-
background-size: contain;
|
|
107
|
-
background-repeat: no-repeat;
|
|
108
|
-
background-position: center;
|
|
109
|
-
}
|
|
110
|
-
.ql-flow-chart-edge-panel .ql-flow-chart-edge-item:hover {
|
|
111
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.ql-flow-chart-item .lf-text-input {
|
|
115
|
-
display: none !important;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.ql-flow-chart-right-up-control {
|
|
119
|
-
position: absolute;
|
|
120
|
-
top: 8px;
|
|
121
|
-
right: 6px;
|
|
122
|
-
display: inline-flex;
|
|
123
|
-
gap: 6px;
|
|
124
|
-
white-space: nowrap;
|
|
125
|
-
pointer-events: auto;
|
|
126
|
-
padding: 5px 5px;
|
|
127
|
-
background-color: rgba(255, 255, 255, 0.85);
|
|
128
|
-
border-radius: 8px;
|
|
129
|
-
box-shadow: 0 3px 15px rgba(0, 0, 0, 0.15);
|
|
130
|
-
}
|
|
131
|
-
.ql-flow-chart-right-up-control .ql-flow-chart-control-item {
|
|
132
|
-
align-items: center;
|
|
133
|
-
cursor: pointer;
|
|
134
|
-
display: flex;
|
|
135
|
-
flex-direction: column;
|
|
136
|
-
justify-content: center;
|
|
137
|
-
padding: 5px 5px;
|
|
138
|
-
border-radius: inherit;
|
|
139
|
-
transition: all 0.2s ease;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
.lf-shape-dashed {
|
|
143
|
-
margin: 10px auto 0px auto;
|
|
144
|
-
width: 20px;
|
|
145
|
-
height: 20px;
|
|
146
|
-
background-color: transparent;
|
|
147
|
-
border: 1.5px dashed #000;
|
|
148
|
-
border-radius: 2px;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.lf-shape-rect {
|
|
152
|
-
margin: 10px auto 0px auto;
|
|
153
|
-
width: 20px;
|
|
154
|
-
height: 20px;
|
|
155
|
-
background-color: transparent;
|
|
156
|
-
border: 1.5px solid #000;
|
|
157
|
-
border-radius: 2px;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
.lf-shape-circle {
|
|
161
|
-
margin: 10px auto 0px auto;
|
|
162
|
-
width: 20px;
|
|
163
|
-
height: 20px;
|
|
164
|
-
background-color: transparent;
|
|
165
|
-
border: 1.5px solid #000;
|
|
166
|
-
border-radius: 50%;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.lf-shape-ellipse {
|
|
170
|
-
margin: 10px auto 0px 3px;
|
|
171
|
-
width: 26px;
|
|
172
|
-
height: 20px;
|
|
173
|
-
background-color: transparent;
|
|
174
|
-
border: 1.5px solid #000;
|
|
175
|
-
border-radius: 50%;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.lf-shape-diamond {
|
|
179
|
-
margin: 10px auto 10px auto;
|
|
180
|
-
width: 20px;
|
|
181
|
-
height: 20px;
|
|
182
|
-
background-color: transparent;
|
|
183
|
-
border: 1.5px solid #000;
|
|
184
|
-
transform: rotate(45deg);
|
|
185
|
-
}
|