@superdoc-dev/cli 0.2.0-next.117 → 0.2.0-next.118
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 +128 -26
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -134408,7 +134408,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
|
|
|
134408
134408
|
init_remark_gfm_z_sDF4ss_es();
|
|
134409
134409
|
});
|
|
134410
134410
|
|
|
134411
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
134411
|
+
// ../../packages/superdoc/dist/chunks/src-C1wprZky.es.js
|
|
134412
134412
|
function deleteProps(obj, propOrProps) {
|
|
134413
134413
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
134414
134414
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -196966,7 +196966,7 @@ var Node$13 = class Node$14 {
|
|
|
196966
196966
|
day: "2-digit",
|
|
196967
196967
|
year: "numeric"
|
|
196968
196968
|
});
|
|
196969
|
-
}, AnnotatorHelpers, PARTS_MAP_KEY = "parts", META_MAP_KEY = "meta", META_PARTS_SCHEMA_VERSION_KEY = "partsSchemaVersion", META_PARTS_MIGRATION_KEY = "partsMigration", META_PARTS_LAST_HYDRATED_AT_KEY = "partsLastHydratedAt", META_PARTS_FALLBACK_MODE_KEY = "partsFallbackMode", META_PARTS_CAPABILITY_KEY = "partsCapability", SOURCE_COLLAB_REMOTE_PARTS = "collab:remote:parts", SOURCE_COLLAB_REMOTE_PREFIX = "collab:remote:", EXCLUDED_PART_IDS, CRITICAL_PART_IDS, SOURCE_HEADER_FOOTER_LOCAL = "header-footer-sync:local", HEADER_PATTERN, FOOTER_PATTERN, DEFAULT_HDR_FTR_ATTRS, HEADER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", isApplyingRemoteParts = false, headlessBindingStateByEditor, headlessCleanupRegisteredEditors, collaborationCleanupByEditor, registerHeadlessBindingCleanup = (editor, cleanup) => {
|
|
196969
|
+
}, AnnotatorHelpers, PARTS_MAP_KEY = "parts", META_MAP_KEY = "meta", META_PARTS_SCHEMA_VERSION_KEY = "partsSchemaVersion", META_PARTS_MIGRATION_KEY = "partsMigration", META_PARTS_LAST_HYDRATED_AT_KEY = "partsLastHydratedAt", META_PARTS_FALLBACK_MODE_KEY = "partsFallbackMode", META_PARTS_CAPABILITY_KEY = "partsCapability", SOURCE_COLLAB_REMOTE_PARTS = "collab:remote:parts", SOURCE_COLLAB_REMOTE_PREFIX = "collab:remote:", EXCLUDED_PART_IDS, CRITICAL_PART_IDS, SOURCE_HEADER_FOOTER_LOCAL = "header-footer-sync:local", HEADER_PATTERN, FOOTER_PATTERN, DEFAULT_HDR_FTR_ATTRS, HEADER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", isApplyingRemoteParts = false, headlessBindingStateByEditor, headlessCleanupRegisteredEditors, META_BODY_SECT_PR_KEY = "bodySectPr", BODY_SECT_PR_SYNC_META_KEY = "bodySectPrSync", collaborationCleanupByEditor, registerHeadlessBindingCleanup = (editor, cleanup) => {
|
|
196970
196970
|
if (!cleanup || headlessCleanupRegisteredEditors.has(editor))
|
|
196971
196971
|
return;
|
|
196972
196972
|
headlessCleanupRegisteredEditors.add(editor);
|
|
@@ -196974,6 +196974,81 @@ var Node$13 = class Node$14 {
|
|
|
196974
196974
|
cleanup();
|
|
196975
196975
|
headlessCleanupRegisteredEditors.delete(editor);
|
|
196976
196976
|
});
|
|
196977
|
+
}, cloneJsonValue = (value) => {
|
|
196978
|
+
if (value == null)
|
|
196979
|
+
return null;
|
|
196980
|
+
return JSON.parse(JSON.stringify(value));
|
|
196981
|
+
}, serializeComparableValue = (value) => JSON.stringify(value ?? null), getEditorBodySectPr = (editor) => editor?.state?.doc?.attrs?.bodySectPr ?? null, setEditorConverterBodySectPr = (editor, bodySectPr) => {
|
|
196982
|
+
if (!editor?.converter)
|
|
196983
|
+
return;
|
|
196984
|
+
editor.converter.bodySectPr = cloneJsonValue(bodySectPr);
|
|
196985
|
+
}, syncBodySectPrToMetaMap = (ydoc, editor) => {
|
|
196986
|
+
const metaMap = ydoc.getMap("meta");
|
|
196987
|
+
const nextBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
196988
|
+
const currentMetaBodySectPr = cloneJsonValue(metaMap.get(META_BODY_SECT_PR_KEY) ?? null);
|
|
196989
|
+
setEditorConverterBodySectPr(editor, nextBodySectPr);
|
|
196990
|
+
if (serializeComparableValue(nextBodySectPr) === serializeComparableValue(currentMetaBodySectPr))
|
|
196991
|
+
return false;
|
|
196992
|
+
metaMap.set(META_BODY_SECT_PR_KEY, nextBodySectPr);
|
|
196993
|
+
return true;
|
|
196994
|
+
}, applyBodySectPrFromMetaMap = (editor, ydoc) => {
|
|
196995
|
+
const nextBodySectPr = cloneJsonValue(ydoc.getMap("meta").get(META_BODY_SECT_PR_KEY) ?? null);
|
|
196996
|
+
const currentBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
196997
|
+
setEditorConverterBodySectPr(editor, nextBodySectPr);
|
|
196998
|
+
if (serializeComparableValue(nextBodySectPr) === serializeComparableValue(currentBodySectPr))
|
|
196999
|
+
return false;
|
|
197000
|
+
if (!editor?.state?.tr)
|
|
197001
|
+
return false;
|
|
197002
|
+
const nextDocAttrs = {
|
|
197003
|
+
...editor.state.doc?.attrs ?? {},
|
|
197004
|
+
bodySectPr: nextBodySectPr
|
|
197005
|
+
};
|
|
197006
|
+
const tr = editor.state.tr.setNodeMarkup(0, undefined, nextDocAttrs).setMeta("addToHistory", false).setMeta(BODY_SECT_PR_SYNC_META_KEY, true);
|
|
197007
|
+
if (typeof editor.dispatch === "function") {
|
|
197008
|
+
editor.dispatch(tr);
|
|
197009
|
+
return true;
|
|
197010
|
+
}
|
|
197011
|
+
if (typeof editor.view?.dispatch === "function") {
|
|
197012
|
+
editor.view.dispatch(tr);
|
|
197013
|
+
return true;
|
|
197014
|
+
}
|
|
197015
|
+
return false;
|
|
197016
|
+
}, registerBodySectPrSync = (editor, ydoc, provider, cleanupState) => {
|
|
197017
|
+
const metaMap = ydoc.getMap("meta");
|
|
197018
|
+
const metaMapObserver = (event) => {
|
|
197019
|
+
if (!event?.changes?.keys?.has?.(META_BODY_SECT_PR_KEY))
|
|
197020
|
+
return;
|
|
197021
|
+
applyBodySectPrFromMetaMap(editor, ydoc);
|
|
197022
|
+
};
|
|
197023
|
+
metaMap.observe(metaMapObserver);
|
|
197024
|
+
cleanupState.metaMap = metaMap;
|
|
197025
|
+
cleanupState.metaMapObserver = metaMapObserver;
|
|
197026
|
+
const applyInitialBodySectPr = () => {
|
|
197027
|
+
if (editor.isDestroyed)
|
|
197028
|
+
return;
|
|
197029
|
+
applyBodySectPrFromMetaMap(editor, ydoc);
|
|
197030
|
+
};
|
|
197031
|
+
if (!provider)
|
|
197032
|
+
applyInitialBodySectPr();
|
|
197033
|
+
else
|
|
197034
|
+
cleanupState.bodySectPrPendingCleanup = onCollaborationProviderSynced(provider, applyInitialBodySectPr);
|
|
197035
|
+
if (typeof editor.on === "function" && !editor.options?.isHeadless) {
|
|
197036
|
+
const bodySectPrTransactionHandler = ({ transaction }) => {
|
|
197037
|
+
if (!transaction || transaction.getMeta?.(BODY_SECT_PR_SYNC_META_KEY))
|
|
197038
|
+
return;
|
|
197039
|
+
if (Boolean(transaction.getMeta?.(ySyncPluginKey)?.isChangeOrigin)) {
|
|
197040
|
+
applyBodySectPrFromMetaMap(editor, ydoc);
|
|
197041
|
+
return;
|
|
197042
|
+
}
|
|
197043
|
+
const previousBodySectPr = cloneJsonValue(transaction.before?.attrs?.bodySectPr ?? null);
|
|
197044
|
+
const nextBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
197045
|
+
if (serializeComparableValue(previousBodySectPr) === serializeComparableValue(nextBodySectPr))
|
|
197046
|
+
return;
|
|
197047
|
+
syncBodySectPrToMetaMap(ydoc, editor);
|
|
197048
|
+
};
|
|
197049
|
+
editor.on("transaction", bodySectPrTransactionHandler);
|
|
197050
|
+
cleanupState.bodySectPrTransactionHandler = bodySectPrTransactionHandler;
|
|
197051
|
+
}
|
|
196977
197052
|
}, Collaboration, createSyncPlugin = (ydoc, editor) => {
|
|
196978
197053
|
const fragment2 = ydoc.getXmlFragment("supereditor");
|
|
196979
197054
|
const onFirstRender = () => {
|
|
@@ -196988,6 +197063,7 @@ var Node$13 = class Node$14 {
|
|
|
196988
197063
|
Object.entries(editor.options.mediaFiles).forEach(([key$1, value]) => {
|
|
196989
197064
|
mediaMap.set(key$1, value);
|
|
196990
197065
|
});
|
|
197066
|
+
syncBodySectPrToMetaMap(ydoc, editor);
|
|
196991
197067
|
const metaMap = ydoc.getMap("meta");
|
|
196992
197068
|
metaMap.set("fonts", editor.options.fonts);
|
|
196993
197069
|
metaMap.set("bootstrap", {
|
|
@@ -197067,30 +197143,36 @@ var Node$13 = class Node$14 {
|
|
|
197067
197143
|
const transactionHandler = ({ transaction }) => {
|
|
197068
197144
|
if (!editor.options.ydoc)
|
|
197069
197145
|
return;
|
|
197070
|
-
if (transaction.getMeta(ySyncPluginKey)?.isChangeOrigin)
|
|
197071
|
-
|
|
197072
|
-
const binding = ensureInitializedBinding();
|
|
197073
|
-
if (!binding)
|
|
197074
|
-
return;
|
|
197075
|
-
if (typeof binding._prosemirrorChanged !== "function")
|
|
197146
|
+
if (transaction.getMeta(ySyncPluginKey)?.isChangeOrigin) {
|
|
197147
|
+
applyBodySectPrFromMetaMap(editor, editor.options.ydoc);
|
|
197076
197148
|
return;
|
|
197077
|
-
|
|
197078
|
-
if (
|
|
197079
|
-
yUndoPluginKey.getState(editor.state)?.undoManager?.stopCapturing?.();
|
|
197080
|
-
const syncToYjs = () => {
|
|
197081
|
-
const ydoc = editor.options.ydoc;
|
|
197082
|
-
if (!ydoc)
|
|
197083
|
-
return;
|
|
197084
|
-
ydoc.transact((tr) => {
|
|
197085
|
-
tr?.meta?.set?.("addToHistory", addToHistory);
|
|
197086
|
-
binding._prosemirrorChanged(editor.state.doc);
|
|
197087
|
-
}, ySyncPluginKey);
|
|
197088
|
-
};
|
|
197089
|
-
if (typeof binding.mux === "function") {
|
|
197090
|
-
binding.mux(syncToYjs);
|
|
197149
|
+
}
|
|
197150
|
+
if (transaction.getMeta?.(BODY_SECT_PR_SYNC_META_KEY))
|
|
197091
197151
|
return;
|
|
197152
|
+
const previousBodySectPr = cloneJsonValue(transaction.before?.attrs?.bodySectPr ?? null);
|
|
197153
|
+
const nextBodySectPr = cloneJsonValue(getEditorBodySectPr(editor));
|
|
197154
|
+
const bodySectPrChanged = serializeComparableValue(previousBodySectPr) !== serializeComparableValue(nextBodySectPr);
|
|
197155
|
+
const binding = ensureInitializedBinding();
|
|
197156
|
+
if (binding && typeof binding._prosemirrorChanged === "function") {
|
|
197157
|
+
const addToHistory = transaction.getMeta("addToHistory") !== false;
|
|
197158
|
+
if (!addToHistory)
|
|
197159
|
+
yUndoPluginKey.getState(editor.state)?.undoManager?.stopCapturing?.();
|
|
197160
|
+
const syncToYjs = () => {
|
|
197161
|
+
const ydoc = editor.options.ydoc;
|
|
197162
|
+
if (!ydoc)
|
|
197163
|
+
return;
|
|
197164
|
+
ydoc.transact((tr) => {
|
|
197165
|
+
tr?.meta?.set?.("addToHistory", addToHistory);
|
|
197166
|
+
binding._prosemirrorChanged(editor.state.doc);
|
|
197167
|
+
}, ySyncPluginKey);
|
|
197168
|
+
};
|
|
197169
|
+
if (typeof binding.mux === "function")
|
|
197170
|
+
binding.mux(syncToYjs);
|
|
197171
|
+
else
|
|
197172
|
+
syncToYjs();
|
|
197092
197173
|
}
|
|
197093
|
-
|
|
197174
|
+
if (bodySectPrChanged)
|
|
197175
|
+
syncBodySectPrToMetaMap(editor.options.ydoc, editor);
|
|
197094
197176
|
};
|
|
197095
197177
|
editor.on("transaction", transactionHandler);
|
|
197096
197178
|
ensureInitializedBinding();
|
|
@@ -216354,7 +216436,7 @@ var Node$13 = class Node$14 {
|
|
|
216354
216436
|
return false;
|
|
216355
216437
|
return Boolean(checker(attrs));
|
|
216356
216438
|
}, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
|
|
216357
|
-
var
|
|
216439
|
+
var init_src_C1wprZky_es = __esm(() => {
|
|
216358
216440
|
init_rolldown_runtime_B2q5OVn9_es();
|
|
216359
216441
|
init_SuperConverter_BBGfKYpx_es();
|
|
216360
216442
|
init_jszip_ChlR43oI_es();
|
|
@@ -224051,10 +224133,15 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
224051
224133
|
const cleanupState = {
|
|
224052
224134
|
mediaMap,
|
|
224053
224135
|
mediaMapObserver,
|
|
224136
|
+
metaMap: null,
|
|
224137
|
+
metaMapObserver: null,
|
|
224054
224138
|
partSyncHandle: null,
|
|
224055
|
-
partSyncPendingCleanup: null
|
|
224139
|
+
partSyncPendingCleanup: null,
|
|
224140
|
+
bodySectPrPendingCleanup: null,
|
|
224141
|
+
bodySectPrTransactionHandler: null
|
|
224056
224142
|
};
|
|
224057
224143
|
collaborationCleanupByEditor.set(this.editor, cleanupState);
|
|
224144
|
+
registerBodySectPrSync(this.editor, this.options.ydoc, this.editor.options.collaborationProvider, cleanupState);
|
|
224058
224145
|
if (typeof this.editor.on === "function") {
|
|
224059
224146
|
const editor = this.editor;
|
|
224060
224147
|
const ydoc = this.options.ydoc;
|
|
@@ -224086,8 +224173,12 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
224086
224173
|
if (!cleanup)
|
|
224087
224174
|
return;
|
|
224088
224175
|
cleanup.mediaMap.unobserve(cleanup.mediaMapObserver);
|
|
224176
|
+
cleanup.metaMap?.unobserve?.(cleanup.metaMapObserver);
|
|
224089
224177
|
cleanup.partSyncHandle?.destroy();
|
|
224090
224178
|
cleanup.partSyncPendingCleanup?.();
|
|
224179
|
+
cleanup.bodySectPrPendingCleanup?.();
|
|
224180
|
+
if (cleanup.bodySectPrTransactionHandler && typeof this.editor.off === "function")
|
|
224181
|
+
this.editor.off("transaction", cleanup.bodySectPrTransactionHandler);
|
|
224091
224182
|
collaborationCleanupByEditor.delete(this.editor);
|
|
224092
224183
|
},
|
|
224093
224184
|
addCommands() {
|
|
@@ -226047,8 +226138,19 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
226047
226138
|
return;
|
|
226048
226139
|
this.options.isNewFile = false;
|
|
226049
226140
|
const doc$2 = this.#generatePmData();
|
|
226141
|
+
const nextBodySectPr = JSON.parse(JSON.stringify(doc$2.attrs?.bodySectPr ?? null));
|
|
226050
226142
|
const tr = this.state.tr.replaceWith(0, this.state.doc.content.size, doc$2).setMeta("addToHistory", false);
|
|
226051
226143
|
this.#dispatchTransaction(tr);
|
|
226144
|
+
const ydoc = this.options.ydoc;
|
|
226145
|
+
if (ydoc)
|
|
226146
|
+
ydoc.getMap("meta").set("bodySectPr", nextBodySectPr);
|
|
226147
|
+
if (Object.keys(doc$2.attrs).length > 0) {
|
|
226148
|
+
const attrsTr = this.state.tr.setNodeMarkup(0, undefined, {
|
|
226149
|
+
...this.state.doc.attrs ?? {},
|
|
226150
|
+
...doc$2.attrs ?? {}
|
|
226151
|
+
}).setMeta("addToHistory", false);
|
|
226152
|
+
this.#dispatchTransaction(attrsTr);
|
|
226153
|
+
}
|
|
226052
226154
|
setTimeout(() => {
|
|
226053
226155
|
this.#initComments();
|
|
226054
226156
|
}, 50);
|
|
@@ -249914,7 +250016,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
|
|
|
249914
250016
|
|
|
249915
250017
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
249916
250018
|
var init_super_editor_es = __esm(() => {
|
|
249917
|
-
|
|
250019
|
+
init_src_C1wprZky_es();
|
|
249918
250020
|
init_SuperConverter_BBGfKYpx_es();
|
|
249919
250021
|
init_jszip_ChlR43oI_es();
|
|
249920
250022
|
init_xml_js_DLE8mr0n_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.118",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superdoc": "./dist/index.js"
|
|
@@ -30,11 +30,11 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"optionalDependencies": {
|
|
33
|
-
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.
|
|
34
|
-
"@superdoc-dev/cli-
|
|
35
|
-
"@superdoc-dev/cli-
|
|
36
|
-
"@superdoc-dev/cli-
|
|
37
|
-
"@superdoc-dev/cli-
|
|
33
|
+
"@superdoc-dev/cli-darwin-arm64": "0.2.0-next.118",
|
|
34
|
+
"@superdoc-dev/cli-darwin-x64": "0.2.0-next.118",
|
|
35
|
+
"@superdoc-dev/cli-linux-arm64": "0.2.0-next.118",
|
|
36
|
+
"@superdoc-dev/cli-linux-x64": "0.2.0-next.118",
|
|
37
|
+
"@superdoc-dev/cli-windows-x64": "0.2.0-next.118"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"dev": "bun run src/index.ts",
|