@superdoc-dev/cli 0.2.0-next.120 → 0.2.0-next.121

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.
Files changed (2) hide show
  1. package/dist/index.js +33 -34
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -134644,7 +134644,7 @@ var init_remark_gfm_CjV8kaUy_es = __esm(() => {
134644
134644
  init_remark_gfm_z_sDF4ss_es();
134645
134645
  });
134646
134646
 
134647
- // ../../packages/superdoc/dist/chunks/src-CA9yZS_s.es.js
134647
+ // ../../packages/superdoc/dist/chunks/src-Mwv45g3M.es.js
134648
134648
  function deleteProps(obj, propOrProps) {
134649
134649
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
134650
134650
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -158845,12 +158845,8 @@ function applySectPrToProjection$1(editor, projection, sectPr) {
158845
158845
  editor.dispatch(tr$1);
158846
158846
  return;
158847
158847
  }
158848
- const docAttrs = editor.state.doc.attrs ?? {};
158849
158848
  const tr = applyDirectMutationMeta(editor.state.tr);
158850
- tr.setNodeMarkup(0, undefined, {
158851
- ...docAttrs,
158852
- bodySectPr: sectPr
158853
- });
158849
+ tr.setDocAttribute("bodySectPr", sectPr);
158854
158850
  tr.setMeta("forceUpdatePagination", true);
158855
158851
  editor.dispatch(tr);
158856
158852
  syncConverterBodySection$1(editor, sectPr);
@@ -163124,12 +163120,8 @@ function applySectPrToProjection(editor, projection, sectPr) {
163124
163120
  editor.dispatch(tr$1);
163125
163121
  return;
163126
163122
  }
163127
- const docAttrs = editor.state.doc.attrs ?? {};
163128
163123
  const tr = applyDirectMutationMeta(editor.state.tr);
163129
- tr.setNodeMarkup(0, undefined, {
163130
- ...docAttrs,
163131
- bodySectPr: sectPr
163132
- });
163124
+ tr.setDocAttribute("bodySectPr", sectPr);
163133
163125
  tr.setMeta("forceUpdatePagination", true);
163134
163126
  editor.dispatch(tr);
163135
163127
  syncConverterBodySection(editor, sectPr);
@@ -194368,11 +194360,7 @@ var Node$13 = class Node$14 {
194368
194360
  if (resolved.footer != null)
194369
194361
  pageMargins.footer = resolved.footer;
194370
194362
  }
194371
- const nextDocAttrs = {
194372
- ...docAttrs,
194373
- bodySectPr: sectPr
194374
- };
194375
- tr.setNodeMarkup(0, undefined, nextDocAttrs);
194363
+ tr.setDocAttribute("bodySectPr", sectPr);
194376
194364
  tr.setMeta("forceUpdatePagination", true);
194377
194365
  return true;
194378
194366
  }, insertSectionBreakAtSelection = ({ headerInches, footerInches } = {}) => ({ tr, state, editor }) => {
@@ -197321,11 +197309,7 @@ var Node$13 = class Node$14 {
197321
197309
  return false;
197322
197310
  if (!editor?.state?.tr)
197323
197311
  return false;
197324
- const nextDocAttrs = {
197325
- ...editor.state.doc?.attrs ?? {},
197326
- bodySectPr: nextBodySectPr
197327
- };
197328
- const tr = editor.state.tr.setNodeMarkup(0, undefined, nextDocAttrs).setMeta("addToHistory", false).setMeta(BODY_SECT_PR_SYNC_META_KEY, true);
197312
+ const tr = editor.state.tr.setDocAttribute("bodySectPr", nextBodySectPr).setMeta("addToHistory", false).setMeta(BODY_SECT_PR_SYNC_META_KEY, true);
197329
197313
  if (typeof editor.dispatch === "function") {
197330
197314
  editor.dispatch(tr);
197331
197315
  return true;
@@ -216758,7 +216742,7 @@ var Node$13 = class Node$14 {
216758
216742
  return false;
216759
216743
  return Boolean(checker(attrs));
216760
216744
  }, SuperToolbar, ICONS, TEXTS, tableActionsOptions;
216761
- var init_src_CA9yZS_s_es = __esm(() => {
216745
+ var init_src_Mwv45g3M_es = __esm(() => {
216762
216746
  init_rolldown_runtime_B2q5OVn9_es();
216763
216747
  init_SuperConverter_BBGfKYpx_es();
216764
216748
  init_jszip_ChlR43oI_es();
@@ -226455,6 +226439,29 @@ function print() { __p += __j.call(arguments, '') }
226455
226439
  tr.setMeta("replaceContent", true);
226456
226440
  this.#dispatchTransaction(tr);
226457
226441
  }
226442
+ #syncDocumentAttrs(nextAttrs = {}) {
226443
+ const currentAttrs = this.state.doc?.attrs ?? {};
226444
+ const docAttrSpecs = this.schema?.topNodeType?.spec?.attrs ?? {};
226445
+ const attrKeys = new Set([
226446
+ ...Object.keys(docAttrSpecs),
226447
+ ...Object.keys(currentAttrs),
226448
+ ...Object.keys(nextAttrs)
226449
+ ]);
226450
+ if (attrKeys.size === 0)
226451
+ return;
226452
+ const valuesMatch = (a2, b$1) => a2 === b$1 || JSON.stringify(a2) === JSON.stringify(b$1);
226453
+ const tr = this.state.tr.setMeta("addToHistory", false);
226454
+ let changed = false;
226455
+ for (const key$1 of attrKeys) {
226456
+ const nextValue = Object.prototype.hasOwnProperty.call(nextAttrs, key$1) ? nextAttrs[key$1] : docAttrSpecs[key$1]?.default;
226457
+ if (valuesMatch(currentAttrs[key$1], nextValue))
226458
+ continue;
226459
+ tr.setDocAttribute(key$1, nextValue);
226460
+ changed = true;
226461
+ }
226462
+ if (changed)
226463
+ this.#dispatchTransaction(tr);
226464
+ }
226458
226465
  #insertNewFileData() {
226459
226466
  if (!this.options.isNewFile)
226460
226467
  return;
@@ -226466,13 +226473,7 @@ function print() { __p += __j.call(arguments, '') }
226466
226473
  const ydoc = this.options.ydoc;
226467
226474
  if (ydoc)
226468
226475
  ydoc.getMap("meta").set("bodySectPr", nextBodySectPr);
226469
- if (Object.keys(doc$2.attrs).length > 0) {
226470
- const attrsTr = this.state.tr.setNodeMarkup(0, undefined, {
226471
- ...this.state.doc.attrs ?? {},
226472
- ...doc$2.attrs ?? {}
226473
- }).setMeta("addToHistory", false);
226474
- this.#dispatchTransaction(attrsTr);
226475
- }
226476
+ this.#syncDocumentAttrs(doc$2.attrs ?? {});
226476
226477
  setTimeout(() => {
226477
226478
  this.#initComments();
226478
226479
  }, 50);
@@ -250351,7 +250352,7 @@ var init_zipper_DqXT7uTa_es = __esm(() => {
250351
250352
 
250352
250353
  // ../../packages/superdoc/dist/super-editor.es.js
250353
250354
  var init_super_editor_es = __esm(() => {
250354
- init_src_CA9yZS_s_es();
250355
+ init_src_Mwv45g3M_es();
250355
250356
  init_SuperConverter_BBGfKYpx_es();
250356
250357
  init_jszip_ChlR43oI_es();
250357
250358
  init_xml_js_DLE8mr0n_es();
@@ -331666,9 +331667,8 @@ function applySectPrToProjection2(editor, projection, sectPr) {
331666
331667
  editor.dispatch(tr2);
331667
331668
  return;
331668
331669
  }
331669
- const docAttrs = editor.state.doc.attrs ?? {};
331670
331670
  const tr = applyDirectMutationMeta2(editor.state.tr);
331671
- tr.setNodeMarkup(0, undefined, { ...docAttrs, bodySectPr: sectPr });
331671
+ tr.setDocAttribute("bodySectPr", sectPr);
331672
331672
  tr.setMeta("forceUpdatePagination", true);
331673
331673
  editor.dispatch(tr);
331674
331674
  syncConverterBodySection2(editor, sectPr);
@@ -335928,9 +335928,8 @@ function applySectPrToProjection3(editor, projection, sectPr) {
335928
335928
  editor.dispatch(tr2);
335929
335929
  return;
335930
335930
  }
335931
- const docAttrs = editor.state.doc.attrs ?? {};
335932
335931
  const tr = applyDirectMutationMeta2(editor.state.tr);
335933
- tr.setNodeMarkup(0, undefined, { ...docAttrs, bodySectPr: sectPr });
335932
+ tr.setDocAttribute("bodySectPr", sectPr);
335934
335933
  tr.setMeta("forceUpdatePagination", true);
335935
335934
  editor.dispatch(tr);
335936
335935
  syncConverterBodySection3(editor, sectPr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.2.0-next.120",
3
+ "version": "0.2.0-next.121",
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.120",
34
- "@superdoc-dev/cli-darwin-x64": "0.2.0-next.120",
35
- "@superdoc-dev/cli-linux-x64": "0.2.0-next.120",
36
- "@superdoc-dev/cli-linux-arm64": "0.2.0-next.120",
37
- "@superdoc-dev/cli-windows-x64": "0.2.0-next.120"
33
+ "@superdoc-dev/cli-darwin-arm64": "0.2.0-next.121",
34
+ "@superdoc-dev/cli-darwin-x64": "0.2.0-next.121",
35
+ "@superdoc-dev/cli-linux-x64": "0.2.0-next.121",
36
+ "@superdoc-dev/cli-linux-arm64": "0.2.0-next.121",
37
+ "@superdoc-dev/cli-windows-x64": "0.2.0-next.121"
38
38
  },
39
39
  "scripts": {
40
40
  "dev": "bun run src/index.ts",