@kedataindo/docflow-core 0.0.35 → 0.0.37
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/index.cjs +14 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -214,7 +214,19 @@ function createCollaboration(options) {
|
|
|
214
214
|
const ws = provider;
|
|
215
215
|
readyParts.push(
|
|
216
216
|
new Promise((resolve) => {
|
|
217
|
-
|
|
217
|
+
let settled = false;
|
|
218
|
+
const done = () => {
|
|
219
|
+
if (settled) return;
|
|
220
|
+
settled = true;
|
|
221
|
+
resolve();
|
|
222
|
+
};
|
|
223
|
+
if (ws.synced) {
|
|
224
|
+
done();
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
ws.once("sync", done);
|
|
228
|
+
ws.once("synced", done);
|
|
229
|
+
setTimeout(done, 5e3);
|
|
218
230
|
})
|
|
219
231
|
);
|
|
220
232
|
}
|
|
@@ -1541,7 +1553,7 @@ function createEditor(options = {}) {
|
|
|
1541
1553
|
content: options.content ? migrateContent(options.content) : options.content
|
|
1542
1554
|
};
|
|
1543
1555
|
const plugins = migratedOptions.plugins ?? [];
|
|
1544
|
-
const collaborationSetup = migratedOptions.collaboration ? createCollaboration(migratedOptions.collaboration)
|
|
1556
|
+
const collaborationSetup = !migratedOptions.collaboration ? void 0 : "ydoc" in migratedOptions.collaboration ? migratedOptions.collaboration : createCollaboration(migratedOptions.collaboration);
|
|
1545
1557
|
const performanceMonitor = migratedOptions.debug ? createPerformanceMonitor() : void 0;
|
|
1546
1558
|
let tiptapEditor = createTiptapEditor(migratedOptions, plugins, collaborationSetup);
|
|
1547
1559
|
let pluginActions = createActionMap(tiptapEditor, plugins);
|
package/dist/index.d.cts
CHANGED
|
@@ -201,7 +201,7 @@ interface EditorOptions {
|
|
|
201
201
|
plugins?: DocsEditorPlugin[];
|
|
202
202
|
editable?: boolean;
|
|
203
203
|
onUpdate?: (json: object) => void;
|
|
204
|
-
collaboration?: CollaborationOptions;
|
|
204
|
+
collaboration?: CollaborationOptions | CollaborationSetup;
|
|
205
205
|
getPageMap?: () => Map<number, {
|
|
206
206
|
page: number;
|
|
207
207
|
blockIndex: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -201,7 +201,7 @@ interface EditorOptions {
|
|
|
201
201
|
plugins?: DocsEditorPlugin[];
|
|
202
202
|
editable?: boolean;
|
|
203
203
|
onUpdate?: (json: object) => void;
|
|
204
|
-
collaboration?: CollaborationOptions;
|
|
204
|
+
collaboration?: CollaborationOptions | CollaborationSetup;
|
|
205
205
|
getPageMap?: () => Map<number, {
|
|
206
206
|
page: number;
|
|
207
207
|
blockIndex: number;
|
package/dist/index.js
CHANGED
|
@@ -156,7 +156,19 @@ function createCollaboration(options) {
|
|
|
156
156
|
const ws = provider;
|
|
157
157
|
readyParts.push(
|
|
158
158
|
new Promise((resolve) => {
|
|
159
|
-
|
|
159
|
+
let settled = false;
|
|
160
|
+
const done = () => {
|
|
161
|
+
if (settled) return;
|
|
162
|
+
settled = true;
|
|
163
|
+
resolve();
|
|
164
|
+
};
|
|
165
|
+
if (ws.synced) {
|
|
166
|
+
done();
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
ws.once("sync", done);
|
|
170
|
+
ws.once("synced", done);
|
|
171
|
+
setTimeout(done, 5e3);
|
|
160
172
|
})
|
|
161
173
|
);
|
|
162
174
|
}
|
|
@@ -1483,7 +1495,7 @@ function createEditor(options = {}) {
|
|
|
1483
1495
|
content: options.content ? migrateContent(options.content) : options.content
|
|
1484
1496
|
};
|
|
1485
1497
|
const plugins = migratedOptions.plugins ?? [];
|
|
1486
|
-
const collaborationSetup = migratedOptions.collaboration ? createCollaboration(migratedOptions.collaboration)
|
|
1498
|
+
const collaborationSetup = !migratedOptions.collaboration ? void 0 : "ydoc" in migratedOptions.collaboration ? migratedOptions.collaboration : createCollaboration(migratedOptions.collaboration);
|
|
1487
1499
|
const performanceMonitor = migratedOptions.debug ? createPerformanceMonitor() : void 0;
|
|
1488
1500
|
let tiptapEditor = createTiptapEditor(migratedOptions, plugins, collaborationSetup);
|
|
1489
1501
|
let pluginActions = createActionMap(tiptapEditor, plugins);
|