@superdoc-dev/cli 0.5.0-next.57 → 0.5.0-next.58

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 +49 -15
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -65262,7 +65262,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
65262
65262
  emptyOptions2 = {};
65263
65263
  });
65264
65264
 
65265
- // ../../packages/superdoc/dist/chunks/SuperConverter-wNq3qezj.es.js
65265
+ // ../../packages/superdoc/dist/chunks/SuperConverter-CE_qGNRx.es.js
65266
65266
  function getExtensionConfigField(extension$1, field, context = { name: "" }) {
65267
65267
  const fieldValue = extension$1.config[field];
65268
65268
  if (typeof fieldValue === "function")
@@ -91264,6 +91264,30 @@ function updateDOMAttributes(dom, attrs = {}, options = {}) {
91264
91264
  dom.removeAttribute(key);
91265
91265
  });
91266
91266
  }
91267
+ function findEnclosingStructuredContentPosition($pos) {
91268
+ for (let depth = $pos.depth;depth > 0; depth--) {
91269
+ const node3 = $pos.node(depth);
91270
+ if (STRUCTURED_CONTENT_NODE_TYPES.has(node3.type.name))
91271
+ return $pos.before(depth);
91272
+ }
91273
+ return null;
91274
+ }
91275
+ function getViewModeSelectionWithoutStructuredContent(state) {
91276
+ const { selection, doc: doc$2 } = state;
91277
+ if (selection instanceof NodeSelection && STRUCTURED_CONTENT_NODE_TYPES.has(selection.node.type.name)) {
91278
+ const candidate = Selection.near(doc$2.resolve(selection.from), -1);
91279
+ if (findEnclosingStructuredContentPosition(candidate.$from) !== null)
91280
+ return null;
91281
+ return candidate;
91282
+ }
91283
+ if (selection.empty)
91284
+ return null;
91285
+ const startPos = findEnclosingStructuredContentPosition(selection.$from);
91286
+ const endPos = findEnclosingStructuredContentPosition(selection.$to);
91287
+ if (startPos === null || endPos === null || startPos !== endPos)
91288
+ return null;
91289
+ return Selection.near(doc$2.resolve(startPos), -1);
91290
+ }
91267
91291
  function resolveHyperlinkRId(attrs, params3) {
91268
91292
  if (!attrs.hyperlink?.url || !params3)
91269
91293
  return null;
@@ -112663,7 +112687,7 @@ var isRegExp = (value) => {
112663
112687
  tr,
112664
112688
  changed: true
112665
112689
  };
112666
- }, helpers_exports, DECORATIVE_EXT_URI = "{C183D7F6-B498-43B3-948B-1728B52AA6E4}", DECORATIVE_NAMESPACE = "http://schemas.microsoft.com/office/drawing/2017/decorative", HYPERLINK_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", translateImageNode = (params3) => {
112690
+ }, STRUCTURED_CONTENT_NODE_TYPES, helpers_exports, DECORATIVE_EXT_URI = "{C183D7F6-B498-43B3-948B-1728B52AA6E4}", DECORATIVE_NAMESPACE = "http://schemas.microsoft.com/office/drawing/2017/decorative", HYPERLINK_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", translateImageNode = (params3) => {
112667
112691
  const { node: { attrs = {} }, tableCell, imageSize } = params3;
112668
112692
  let imageId = attrs.rId;
112669
112693
  const src = attrs.originalSrc || attrs.src || attrs.imageSrc;
@@ -116833,7 +116857,7 @@ var isRegExp = (value) => {
116833
116857
  state.kern = kernNode.attributes["w:val"];
116834
116858
  }
116835
116859
  }, SuperConverter;
