@superdoc-dev/cli 0.5.0-next.4 → 0.5.0-next.6
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.js +95 -20
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -171536,7 +171536,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
171536
171536
|
init_remark_gfm_z_sDF4ss_es();
|
|
171537
171537
|
});
|
|
171538
171538
|
|
|
171539
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
171539
|
+
// ../../packages/superdoc/dist/chunks/src-JYX7HxB3.es.js
|
|
171540
171540
|
function deleteProps(obj, propOrProps) {
|
|
171541
171541
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
171542
171542
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -227302,7 +227302,20 @@ var Node$13 = class Node$14 {
|
|
|
227302
227302
|
editor.on("transaction", bodySectPrTransactionHandler);
|
|
227303
227303
|
cleanupState.bodySectPrTransactionHandler = bodySectPrTransactionHandler;
|
|
227304
227304
|
}
|
|
227305
|
-
}, Collaboration,
|
|
227305
|
+
}, Collaboration, cleanupCollaborationSideEffects = (editor) => {
|
|
227306
|
+
const cleanup = collaborationCleanupByEditor.get(editor);
|
|
227307
|
+
if (!cleanup)
|
|
227308
|
+
return;
|
|
227309
|
+
cleanup.syncListenerCleanup?.();
|
|
227310
|
+
cleanup.mediaMap?.unobserve?.(cleanup.mediaMapObserver);
|
|
227311
|
+
cleanup.metaMap?.unobserve?.(cleanup.metaMapObserver);
|
|
227312
|
+
cleanup.partSyncHandle?.destroy();
|
|
227313
|
+
cleanup.partSyncPendingCleanup?.();
|
|
227314
|
+
cleanup.bodySectPrPendingCleanup?.();
|
|
227315
|
+
if (cleanup.bodySectPrTransactionHandler && typeof editor.off === "function")
|
|
227316
|
+
editor.off("transaction", cleanup.bodySectPrTransactionHandler);
|
|
227317
|
+
collaborationCleanupByEditor.delete(editor);
|
|
227318
|
+
}, createSyncPlugin = (ydoc, editor) => {
|
|
227306
227319
|
const fragment2 = ydoc.getXmlFragment("supereditor");
|
|
227307
227320
|
const onFirstRender = () => {
|
|
227308
227321
|
if (!editor.options.isNewFile)
|
|
@@ -227328,8 +227341,11 @@ var Node$13 = class Node$14 {
|
|
|
227328
227341
|
}, initSyncListener = (ydoc, editor, extension2) => {
|
|
227329
227342
|
const provider = editor.options.collaborationProvider;
|
|
227330
227343
|
if (!provider)
|
|
227331
|
-
return;
|
|
227344
|
+
return () => {};
|
|
227345
|
+
let cancelled = false;
|
|
227332
227346
|
const emit2 = (synced) => {
|
|
227347
|
+
if (cancelled)
|
|
227348
|
+
return;
|
|
227333
227349
|
if (synced === false)
|
|
227334
227350
|
return;
|
|
227335
227351
|
extension2.options.isReady = true;
|
|
@@ -227339,12 +227355,19 @@ var Node$13 = class Node$14 {
|
|
|
227339
227355
|
});
|
|
227340
227356
|
};
|
|
227341
227357
|
if (isCollaborationProviderSynced(provider)) {
|
|
227342
|
-
setTimeout(() => {
|
|
227358
|
+
const timerId = setTimeout(() => {
|
|
227343
227359
|
emit2();
|
|
227344
227360
|
}, 250);
|
|
227345
|
-
return
|
|
227361
|
+
return () => {
|
|
227362
|
+
cancelled = true;
|
|
227363
|
+
clearTimeout(timerId);
|
|
227364
|
+
};
|
|
227346
227365
|
}
|
|
227347
|
-
onCollaborationProviderSynced(provider, emit2);
|
|
227366
|
+
const removeProviderListeners = onCollaborationProviderSynced(provider, emit2);
|
|
227367
|
+
return () => {
|
|
227368
|
+
cancelled = true;
|
|
227369
|
+
removeProviderListeners();
|
|
227370
|
+
};
|
|
227348
227371
|
}, generateCollaborationData = async (editor) => {
|
|
227349
227372
|
const ydoc = prosemirrorToYDoc(editor.state.doc, "supereditor");
|
|
227350
227373
|
initializeMetaMap(ydoc, editor);
|
|
@@ -248630,6 +248653,9 @@ var Node$13 = class Node$14 {
|
|
|
248630
248653
|
setCursorsUpdateCallback(callback) {
|
|
248631
248654
|
this.#onCursorsUpdate = callback;
|
|
248632
248655
|
}
|
|
248656
|
+
setCollaborationProvider(provider) {
|
|
248657
|
+
this.#options.collaborationProvider = provider;
|
|
248658
|
+
}
|
|
248633
248659
|
setup() {
|
|
248634
248660
|
const provider = this.#options.collaborationProvider;
|
|
248635
248661
|
if (!provider?.awareness)
|
|
@@ -252265,7 +252291,7 @@ var Node$13 = class Node$14 {
|
|
|
252265
252291
|
return;
|
|
252266
252292
|
console.log(...args$1);
|
|
252267
252293
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
|
|
252268
|
-
var
|
|
252294
|
+
var init_src_JYX7HxB3_es = __esm(() => {
|
|
252269
252295
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
252270
252296
|
init_SuperConverter_CXcZg9Os_es();
|
|
252271
252297
|
init_jszip_ChlR43oI_es();
|
|
@@ -253479,8 +253505,13 @@ ${err.toString()}`);
|
|
|
253479
253505
|
addPmPlugins() {
|
|
253480
253506
|
if (!this.editor.options.ydoc)
|
|
253481
253507
|
return [];
|
|
253508
|
+
if (collaborationCleanupByEditor.has(this.editor)) {
|
|
253509
|
+
const fragment$1 = this.options.fragment;
|
|
253510
|
+
if (fragment$1)
|
|
253511
|
+
return [ySyncPlugin(fragment$1, { onFirstRender: () => {} })];
|
|
253512
|
+
}
|
|
253482
253513
|
this.options.ydoc = this.editor.options.ydoc;
|
|
253483
|
-
initSyncListener(this.options.ydoc, this.editor, this);
|
|
253514
|
+
const syncListenerCleanup = initSyncListener(this.options.ydoc, this.editor, this);
|
|
253484
253515
|
const [syncPlugin, fragment2] = createSyncPlugin(this.options.ydoc, this.editor);
|
|
253485
253516
|
this.options.fragment = fragment2;
|
|
253486
253517
|
const mediaMap = this.options.ydoc.getMap("media");
|
|
@@ -253494,6 +253525,7 @@ ${err.toString()}`);
|
|
|
253494
253525
|
};
|
|
253495
253526
|
mediaMap.observe(mediaMapObserver);
|
|
253496
253527
|
const cleanupState = {
|
|
253528
|
+
syncListenerCleanup,
|
|
253497
253529
|
mediaMap,
|
|
253498
253530
|
mediaMapObserver,
|
|
253499
253531
|
metaMap: null,
|
|
@@ -253532,17 +253564,7 @@ ${err.toString()}`);
|
|
|
253532
253564
|
}
|
|
253533
253565
|
},
|
|
253534
253566
|
onDestroy() {
|
|
253535
|
-
|
|
253536
|
-
if (!cleanup)
|
|
253537
|
-
return;
|
|
253538
|
-
cleanup.mediaMap.unobserve(cleanup.mediaMapObserver);
|
|
253539
|
-
cleanup.metaMap?.unobserve?.(cleanup.metaMapObserver);
|
|
253540
|
-
cleanup.partSyncHandle?.destroy();
|
|
253541
|
-
cleanup.partSyncPendingCleanup?.();
|
|
253542
|
-
cleanup.bodySectPrPendingCleanup?.();
|
|
253543
|
-
if (cleanup.bodySectPrTransactionHandler && typeof this.editor.off === "function")
|
|
253544
|
-
this.editor.off("transaction", cleanup.bodySectPrTransactionHandler);
|
|
253545
|
-
collaborationCleanupByEditor.delete(this.editor);
|
|
253567
|
+
cleanupCollaborationSideEffects(this.editor);
|
|
253546
253568
|
},
|
|
253547
253569
|
addCommands() {
|
|
253548
253570
|
return { addImageToCollaboration: ({ mediaPath, fileData }) => () => {
|
|
@@ -279731,6 +279753,44 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
279731
279753
|
this._state = this.state.reconfigure({ plugins: this.state.plugins.filter((plugin) => !this.#getPluginKeyName(plugin).startsWith(name)) });
|
|
279732
279754
|
this.view?.updateState(this._state);
|
|
279733
279755
|
}
|
|
279756
|
+
attachCollaboration({ ydoc, collaborationProvider }) {
|
|
279757
|
+
if (this.isDestroyed)
|
|
279758
|
+
throw new Error("[super-editor] Cannot attach collaboration to a destroyed editor");
|
|
279759
|
+
if (this.options.ydoc)
|
|
279760
|
+
throw new Error("[super-editor] Editor already has collaboration attached");
|
|
279761
|
+
if (this.options.isHeadless)
|
|
279762
|
+
throw new Error("[super-editor] attachCollaboration is not supported in headless mode");
|
|
279763
|
+
const prevProvider = this.options.collaborationProvider;
|
|
279764
|
+
const prevShouldLoadComments = this.options.shouldLoadComments;
|
|
279765
|
+
const prevCollaborationIsReady = this.options.collaborationIsReady;
|
|
279766
|
+
const prevState = this._state;
|
|
279767
|
+
const rollback2 = () => {
|
|
279768
|
+
cleanupCollaborationSideEffects(this);
|
|
279769
|
+
this.options.ydoc = undefined;
|
|
279770
|
+
this.options.collaborationProvider = prevProvider;
|
|
279771
|
+
this.options.shouldLoadComments = prevShouldLoadComments;
|
|
279772
|
+
this.options.collaborationIsReady = prevCollaborationIsReady;
|
|
279773
|
+
this._state = prevState;
|
|
279774
|
+
this.view?.updateState(prevState);
|
|
279775
|
+
};
|
|
279776
|
+
this.options.ydoc = ydoc;
|
|
279777
|
+
this.options.collaborationProvider = collaborationProvider;
|
|
279778
|
+
this.options.shouldLoadComments = false;
|
|
279779
|
+
let plugins;
|
|
279780
|
+
try {
|
|
279781
|
+
plugins = [...this.extensionService.plugins];
|
|
279782
|
+
} catch (err) {
|
|
279783
|
+
rollback2();
|
|
279784
|
+
throw err;
|
|
279785
|
+
}
|
|
279786
|
+
try {
|
|
279787
|
+
this._state = this.state.reconfigure({ plugins });
|
|
279788
|
+
this.view?.updateState(this._state);
|
|
279789
|
+
} catch (err) {
|
|
279790
|
+
rollback2();
|
|
279791
|
+
throw err;
|
|
279792
|
+
}
|
|
279793
|
+
}
|
|
279734
279794
|
#createExtensionService() {
|
|
279735
279795
|
const allowedExtensions = [
|
|
279736
279796
|
"extension",
|
|
@@ -282177,6 +282237,21 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
282177
282237
|
get editor() {
|
|
282178
282238
|
return this.#editor;
|
|
282179
282239
|
}
|
|
282240
|
+
attachCollaboration({ ydoc, collaborationProvider }) {
|
|
282241
|
+
const prevProvider = this.#options.collaborationProvider;
|
|
282242
|
+
this.#options.collaborationProvider = collaborationProvider;
|
|
282243
|
+
this.#remoteCursorManager?.setCollaborationProvider(collaborationProvider);
|
|
282244
|
+
try {
|
|
282245
|
+
this.#editor.attachCollaboration({
|
|
282246
|
+
ydoc,
|
|
282247
|
+
collaborationProvider
|
|
282248
|
+
});
|
|
282249
|
+
} catch (err) {
|
|
282250
|
+
this.#options.collaborationProvider = prevProvider;
|
|
282251
|
+
this.#remoteCursorManager?.setCollaborationProvider(prevProvider ?? null);
|
|
282252
|
+
throw err;
|
|
282253
|
+
}
|
|
282254
|
+
}
|
|
282180
282255
|
get element() {
|
|
282181
282256
|
return this.#visibleHost;
|
|
282182
282257
|
}
|
|
@@ -285700,7 +285775,7 @@ var init_zipper_YmNpPIyc_es = __esm(() => {
|
|
|
285700
285775
|
|
|
285701
285776
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
285702
285777
|
var init_super_editor_es = __esm(() => {
|
|
285703
|
-
|
|
285778
|
+
init_src_JYX7HxB3_es();
|
|
285704
285779
|
init_SuperConverter_CXcZg9Os_es();
|
|
285705
285780
|
init_jszip_ChlR43oI_es();
|
|
285706
285781
|
init_xml_js_40FWvL78_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.5.0-next.
|
|
3
|
+
"version": "0.5.0-next.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@types/ws": "^8.5.13",
|
|
26
26
|
"typescript": "^5.9.2",
|
|
27
27
|
"@superdoc/document-api": "0.0.1",
|
|
28
|
-
"@superdoc/super-editor": "0.0.1",
|
|
29
28
|
"@superdoc/pm-adapter": "0.0.0",
|
|
29
|
+
"@superdoc/super-editor": "0.0.1",
|
|
30
30
|
"superdoc": "1.23.0"
|
|
31
31
|
},
|
|
32
32
|
"module": "src/index.ts",
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"optionalDependencies": {
|
|
37
|
-
"@superdoc-dev/cli-darwin-arm64": "0.5.0-next.
|
|
38
|
-
"@superdoc-dev/cli-
|
|
39
|
-
"@superdoc-dev/cli-
|
|
40
|
-
"@superdoc-dev/cli-linux-arm64": "0.5.0-next.
|
|
41
|
-
"@superdoc-dev/cli-windows-x64": "0.5.0-next.
|
|
37
|
+
"@superdoc-dev/cli-darwin-arm64": "0.5.0-next.6",
|
|
38
|
+
"@superdoc-dev/cli-linux-x64": "0.5.0-next.6",
|
|
39
|
+
"@superdoc-dev/cli-darwin-x64": "0.5.0-next.6",
|
|
40
|
+
"@superdoc-dev/cli-linux-arm64": "0.5.0-next.6",
|
|
41
|
+
"@superdoc-dev/cli-windows-x64": "0.5.0-next.6"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"predev": "node scripts/ensure-superdoc-build.js",
|