@superdoc-dev/cli 0.15.0-next.5 → 0.15.0-next.7
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 +253 -89
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -221759,7 +221759,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
221759
221759
|
init_remark_gfm_BhnWr3yf_es();
|
|
221760
221760
|
});
|
|
221761
221761
|
|
|
221762
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
221762
|
+
// ../../packages/superdoc/dist/chunks/src-CYzfdR4C.es.js
|
|
221763
221763
|
function deleteProps(obj, propOrProps) {
|
|
221764
221764
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
221765
221765
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -223110,12 +223110,80 @@ function findContainingBlockAncestor(element3) {
|
|
|
223110
223110
|
}
|
|
223111
223111
|
return null;
|
|
223112
223112
|
}
|
|
223113
|
+
function isZeroWidthMarker(node3) {
|
|
223114
|
+
if (node3.type.name === "fieldAnnotation" && node3.attrs?.hidden === true)
|
|
223115
|
+
return true;
|
|
223116
|
+
return ZERO_WIDTH_MARKER_NODE_NAMES.has(node3.type.name);
|
|
223117
|
+
}
|
|
223118
|
+
function findFirstTextPosInNode(node3, nodePos) {
|
|
223119
|
+
if (node3.isText)
|
|
223120
|
+
return nodePos;
|
|
223121
|
+
for (let index2 = 0, offset$1 = 0;index2 < node3.childCount; index2 += 1) {
|
|
223122
|
+
const child = node3.child(index2);
|
|
223123
|
+
const found2 = findFirstTextPosInNode(child, nodePos + 1 + offset$1);
|
|
223124
|
+
if (found2 != null)
|
|
223125
|
+
return found2;
|
|
223126
|
+
offset$1 += child.nodeSize;
|
|
223127
|
+
}
|
|
223128
|
+
return null;
|
|
223129
|
+
}
|
|
223130
|
+
function findFirstContentCursorPosInNode(node3, nodePos) {
|
|
223131
|
+
if (isZeroWidthMarker(node3))
|
|
223132
|
+
return null;
|
|
223133
|
+
if (node3.isText || node3.isAtom)
|
|
223134
|
+
return nodePos;
|
|
223135
|
+
if (node3.isTextblock && node3.childCount === 0)
|
|
223136
|
+
return nodePos + 1;
|
|
223137
|
+
for (let index2 = 0, offset$1 = 0;index2 < node3.childCount; index2 += 1) {
|
|
223138
|
+
const child = node3.child(index2);
|
|
223139
|
+
const found2 = findFirstContentCursorPosInNode(child, nodePos + 1 + offset$1);
|
|
223140
|
+
if (found2 != null)
|
|
223141
|
+
return found2;
|
|
223142
|
+
offset$1 += child.nodeSize;
|
|
223143
|
+
}
|
|
223144
|
+
if (node3.isTextblock)
|
|
223145
|
+
return nodePos + 1;
|
|
223146
|
+
return null;
|
|
223147
|
+
}
|
|
223148
|
+
function findLastTextPosInNode(node3, nodePos) {
|
|
223149
|
+
if (node3.isText)
|
|
223150
|
+
return nodePos + (node3.text?.length ?? 0);
|
|
223151
|
+
for (let index2 = node3.childCount - 1, offset$1 = node3.content.size;index2 >= 0; index2 -= 1) {
|
|
223152
|
+
const child = node3.child(index2);
|
|
223153
|
+
offset$1 -= child.nodeSize;
|
|
223154
|
+
const found2 = findLastTextPosInNode(child, nodePos + 1 + offset$1);
|
|
223155
|
+
if (found2 != null)
|
|
223156
|
+
return found2;
|
|
223157
|
+
}
|
|
223158
|
+
return null;
|
|
223159
|
+
}
|
|
223160
|
+
function findLastContentCursorPosInNode(node3, nodePos) {
|
|
223161
|
+
if (isZeroWidthMarker(node3))
|
|
223162
|
+
return null;
|
|
223163
|
+
if (node3.isText)
|
|
223164
|
+
return nodePos + (node3.text?.length ?? 0);
|
|
223165
|
+
if (node3.isAtom)
|
|
223166
|
+
return node3.isInline ? nodePos + node3.nodeSize : nodePos;
|
|
223167
|
+
if (node3.isTextblock && node3.childCount === 0)
|
|
223168
|
+
return nodePos + 1;
|
|
223169
|
+
for (let index2 = node3.childCount - 1, offset$1 = node3.content.size;index2 >= 0; index2 -= 1) {
|
|
223170
|
+
const child = node3.child(index2);
|
|
223171
|
+
offset$1 -= child.nodeSize;
|
|
223172
|
+
const found2 = findLastContentCursorPosInNode(child, nodePos + 1 + offset$1);
|
|
223173
|
+
if (found2 != null)
|
|
223174
|
+
return found2;
|
|
223175
|
+
}
|
|
223176
|
+
if (node3.isTextblock)
|
|
223177
|
+
return nodePos + node3.nodeSize - 1;
|
|
223178
|
+
return null;
|
|
223179
|
+
}
|
|
223113
223180
|
function collectSDTNodes(doc$12) {
|
|
223114
223181
|
const sdtNodes = [];
|
|
223115
223182
|
doc$12.descendants((node3, pos) => {
|
|
223116
223183
|
if (node3.type.name === "structuredContent" || node3.type.name === "structuredContentBlock")
|
|
223117
223184
|
sdtNodes.push({
|
|
223118
223185
|
type: node3.type.name,
|
|
223186
|
+
node: node3,
|
|
223119
223187
|
lockMode: node3.attrs.lockMode,
|
|
223120
223188
|
pos,
|
|
223121
223189
|
end: pos + node3.nodeSize
|
|
@@ -223171,6 +223239,15 @@ function isAtBlockSdtWrapperDeletePosition(state, sdt, pos) {
|
|
|
223171
223239
|
return false;
|
|
223172
223240
|
return $pos.before(textblockDepth) === $pos.start(sdtDepth);
|
|
223173
223241
|
}
|
|
223242
|
+
function selectionCoversSdtContent(sdt, from$1, to) {
|
|
223243
|
+
if (from$1 === sdt.pos + 1 && to === sdt.end - 1)
|
|
223244
|
+
return true;
|
|
223245
|
+
if (sdt.type !== "structuredContentBlock")
|
|
223246
|
+
return false;
|
|
223247
|
+
const contentStart = findFirstContentCursorPosInNode(sdt.node, sdt.pos);
|
|
223248
|
+
const contentEnd = findLastContentCursorPosInNode(sdt.node, sdt.pos);
|
|
223249
|
+
return contentStart != null && contentEnd != null && from$1 === contentStart && to === contentEnd;
|
|
223250
|
+
}
|
|
223174
223251
|
function createStructuredContentLockPlugin() {
|
|
223175
223252
|
return new Plugin({
|
|
223176
223253
|
key: STRUCTURED_CONTENT_LOCK_KEY,
|
|
@@ -223198,7 +223275,7 @@ function createStructuredContentLockPlugin() {
|
|
|
223198
223275
|
if (sdtNodes.length === 0)
|
|
223199
223276
|
return false;
|
|
223200
223277
|
if (from$1 !== to && !(selection instanceof NodeSelection)) {
|
|
223201
|
-
const exactContentSDT = sdtNodes.find((s2) => from$1
|
|
223278
|
+
const exactContentSDT = sdtNodes.find((s2) => selectionCoversSdtContent(s2, from$1, to));
|
|
223202
223279
|
if (exactContentSDT) {
|
|
223203
223280
|
const isContentLocked = exactContentSDT.lockMode === "contentLocked" || exactContentSDT.lockMode === "sdtContentLocked";
|
|
223204
223281
|
const isWrapperDeletable = exactContentSDT.lockMode !== "sdtLocked" && exactContentSDT.lockMode !== "sdtContentLocked";
|
|
@@ -224331,80 +224408,70 @@ function shallowEqual$2(a2, b$1) {
|
|
|
224331
224408
|
return false;
|
|
224332
224409
|
return true;
|
|
224333
224410
|
}
|
|
224334
|
-
function
|
|
224335
|
-
return node3.attrs.lockMode === "sdtContentLocked";
|
|
224336
|
-
}
|
|
224337
|
-
function findAncestorDepth$2($pos, predicate) {
|
|
224411
|
+
function findAncestorDepth$3($pos, predicate) {
|
|
224338
224412
|
for (let depth = $pos.depth;depth > 0; depth -= 1)
|
|
224339
224413
|
if (predicate($pos.node(depth)))
|
|
224340
224414
|
return depth;
|
|
224341
224415
|
return null;
|
|
224342
224416
|
}
|
|
224343
|
-
function
|
|
224344
|
-
|
|
224345
|
-
|
|
224346
|
-
|
|
224347
|
-
|
|
224348
|
-
|
|
224349
|
-
if (node3.isText)
|
|
224350
|
-
return nodePos;
|
|
224351
|
-
for (let index2 = 0, offset$1 = 0;index2 < node3.childCount; index2 += 1) {
|
|
224352
|
-
const child = node3.child(index2);
|
|
224353
|
-
const found2 = findFirstTextPosInNode(child, nodePos + 1 + offset$1);
|
|
224354
|
-
if (found2 != null)
|
|
224355
|
-
return found2;
|
|
224356
|
-
offset$1 += child.nodeSize;
|
|
224417
|
+
function findSiblingAcrossHiddenMarkers$1(doc$12, pos, direction) {
|
|
224418
|
+
let currentPos = pos;
|
|
224419
|
+
let node3 = direction === "before" ? doc$12.resolve(currentPos).nodeBefore : doc$12.resolve(currentPos).nodeAfter;
|
|
224420
|
+
while (node3 && isZeroWidthMarker(node3)) {
|
|
224421
|
+
currentPos += direction === "before" ? -node3.nodeSize : node3.nodeSize;
|
|
224422
|
+
node3 = direction === "before" ? doc$12.resolve(currentPos).nodeBefore : doc$12.resolve(currentPos).nodeAfter;
|
|
224357
224423
|
}
|
|
224358
|
-
return
|
|
224424
|
+
return {
|
|
224425
|
+
node: node3,
|
|
224426
|
+
nodePos: direction === "before" && node3 ? currentPos - node3.nodeSize : currentPos
|
|
224427
|
+
};
|
|
224359
224428
|
}
|
|
224360
|
-
function
|
|
224361
|
-
|
|
224429
|
+
function isAtTextBlockBoundary($from, direction) {
|
|
224430
|
+
const textblockDepth = findAncestorDepth$3($from, (node3) => node3.isTextblock);
|
|
224431
|
+
if (textblockDepth == null)
|
|
224362
224432
|
return null;
|
|
224363
|
-
|
|
224364
|
-
|
|
224365
|
-
|
|
224366
|
-
|
|
224367
|
-
|
|
224368
|
-
|
|
224369
|
-
|
|
224370
|
-
|
|
224371
|
-
|
|
224372
|
-
offset$1 += child.nodeSize;
|
|
224373
|
-
}
|
|
224374
|
-
if (node3.isTextblock)
|
|
224375
|
-
return nodePos + 1;
|
|
224376
|
-
return null;
|
|
224433
|
+
const textblock = $from.node(textblockDepth);
|
|
224434
|
+
const textblockPos = $from.before(textblockDepth);
|
|
224435
|
+
const boundary = direction === "before" ? findFirstContentCursorPosInNode(textblock, textblockPos) ?? $from.start(textblockDepth) : findLastContentCursorPosInNode(textblock, textblockPos) ?? $from.end(textblockDepth);
|
|
224436
|
+
if ($from.pos !== boundary)
|
|
224437
|
+
return null;
|
|
224438
|
+
return {
|
|
224439
|
+
textblockDepth,
|
|
224440
|
+
textblockPos
|
|
224441
|
+
};
|
|
224377
224442
|
}
|
|
224378
|
-
function
|
|
224379
|
-
|
|
224380
|
-
|
|
224381
|
-
|
|
224382
|
-
|
|
224383
|
-
|
|
224384
|
-
|
|
224385
|
-
|
|
224386
|
-
|
|
224387
|
-
|
|
224388
|
-
|
|
224443
|
+
function selectAdjacentBlockSdtContent(direction) {
|
|
224444
|
+
return ({ state, dispatch }) => {
|
|
224445
|
+
const { selection } = state;
|
|
224446
|
+
if (!selection.empty)
|
|
224447
|
+
return false;
|
|
224448
|
+
const boundary = isAtTextBlockBoundary(selection.$from, direction);
|
|
224449
|
+
if (!boundary)
|
|
224450
|
+
return false;
|
|
224451
|
+
const siblingBoundaryPos = direction === "before" ? boundary.textblockPos : selection.$from.after(boundary.textblockDepth);
|
|
224452
|
+
const { node: node3, nodePos } = findSiblingAcrossHiddenMarkers$1(state.doc, siblingBoundaryPos, direction);
|
|
224453
|
+
if (node3?.type.name !== "structuredContentBlock")
|
|
224454
|
+
return false;
|
|
224455
|
+
if (node3.content.size === 0)
|
|
224456
|
+
return false;
|
|
224457
|
+
const contentStart = findFirstContentCursorPosInNode(node3, nodePos);
|
|
224458
|
+
const contentEnd = findLastContentCursorPosInNode(node3, nodePos);
|
|
224459
|
+
if (contentStart == null || contentEnd == null)
|
|
224460
|
+
return false;
|
|
224461
|
+
if (contentStart >= contentEnd)
|
|
224462
|
+
return false;
|
|
224463
|
+
if (dispatch)
|
|
224464
|
+
dispatch(state.tr.setSelection(TextSelection.create(state.doc, contentStart, contentEnd)).scrollIntoView());
|
|
224465
|
+
return true;
|
|
224466
|
+
};
|
|
224389
224467
|
}
|
|
224390
|
-
function
|
|
224391
|
-
|
|
224392
|
-
|
|
224393
|
-
|
|
224394
|
-
|
|
224395
|
-
|
|
224396
|
-
|
|
224397
|
-
if (node3.isTextblock && node3.childCount === 0)
|
|
224398
|
-
return nodePos + 1;
|
|
224399
|
-
for (let index2 = node3.childCount - 1, offset$1 = node3.content.size;index2 >= 0; index2 -= 1) {
|
|
224400
|
-
const child = node3.child(index2);
|
|
224401
|
-
offset$1 -= child.nodeSize;
|
|
224402
|
-
const found2 = findLastContentCursorPosInNode(child, nodePos + 1 + offset$1);
|
|
224403
|
-
if (found2 != null)
|
|
224404
|
-
return found2;
|
|
224405
|
-
}
|
|
224406
|
-
if (node3.isTextblock)
|
|
224407
|
-
return nodePos + node3.nodeSize - 1;
|
|
224468
|
+
function isSdtContentFullyLocked(node3) {
|
|
224469
|
+
return node3.attrs.lockMode === "sdtContentLocked";
|
|
224470
|
+
}
|
|
224471
|
+
function findAncestorDepth$2($pos, predicate) {
|
|
224472
|
+
for (let depth = $pos.depth;depth > 0; depth -= 1)
|
|
224473
|
+
if (predicate($pos.node(depth)))
|
|
224474
|
+
return depth;
|
|
224408
224475
|
return null;
|
|
224409
224476
|
}
|
|
224410
224477
|
function findAncestorDepth$1($pos, predicate) {
|
|
@@ -283216,7 +283283,7 @@ var Node$13 = class Node$14 {
|
|
|
283216
283283
|
const transaction = view.state.tr.setSelection(selection);
|
|
283217
283284
|
view.dispatch(transaction);
|
|
283218
283285
|
}
|
|
283219
|
-
}, StructuredContentInlineView, findChildren$12, SD_BLOCK_ID_ATTRIBUTE_NAME = "sdBlockId", SD_BLOCK_REV_ATTRIBUTE_NAME = "sdBlockRev", BLOCK_NODE_METADATA_UPDATE_META = "blockNodeMetadataUpdate", BlockNodePluginKey, BlockNode, nodeAllowsSdBlockIdAttr = (node3) => {
|
|
283286
|
+
}, StructuredContentInlineView, ZERO_WIDTH_MARKER_NODE_NAMES, findChildren$12, SD_BLOCK_ID_ATTRIBUTE_NAME = "sdBlockId", SD_BLOCK_REV_ATTRIBUTE_NAME = "sdBlockRev", BLOCK_NODE_METADATA_UPDATE_META = "blockNodeMetadataUpdate", BlockNodePluginKey, BlockNode, nodeAllowsSdBlockIdAttr = (node3) => {
|
|
283220
283287
|
return !!(node3?.isBlock && node3?.type?.spec?.attrs?.[SD_BLOCK_ID_ATTRIBUTE_NAME]);
|
|
283221
283288
|
}, nodeAllowsSdBlockRevAttr = (node3) => {
|
|
283222
283289
|
return !!(node3?.isBlock && node3?.type?.spec?.attrs?.[SD_BLOCK_REV_ATTRIBUTE_NAME]);
|
|
@@ -284872,7 +284939,7 @@ var Node$13 = class Node$14 {
|
|
|
284872
284939
|
dispatch(tr.scrollIntoView());
|
|
284873
284940
|
}
|
|
284874
284941
|
return true;
|
|
284875
|
-
}, deleteBlockSdtAtTextBlockStart = () => ({ state, dispatch }) => {
|
|
284942
|
+
}, selectBlockSdtBeforeTextBlockStart = () => selectAdjacentBlockSdtContent("before"), selectBlockSdtAfterTextBlockEnd = () => selectAdjacentBlockSdtContent("after"), deleteBlockSdtAtTextBlockStart = () => ({ state, dispatch }) => {
|
|
284876
284943
|
const { selection } = state;
|
|
284877
284944
|
if (!selection.empty)
|
|
284878
284945
|
return false;
|
|
@@ -284901,7 +284968,7 @@ var Node$13 = class Node$14 {
|
|
|
284901
284968
|
dispatch(tr.setSelection(Selection.near(tr.doc.resolve(selectionPos), -1)).scrollIntoView());
|
|
284902
284969
|
}
|
|
284903
284970
|
return true;
|
|
284904
|
-
},
|
|
284971
|
+
}, moveIntoBlockSdtBeforeTextBlockStart = () => moveIntoAdjacentBlockSdt("before"), moveIntoBlockSdtAfterTextBlockEnd = () => moveIntoAdjacentBlockSdt("after"), deleteSkipEmptyRun = () => ({ state, dispatch }) => {
|
|
284905
284972
|
const sel = state.selection;
|
|
284906
284973
|
if (!sel.empty)
|
|
284907
284974
|
return false;
|
|
@@ -296268,6 +296335,7 @@ var Node$13 = class Node$14 {
|
|
|
296268
296335
|
},
|
|
296269
296336
|
() => commands$1.deleteBlockSdtAtTextBlockStart(),
|
|
296270
296337
|
() => commands$1.selectInlineSdtBeforeRunStart(),
|
|
296338
|
+
() => commands$1.selectBlockSdtBeforeTextBlockStart(),
|
|
296271
296339
|
() => commands$1.moveIntoBlockSdtBeforeTextBlockStart(),
|
|
296272
296340
|
() => commands$1.backspaceEmptyRunParagraph(),
|
|
296273
296341
|
() => commands$1.backspaceSkipEmptyRun(),
|
|
@@ -296286,6 +296354,7 @@ var Node$13 = class Node$14 {
|
|
|
296286
296354
|
return editor.commands.first(({ commands: commands$1 }) => [
|
|
296287
296355
|
() => commands$1.deleteBlockSdtAtTextBlockStart(),
|
|
296288
296356
|
() => commands$1.selectInlineSdtAfterRunEnd(),
|
|
296357
|
+
() => commands$1.selectBlockSdtAfterTextBlockEnd(),
|
|
296289
296358
|
() => commands$1.moveIntoBlockSdtAfterTextBlockEnd(),
|
|
296290
296359
|
() => commands$1.deleteSkipEmptyRun(),
|
|
296291
296360
|
() => commands$1.deleteAtomAfter(),
|
|
@@ -298317,7 +298386,7 @@ var Node$13 = class Node$14 {
|
|
|
298317
298386
|
return false;
|
|
298318
298387
|
const docs = tr.docs ?? [];
|
|
298319
298388
|
return tr.steps.some((step3, index2) => stepTouchesTrackedReviewState(step3, docs[index2] ?? state.doc));
|
|
298320
|
-
}, cloneExtensionInstance = (extension3) => {
|
|
298389
|
+
}, CONTENT_CONTROL_POINTER_WINDOW_MS = 800, cloneExtensionInstance = (extension3) => {
|
|
298321
298390
|
const extensionLike = extension3;
|
|
298322
298391
|
const config2 = extensionLike?.config;
|
|
298323
298392
|
const ExtensionCtor = extensionLike?.constructor;
|
|
@@ -314898,7 +314967,7 @@ menclose::after {
|
|
|
314898
314967
|
nextSelection = TextSelection.create(doc$12, hit.pos);
|
|
314899
314968
|
if (!nextSelection.$from.parent.inlineContent)
|
|
314900
314969
|
nextSelection = Selection.near(doc$12.resolve(hit.pos), 1);
|
|
314901
|
-
let tr = editor.state.tr.setSelection(nextSelection);
|
|
314970
|
+
let tr = editor.state.tr.setSelection(nextSelection).setMeta("uiEvent", "click");
|
|
314902
314971
|
if (inlineSdtBoundaryPos != null && inlineSdtBoundaryDirection) {
|
|
314903
314972
|
tr = applyEditableSlotAtInlineBoundary(tr, inlineSdtBoundaryPos, inlineSdtBoundaryDirection);
|
|
314904
314973
|
nextSelection = tr.selection;
|
|
@@ -318874,7 +318943,7 @@ menclose::after {
|
|
|
318874
318943
|
return;
|
|
318875
318944
|
console.log(...args$1);
|
|
318876
318945
|
}, 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, TRACKED_MARK_NAMES;
|
|
318877
|
-
var
|
|
318946
|
+
var init_src_CYzfdR4C_es = __esm(() => {
|
|
318878
318947
|
init_rolldown_runtime_Bg48TavK_es();
|
|
318879
318948
|
init_SuperConverter_C6hKp29w_es();
|
|
318880
318949
|
init_jszip_C49i9kUs_es();
|
|
@@ -320632,6 +320701,22 @@ ${err.toString()}`);
|
|
|
320632
320701
|
return true;
|
|
320633
320702
|
}
|
|
320634
320703
|
};
|
|
320704
|
+
ZERO_WIDTH_MARKER_NODE_NAMES = new Set([
|
|
320705
|
+
"bookmarkStart",
|
|
320706
|
+
"bookmarkEnd",
|
|
320707
|
+
"commentRangeStart",
|
|
320708
|
+
"commentRangeEnd",
|
|
320709
|
+
"commentReference",
|
|
320710
|
+
"permStart",
|
|
320711
|
+
"permEnd",
|
|
320712
|
+
"permStartBlock",
|
|
320713
|
+
"permEndBlock",
|
|
320714
|
+
"tableOfContentsEntry",
|
|
320715
|
+
"indexEntry",
|
|
320716
|
+
"authorityEntry",
|
|
320717
|
+
"passthroughInline",
|
|
320718
|
+
"passthroughBlock"
|
|
320719
|
+
]);
|
|
320635
320720
|
({ findChildren: findChildren$12 } = helpers_exports);
|
|
320636
320721
|
BlockNodePluginKey = new PluginKey("blockNodePlugin");
|
|
320637
320722
|
BlockNode = Extension.create({
|
|
@@ -321900,22 +321985,6 @@ ${err.toString()}`);
|
|
|
321900
321985
|
macBaseKeymap[key2] = pcBaseKeymap[key2];
|
|
321901
321986
|
typeof navigator != "undefined" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os != "undefined" && os.platform && os.platform();
|
|
321902
321987
|
DELETABLE_INLINE_ATOMS$1 = new Set(["noBreakHyphen"]);
|
|
321903
|
-
ZERO_WIDTH_MARKER_NODE_NAMES = new Set([
|
|
321904
|
-
"bookmarkStart",
|
|
321905
|
-
"bookmarkEnd",
|
|
321906
|
-
"commentRangeStart",
|
|
321907
|
-
"commentRangeEnd",
|
|
321908
|
-
"commentReference",
|
|
321909
|
-
"permStart",
|
|
321910
|
-
"permEnd",
|
|
321911
|
-
"permStartBlock",
|
|
321912
|
-
"permEndBlock",
|
|
321913
|
-
"tableOfContentsEntry",
|
|
321914
|
-
"indexEntry",
|
|
321915
|
-
"authorityEntry",
|
|
321916
|
-
"passthroughInline",
|
|
321917
|
-
"passthroughBlock"
|
|
321918
|
-
]);
|
|
321919
321988
|
DELETABLE_INLINE_ATOMS = new Set(["noBreakHyphen"]);
|
|
321920
321989
|
commands_exports = /* @__PURE__ */ __export3({
|
|
321921
321990
|
SELECT_INLINE_SDT_BEFORE_RUN_START_META: () => SELECT_INLINE_SDT_BEFORE_RUN_START_META,
|
|
@@ -321966,6 +322035,8 @@ ${err.toString()}`);
|
|
|
321966
322035
|
resetAttributes: () => resetAttributes,
|
|
321967
322036
|
restoreSelection: () => restoreSelection,
|
|
321968
322037
|
selectAll: () => selectAll$1,
|
|
322038
|
+
selectBlockSdtAfterTextBlockEnd: () => selectBlockSdtAfterTextBlockEnd,
|
|
322039
|
+
selectBlockSdtBeforeTextBlockStart: () => selectBlockSdtBeforeTextBlockStart,
|
|
321969
322040
|
selectInlineSdtAfterRunEnd: () => selectInlineSdtAfterRunEnd,
|
|
321970
322041
|
selectInlineSdtBeforeRunStart: () => selectInlineSdtBeforeRunStart,
|
|
321971
322042
|
selectNodeBackward: () => selectNodeBackward$1,
|
|
@@ -343072,6 +343143,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
343072
343143
|
}
|
|
343073
343144
|
#telemetry = null;
|
|
343074
343145
|
#documentOpenTracked = false;
|
|
343146
|
+
#lastActiveContentControlRef = null;
|
|
343147
|
+
#lastPointerDownAt = 0;
|
|
343075
343148
|
#constructorFragment = null;
|
|
343076
343149
|
constructor(options) {
|
|
343077
343150
|
super();
|
|
@@ -343293,9 +343366,15 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
343293
343366
|
this.on("fonts-resolved", this.options.onFontsResolved);
|
|
343294
343367
|
this.on("exception", this.options.onException);
|
|
343295
343368
|
this.on("pointerDown", this.options.onPointerDown);
|
|
343369
|
+
this.#trackContentControlPointer();
|
|
343296
343370
|
this.on("pointerUp", this.options.onPointerUp);
|
|
343297
343371
|
this.on("rightClick", this.options.onRightClick);
|
|
343298
343372
|
}
|
|
343373
|
+
#trackContentControlPointer() {
|
|
343374
|
+
this.on("pointerDown", () => {
|
|
343375
|
+
this.#lastPointerDownAt = Date.now();
|
|
343376
|
+
});
|
|
343377
|
+
}
|
|
343299
343378
|
async#loadDocument(source, options) {
|
|
343300
343379
|
try {
|
|
343301
343380
|
const resolvedMode = options?.mode ?? this.options.mode ?? "docx";
|
|
@@ -343446,6 +343525,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
343446
343525
|
this.options.fileSource = null;
|
|
343447
343526
|
this.options.fragment = null;
|
|
343448
343527
|
this._state = undefined;
|
|
343528
|
+
this.#lastActiveContentControlRef = null;
|
|
343529
|
+
this.#lastPointerDownAt = 0;
|
|
343449
343530
|
}
|
|
343450
343531
|
#initProtectionState() {
|
|
343451
343532
|
const protStorage = getProtectionStorage(this);
|
|
@@ -343505,6 +343586,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
343505
343586
|
this.on("fonts-resolved", this.options.onFontsResolved);
|
|
343506
343587
|
this.on("exception", this.options.onException);
|
|
343507
343588
|
this.on("pointerDown", this.options.onPointerDown);
|
|
343589
|
+
this.#trackContentControlPointer();
|
|
343508
343590
|
this.on("pointerUp", this.options.onPointerUp);
|
|
343509
343591
|
this.on("rightClick", this.options.onRightClick);
|
|
343510
343592
|
if (!shouldMountRenderer)
|
|
@@ -343553,6 +343635,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
343553
343635
|
this.on("locked", this.options.onDocumentLocked);
|
|
343554
343636
|
this.on("list-definitions-change", this.options.onListDefinitionsChange);
|
|
343555
343637
|
this.on("pointerDown", this.options.onPointerDown);
|
|
343638
|
+
this.#trackContentControlPointer();
|
|
343556
343639
|
this.on("pointerUp", this.options.onPointerUp);
|
|
343557
343640
|
this.on("rightClick", this.options.onRightClick);
|
|
343558
343641
|
if (!shouldMountRenderer)
|
|
@@ -344372,6 +344455,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344372
344455
|
editor: this,
|
|
344373
344456
|
transaction: transactionToApply
|
|
344374
344457
|
});
|
|
344458
|
+
this.#emitContentControlEvents({
|
|
344459
|
+
transaction: transactionToApply,
|
|
344460
|
+
nextState,
|
|
344461
|
+
selectionHasChanged
|
|
344462
|
+
});
|
|
344375
344463
|
const focus = transactionToApply.getMeta("focus");
|
|
344376
344464
|
if (focus)
|
|
344377
344465
|
this.emit("focus", {
|
|
@@ -344400,6 +344488,82 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
344400
344488
|
});
|
|
344401
344489
|
}
|
|
344402
344490
|
}
|
|
344491
|
+
#emitContentControlEvents({ transaction, nextState, selectionHasChanged }) {
|
|
344492
|
+
const uiEvent = transaction.getMeta("uiEvent");
|
|
344493
|
+
const recentPointerDown = Date.now() - this.#lastPointerDownAt <= CONTENT_CONTROL_POINTER_WINDOW_MS;
|
|
344494
|
+
const source = uiEvent === "click" || recentPointerDown ? "pointer" : "keyboard";
|
|
344495
|
+
const activePath = nextState.selection ? this.#collectActiveSdtRefs(nextState.selection) : [];
|
|
344496
|
+
const activeContentControl = activePath[0] ?? null;
|
|
344497
|
+
if (selectionHasChanged) {
|
|
344498
|
+
const previous3 = this.#lastActiveContentControlRef;
|
|
344499
|
+
if (previous3?.id !== activeContentControl?.id) {
|
|
344500
|
+
if (activeContentControl)
|
|
344501
|
+
this.emit("contentControlFocus", {
|
|
344502
|
+
active: activeContentControl,
|
|
344503
|
+
previous: previous3,
|
|
344504
|
+
activePath,
|
|
344505
|
+
source
|
|
344506
|
+
});
|
|
344507
|
+
else if (previous3)
|
|
344508
|
+
this.emit("contentControlBlur", {
|
|
344509
|
+
active: null,
|
|
344510
|
+
previous: previous3,
|
|
344511
|
+
activePath: [],
|
|
344512
|
+
source
|
|
344513
|
+
});
|
|
344514
|
+
this.#lastActiveContentControlRef = activeContentControl;
|
|
344515
|
+
}
|
|
344516
|
+
}
|
|
344517
|
+
if (uiEvent === "click" && activeContentControl)
|
|
344518
|
+
this.emit("contentControlClick", {
|
|
344519
|
+
target: activeContentControl,
|
|
344520
|
+
source: "pointer"
|
|
344521
|
+
});
|
|
344522
|
+
}
|
|
344523
|
+
#collectActiveSdtRefs(selection) {
|
|
344524
|
+
const refs = [];
|
|
344525
|
+
const seenIds = /* @__PURE__ */ new Set;
|
|
344526
|
+
const selectedNode = selection instanceof NodeSelection ? selection.node : null;
|
|
344527
|
+
if (selectedNode && (selectedNode.type?.name === "structuredContent" || selectedNode.type?.name === "structuredContentBlock")) {
|
|
344528
|
+
const ref$1 = this.#toSdtRef(selectedNode);
|
|
344529
|
+
if (ref$1) {
|
|
344530
|
+
refs.push(ref$1);
|
|
344531
|
+
seenIds.add(ref$1.id);
|
|
344532
|
+
}
|
|
344533
|
+
}
|
|
344534
|
+
const anchor = selection.$anchor;
|
|
344535
|
+
if (anchor && typeof anchor.depth === "number" && typeof anchor.node === "function")
|
|
344536
|
+
for (let depth = anchor.depth;depth >= 0; depth -= 1) {
|
|
344537
|
+
const node3 = anchor.node(depth);
|
|
344538
|
+
if (!node3)
|
|
344539
|
+
continue;
|
|
344540
|
+
const typeName = node3?.type?.name;
|
|
344541
|
+
if (typeName !== "structuredContent" && typeName !== "structuredContentBlock")
|
|
344542
|
+
continue;
|
|
344543
|
+
const ref$1 = this.#toSdtRef(node3);
|
|
344544
|
+
if (!ref$1)
|
|
344545
|
+
continue;
|
|
344546
|
+
if (seenIds.has(ref$1.id))
|
|
344547
|
+
continue;
|
|
344548
|
+
refs.push(ref$1);
|
|
344549
|
+
seenIds.add(ref$1.id);
|
|
344550
|
+
}
|
|
344551
|
+
return refs;
|
|
344552
|
+
}
|
|
344553
|
+
#toSdtRef(node3) {
|
|
344554
|
+
const attrs = node3.attrs;
|
|
344555
|
+
const id2 = attrs?.id;
|
|
344556
|
+
if (typeof id2 !== "string" || id2.length === 0)
|
|
344557
|
+
return null;
|
|
344558
|
+
const scope = node3.type.name === "structuredContent" ? "inline" : "block";
|
|
344559
|
+
return {
|
|
344560
|
+
id: id2,
|
|
344561
|
+
tag: typeof attrs.tag === "string" ? attrs.tag : undefined,
|
|
344562
|
+
alias: typeof attrs.alias === "string" ? attrs.alias : undefined,
|
|
344563
|
+
controlType: typeof attrs.controlType === "string" ? attrs.controlType : "unknown",
|
|
344564
|
+
scope
|
|
344565
|
+
};
|
|
344566
|
+
}
|
|
344403
344567
|
dispatch(tr) {
|
|
344404
344568
|
this.#dispatchTransaction(tr);
|
|
344405
344569
|
}
|
|
@@ -353127,7 +353291,7 @@ var init_zipper_yaJVJ4z9_es = __esm(() => {
|
|
|
353127
353291
|
|
|
353128
353292
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
353129
353293
|
var init_super_editor_es = __esm(() => {
|
|
353130
|
-
|
|
353294
|
+
init_src_CYzfdR4C_es();
|
|
353131
353295
|
init_SuperConverter_C6hKp29w_es();
|
|
353132
353296
|
init_jszip_C49i9kUs_es();
|
|
353133
353297
|
init_xml_js_CqGKpaft_es();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdoc-dev/cli",
|
|
3
|
-
"version": "0.15.0-next.
|
|
3
|
+
"version": "0.15.0-next.7",
|
|
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-
|
|
38
|
-
"@superdoc-dev/cli-
|
|
39
|
-
"@superdoc-dev/cli-linux-
|
|
40
|
-
"@superdoc-dev/cli-
|
|
41
|
-
"@superdoc-dev/cli-windows-x64": "0.15.0-next.
|
|
37
|
+
"@superdoc-dev/cli-darwin-arm64": "0.15.0-next.7",
|
|
38
|
+
"@superdoc-dev/cli-linux-x64": "0.15.0-next.7",
|
|
39
|
+
"@superdoc-dev/cli-linux-arm64": "0.15.0-next.7",
|
|
40
|
+
"@superdoc-dev/cli-darwin-x64": "0.15.0-next.7",
|
|
41
|
+
"@superdoc-dev/cli-windows-x64": "0.15.0-next.7"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"predev": "node scripts/ensure-superdoc-build.js",
|