116836
- var init_SuperConverter_wNq3qezj_es = __esm(() => {
116860
+ var init_SuperConverter_CE_qGNRx_es = __esm(() => {
116837
116861
  init_rolldown_runtime_Bg48TavK_es();
116838
116862
  init_jszip_C49i9kUs_es();
116839
116863
  init_xml_js_CqGKpaft_es();
@@ -147211,6 +147235,7 @@ var init_SuperConverter_wNq3qezj_es = __esm(() => {
147211
147235
  getMarksAtPosition,
147212
147236
  buildTextNodes
147213
147237
  };
147238
+ STRUCTURED_CONTENT_NODE_TYPES = new Set(["structuredContent", "structuredContentBlock"]);
147214
147239
  helpers_exports = /* @__PURE__ */ __export3({
147215
147240
  _testInternals: () => _testInternals,
147216
147241
  applyPatch: () => applyPatch,
@@ -147240,6 +147265,7 @@ var init_SuperConverter_wNq3qezj_es = __esm(() => {
147240
147265
  getSchemaTypeByName: () => getSchemaTypeByName,
147241
147266
  getSchemaTypeNameByName: () => getSchemaTypeNameByName,
147242
147267
  getSelectionFormattingState: () => getSelectionFormattingState,
147268
+ getViewModeSelectionWithoutStructuredContent: () => getViewModeSelectionWithoutStructuredContent,
147243
147269
  isActive: () => isActive,
147244
147270
  isInTable: () => isInTable,
147245
147271
  isList: () => isList$1,
@@ -153904,7 +153930,7 @@ var init_SuperConverter_wNq3qezj_es = __esm(() => {
153904
153930
  };
153905
153931
  });
153906
153932
 
153907
- // ../../packages/superdoc/dist/chunks/create-headless-toolbar-Csd13BoY.es.js
153933
+ // ../../packages/superdoc/dist/chunks/create-headless-toolbar-oHAjbd4d.es.js
153908
153934
  function parseSizeUnit(val = "0") {
153909
153935
  const length3 = val.toString() || "0";
153910
153936
  const value = Number.parseFloat(length3);
@@ -155440,8 +155466,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
155440
155466
  return false;
155441
155467
  return Boolean(checker(attrs));
155442
155468
  };
155443
- var init_create_headless_toolbar_Csd13BoY_es = __esm(() => {
155444
- init_SuperConverter_wNq3qezj_es();
155469
+ var init_create_headless_toolbar_oHAjbd4d_es = __esm(() => {
155470
+ init_SuperConverter_CE_qGNRx_es();
155445
155471
  init_constants_5yyN6FZg_es();
155446
155472
  init_dist_B8HfvhaK_es();
155447
155473
  CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
@@ -203879,7 +203905,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
203879
203905
  init_remark_gfm_BhnWr3yf_es();
203880
203906
  });
203881
203907
 
203882
- // ../../packages/superdoc/dist/chunks/src-8ohzSIPE.es.js
203908
+ // ../../packages/superdoc/dist/chunks/src-iEokMYE4.es.js
203883
203909
  function deleteProps(obj, propOrProps) {
203884
203910
  const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
203885
203911
  const removeNested = (target, pathParts, index2 = 0) => {
@@ -205613,8 +205639,10 @@ function createStructuredContentLockPlugin() {
205613
205639
  }
205614
205640
  });
205615
205641
  }
205616
- function createStructuredContentSelectPlugin() {
205642
+ function createStructuredContentSelectPlugin(editor) {
205617
205643
  return new Plugin({ appendTransaction(transactions, oldState, newState) {
205644
+ if (editor?.options?.documentMode === "viewing")
205645
+ return null;
205618
205646
  const { selection } = newState;
205619
205647
  if (!selection.empty)
205620
205648
  return null;
@@ -262110,12 +262138,15 @@ var Node$13 = class Node$14 {
262110
262138
  const isPasteEvent = event.type === "paste";
262111
262139
  const isCutEvent = event.type === "cut";
262112
262140
  const isClickEvent = event.type === "mousedown";
262141
+ const isViewingMode = this.editor?.options?.documentMode === "viewing";
262113
262142
  if (!isDraggable && isSelectable && isDragEvent && event.target === this.dom)
262114
262143
  event.preventDefault();
262115
262144
  if (isDraggable && isDragEvent && !isDragging && event.target === this.dom) {
262116
262145
  event.preventDefault();
262117
262146
  return false;
262118
262147
  }
262148
+ if (isViewingMode && isClickEvent && isSelectable)
262149
+ return true;
262119
262150
  if (isDraggable && isEditable && !isDragging && isClickEvent) {
262120
262151
  const dragHandle = target.closest("[data-drag-handle]");
262121
262152
  if (dragHandle && (this.dom === dragHandle || this.dom.contains(dragHandle))) {
@@ -286160,12 +286191,12 @@ var Node$13 = class Node$14 {
286160
286191
  return;
286161
286192
  console.log(...args$1);
286162
286193
  }, 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;
286163
- var init_src_8ohzSIPE_es = __esm(() => {
286194
+ var init_src_iEokMYE4_es = __esm(() => {
286164
286195
  init_rolldown_runtime_Bg48TavK_es();
286165
- init_SuperConverter_wNq3qezj_es();
286196
+ init_SuperConverter_CE_qGNRx_es();
286166
286197
  init_jszip_C49i9kUs_es();
286167
286198
  init_uuid_qzgm05fK_es();
286168
- init_create_headless_toolbar_Csd13BoY_es();
286199
+ init_create_headless_toolbar_oHAjbd4d_es();
286169
286200
  init_constants_5yyN6FZg_es();
286170
286201
  init_dist_B8HfvhaK_es();
286171
286202
  init_unified_Dsuw2be5_es();
@@ -287975,7 +288006,7 @@ ${err.toString()}`);
287975
288006
  ];
287976
288007
  },
287977
288008
  addPmPlugins() {
287978
- return [createStructuredContentLockPlugin(), createStructuredContentSelectPlugin()];
288009
+ return [createStructuredContentLockPlugin(), createStructuredContentSelectPlugin(this.editor)];
287979
288010
  },
287980
288011
  addNodeView() {
287981
288012
  return (props) => {
@@ -310224,6 +310255,9 @@ function print() { __p += __j.call(arguments, '') }
310224
310255
  cleanedMode = "suggesting";
310225
310256
  if (cleanedMode === "viewing") {
310226
310257
  this.commands.toggleTrackChangesShowOriginal?.();
310258
+ const normalizedSelection = getViewModeSelectionWithoutStructuredContent(this.state);
310259
+ if (normalizedSelection)
310260
+ this.view?.dispatch(this.state.tr.setSelection(normalizedSelection));
310227
310261
  this.setEditable(false, false);
310228
310262
  this.setOptions({ documentMode: "viewing" });
310229
310263
  if (pm)
@@ -320621,11 +320655,11 @@ var init_zipper_DbkgrypV_es = __esm(() => {
320621
320655
 
320622
320656
  // ../../packages/superdoc/dist/super-editor.es.js
320623
320657
  var init_super_editor_es = __esm(() => {
320624
- init_src_8ohzSIPE_es();
320625
- init_SuperConverter_wNq3qezj_es();
320658
+ init_src_iEokMYE4_es();
320659
+ init_SuperConverter_CE_qGNRx_es();
320626
320660
  init_jszip_C49i9kUs_es();
320627
320661
  init_xml_js_CqGKpaft_es();
320628
- init_create_headless_toolbar_Csd13BoY_es();
320662
+ init_create_headless_toolbar_oHAjbd4d_es();
320629
320663
  init_constants_5yyN6FZg_es();
320630
320664
  init_dist_B8HfvhaK_es();
320631
320665
  init_unified_Dsuw2be5_es();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc-dev/cli",
3
- "version": "0.5.0-next.57",
3
+ "version": "0.5.0-next.58",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "superdoc": "./dist/index.js"
@@ -34,11 +34,11 @@
34
34
  "access": "public"
35
35
  },
36
36
  "optionalDependencies": {
37
- "@superdoc-dev/cli-darwin-arm64": "0.5.0-next.57",
38
- "@superdoc-dev/cli-linux-x64": "0.5.0-next.57",
39
- "@superdoc-dev/cli-darwin-x64": "0.5.0-next.57",
40
- "@superdoc-dev/cli-linux-arm64": "0.5.0-next.57",
41
- "@superdoc-dev/cli-windows-x64": "0.5.0-next.57"
37
+ "@superdoc-dev/cli-darwin-arm64": "0.5.0-next.58",
38
+ "@superdoc-dev/cli-linux-x64": "0.5.0-next.58",
39
+ "@superdoc-dev/cli-darwin-x64": "0.5.0-next.58",
40
+ "@superdoc-dev/cli-windows-x64": "0.5.0-next.58",
41
+ "@superdoc-dev/cli-linux-arm64": "0.5.0-next.58"
42
42
  },
43
43
  "scripts": {
44
44
  "predev": "node scripts/ensure-superdoc-build.js",