@superdoc-dev/cli 0.2.0-next.40 → 0.2.0-next.42
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 +1293 -296
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -2794,7 +2794,7 @@ var init_operation_definitions = __esm(() => {
|
|
|
2794
2794
|
supportsDryRun: true,
|
|
2795
2795
|
supportsTrackedMode: false,
|
|
2796
2796
|
possibleFailureCodes: ["NO_OP", "INVALID_INSERTION_CONTEXT"],
|
|
2797
|
-
throws: ["INVALID_TARGET", "TARGET_NOT_FOUND", "CAPABILITY_UNAVAILABLE"]
|
|
2797
|
+
throws: ["INVALID_TARGET", "TARGET_NOT_FOUND", "INVALID_INPUT", "CAPABILITY_UNAVAILABLE"]
|
|
2798
2798
|
}),
|
|
2799
2799
|
referenceDocPath: "create/table-of-contents.mdx",
|
|
2800
2800
|
referenceGroup: "create"
|
|
@@ -2832,21 +2832,21 @@ var init_operation_definitions = __esm(() => {
|
|
|
2832
2832
|
supportsDryRun: true,
|
|
2833
2833
|
supportsTrackedMode: false,
|
|
2834
2834
|
possibleFailureCodes: ["NO_OP"],
|
|
2835
|
-
throws: ["TARGET_NOT_FOUND", "INVALID_TARGET", "CAPABILITY_UNAVAILABLE"]
|
|
2835
|
+
throws: ["TARGET_NOT_FOUND", "INVALID_TARGET", "INVALID_INPUT", "CAPABILITY_UNAVAILABLE"]
|
|
2836
2836
|
}),
|
|
2837
2837
|
referenceDocPath: "toc/configure.mdx",
|
|
2838
2838
|
referenceGroup: "toc"
|
|
2839
2839
|
},
|
|
2840
2840
|
"toc.update": {
|
|
2841
2841
|
memberPath: "toc.update",
|
|
2842
|
-
description: "Rebuild the materialized content of a table of contents.",
|
|
2843
|
-
expectedResult: "Returns a TocMutationResult with the TOC address on success, or a failure code if content is unchanged.",
|
|
2842
|
+
description: "Rebuild or refresh the materialized content of a table of contents.",
|
|
2843
|
+
expectedResult: "Returns a TocMutationResult with the TOC address on success, or a failure code if content is unchanged or page numbers cannot be resolved.",
|
|
2844
2844
|
requiresDocumentContext: true,
|
|
2845
2845
|
metadata: mutationOperation({
|
|
2846
2846
|
idempotency: "conditional",
|
|
2847
2847
|
supportsDryRun: true,
|
|
2848
2848
|
supportsTrackedMode: false,
|
|
2849
|
-
possibleFailureCodes: ["NO_OP"],
|
|
2849
|
+
possibleFailureCodes: ["NO_OP", "PAGE_NUMBERS_NOT_MATERIALIZED", "CAPABILITY_UNAVAILABLE"],
|
|
2850
2850
|
throws: ["TARGET_NOT_FOUND", "INVALID_TARGET", "CAPABILITY_UNAVAILABLE"]
|
|
2851
2851
|
}),
|
|
2852
2852
|
referenceDocPath: "toc/update.mdx",
|
|
@@ -2867,6 +2867,74 @@ var init_operation_definitions = __esm(() => {
|
|
|
2867
2867
|
referenceDocPath: "toc/remove.mdx",
|
|
2868
2868
|
referenceGroup: "toc"
|
|
2869
2869
|
},
|
|
2870
|
+
"toc.markEntry": {
|
|
2871
|
+
memberPath: "toc.markEntry",
|
|
2872
|
+
description: "Insert a TC (table of contents entry) field at the target paragraph.",
|
|
2873
|
+
expectedResult: "Returns a TocEntryMutationResult with the created entry address on success.",
|
|
2874
|
+
requiresDocumentContext: true,
|
|
2875
|
+
metadata: mutationOperation({
|
|
2876
|
+
idempotency: "non-idempotent",
|
|
2877
|
+
supportsDryRun: true,
|
|
2878
|
+
supportsTrackedMode: false,
|
|
2879
|
+
possibleFailureCodes: ["NO_OP", "INVALID_INSERTION_CONTEXT"],
|
|
2880
|
+
throws: ["TARGET_NOT_FOUND", "INVALID_TARGET", "INVALID_INPUT", "CAPABILITY_UNAVAILABLE"]
|
|
2881
|
+
}),
|
|
2882
|
+
referenceDocPath: "toc/mark-entry.mdx",
|
|
2883
|
+
referenceGroup: "toc"
|
|
2884
|
+
},
|
|
2885
|
+
"toc.unmarkEntry": {
|
|
2886
|
+
memberPath: "toc.unmarkEntry",
|
|
2887
|
+
description: "Remove a TC (table of contents entry) field from the document.",
|
|
2888
|
+
expectedResult: "Returns a TocEntryMutationResult with the removed entry address on success.",
|
|
2889
|
+
requiresDocumentContext: true,
|
|
2890
|
+
metadata: mutationOperation({
|
|
2891
|
+
idempotency: "conditional",
|
|
2892
|
+
supportsDryRun: true,
|
|
2893
|
+
supportsTrackedMode: false,
|
|
2894
|
+
possibleFailureCodes: ["NO_OP"],
|
|
2895
|
+
throws: ["TARGET_NOT_FOUND", "INVALID_TARGET", "CAPABILITY_UNAVAILABLE"]
|
|
2896
|
+
}),
|
|
2897
|
+
referenceDocPath: "toc/unmark-entry.mdx",
|
|
2898
|
+
referenceGroup: "toc"
|
|
2899
|
+
},
|
|
2900
|
+
"toc.listEntries": {
|
|
2901
|
+
memberPath: "toc.listEntries",
|
|
2902
|
+
description: "List all TC (table of contents entry) fields in the document body.",
|
|
2903
|
+
expectedResult: "Returns a TocListEntriesResult with an array of TC entry discovery items and pagination metadata.",
|
|
2904
|
+
requiresDocumentContext: true,
|
|
2905
|
+
metadata: readOperation({
|
|
2906
|
+
idempotency: "idempotent"
|
|
2907
|
+
}),
|
|
2908
|
+
referenceDocPath: "toc/list-entries.mdx",
|
|
2909
|
+
referenceGroup: "toc"
|
|
2910
|
+
},
|
|
2911
|
+
"toc.getEntry": {
|
|
2912
|
+
memberPath: "toc.getEntry",
|
|
2913
|
+
description: "Retrieve details of a specific TC (table of contents entry) field.",
|
|
2914
|
+
expectedResult: "Returns a TocEntryInfo object with the instruction, text, level, and switch configuration.",
|
|
2915
|
+
requiresDocumentContext: true,
|
|
2916
|
+
metadata: readOperation({
|
|
2917
|
+
idempotency: "idempotent",
|
|
2918
|
+
throws: T_NOT_FOUND
|
|
2919
|
+
}),
|
|
2920
|
+
referenceDocPath: "toc/get-entry.mdx",
|
|
2921
|
+
referenceGroup: "toc"
|
|
2922
|
+
},
|
|
2923
|
+
"toc.editEntry": {
|
|
2924
|
+
memberPath: "toc.editEntry",
|
|
2925
|
+
description: "Update the properties of a TC (table of contents entry) field.",
|
|
2926
|
+
expectedResult: "Returns a TocEntryMutationResult with the updated entry address on success, or NO_OP if no change.",
|
|
2927
|
+
requiresDocumentContext: true,
|
|
2928
|
+
metadata: mutationOperation({
|
|
2929
|
+
idempotency: "conditional",
|
|
2930
|
+
supportsDryRun: true,
|
|
2931
|
+
supportsTrackedMode: false,
|
|
2932
|
+
possibleFailureCodes: ["NO_OP"],
|
|
2933
|
+
throws: ["TARGET_NOT_FOUND", "INVALID_TARGET", "INVALID_INPUT", "CAPABILITY_UNAVAILABLE"]
|
|
2934
|
+
}),
|
|
2935
|
+
referenceDocPath: "toc/edit-entry.mdx",
|
|
2936
|
+
referenceGroup: "toc"
|
|
2937
|
+
},
|
|
2870
2938
|
"history.get": {
|
|
2871
2939
|
memberPath: "history.get",
|
|
2872
2940
|
description: "Query the current undo/redo history state of the active editor.",
|
|
@@ -3520,6 +3588,28 @@ function tocMutationResultSchema() {
|
|
|
3520
3588
|
oneOf: [tocMutationSuccessSchema, tocMutationFailureSchema]
|
|
3521
3589
|
};
|
|
3522
3590
|
}
|
|
3591
|
+
function tocEntryAddressSchema() {
|
|
3592
|
+
return objectSchema({
|
|
3593
|
+
kind: { const: "inline" },
|
|
3594
|
+
nodeType: { const: "tableOfContentsEntry" },
|
|
3595
|
+
nodeId: { type: "string" }
|
|
3596
|
+
}, ["kind", "nodeType", "nodeId"]);
|
|
3597
|
+
}
|
|
3598
|
+
function tocEntryInsertionTargetSchema() {
|
|
3599
|
+
return objectSchema({
|
|
3600
|
+
kind: { const: "inline-insert" },
|
|
3601
|
+
anchor: objectSchema({
|
|
3602
|
+
nodeType: { const: "paragraph" },
|
|
3603
|
+
nodeId: { type: "string" }
|
|
3604
|
+
}, ["nodeType", "nodeId"]),
|
|
3605
|
+
position: { enum: ["start", "end"] }
|
|
3606
|
+
}, ["kind", "anchor"]);
|
|
3607
|
+
}
|
|
3608
|
+
function tocEntryMutationResultSchema() {
|
|
3609
|
+
return {
|
|
3610
|
+
oneOf: [tocEntryMutationSuccessSchema, tocEntryMutationFailureSchema]
|
|
3611
|
+
};
|
|
3612
|
+
}
|
|
3523
3613
|
function buildInternalContractSchemas() {
|
|
3524
3614
|
const operations = { ...operationSchemas };
|
|
3525
3615
|
for (const operationId of OPERATION_IDS) {
|
|
@@ -3539,7 +3629,7 @@ function buildInternalContractSchemas() {
|
|
|
3539
3629
|
operations
|
|
3540
3630
|
};
|
|
3541
3631
|
}
|
|
3542
|
-
var nodeTypeValues, blockNodeTypeValues, deletableBlockNodeTypeValues, inlineNodeTypeValues, knownTargetKindValues, SHARED_DEFS, rangeSchema, positionSchema, inlineAnchorSchema, targetKindSchema, textAddressSchema, textTargetSchema, blockNodeAddressSchema, deletableBlockNodeAddressSchema, paragraphAddressSchema, headingAddressSchema, listItemAddressSchema, paragraphTargetSchema, sectionAddressSchema, inlineNodeAddressSchema, nodeAddressSchema, commentAddressSchema, trackedChangeAddressSchema, entityAddressSchema, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchRunSchema, matchBlockSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema, nodeSelectorSchema, selectorShorthandSchema, selectSchema, findInputSchema, findItemDomainSchema, findOutputSchema, documentInfoCountsSchema, documentInfoOutlineItemSchema, documentInfoCapabilitiesSchema, documentInfoSchema, listKindSchema, listInsertPositionSchema, listItemInfoSchema, listItemDomainItemSchema, listsListResultSchema, sectionBreakTypeSchema, sectionOrientationSchema, sectionVerticalAlignSchema, sectionDirectionSchema, sectionHeaderFooterKindSchema, sectionHeaderFooterVariantSchema, sectionLineNumberRestartSchema, sectionPageNumberFormatSchema, sectionRangeDomainSchema, sectionPageMarginsSchema, sectionHeaderFooterMarginsSchema, sectionPageSetupSchema, sectionColumnsSchema, sectionLineNumberingSchema, sectionPageNumberingSchema, sectionHeaderFooterRefsSchema, sectionBorderSpecSchema, sectionPageBordersSchema, sectionInfoSchema, sectionResolvedHandleSchema, sectionDomainItemSchema, sectionsListResultSchema, sectionMutationSuccessSchema, documentMutationSuccessSchema, paragraphMutationTargetSchema, paragraphMutationSuccessSchema, createSectionBreakSuccessSchema, commentInfoSchema, commentDomainItemSchema, commentsListResultSchema, trackChangeInfoSchema, trackChangeDomainItemSchema, trackChangesListResultSchema, capabilityReasonCodeSchema, capabilityReasonsSchema, capabilityFlagSchema, operationRuntimeCapabilitySchema, operationCapabilitiesSchema, inlinePropertyCapabilitySchema, inlinePropertyCapabilitiesByKeySchema, formatCapabilitiesSchema, planEngineCapabilitiesSchema, capabilitiesOutputSchema, strictEmptyObjectSchema, insertInputSchema, tableLocatorSchema, _tableScopedRowLocatorSchema, _tableScopedColumnLocatorSchema, mergeRangeLocatorSchema, mixedRowLocatorOneOf, tableCreateLocationSchema, tableMutationSuccessSchema, createTableSuccessSchema, tableMutationFailureCodes, tableMutationFailureSchema, tableMutationResultSchema, createTableResultSchema, historyActionSuccessSchema, historyActionFailureSchema, formatInlineAliasOperationSchemas, tocMutationFailureCodes, tocMutationFailureSchema, tocMutationSuccessSchema, operationSchemas;
|
|
3632
|
+
var nodeTypeValues, blockNodeTypeValues, deletableBlockNodeTypeValues, inlineNodeTypeValues, knownTargetKindValues, SHARED_DEFS, rangeSchema, positionSchema, inlineAnchorSchema, targetKindSchema, textAddressSchema, textTargetSchema, blockNodeAddressSchema, deletableBlockNodeAddressSchema, paragraphAddressSchema, headingAddressSchema, listItemAddressSchema, paragraphTargetSchema, sectionAddressSchema, inlineNodeAddressSchema, nodeAddressSchema, commentAddressSchema, trackedChangeAddressSchema, entityAddressSchema, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchRunSchema, matchBlockSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema, nodeSelectorSchema, selectorShorthandSchema, selectSchema, findInputSchema, findItemDomainSchema, findOutputSchema, documentInfoCountsSchema, documentInfoOutlineItemSchema, documentInfoCapabilitiesSchema, documentInfoSchema, listKindSchema, listInsertPositionSchema, listItemInfoSchema, listItemDomainItemSchema, listsListResultSchema, sectionBreakTypeSchema, sectionOrientationSchema, sectionVerticalAlignSchema, sectionDirectionSchema, sectionHeaderFooterKindSchema, sectionHeaderFooterVariantSchema, sectionLineNumberRestartSchema, sectionPageNumberFormatSchema, sectionRangeDomainSchema, sectionPageMarginsSchema, sectionHeaderFooterMarginsSchema, sectionPageSetupSchema, sectionColumnsSchema, sectionLineNumberingSchema, sectionPageNumberingSchema, sectionHeaderFooterRefsSchema, sectionBorderSpecSchema, sectionPageBordersSchema, sectionInfoSchema, sectionResolvedHandleSchema, sectionDomainItemSchema, sectionsListResultSchema, sectionMutationSuccessSchema, documentMutationSuccessSchema, paragraphMutationTargetSchema, paragraphMutationSuccessSchema, createSectionBreakSuccessSchema, commentInfoSchema, commentDomainItemSchema, commentsListResultSchema, trackChangeInfoSchema, trackChangeDomainItemSchema, trackChangesListResultSchema, capabilityReasonCodeSchema, capabilityReasonsSchema, capabilityFlagSchema, operationRuntimeCapabilitySchema, operationCapabilitiesSchema, inlinePropertyCapabilitySchema, inlinePropertyCapabilitiesByKeySchema, formatCapabilitiesSchema, planEngineCapabilitiesSchema, capabilitiesOutputSchema, strictEmptyObjectSchema, insertInputSchema, tableLocatorSchema, _tableScopedRowLocatorSchema, _tableScopedColumnLocatorSchema, mergeRangeLocatorSchema, mixedRowLocatorOneOf, tableCreateLocationSchema, tableMutationSuccessSchema, createTableSuccessSchema, tableMutationFailureCodes, tableMutationFailureSchema, tableMutationResultSchema, createTableResultSchema, historyActionSuccessSchema, historyActionFailureSchema, formatInlineAliasOperationSchemas, tocMutationFailureCodes, tocMutationFailureSchema, tocMutationSuccessSchema, tocEntryMutationFailureCodes, tocEntryMutationFailureSchema, tocEntryMutationSuccessSchema, operationSchemas;
|
|
3543
3633
|
var init_schemas = __esm(() => {
|
|
3544
3634
|
init_command_catalog();
|
|
3545
3635
|
init_types2();
|
|
@@ -4255,7 +4345,8 @@ var init_schemas = __esm(() => {
|
|
|
4255
4345
|
"INVALID_TARGET",
|
|
4256
4346
|
"TARGET_NOT_FOUND",
|
|
4257
4347
|
"CAPABILITY_UNAVAILABLE",
|
|
4258
|
-
"INVALID_INSERTION_CONTEXT"
|
|
4348
|
+
"INVALID_INSERTION_CONTEXT",
|
|
4349
|
+
"PAGE_NUMBERS_NOT_MATERIALIZED"
|
|
4259
4350
|
];
|
|
4260
4351
|
tocMutationFailureSchema = objectSchema({
|
|
4261
4352
|
success: { const: false },
|
|
@@ -4269,6 +4360,23 @@ var init_schemas = __esm(() => {
|
|
|
4269
4360
|
"success",
|
|
4270
4361
|
"toc"
|
|
4271
4362
|
]);
|
|
4363
|
+
tocEntryMutationFailureCodes = [
|
|
4364
|
+
"NO_OP",
|
|
4365
|
+
"INVALID_TARGET",
|
|
4366
|
+
"TARGET_NOT_FOUND",
|
|
4367
|
+
"CAPABILITY_UNAVAILABLE",
|
|
4368
|
+
"INVALID_INSERTION_CONTEXT",
|
|
4369
|
+
"INVALID_INPUT"
|
|
4370
|
+
];
|
|
4371
|
+
tocEntryMutationFailureSchema = objectSchema({
|
|
4372
|
+
success: { const: false },
|
|
4373
|
+
failure: objectSchema({
|
|
4374
|
+
code: { enum: [...tocEntryMutationFailureCodes] },
|
|
4375
|
+
message: { type: "string" },
|
|
4376
|
+
details: {}
|
|
4377
|
+
}, ["code", "message"])
|
|
4378
|
+
}, ["success", "failure"]);
|
|
4379
|
+
tocEntryMutationSuccessSchema = objectSchema({ success: { const: true }, entry: tocEntryAddressSchema() }, ["success", "entry"]);
|
|
4272
4380
|
operationSchemas = {
|
|
4273
4381
|
find: {
|
|
4274
4382
|
input: findInputSchema,
|
|
@@ -5696,10 +5804,15 @@ var init_schemas = __esm(() => {
|
|
|
5696
5804
|
config: objectSchema({
|
|
5697
5805
|
outlineLevels: objectSchema({ from: { type: "integer" }, to: { type: "integer" } }, ["from", "to"]),
|
|
5698
5806
|
useAppliedOutlineLevel: { type: "boolean" },
|
|
5807
|
+
tcFieldIdentifier: { type: "string" },
|
|
5808
|
+
tcFieldLevels: objectSchema({ from: { type: "integer" }, to: { type: "integer" } }, ["from", "to"]),
|
|
5699
5809
|
hyperlinks: { type: "boolean" },
|
|
5700
5810
|
hideInWebView: { type: "boolean" },
|
|
5701
5811
|
omitPageNumberLevels: objectSchema({ from: { type: "integer" }, to: { type: "integer" } }, ["from", "to"]),
|
|
5702
|
-
separator: { type: "string" }
|
|
5812
|
+
separator: { type: "string" },
|
|
5813
|
+
includePageNumbers: { type: "boolean" },
|
|
5814
|
+
tabLeader: { enum: ["none", "dot", "hyphen", "underscore", "middleDot"] },
|
|
5815
|
+
rightAlignPageNumbers: { type: "boolean" }
|
|
5703
5816
|
})
|
|
5704
5817
|
}),
|
|
5705
5818
|
output: tocMutationResultSchema(),
|
|
@@ -5747,10 +5860,15 @@ var init_schemas = __esm(() => {
|
|
|
5747
5860
|
patch: objectSchema({
|
|
5748
5861
|
outlineLevels: objectSchema({ from: { type: "integer" }, to: { type: "integer" } }, ["from", "to"]),
|
|
5749
5862
|
useAppliedOutlineLevel: { type: "boolean" },
|
|
5863
|
+
tcFieldIdentifier: { type: "string" },
|
|
5864
|
+
tcFieldLevels: objectSchema({ from: { type: "integer" }, to: { type: "integer" } }, ["from", "to"]),
|
|
5750
5865
|
hyperlinks: { type: "boolean" },
|
|
5751
5866
|
hideInWebView: { type: "boolean" },
|
|
5752
5867
|
omitPageNumberLevels: objectSchema({ from: { type: "integer" }, to: { type: "integer" } }, ["from", "to"]),
|
|
5753
|
-
separator: { type: "string" }
|
|
5868
|
+
separator: { type: "string" },
|
|
5869
|
+
includePageNumbers: { type: "boolean" },
|
|
5870
|
+
tabLeader: { enum: ["none", "dot", "hyphen", "underscore", "middleDot"] },
|
|
5871
|
+
rightAlignPageNumbers: { type: "boolean" }
|
|
5754
5872
|
})
|
|
5755
5873
|
}, ["target", "patch"]),
|
|
5756
5874
|
output: tocMutationResultSchema(),
|
|
@@ -5759,7 +5877,8 @@ var init_schemas = __esm(() => {
|
|
|
5759
5877
|
},
|
|
5760
5878
|
"toc.update": {
|
|
5761
5879
|
input: objectSchema({
|
|
5762
|
-
target: tocAddressSchema()
|
|
5880
|
+
target: tocAddressSchema(),
|
|
5881
|
+
mode: { enum: ["all", "pageNumbers"] }
|
|
5763
5882
|
}, ["target"]),
|
|
5764
5883
|
output: tocMutationResultSchema(),
|
|
5765
5884
|
success: tocMutationSuccessSchema,
|
|
@@ -5770,6 +5889,75 @@ var init_schemas = __esm(() => {
|
|
|
5770
5889
|
output: tocMutationResultSchema(),
|
|
5771
5890
|
success: tocMutationSuccessSchema,
|
|
5772
5891
|
failure: tocMutationFailureSchema
|
|
5892
|
+
},
|
|
5893
|
+
"toc.markEntry": {
|
|
5894
|
+
input: objectSchema({
|
|
5895
|
+
target: tocEntryInsertionTargetSchema(),
|
|
5896
|
+
text: { type: "string" },
|
|
5897
|
+
level: { type: "integer", minimum: 1, maximum: 9 },
|
|
5898
|
+
tableIdentifier: { type: "string" },
|
|
5899
|
+
omitPageNumber: { type: "boolean" }
|
|
5900
|
+
}, ["target", "text"]),
|
|
5901
|
+
output: tocEntryMutationResultSchema(),
|
|
5902
|
+
success: tocEntryMutationSuccessSchema,
|
|
5903
|
+
failure: tocEntryMutationFailureSchema
|
|
5904
|
+
},
|
|
5905
|
+
"toc.unmarkEntry": {
|
|
5906
|
+
input: objectSchema({ target: tocEntryAddressSchema() }, ["target"]),
|
|
5907
|
+
output: tocEntryMutationResultSchema(),
|
|
5908
|
+
success: tocEntryMutationSuccessSchema,
|
|
5909
|
+
failure: tocEntryMutationFailureSchema
|
|
5910
|
+
},
|
|
5911
|
+
"toc.listEntries": {
|
|
5912
|
+
input: objectSchema({
|
|
5913
|
+
tableIdentifier: { type: "string" },
|
|
5914
|
+
levelRange: objectSchema({ from: { type: "integer" }, to: { type: "integer" } }, ["from", "to"]),
|
|
5915
|
+
limit: { type: "integer" },
|
|
5916
|
+
offset: { type: "integer" }
|
|
5917
|
+
}),
|
|
5918
|
+
output: objectSchema({
|
|
5919
|
+
evaluatedRevision: { type: "string" },
|
|
5920
|
+
total: { type: "integer" },
|
|
5921
|
+
items: arraySchema(objectSchema({
|
|
5922
|
+
id: { type: "string" },
|
|
5923
|
+
handle: ref("ResolvedHandle"),
|
|
5924
|
+
address: tocEntryAddressSchema(),
|
|
5925
|
+
instruction: { type: "string" },
|
|
5926
|
+
text: { type: "string" },
|
|
5927
|
+
level: { type: "integer" },
|
|
5928
|
+
tableIdentifier: { type: "string" },
|
|
5929
|
+
omitPageNumber: { type: "boolean" }
|
|
5930
|
+
}, ["id", "handle", "address", "instruction", "text", "level", "omitPageNumber"])),
|
|
5931
|
+
page: ref("PageInfo")
|
|
5932
|
+
}, ["evaluatedRevision", "total", "items", "page"])
|
|
5933
|
+
},
|
|
5934
|
+
"toc.getEntry": {
|
|
5935
|
+
input: objectSchema({ target: tocEntryAddressSchema() }, ["target"]),
|
|
5936
|
+
output: objectSchema({
|
|
5937
|
+
nodeType: { const: "tableOfContentsEntry" },
|
|
5938
|
+
kind: { const: "inline" },
|
|
5939
|
+
properties: objectSchema({
|
|
5940
|
+
instruction: { type: "string" },
|
|
5941
|
+
text: { type: "string" },
|
|
5942
|
+
level: { type: "integer" },
|
|
5943
|
+
tableIdentifier: { type: "string" },
|
|
5944
|
+
omitPageNumber: { type: "boolean" }
|
|
5945
|
+
}, ["instruction", "text", "level", "omitPageNumber"])
|
|
5946
|
+
}, ["nodeType", "kind", "properties"])
|
|
5947
|
+
},
|
|
5948
|
+
"toc.editEntry": {
|
|
5949
|
+
input: objectSchema({
|
|
5950
|
+
target: tocEntryAddressSchema(),
|
|
5951
|
+
patch: objectSchema({
|
|
5952
|
+
text: { type: "string" },
|
|
5953
|
+
level: { type: "integer", minimum: 1, maximum: 9 },
|
|
5954
|
+
tableIdentifier: { type: "string" },
|
|
5955
|
+
omitPageNumber: { type: "boolean" }
|
|
5956
|
+
})
|
|
5957
|
+
}, ["target", "patch"]),
|
|
5958
|
+
output: tocEntryMutationResultSchema(),
|
|
5959
|
+
success: tocEntryMutationSuccessSchema,
|
|
5960
|
+
failure: tocEntryMutationFailureSchema
|
|
5773
5961
|
}
|
|
5774
5962
|
};
|
|
5775
5963
|
});
|
|
@@ -6989,7 +7177,12 @@ function buildDispatchTable(api) {
|
|
|
6989
7177
|
"toc.get": (input) => api.toc.get(input),
|
|
6990
7178
|
"toc.configure": (input, options) => api.toc.configure(input, options),
|
|
6991
7179
|
"toc.update": (input, options) => api.toc.update(input, options),
|
|
6992
|
-
"toc.remove": (input, options) => api.toc.remove(input, options)
|
|
7180
|
+
"toc.remove": (input, options) => api.toc.remove(input, options),
|
|
7181
|
+
"toc.markEntry": (input, options) => api.toc.markEntry(input, options),
|
|
7182
|
+
"toc.unmarkEntry": (input, options) => api.toc.unmarkEntry(input, options),
|
|
7183
|
+
"toc.listEntries": (input) => api.toc.listEntries(input),
|
|
7184
|
+
"toc.getEntry": (input) => api.toc.getEntry(input),
|
|
7185
|
+
"toc.editEntry": (input, options) => api.toc.editEntry(input, options)
|
|
6993
7186
|
};
|
|
6994
7187
|
}
|
|
6995
7188
|
var init_invoke = __esm(() => {
|
|
@@ -7422,6 +7615,30 @@ function validateTocTarget(target, operationName) {
|
|
|
7422
7615
|
throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} target must be a TocAddress with kind 'block', nodeType 'tableOfContents', and a string nodeId.`, { target });
|
|
7423
7616
|
}
|
|
7424
7617
|
}
|
|
7618
|
+
function validateTocEntryTarget(target, operationName) {
|
|
7619
|
+
if (target === undefined || target === null) {
|
|
7620
|
+
throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} requires a target.`);
|
|
7621
|
+
}
|
|
7622
|
+
const t = target;
|
|
7623
|
+
if (t.kind !== "inline" || t.nodeType !== "tableOfContentsEntry" || typeof t.nodeId !== "string") {
|
|
7624
|
+
throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} target must be a TocEntryAddress with kind 'inline', nodeType 'tableOfContentsEntry', and a string nodeId.`, { target });
|
|
7625
|
+
}
|
|
7626
|
+
}
|
|
7627
|
+
function validateInsertionTarget(target, operationName) {
|
|
7628
|
+
if (target === undefined || target === null) {
|
|
7629
|
+
throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} requires a target.`);
|
|
7630
|
+
}
|
|
7631
|
+
const t = target;
|
|
7632
|
+
if (t.kind !== "inline-insert") {
|
|
7633
|
+
throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} target must have kind 'inline-insert'.`, {
|
|
7634
|
+
target
|
|
7635
|
+
});
|
|
7636
|
+
}
|
|
7637
|
+
const anchor = t.anchor;
|
|
7638
|
+
if (!anchor || anchor.nodeType !== "paragraph" || typeof anchor.nodeId !== "string") {
|
|
7639
|
+
throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} target.anchor must have nodeType 'paragraph' and a string nodeId.`, { target });
|
|
7640
|
+
}
|
|
7641
|
+
}
|
|
7425
7642
|
function executeTocList(adapter, query2) {
|
|
7426
7643
|
return adapter.list(query2);
|
|
7427
7644
|
}
|
|
@@ -7441,6 +7658,28 @@ function executeTocRemove(adapter, input, options) {
|
|
|
7441
7658
|
validateTocTarget(input.target, "toc.remove");
|
|
7442
7659
|
return adapter.remove(input, normalizeMutationOptions(options));
|
|
7443
7660
|
}
|
|
7661
|
+
function executeTocMarkEntry(adapter, input, options) {
|
|
7662
|
+
validateInsertionTarget(input.target, "toc.markEntry");
|
|
7663
|
+
if (!input.text || typeof input.text !== "string") {
|
|
7664
|
+
throw new DocumentApiValidationError("INVALID_INPUT", "toc.markEntry requires a non-empty text string.");
|
|
7665
|
+
}
|
|
7666
|
+
return adapter.markEntry(input, normalizeMutationOptions(options));
|
|
7667
|
+
}
|
|
7668
|
+
function executeTocUnmarkEntry(adapter, input, options) {
|
|
7669
|
+
validateTocEntryTarget(input.target, "toc.unmarkEntry");
|
|
7670
|
+
return adapter.unmarkEntry(input, normalizeMutationOptions(options));
|
|
7671
|
+
}
|
|
7672
|
+
function executeTocListEntries(adapter, query2) {
|
|
7673
|
+
return adapter.listEntries(query2);
|
|
7674
|
+
}
|
|
7675
|
+
function executeTocGetEntry(adapter, input) {
|
|
7676
|
+
validateTocEntryTarget(input.target, "toc.getEntry");
|
|
7677
|
+
return adapter.getEntry(input);
|
|
7678
|
+
}
|
|
7679
|
+
function executeTocEditEntry(adapter, input, options) {
|
|
7680
|
+
validateTocEntryTarget(input.target, "toc.editEntry");
|
|
7681
|
+
return adapter.editEntry(input, normalizeMutationOptions(options));
|
|
7682
|
+
}
|
|
7444
7683
|
var init_toc = __esm(() => {
|
|
7445
7684
|
init_errors2();
|
|
7446
7685
|
});
|
|
@@ -7831,6 +8070,21 @@ function createDocumentApi(adapters) {
|
|
|
7831
8070
|
},
|
|
7832
8071
|
remove(input, options) {
|
|
7833
8072
|
return executeTocRemove(adapters.toc, input, options);
|
|
8073
|
+
},
|
|
8074
|
+
markEntry(input, options) {
|
|
8075
|
+
return executeTocMarkEntry(adapters.toc, input, options);
|
|
8076
|
+
},
|
|
8077
|
+
unmarkEntry(input, options) {
|
|
8078
|
+
return executeTocUnmarkEntry(adapters.toc, input, options);
|
|
8079
|
+
},
|
|
8080
|
+
listEntries(query2) {
|
|
8081
|
+
return executeTocListEntries(adapters.toc, query2);
|
|
8082
|
+
},
|
|
8083
|
+
getEntry(input) {
|
|
8084
|
+
return executeTocGetEntry(adapters.toc, input);
|
|
8085
|
+
},
|
|
8086
|
+
editEntry(input, options) {
|
|
8087
|
+
return executeTocEditEntry(adapters.toc, input, options);
|
|
7834
8088
|
}
|
|
7835
8089
|
},
|
|
7836
8090
|
query: {
|
|
@@ -8578,6 +8832,11 @@ var init_operation_hints = __esm(() => {
|
|
|
8578
8832
|
"toc.configure": "configured table of contents",
|
|
8579
8833
|
"toc.update": "updated table of contents",
|
|
8580
8834
|
"toc.remove": "removed table of contents",
|
|
8835
|
+
"toc.markEntry": "marked table of contents entry",
|
|
8836
|
+
"toc.unmarkEntry": "unmarked table of contents entry",
|
|
8837
|
+
"toc.listEntries": "listed table of contents entries",
|
|
8838
|
+
"toc.getEntry": "resolved table of contents entry",
|
|
8839
|
+
"toc.editEntry": "edited table of contents entry",
|
|
8581
8840
|
"query.match": "matched selectors",
|
|
8582
8841
|
"mutations.preview": "previewed mutations",
|
|
8583
8842
|
"mutations.apply": "applied mutations",
|
|
@@ -8664,6 +8923,11 @@ var init_operation_hints = __esm(() => {
|
|
|
8664
8923
|
"toc.configure": "plain",
|
|
8665
8924
|
"toc.update": "plain",
|
|
8666
8925
|
"toc.remove": "plain",
|
|
8926
|
+
"toc.markEntry": "plain",
|
|
8927
|
+
"toc.unmarkEntry": "plain",
|
|
8928
|
+
"toc.listEntries": "plain",
|
|
8929
|
+
"toc.getEntry": "plain",
|
|
8930
|
+
"toc.editEntry": "plain",
|
|
8667
8931
|
"query.match": "plain",
|
|
8668
8932
|
"mutations.preview": "plain",
|
|
8669
8933
|
"mutations.apply": "plain",
|
|
@@ -8750,6 +9014,11 @@ var init_operation_hints = __esm(() => {
|
|
|
8750
9014
|
"toc.configure": "result",
|
|
8751
9015
|
"toc.update": "result",
|
|
8752
9016
|
"toc.remove": "result",
|
|
9017
|
+
"toc.markEntry": "result",
|
|
9018
|
+
"toc.unmarkEntry": "result",
|
|
9019
|
+
"toc.listEntries": "result",
|
|
9020
|
+
"toc.getEntry": "result",
|
|
9021
|
+
"toc.editEntry": "result",
|
|
8753
9022
|
"query.match": "result",
|
|
8754
9023
|
"mutations.preview": "result",
|
|
8755
9024
|
"mutations.apply": "result",
|
|
@@ -8843,6 +9112,11 @@ var init_operation_hints = __esm(() => {
|
|
|
8843
9112
|
"toc.configure": "toc",
|
|
8844
9113
|
"toc.update": "toc",
|
|
8845
9114
|
"toc.remove": "toc",
|
|
9115
|
+
"toc.markEntry": "toc",
|
|
9116
|
+
"toc.unmarkEntry": "toc",
|
|
9117
|
+
"toc.listEntries": "query",
|
|
9118
|
+
"toc.getEntry": "query",
|
|
9119
|
+
"toc.editEntry": "toc",
|
|
8846
9120
|
"query.match": "query",
|
|
8847
9121
|
"mutations.preview": "general",
|
|
8848
9122
|
"mutations.apply": "general",
|
|
@@ -10088,12 +10362,26 @@ function parseCustomStyles(value) {
|
|
|
10088
10362
|
}
|
|
10089
10363
|
return entries;
|
|
10090
10364
|
}
|
|
10365
|
+
function deriveIncludePageNumbers(omitRange, outlineLevels) {
|
|
10366
|
+
if (!omitRange)
|
|
10367
|
+
return true;
|
|
10368
|
+
const effectiveRange = outlineLevels ?? { from: 1, to: 9 };
|
|
10369
|
+
const fullyCovered = omitRange.from <= effectiveRange.from && omitRange.to >= effectiveRange.to;
|
|
10370
|
+
return !fullyCovered;
|
|
10371
|
+
}
|
|
10372
|
+
function deriveTabLeader(separator) {
|
|
10373
|
+
if (!separator)
|
|
10374
|
+
return "none";
|
|
10375
|
+
const leader = SEPARATOR_TO_TAB_LEADER[separator];
|
|
10376
|
+
return leader;
|
|
10377
|
+
}
|
|
10091
10378
|
function parseTocInstruction(instruction) {
|
|
10092
10379
|
const source = {};
|
|
10093
10380
|
const display = {};
|
|
10094
10381
|
const preserved = {};
|
|
10095
10382
|
const rawExtensions = [];
|
|
10096
10383
|
let match;
|
|
10384
|
+
SWITCH_PATTERN.lastIndex = 0;
|
|
10097
10385
|
while ((match = SWITCH_PATTERN.exec(instruction)) !== null) {
|
|
10098
10386
|
const switchChar = match[1].toLowerCase();
|
|
10099
10387
|
const arg = match[2] ?? "";
|
|
@@ -10107,6 +10395,16 @@ function parseTocInstruction(instruction) {
|
|
|
10107
10395
|
case "u":
|
|
10108
10396
|
source.useAppliedOutlineLevel = true;
|
|
10109
10397
|
break;
|
|
10398
|
+
case "f":
|
|
10399
|
+
if (arg)
|
|
10400
|
+
source.tcFieldIdentifier = arg;
|
|
10401
|
+
break;
|
|
10402
|
+
case "l": {
|
|
10403
|
+
const range = parseLevelRange(arg);
|
|
10404
|
+
if (range)
|
|
10405
|
+
source.tcFieldLevels = range;
|
|
10406
|
+
break;
|
|
10407
|
+
}
|
|
10110
10408
|
case "h":
|
|
10111
10409
|
display.hyperlinks = true;
|
|
10112
10410
|
break;
|
|
@@ -10131,16 +10429,6 @@ function parseTocInstruction(instruction) {
|
|
|
10131
10429
|
if (arg)
|
|
10132
10430
|
preserved.bookmarkName = arg;
|
|
10133
10431
|
break;
|
|
10134
|
-
case "f":
|
|
10135
|
-
if (arg)
|
|
10136
|
-
preserved.tcFieldIdentifier = arg;
|
|
10137
|
-
break;
|
|
10138
|
-
case "l": {
|
|
10139
|
-
const range = parseLevelRange(arg);
|
|
10140
|
-
if (range)
|
|
10141
|
-
preserved.tcFieldLevels = range;
|
|
10142
|
-
break;
|
|
10143
|
-
}
|
|
10144
10432
|
case "a":
|
|
10145
10433
|
if (arg)
|
|
10146
10434
|
preserved.captionType = arg;
|
|
@@ -10168,6 +10456,11 @@ function parseTocInstruction(instruction) {
|
|
|
10168
10456
|
if (rawExtensions.length > 0) {
|
|
10169
10457
|
preserved.rawExtensions = rawExtensions;
|
|
10170
10458
|
}
|
|
10459
|
+
display.includePageNumbers = deriveIncludePageNumbers(display.omitPageNumberLevels, source.outlineLevels);
|
|
10460
|
+
const tabLeader = deriveTabLeader(display.separator);
|
|
10461
|
+
if (tabLeader !== undefined) {
|
|
10462
|
+
display.tabLeader = tabLeader;
|
|
10463
|
+
}
|
|
10171
10464
|
return { source, display, preserved };
|
|
10172
10465
|
}
|
|
10173
10466
|
function serializeTocInstruction(config) {
|
|
@@ -10179,6 +10472,12 @@ function serializeTocInstruction(config) {
|
|
|
10179
10472
|
if (source.useAppliedOutlineLevel) {
|
|
10180
10473
|
parts.push("\\u");
|
|
10181
10474
|
}
|
|
10475
|
+
if (source.tcFieldIdentifier) {
|
|
10476
|
+
parts.push(`\\f "${source.tcFieldIdentifier}"`);
|
|
10477
|
+
}
|
|
10478
|
+
if (source.tcFieldLevels) {
|
|
10479
|
+
parts.push(`\\l "${source.tcFieldLevels.from}-${source.tcFieldLevels.to}"`);
|
|
10480
|
+
}
|
|
10182
10481
|
if (preserved.customStyles?.length) {
|
|
10183
10482
|
const pairs = preserved.customStyles.map((s) => `${s.styleName},${s.level}`).join(",");
|
|
10184
10483
|
parts.push(`\\t "${pairs}"`);
|
|
@@ -10207,12 +10506,6 @@ function serializeTocInstruction(config) {
|
|
|
10207
10506
|
if (preserved.chapterSeparator) {
|
|
10208
10507
|
parts.push(`\\d "${preserved.chapterSeparator}"`);
|
|
10209
10508
|
}
|
|
10210
|
-
if (preserved.tcFieldIdentifier) {
|
|
10211
|
-
parts.push(`\\f "${preserved.tcFieldIdentifier}"`);
|
|
10212
|
-
}
|
|
10213
|
-
if (preserved.tcFieldLevels) {
|
|
10214
|
-
parts.push(`\\l "${preserved.tcFieldLevels.from}-${preserved.tcFieldLevels.to}"`);
|
|
10215
|
-
}
|
|
10216
10509
|
if (preserved.chapterNumberSource) {
|
|
10217
10510
|
parts.push(`\\s "${preserved.chapterNumberSource}"`);
|
|
10218
10511
|
}
|
|
@@ -10224,28 +10517,78 @@ function serializeTocInstruction(config) {
|
|
|
10224
10517
|
}
|
|
10225
10518
|
return parts.join(" ");
|
|
10226
10519
|
}
|
|
10520
|
+
function computeOmitPageNumberRange(source) {
|
|
10521
|
+
return source.outlineLevels ?? { from: 1, to: 9 };
|
|
10522
|
+
}
|
|
10227
10523
|
function applyTocPatch(existing, patch) {
|
|
10524
|
+
if (patch.tabLeader !== undefined && patch.separator !== undefined) {
|
|
10525
|
+
throw new Error("INVALID_INPUT: cannot set both tabLeader and separator in the same patch");
|
|
10526
|
+
}
|
|
10527
|
+
if (patch.includePageNumbers !== undefined && patch.omitPageNumberLevels !== undefined) {
|
|
10528
|
+
throw new Error("INVALID_INPUT: cannot set both includePageNumbers and omitPageNumberLevels in the same patch");
|
|
10529
|
+
}
|
|
10530
|
+
const newSource = {
|
|
10531
|
+
...existing.source,
|
|
10532
|
+
...patch.outlineLevels !== undefined && { outlineLevels: patch.outlineLevels },
|
|
10533
|
+
...patch.useAppliedOutlineLevel !== undefined && { useAppliedOutlineLevel: patch.useAppliedOutlineLevel },
|
|
10534
|
+
...patch.tcFieldIdentifier !== undefined && { tcFieldIdentifier: patch.tcFieldIdentifier },
|
|
10535
|
+
...patch.tcFieldLevels !== undefined && { tcFieldLevels: patch.tcFieldLevels }
|
|
10536
|
+
};
|
|
10537
|
+
const newDisplay = {
|
|
10538
|
+
...existing.display,
|
|
10539
|
+
...patch.hyperlinks !== undefined && { hyperlinks: patch.hyperlinks },
|
|
10540
|
+
...patch.hideInWebView !== undefined && { hideInWebView: patch.hideInWebView }
|
|
10541
|
+
};
|
|
10542
|
+
if (patch.includePageNumbers !== undefined) {
|
|
10543
|
+
if (patch.includePageNumbers) {
|
|
10544
|
+
delete newDisplay.omitPageNumberLevels;
|
|
10545
|
+
} else {
|
|
10546
|
+
newDisplay.omitPageNumberLevels = computeOmitPageNumberRange(newSource);
|
|
10547
|
+
}
|
|
10548
|
+
newDisplay.includePageNumbers = patch.includePageNumbers;
|
|
10549
|
+
} else if (patch.omitPageNumberLevels !== undefined) {
|
|
10550
|
+
newDisplay.omitPageNumberLevels = patch.omitPageNumberLevels;
|
|
10551
|
+
newDisplay.includePageNumbers = deriveIncludePageNumbers(patch.omitPageNumberLevels, newSource.outlineLevels);
|
|
10552
|
+
}
|
|
10553
|
+
if (patch.tabLeader !== undefined) {
|
|
10554
|
+
if (patch.tabLeader === "none") {
|
|
10555
|
+
delete newDisplay.separator;
|
|
10556
|
+
} else {
|
|
10557
|
+
newDisplay.separator = TAB_LEADER_TO_SEPARATOR[patch.tabLeader];
|
|
10558
|
+
}
|
|
10559
|
+
newDisplay.tabLeader = patch.tabLeader;
|
|
10560
|
+
} else if (patch.separator !== undefined) {
|
|
10561
|
+
newDisplay.separator = patch.separator;
|
|
10562
|
+
const derived = deriveTabLeader(patch.separator);
|
|
10563
|
+
if (derived !== undefined) {
|
|
10564
|
+
newDisplay.tabLeader = derived;
|
|
10565
|
+
} else {
|
|
10566
|
+
delete newDisplay.tabLeader;
|
|
10567
|
+
}
|
|
10568
|
+
}
|
|
10228
10569
|
return {
|
|
10229
|
-
source:
|
|
10230
|
-
|
|
10231
|
-
...patch.outlineLevels !== undefined && { outlineLevels: patch.outlineLevels },
|
|
10232
|
-
...patch.useAppliedOutlineLevel !== undefined && { useAppliedOutlineLevel: patch.useAppliedOutlineLevel }
|
|
10233
|
-
},
|
|
10234
|
-
display: {
|
|
10235
|
-
...existing.display,
|
|
10236
|
-
...patch.hyperlinks !== undefined && { hyperlinks: patch.hyperlinks },
|
|
10237
|
-
...patch.hideInWebView !== undefined && { hideInWebView: patch.hideInWebView },
|
|
10238
|
-
...patch.omitPageNumberLevels !== undefined && { omitPageNumberLevels: patch.omitPageNumberLevels },
|
|
10239
|
-
...patch.separator !== undefined && { separator: patch.separator }
|
|
10240
|
-
},
|
|
10570
|
+
source: newSource,
|
|
10571
|
+
display: newDisplay,
|
|
10241
10572
|
preserved: { ...existing.preserved }
|
|
10242
10573
|
};
|
|
10243
10574
|
}
|
|
10244
10575
|
function areTocConfigsEqual(a, b) {
|
|
10245
10576
|
return serializeTocInstruction(a) === serializeTocInstruction(b);
|
|
10246
10577
|
}
|
|
10247
|
-
var DEFAULT_SOURCE, DEFAULT_DISPLAY, DEFAULT_TOC_CONFIG, SWITCH_PATTERN;
|
|
10578
|
+
var TAB_LEADER_TO_SEPARATOR, SEPARATOR_TO_TAB_LEADER, DEFAULT_SOURCE, DEFAULT_DISPLAY, DEFAULT_TOC_CONFIG, SWITCH_PATTERN;
|
|
10248
10579
|
var init_toc_switches = __esm(() => {
|
|
10580
|
+
TAB_LEADER_TO_SEPARATOR = {
|
|
10581
|
+
dot: ".",
|
|
10582
|
+
hyphen: "-",
|
|
10583
|
+
underscore: "_",
|
|
10584
|
+
middleDot: "·"
|
|
10585
|
+
};
|
|
10586
|
+
SEPARATOR_TO_TAB_LEADER = {
|
|
10587
|
+
".": "dot",
|
|
10588
|
+
"-": "hyphen",
|
|
10589
|
+
_: "underscore",
|
|
10590
|
+
"·": "middleDot"
|
|
10591
|
+
};
|
|
10249
10592
|
DEFAULT_SOURCE = {
|
|
10250
10593
|
outlineLevels: { from: 1, to: 3 },
|
|
10251
10594
|
useAppliedOutlineLevel: true
|
|
@@ -11715,7 +12058,10 @@ var init_capabilities_adapter = __esm(() => {
|
|
|
11715
12058
|
"create.tableOfContents": ["insertTableOfContentsAt"],
|
|
11716
12059
|
"toc.configure": ["setTableOfContentsInstructionById"],
|
|
11717
12060
|
"toc.update": ["replaceTableOfContentsContentById"],
|
|
11718
|
-
"toc.remove": ["deleteTableOfContentsById"]
|
|
12061
|
+
"toc.remove": ["deleteTableOfContentsById"],
|
|
12062
|
+
"toc.markEntry": ["insertTableOfContentsEntryAt"],
|
|
12063
|
+
"toc.unmarkEntry": ["deleteTableOfContentsEntryAt"],
|
|
12064
|
+
"toc.editEntry": ["updateTableOfContentsEntryAt"]
|
|
11719
12065
|
};
|
|
11720
12066
|
VALID_CAPABILITY_REASON_CODES = new Set(CAPABILITY_REASON_CODES);
|
|
11721
12067
|
REQUIRED_HELPERS = {
|
|
@@ -55440,6 +55786,21 @@ function preProcessXeInstruction(nodesToCombine, instrText, _docx, instructionTo
|
|
|
55440
55786
|
];
|
|
55441
55787
|
}
|
|
55442
55788
|
|
|
55789
|
+
// ../../packages/super-editor/src/core/super-converter/field-references/fld-preprocessors/tc-preprocessor.js
|
|
55790
|
+
function preProcessTcInstruction(nodesToCombine, instrText, _docx, instructionTokens = null) {
|
|
55791
|
+
return [
|
|
55792
|
+
{
|
|
55793
|
+
name: "sd:tableOfContentsEntry",
|
|
55794
|
+
type: "element",
|
|
55795
|
+
attributes: {
|
|
55796
|
+
instruction: instrText,
|
|
55797
|
+
...instructionTokens ? { instructionTokens } : {}
|
|
55798
|
+
},
|
|
55799
|
+
elements: nodesToCombine
|
|
55800
|
+
}
|
|
55801
|
+
];
|
|
55802
|
+
}
|
|
55803
|
+
|
|
55443
55804
|
// ../../packages/super-editor/src/core/super-converter/field-references/fld-preprocessors/index.js
|
|
55444
55805
|
var getInstructionPreProcessor = (instruction) => {
|
|
55445
55806
|
const instructionType = instruction.split(" ")[0];
|
|
@@ -55458,6 +55819,8 @@ var getInstructionPreProcessor = (instruction) => {
|
|
|
55458
55819
|
return preProcessIndexInstruction;
|
|
55459
55820
|
case "XE":
|
|
55460
55821
|
return preProcessXeInstruction;
|
|
55822
|
+
case "TC":
|
|
55823
|
+
return preProcessTcInstruction;
|
|
55461
55824
|
default:
|
|
55462
55825
|
return null;
|
|
55463
55826
|
}
|
|
@@ -60443,6 +60806,15 @@ var init_pageReference = __esm(() => {
|
|
|
60443
60806
|
});
|
|
60444
60807
|
|
|
60445
60808
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContents/tableOfContents-translator.js
|
|
60809
|
+
function deriveRightAlignPageNumbers(content3) {
|
|
60810
|
+
for (const para of content3) {
|
|
60811
|
+
const tabStops = para?.attrs?.paragraphProperties?.tabStops;
|
|
60812
|
+
if (!Array.isArray(tabStops) || tabStops.length === 0)
|
|
60813
|
+
continue;
|
|
60814
|
+
return tabStops.some((ts) => ts?.tab?.tabType === "right");
|
|
60815
|
+
}
|
|
60816
|
+
return true;
|
|
60817
|
+
}
|
|
60446
60818
|
var XML_NODE_NAME23 = "sd:tableOfContents", SD_NODE_NAME19 = "tableOfContents", encode57 = (params2) => {
|
|
60447
60819
|
const { nodes = [], nodeListHandler } = params2 || {};
|
|
60448
60820
|
const node3 = nodes[0];
|
|
@@ -60453,7 +60825,8 @@ var XML_NODE_NAME23 = "sd:tableOfContents", SD_NODE_NAME19 = "tableOfContents",
|
|
|
60453
60825
|
const processedNode = {
|
|
60454
60826
|
type: "tableOfContents",
|
|
60455
60827
|
attrs: {
|
|
60456
|
-
instruction: node3.attributes?.instruction || ""
|
|
60828
|
+
instruction: node3.attributes?.instruction || "",
|
|
60829
|
+
rightAlignPageNumbers: deriveRightAlignPageNumbers(processedContent)
|
|
60457
60830
|
},
|
|
60458
60831
|
content: processedContent
|
|
60459
60832
|
};
|
|
@@ -61502,12 +61875,107 @@ var init_sdtNodeImporter = __esm(() => {
|
|
|
61502
61875
|
};
|
|
61503
61876
|
});
|
|
61504
61877
|
|
|
61878
|
+
// ../../packages/super-editor/src/core/super-converter/v3/handlers/sd/tableOfContentsEntry/tableOfContentsEntry-translator.js
|
|
61879
|
+
var XML_NODE_NAME31 = "sd:tableOfContentsEntry", SD_NODE_NAME25 = "tableOfContentsEntry", encode65 = (params2) => {
|
|
61880
|
+
const { nodes = [], nodeListHandler } = params2 || {};
|
|
61881
|
+
const node3 = nodes[0];
|
|
61882
|
+
const processedText = nodeListHandler.handler({
|
|
61883
|
+
...params2,
|
|
61884
|
+
nodes: node3.elements
|
|
61885
|
+
});
|
|
61886
|
+
return {
|
|
61887
|
+
type: "tableOfContentsEntry",
|
|
61888
|
+
attrs: {
|
|
61889
|
+
instruction: node3.attributes?.instruction || "",
|
|
61890
|
+
instructionTokens: node3.attributes?.instructionTokens || null,
|
|
61891
|
+
marksAsAttrs: node3.marks || []
|
|
61892
|
+
},
|
|
61893
|
+
content: processedText
|
|
61894
|
+
};
|
|
61895
|
+
}, decode68 = (params2) => {
|
|
61896
|
+
const { node: node3 } = params2;
|
|
61897
|
+
const outputMarks = processOutputMarks(node3.attrs?.marksAsAttrs || []);
|
|
61898
|
+
const contentNodes = (node3.content ?? []).flatMap((n) => exportSchemaToJson({ ...params2, node: n }));
|
|
61899
|
+
const instructionElements = buildInstructionElements(node3.attrs?.instruction, node3.attrs?.instructionTokens);
|
|
61900
|
+
return [
|
|
61901
|
+
{
|
|
61902
|
+
name: "w:r",
|
|
61903
|
+
elements: [
|
|
61904
|
+
{
|
|
61905
|
+
name: "w:rPr",
|
|
61906
|
+
elements: outputMarks
|
|
61907
|
+
},
|
|
61908
|
+
{
|
|
61909
|
+
name: "w:fldChar",
|
|
61910
|
+
attributes: {
|
|
61911
|
+
"w:fldCharType": "begin"
|
|
61912
|
+
}
|
|
61913
|
+
}
|
|
61914
|
+
]
|
|
61915
|
+
},
|
|
61916
|
+
{
|
|
61917
|
+
name: "w:r",
|
|
61918
|
+
elements: [
|
|
61919
|
+
{
|
|
61920
|
+
name: "w:rPr",
|
|
61921
|
+
elements: outputMarks
|
|
61922
|
+
},
|
|
61923
|
+
...instructionElements
|
|
61924
|
+
]
|
|
61925
|
+
},
|
|
61926
|
+
{
|
|
61927
|
+
name: "w:r",
|
|
61928
|
+
elements: [
|
|
61929
|
+
{
|
|
61930
|
+
name: "w:rPr",
|
|
61931
|
+
elements: outputMarks
|
|
61932
|
+
},
|
|
61933
|
+
{
|
|
61934
|
+
name: "w:fldChar",
|
|
61935
|
+
attributes: {
|
|
61936
|
+
"w:fldCharType": "separate"
|
|
61937
|
+
}
|
|
61938
|
+
}
|
|
61939
|
+
]
|
|
61940
|
+
},
|
|
61941
|
+
...contentNodes,
|
|
61942
|
+
{
|
|
61943
|
+
name: "w:r",
|
|
61944
|
+
elements: [
|
|
61945
|
+
{
|
|
61946
|
+
name: "w:rPr",
|
|
61947
|
+
elements: outputMarks
|
|
61948
|
+
},
|
|
61949
|
+
{
|
|
61950
|
+
name: "w:fldChar",
|
|
61951
|
+
attributes: {
|
|
61952
|
+
"w:fldCharType": "end"
|
|
61953
|
+
}
|
|
61954
|
+
}
|
|
61955
|
+
]
|
|
61956
|
+
}
|
|
61957
|
+
];
|
|
61958
|
+
}, config30, translator165;
|
|
61959
|
+
var init_tableOfContentsEntry_translator = __esm(() => {
|
|
61960
|
+
init_node_translator2();
|
|
61961
|
+
init_exporter();
|
|
61962
|
+
init_shared();
|
|
61963
|
+
config30 = {
|
|
61964
|
+
xmlName: XML_NODE_NAME31,
|
|
61965
|
+
sdNodeOrKeyName: SD_NODE_NAME25,
|
|
61966
|
+
type: NodeTranslator.translatorTypes.NODE,
|
|
61967
|
+
encode: encode65,
|
|
61968
|
+
decode: decode68
|
|
61969
|
+
};
|
|
61970
|
+
translator165 = NodeTranslator.from(config30);
|
|
61971
|
+
});
|
|
61972
|
+
|
|
61505
61973
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/nsid/nsid-translator.js
|
|
61506
|
-
var
|
|
61974
|
+
var translator166;
|
|
61507
61975
|
var init_nsid_translator = __esm(() => {
|
|
61508
61976
|
init_node_translator2();
|
|
61509
61977
|
init_utils();
|
|
61510
|
-
|
|
61978
|
+
translator166 = NodeTranslator.from(createSingleIntegerPropertyHandler("w:nsid"));
|
|
61511
61979
|
});
|
|
61512
61980
|
|
|
61513
61981
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/nsid/index.js
|
|
@@ -61516,11 +61984,11 @@ var init_nsid = __esm(() => {
|
|
|
61516
61984
|
});
|
|
61517
61985
|
|
|
61518
61986
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/tmpl/tmpl-translator.js
|
|
61519
|
-
var
|
|
61987
|
+
var translator167;
|
|
61520
61988
|
var init_tmpl_translator = __esm(() => {
|
|
61521
61989
|
init_node_translator2();
|
|
61522
61990
|
init_utils();
|
|
61523
|
-
|
|
61991
|
+
translator167 = NodeTranslator.from(createSingleIntegerPropertyHandler("w:tmpl"));
|
|
61524
61992
|
});
|
|
61525
61993
|
|
|
61526
61994
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/tmpl/index.js
|
|
@@ -61529,11 +61997,11 @@ var init_tmpl = __esm(() => {
|
|
|
61529
61997
|
});
|
|
61530
61998
|
|
|
61531
61999
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/name/name-translator.js
|
|
61532
|
-
var
|
|
62000
|
+
var translator168;
|
|
61533
62001
|
var init_name_translator = __esm(() => {
|
|
61534
62002
|
init_node_translator2();
|
|
61535
62003
|
init_utils();
|
|
61536
|
-
|
|
62004
|
+
translator168 = NodeTranslator.from(createSingleAttrPropertyHandler("w:name"));
|
|
61537
62005
|
});
|
|
61538
62006
|
|
|
61539
62007
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/name/index.js
|
|
@@ -61542,11 +62010,11 @@ var init_name = __esm(() => {
|
|
|
61542
62010
|
});
|
|
61543
62011
|
|
|
61544
62012
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/styleLink/styleLink-translator.js
|
|
61545
|
-
var
|
|
62013
|
+
var translator169;
|
|
61546
62014
|
var init_styleLink_translator = __esm(() => {
|
|
61547
62015
|
init_node_translator2();
|
|
61548
62016
|
init_utils();
|
|
61549
|
-
|
|
62017
|
+
translator169 = NodeTranslator.from(createSingleAttrPropertyHandler("w:styleLink"));
|
|
61550
62018
|
});
|
|
61551
62019
|
|
|
61552
62020
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/styleLink/index.js
|
|
@@ -61555,11 +62023,11 @@ var init_styleLink = __esm(() => {
|
|
|
61555
62023
|
});
|
|
61556
62024
|
|
|
61557
62025
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/numStyleLink/numStyleLink-translator.js
|
|
61558
|
-
var
|
|
62026
|
+
var translator170;
|
|
61559
62027
|
var init_numStyleLink_translator = __esm(() => {
|
|
61560
62028
|
init_node_translator2();
|
|
61561
62029
|
init_utils();
|
|
61562
|
-
|
|
62030
|
+
translator170 = NodeTranslator.from(createSingleAttrPropertyHandler("w:numStyleLink"));
|
|
61563
62031
|
});
|
|
61564
62032
|
|
|
61565
62033
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/numStyleLink/index.js
|
|
@@ -61568,11 +62036,11 @@ var init_numStyleLink = __esm(() => {
|
|
|
61568
62036
|
});
|
|
61569
62037
|
|
|
61570
62038
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/multiLevelType/multiLevelType-translator.js
|
|
61571
|
-
var
|
|
62039
|
+
var translator171;
|
|
61572
62040
|
var init_multiLevelType_translator = __esm(() => {
|
|
61573
62041
|
init_node_translator2();
|
|
61574
62042
|
init_utils();
|
|
61575
|
-
|
|
62043
|
+
translator171 = NodeTranslator.from(createSingleAttrPropertyHandler("w:multiLevelType"));
|
|
61576
62044
|
});
|
|
61577
62045
|
|
|
61578
62046
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/multiLevelType/index.js
|
|
@@ -61581,59 +62049,59 @@ var init_multiLevelType = __esm(() => {
|
|
|
61581
62049
|
});
|
|
61582
62050
|
|
|
61583
62051
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/lvlRestart/lvlRestart-translator.js
|
|
61584
|
-
var
|
|
62052
|
+
var translator172;
|
|
61585
62053
|
var init_lvlRestart_translator = __esm(() => {
|
|
61586
62054
|
init_node_translator2();
|
|
61587
62055
|
init_utils();
|
|
61588
|
-
|
|
62056
|
+
translator172 = NodeTranslator.from(createSingleIntegerPropertyHandler("w:lvlRestart"));
|
|
61589
62057
|
});
|
|
61590
62058
|
|
|
61591
62059
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/lvlPicBulletId/lvlPicBulletId-translator.js
|
|
61592
|
-
var
|
|
62060
|
+
var translator173;
|
|
61593
62061
|
var init_lvlPicBulletId_translator = __esm(() => {
|
|
61594
62062
|
init_node_translator2();
|
|
61595
62063
|
init_utils();
|
|
61596
|
-
|
|
62064
|
+
translator173 = NodeTranslator.from(createSingleIntegerPropertyHandler("w:lvlPicBulletId"));
|
|
61597
62065
|
});
|
|
61598
62066
|
|
|
61599
62067
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/isLgl/isLgl-translator.js
|
|
61600
|
-
var
|
|
62068
|
+
var translator174;
|
|
61601
62069
|
var init_isLgl_translator = __esm(() => {
|
|
61602
62070
|
init_node_translator2();
|
|
61603
62071
|
init_utils();
|
|
61604
|
-
|
|
62072
|
+
translator174 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:isLgl"));
|
|
61605
62073
|
});
|
|
61606
62074
|
|
|
61607
62075
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/suff/suff-translator.js
|
|
61608
|
-
var
|
|
62076
|
+
var translator175;
|
|
61609
62077
|
var init_suff_translator = __esm(() => {
|
|
61610
62078
|
init_node_translator2();
|
|
61611
62079
|
init_utils();
|
|
61612
|
-
|
|
62080
|
+
translator175 = NodeTranslator.from(createSingleAttrPropertyHandler("w:suff"));
|
|
61613
62081
|
});
|
|
61614
62082
|
|
|
61615
62083
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/lvlText/lvlText-translator.js
|
|
61616
|
-
var
|
|
62084
|
+
var translator176;
|
|
61617
62085
|
var init_lvlText_translator = __esm(() => {
|
|
61618
62086
|
init_node_translator2();
|
|
61619
62087
|
init_utils();
|
|
61620
|
-
|
|
62088
|
+
translator176 = NodeTranslator.from(createSingleAttrPropertyHandler("w:lvlText"));
|
|
61621
62089
|
});
|
|
61622
62090
|
|
|
61623
62091
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/lvlJc/lvlJc-translator.js
|
|
61624
|
-
var
|
|
62092
|
+
var translator177;
|
|
61625
62093
|
var init_lvlJc_translator = __esm(() => {
|
|
61626
62094
|
init_node_translator2();
|
|
61627
62095
|
init_utils();
|
|
61628
|
-
|
|
62096
|
+
translator177 = NodeTranslator.from(createSingleAttrPropertyHandler("w:lvlJc"));
|
|
61629
62097
|
});
|
|
61630
62098
|
|
|
61631
62099
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/numFmt/numFmt-translator.js
|
|
61632
|
-
var
|
|
62100
|
+
var translator178;
|
|
61633
62101
|
var init_numFmt_translator = __esm(() => {
|
|
61634
62102
|
init_node_translator2();
|
|
61635
62103
|
init_utils();
|
|
61636
|
-
|
|
62104
|
+
translator178 = NodeTranslator.from({
|
|
61637
62105
|
xmlName: "w:numFmt",
|
|
61638
62106
|
sdNodeOrKeyName: "numFmt",
|
|
61639
62107
|
attributes: [createAttributeHandler("w:val"), createAttributeHandler("w:format")],
|
|
@@ -61648,11 +62116,11 @@ var init_numFmt_translator = __esm(() => {
|
|
|
61648
62116
|
});
|
|
61649
62117
|
|
|
61650
62118
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/legacy/legacy-translator.js
|
|
61651
|
-
var
|
|
62119
|
+
var translator179;
|
|
61652
62120
|
var init_legacy_translator = __esm(() => {
|
|
61653
62121
|
init_node_translator2();
|
|
61654
62122
|
init_utils();
|
|
61655
|
-
|
|
62123
|
+
translator179 = NodeTranslator.from({
|
|
61656
62124
|
xmlName: "w:legacy",
|
|
61657
62125
|
sdNodeOrKeyName: "legacy",
|
|
61658
62126
|
attributes: [
|
|
@@ -61671,7 +62139,7 @@ var init_legacy_translator = __esm(() => {
|
|
|
61671
62139
|
});
|
|
61672
62140
|
|
|
61673
62141
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/lvl/lvl-translator.js
|
|
61674
|
-
var propertyTranslators14, attributeHandlers2,
|
|
62142
|
+
var propertyTranslators14, attributeHandlers2, translator180;
|
|
61675
62143
|
var init_lvl_translator = __esm(() => {
|
|
61676
62144
|
init_node_translator2();
|
|
61677
62145
|
init_utils();
|
|
@@ -61689,15 +62157,15 @@ var init_lvl_translator = __esm(() => {
|
|
|
61689
62157
|
init_rpr();
|
|
61690
62158
|
propertyTranslators14 = [
|
|
61691
62159
|
translator105,
|
|
61692
|
-
translator171,
|
|
61693
62160
|
translator172,
|
|
61694
62161
|
translator173,
|
|
61695
|
-
translator79,
|
|
61696
62162
|
translator174,
|
|
62163
|
+
translator79,
|
|
61697
62164
|
translator175,
|
|
61698
62165
|
translator176,
|
|
61699
62166
|
translator177,
|
|
61700
62167
|
translator178,
|
|
62168
|
+
translator179,
|
|
61701
62169
|
translator92,
|
|
61702
62170
|
translator46
|
|
61703
62171
|
];
|
|
@@ -61706,7 +62174,7 @@ var init_lvl_translator = __esm(() => {
|
|
|
61706
62174
|
createIntegerAttributeHandler("w:tplc"),
|
|
61707
62175
|
createBooleanAttributeHandler("w:tentative")
|
|
61708
62176
|
];
|
|
61709
|
-
|
|
62177
|
+
translator180 = NodeTranslator.from(createNestedPropertiesTranslator("w:lvl", "lvl", propertyTranslators14, {}, attributeHandlers2));
|
|
61710
62178
|
});
|
|
61711
62179
|
|
|
61712
62180
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/lvl/index.js
|
|
@@ -61715,7 +62183,7 @@ var init_lvl = __esm(() => {
|
|
|
61715
62183
|
});
|
|
61716
62184
|
|
|
61717
62185
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/abstractNum/abstractNum-translator.js
|
|
61718
|
-
var propertyTranslators15, propertyTranslatorsByXmlName, propertyTranslatorsBySdName,
|
|
62186
|
+
var propertyTranslators15, propertyTranslatorsByXmlName, propertyTranslatorsBySdName, translator181;
|
|
61719
62187
|
var init_abstractNum_translator = __esm(() => {
|
|
61720
62188
|
init_node_translator2();
|
|
61721
62189
|
init_nsid();
|
|
@@ -61727,20 +62195,20 @@ var init_abstractNum_translator = __esm(() => {
|
|
|
61727
62195
|
init_lvl();
|
|
61728
62196
|
init_utils();
|
|
61729
62197
|
propertyTranslators15 = [
|
|
61730
|
-
translator165,
|
|
61731
62198
|
translator166,
|
|
61732
62199
|
translator167,
|
|
61733
62200
|
translator168,
|
|
61734
62201
|
translator169,
|
|
61735
|
-
translator170
|
|
62202
|
+
translator170,
|
|
62203
|
+
translator171
|
|
61736
62204
|
];
|
|
61737
62205
|
propertyTranslatorsByXmlName = {};
|
|
61738
62206
|
propertyTranslatorsBySdName = {};
|
|
61739
|
-
propertyTranslators15.forEach((
|
|
61740
|
-
propertyTranslatorsByXmlName[
|
|
61741
|
-
propertyTranslatorsBySdName[
|
|
62207
|
+
propertyTranslators15.forEach((translator181) => {
|
|
62208
|
+
propertyTranslatorsByXmlName[translator181.xmlName] = translator181;
|
|
62209
|
+
propertyTranslatorsBySdName[translator181.sdNodeOrKeyName] = translator181;
|
|
61742
62210
|
});
|
|
61743
|
-
|
|
62211
|
+
translator181 = NodeTranslator.from({
|
|
61744
62212
|
xmlName: "w:abstractNum",
|
|
61745
62213
|
sdNodeOrKeyName: "abstractNum",
|
|
61746
62214
|
type: NodeTranslator.translatorTypes.NODE,
|
|
@@ -61751,7 +62219,7 @@ var init_abstractNum_translator = __esm(() => {
|
|
|
61751
62219
|
const result = {
|
|
61752
62220
|
...encodedAttrs,
|
|
61753
62221
|
...encodeProperties(params2, propertyTranslatorsByXmlName),
|
|
61754
|
-
...encodePropertiesByKey("w:lvl", "levels",
|
|
62222
|
+
...encodePropertiesByKey("w:lvl", "levels", translator180, params2, node3, "ilvl")
|
|
61755
62223
|
};
|
|
61756
62224
|
return result;
|
|
61757
62225
|
},
|
|
@@ -61763,7 +62231,7 @@ var init_abstractNum_translator = __esm(() => {
|
|
|
61763
62231
|
const decodedAttrs = this.decodeAttributes({ node: { ...params2.node, attrs: currentValue } });
|
|
61764
62232
|
const elements = [
|
|
61765
62233
|
...decodeProperties(params2, propertyTranslatorsBySdName, currentValue),
|
|
61766
|
-
...decodePropertiesByKey("w:lvl", "levels",
|
|
62234
|
+
...decodePropertiesByKey("w:lvl", "levels", translator180, params2, currentValue)
|
|
61767
62235
|
];
|
|
61768
62236
|
const newNode = {
|
|
61769
62237
|
name: "w:abstractNum",
|
|
@@ -61777,65 +62245,65 @@ var init_abstractNum_translator = __esm(() => {
|
|
|
61777
62245
|
});
|
|
61778
62246
|
|
|
61779
62247
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/abstractNumId/abstractNumId-translator.js
|
|
61780
|
-
var
|
|
62248
|
+
var translator182;
|
|
61781
62249
|
var init_abstractNumId_translator = __esm(() => {
|
|
61782
62250
|
init_node_translator2();
|
|
61783
62251
|
init_utils();
|
|
61784
|
-
|
|
62252
|
+
translator182 = NodeTranslator.from(createSingleIntegerPropertyHandler("w:abstractNumId"));
|
|
61785
62253
|
});
|
|
61786
62254
|
|
|
61787
62255
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/autoRedefine/autoRedefine-translator.js
|
|
61788
|
-
var
|
|
62256
|
+
var translator183;
|
|
61789
62257
|
var init_autoRedefine_translator = __esm(() => {
|
|
61790
62258
|
init_node_translator2();
|
|
61791
62259
|
init_utils();
|
|
61792
|
-
|
|
62260
|
+
translator183 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:autoRedefine"));
|
|
61793
62261
|
});
|
|
61794
62262
|
|
|
61795
62263
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/aliases/aliases-translator.js
|
|
61796
|
-
var
|
|
62264
|
+
var translator184;
|
|
61797
62265
|
var init_aliases_translator = __esm(() => {
|
|
61798
62266
|
init_node_translator2();
|
|
61799
62267
|
init_utils();
|
|
61800
|
-
|
|
62268
|
+
translator184 = NodeTranslator.from(createSingleAttrPropertyHandler("w:aliases"));
|
|
61801
62269
|
});
|
|
61802
62270
|
|
|
61803
62271
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/basedOn/basedOn-translator.js
|
|
61804
|
-
var
|
|
62272
|
+
var translator185;
|
|
61805
62273
|
var init_basedOn_translator = __esm(() => {
|
|
61806
62274
|
init_node_translator2();
|
|
61807
62275
|
init_utils();
|
|
61808
|
-
|
|
62276
|
+
translator185 = NodeTranslator.from(createSingleAttrPropertyHandler("w:basedOn"));
|
|
61809
62277
|
});
|
|
61810
62278
|
|
|
61811
62279
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/footnoteReference/attributes/w-id.js
|
|
61812
|
-
var
|
|
62280
|
+
var encode66 = (attributes) => {
|
|
61813
62281
|
return attributes?.["w:id"];
|
|
61814
|
-
},
|
|
62282
|
+
}, decode69 = (attrs) => {
|
|
61815
62283
|
return attrs?.id;
|
|
61816
62284
|
}, attrConfig37;
|
|
61817
62285
|
var init_w_id6 = __esm(() => {
|
|
61818
62286
|
attrConfig37 = Object.freeze({
|
|
61819
62287
|
xmlName: "w:id",
|
|
61820
62288
|
sdName: "id",
|
|
61821
|
-
encode:
|
|
61822
|
-
decode:
|
|
62289
|
+
encode: encode66,
|
|
62290
|
+
decode: decode69
|
|
61823
62291
|
});
|
|
61824
62292
|
});
|
|
61825
62293
|
|
|
61826
62294
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/footnoteReference/attributes/w-customMarkFollows.js
|
|
61827
|
-
var
|
|
62295
|
+
var encode67 = (attributes) => {
|
|
61828
62296
|
const val = attributes?.["w:customMarkFollows"];
|
|
61829
62297
|
return val === "1" || val === "true" || val === true ? true : undefined;
|
|
61830
|
-
},
|
|
62298
|
+
}, decode70 = (attrs) => {
|
|
61831
62299
|
return attrs?.customMarkFollows ? "1" : undefined;
|
|
61832
62300
|
}, attrConfig38;
|
|
61833
62301
|
var init_w_customMarkFollows = __esm(() => {
|
|
61834
62302
|
attrConfig38 = Object.freeze({
|
|
61835
62303
|
xmlName: "w:customMarkFollows",
|
|
61836
62304
|
sdName: "customMarkFollows",
|
|
61837
|
-
encode:
|
|
61838
|
-
decode:
|
|
62305
|
+
encode: encode67,
|
|
62306
|
+
decode: decode70
|
|
61839
62307
|
});
|
|
61840
62308
|
});
|
|
61841
62309
|
|
|
@@ -61846,40 +62314,40 @@ var init_attributes12 = __esm(() => {
|
|
|
61846
62314
|
});
|
|
61847
62315
|
|
|
61848
62316
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/footnoteReference/footnoteReference-translator.js
|
|
61849
|
-
var
|
|
61850
|
-
const translated = { type:
|
|
62317
|
+
var XML_NODE_NAME32 = "w:footnoteReference", SD_NODE_NAME26 = "footnoteReference", encode68 = (_, encodedAttrs) => {
|
|
62318
|
+
const translated = { type: SD_NODE_NAME26 };
|
|
61851
62319
|
if (encodedAttrs && Object.keys(encodedAttrs).length > 0) {
|
|
61852
62320
|
translated.attrs = { ...encodedAttrs };
|
|
61853
62321
|
}
|
|
61854
62322
|
return translated;
|
|
61855
|
-
},
|
|
61856
|
-
const ref2 = { name:
|
|
62323
|
+
}, decode71 = (_params, decodedAttrs) => {
|
|
62324
|
+
const ref2 = { name: XML_NODE_NAME32, elements: [] };
|
|
61857
62325
|
if (decodedAttrs && Object.keys(decodedAttrs).length > 0) {
|
|
61858
62326
|
ref2.attributes = { ...decodedAttrs };
|
|
61859
62327
|
}
|
|
61860
62328
|
return ref2;
|
|
61861
|
-
},
|
|
62329
|
+
}, config31, translator186;
|
|
61862
62330
|
var init_footnoteReference_translator = __esm(() => {
|
|
61863
62331
|
init_node_translator2();
|
|
61864
62332
|
init_attributes12();
|
|
61865
|
-
|
|
61866
|
-
xmlName:
|
|
61867
|
-
sdNodeOrKeyName:
|
|
62333
|
+
config31 = {
|
|
62334
|
+
xmlName: XML_NODE_NAME32,
|
|
62335
|
+
sdNodeOrKeyName: SD_NODE_NAME26,
|
|
61868
62336
|
type: NodeTranslator.translatorTypes.NODE,
|
|
61869
|
-
encode:
|
|
61870
|
-
decode:
|
|
62337
|
+
encode: encode68,
|
|
62338
|
+
decode: decode71,
|
|
61871
62339
|
attributes: [attrConfig37, attrConfig38]
|
|
61872
62340
|
};
|
|
61873
|
-
|
|
62341
|
+
translator186 = NodeTranslator.from(config31);
|
|
61874
62342
|
});
|
|
61875
62343
|
|
|
61876
62344
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/docDefaults/docDefaults-translator.js
|
|
61877
|
-
var
|
|
62345
|
+
var translator187;
|
|
61878
62346
|
var init_docDefaults_translator = __esm(() => {
|
|
61879
62347
|
init_node_translator2();
|
|
61880
62348
|
init_pPr();
|
|
61881
62349
|
init_rpr();
|
|
61882
|
-
|
|
62350
|
+
translator187 = NodeTranslator.from({
|
|
61883
62351
|
xmlName: "w:docDefaults",
|
|
61884
62352
|
sdNodeOrKeyName: "docDefaults",
|
|
61885
62353
|
type: NodeTranslator.translatorTypes.NODE,
|
|
@@ -61899,11 +62367,11 @@ var init_docDefaults_translator = __esm(() => {
|
|
|
61899
62367
|
propertyName: "paragraphProperties",
|
|
61900
62368
|
translator: translator92
|
|
61901
62369
|
}
|
|
61902
|
-
].forEach(({ wrapperName, propertyName, translator:
|
|
62370
|
+
].forEach(({ wrapperName, propertyName, translator: translator188 }) => {
|
|
61903
62371
|
const defaultElement = node3.elements?.find((el) => el.name === wrapperName);
|
|
61904
62372
|
const propertyElement = defaultElement?.elements?.find((el) => el.name === wrapperName.replace("Default", ""));
|
|
61905
62373
|
if (propertyElement) {
|
|
61906
|
-
const props =
|
|
62374
|
+
const props = translator188.encode({ ...params2, nodes: [propertyElement] });
|
|
61907
62375
|
if (props) {
|
|
61908
62376
|
result[propertyName] = props;
|
|
61909
62377
|
}
|
|
@@ -61928,10 +62396,10 @@ var init_docDefaults_translator = __esm(() => {
|
|
|
61928
62396
|
propertyName: "paragraphProperties",
|
|
61929
62397
|
translator: translator92
|
|
61930
62398
|
}
|
|
61931
|
-
].forEach(({ wrapperName, propertyName, translator:
|
|
62399
|
+
].forEach(({ wrapperName, propertyName, translator: translator188 }) => {
|
|
61932
62400
|
const propertyValue = currentValue[propertyName];
|
|
61933
62401
|
if (propertyValue) {
|
|
61934
|
-
const decodedProperty =
|
|
62402
|
+
const decodedProperty = translator188.decode({ ...params2, node: { attrs: { [propertyName]: propertyValue } } });
|
|
61935
62403
|
if (decodedProperty) {
|
|
61936
62404
|
elements.push({
|
|
61937
62405
|
name: wrapperName,
|
|
@@ -61956,11 +62424,11 @@ var init_docDefaults_translator = __esm(() => {
|
|
|
61956
62424
|
});
|
|
61957
62425
|
|
|
61958
62426
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/lsdException/lsdException-translator.js
|
|
61959
|
-
var
|
|
62427
|
+
var translator188;
|
|
61960
62428
|
var init_lsdException_translator = __esm(() => {
|
|
61961
62429
|
init_node_translator2();
|
|
61962
62430
|
init_utils();
|
|
61963
|
-
|
|
62431
|
+
translator188 = NodeTranslator.from({
|
|
61964
62432
|
xmlName: "w:lsdException",
|
|
61965
62433
|
sdNodeOrKeyName: "lsdException",
|
|
61966
62434
|
type: NodeTranslator.translatorTypes.NODE,
|
|
@@ -61988,12 +62456,12 @@ var init_lsdException = __esm(() => {
|
|
|
61988
62456
|
});
|
|
61989
62457
|
|
|
61990
62458
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/latentStyles/latentStyles-translator.js
|
|
61991
|
-
var
|
|
62459
|
+
var translator189;
|
|
61992
62460
|
var init_latentStyles_translator = __esm(() => {
|
|
61993
62461
|
init_node_translator2();
|
|
61994
62462
|
init_utils();
|
|
61995
62463
|
init_lsdException();
|
|
61996
|
-
|
|
62464
|
+
translator189 = NodeTranslator.from({
|
|
61997
62465
|
xmlName: "w:latentStyles",
|
|
61998
62466
|
sdNodeOrKeyName: "latentStyles",
|
|
61999
62467
|
type: NodeTranslator.translatorTypes.NODE,
|
|
@@ -62007,7 +62475,7 @@ var init_latentStyles_translator = __esm(() => {
|
|
|
62007
62475
|
encode: (params2, encodedAttrs) => {
|
|
62008
62476
|
const { nodes } = params2;
|
|
62009
62477
|
const node3 = nodes[0];
|
|
62010
|
-
const lsdExceptions = encodePropertiesByKey("w:lsdException", "lsdExceptions",
|
|
62478
|
+
const lsdExceptions = encodePropertiesByKey("w:lsdException", "lsdExceptions", translator188, params2, node3, "name");
|
|
62011
62479
|
return { ...lsdExceptions, ...encodedAttrs };
|
|
62012
62480
|
},
|
|
62013
62481
|
decode: function(params2) {
|
|
@@ -62018,7 +62486,7 @@ var init_latentStyles_translator = __esm(() => {
|
|
|
62018
62486
|
if (!currentValue) {
|
|
62019
62487
|
return;
|
|
62020
62488
|
}
|
|
62021
|
-
const elements = decodePropertiesByKey("w:lsdException", "lsdExceptions",
|
|
62489
|
+
const elements = decodePropertiesByKey("w:lsdException", "lsdExceptions", translator188, params2, currentValue);
|
|
62022
62490
|
const newNode = {
|
|
62023
62491
|
name: "w:latentStyles",
|
|
62024
62492
|
attributes: decodedAttrs,
|
|
@@ -62030,27 +62498,27 @@ var init_latentStyles_translator = __esm(() => {
|
|
|
62030
62498
|
});
|
|
62031
62499
|
|
|
62032
62500
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/locked/locked-translator.js
|
|
62033
|
-
var
|
|
62501
|
+
var translator190;
|
|
62034
62502
|
var init_locked_translator = __esm(() => {
|
|
62035
62503
|
init_node_translator2();
|
|
62036
62504
|
init_utils();
|
|
62037
|
-
|
|
62505
|
+
translator190 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:locked"));
|
|
62038
62506
|
});
|
|
62039
62507
|
|
|
62040
62508
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/link/link-translator.js
|
|
62041
|
-
var
|
|
62509
|
+
var translator191;
|
|
62042
62510
|
var init_link_translator = __esm(() => {
|
|
62043
62511
|
init_node_translator2();
|
|
62044
62512
|
init_utils();
|
|
62045
|
-
|
|
62513
|
+
translator191 = NodeTranslator.from(createSingleAttrPropertyHandler("w:link"));
|
|
62046
62514
|
});
|
|
62047
62515
|
|
|
62048
62516
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/startOverride/startOverride-translator.js
|
|
62049
|
-
var
|
|
62517
|
+
var translator192;
|
|
62050
62518
|
var init_startOverride_translator = __esm(() => {
|
|
62051
62519
|
init_node_translator2();
|
|
62052
62520
|
init_utils();
|
|
62053
|
-
|
|
62521
|
+
translator192 = NodeTranslator.from(createSingleIntegerPropertyHandler("w:startOverride"));
|
|
62054
62522
|
});
|
|
62055
62523
|
|
|
62056
62524
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/startOverride/index.js
|
|
@@ -62059,23 +62527,23 @@ var init_startOverride = __esm(() => {
|
|
|
62059
62527
|
});
|
|
62060
62528
|
|
|
62061
62529
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/lvlOverride/lvlOverride-translator.js
|
|
62062
|
-
var propertyTranslators16, attributeHandlers3,
|
|
62530
|
+
var propertyTranslators16, attributeHandlers3, translator193;
|
|
62063
62531
|
var init_lvlOverride_translator = __esm(() => {
|
|
62064
62532
|
init_node_translator2();
|
|
62065
62533
|
init_utils();
|
|
62066
62534
|
init_startOverride();
|
|
62067
62535
|
init_lvl();
|
|
62068
|
-
propertyTranslators16 = [
|
|
62536
|
+
propertyTranslators16 = [translator192, translator180];
|
|
62069
62537
|
attributeHandlers3 = [createIntegerAttributeHandler("w:ilvl")];
|
|
62070
|
-
|
|
62538
|
+
translator193 = NodeTranslator.from(createNestedPropertiesTranslator("w:lvlOverride", "lvlOverride", propertyTranslators16, {}, attributeHandlers3));
|
|
62071
62539
|
});
|
|
62072
62540
|
|
|
62073
62541
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/next/next-translator.js
|
|
62074
|
-
var
|
|
62542
|
+
var translator194;
|
|
62075
62543
|
var init_next_translator = __esm(() => {
|
|
62076
62544
|
init_node_translator2();
|
|
62077
62545
|
init_utils();
|
|
62078
|
-
|
|
62546
|
+
translator194 = NodeTranslator.from(createSingleAttrPropertyHandler("w:next"));
|
|
62079
62547
|
});
|
|
62080
62548
|
|
|
62081
62549
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/abstractNumId/index.js
|
|
@@ -62089,13 +62557,13 @@ var init_lvlOverride = __esm(() => {
|
|
|
62089
62557
|
});
|
|
62090
62558
|
|
|
62091
62559
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/num/num-translator.js
|
|
62092
|
-
var
|
|
62560
|
+
var translator195;
|
|
62093
62561
|
var init_num_translator = __esm(() => {
|
|
62094
62562
|
init_node_translator2();
|
|
62095
62563
|
init_abstractNumId();
|
|
62096
62564
|
init_lvlOverride();
|
|
62097
62565
|
init_utils();
|
|
62098
|
-
|
|
62566
|
+
translator195 = NodeTranslator.from({
|
|
62099
62567
|
xmlName: "w:num",
|
|
62100
62568
|
sdNodeOrKeyName: "num",
|
|
62101
62569
|
type: NodeTranslator.translatorTypes.NODE,
|
|
@@ -62106,9 +62574,9 @@ var init_num_translator = __esm(() => {
|
|
|
62106
62574
|
const result = {
|
|
62107
62575
|
...encodedAttrs,
|
|
62108
62576
|
...encodeProperties(params2, {
|
|
62109
|
-
"w:abstractNumId":
|
|
62577
|
+
"w:abstractNumId": translator182
|
|
62110
62578
|
}),
|
|
62111
|
-
...encodePropertiesByKey("w:lvlOverride", "lvlOverrides",
|
|
62579
|
+
...encodePropertiesByKey("w:lvlOverride", "lvlOverrides", translator193, params2, node3, "ilvl")
|
|
62112
62580
|
};
|
|
62113
62581
|
return result;
|
|
62114
62582
|
},
|
|
@@ -62120,9 +62588,9 @@ var init_num_translator = __esm(() => {
|
|
|
62120
62588
|
const decodedAttrs = this.decodeAttributes({ node: { ...params2.node, attrs: currentValue } });
|
|
62121
62589
|
const elements = [
|
|
62122
62590
|
...decodeProperties(params2, {
|
|
62123
|
-
abstractNumId:
|
|
62591
|
+
abstractNumId: translator182
|
|
62124
62592
|
}, currentValue),
|
|
62125
|
-
...decodePropertiesByKey("w:lvlOverride", "lvlOverrides",
|
|
62593
|
+
...decodePropertiesByKey("w:lvlOverride", "lvlOverrides", translator193, params2, currentValue)
|
|
62126
62594
|
];
|
|
62127
62595
|
const newNode = {
|
|
62128
62596
|
name: "w:num",
|
|
@@ -62146,11 +62614,11 @@ var init_num = __esm(() => {
|
|
|
62146
62614
|
});
|
|
62147
62615
|
|
|
62148
62616
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/numIdMacAtCleanup/numIdMacAtCleanup-translator.js
|
|
62149
|
-
var
|
|
62617
|
+
var translator196;
|
|
62150
62618
|
var init_numIdMacAtCleanup_translator = __esm(() => {
|
|
62151
62619
|
init_node_translator2();
|
|
62152
62620
|
init_utils();
|
|
62153
|
-
|
|
62621
|
+
translator196 = NodeTranslator.from(createSingleIntegerPropertyHandler("w:numIdMacAtCleanup"));
|
|
62154
62622
|
});
|
|
62155
62623
|
|
|
62156
62624
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/numIdMacAtCleanup/index.js
|
|
@@ -62159,7 +62627,7 @@ var init_numIdMacAtCleanup = __esm(() => {
|
|
|
62159
62627
|
});
|
|
62160
62628
|
|
|
62161
62629
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/numbering/numbering-translator.js
|
|
62162
|
-
var propertyTranslators17, propertyTranslatorsByXmlName2, propertyTranslatorsBySdName2,
|
|
62630
|
+
var propertyTranslators17, propertyTranslatorsByXmlName2, propertyTranslatorsBySdName2, translator197;
|
|
62163
62631
|
var init_numbering_translator = __esm(() => {
|
|
62164
62632
|
init_node_translator2();
|
|
62165
62633
|
init_nsid();
|
|
@@ -62173,21 +62641,21 @@ var init_numbering_translator = __esm(() => {
|
|
|
62173
62641
|
init_numIdMacAtCleanup();
|
|
62174
62642
|
init_utils();
|
|
62175
62643
|
propertyTranslators17 = [
|
|
62176
|
-
translator165,
|
|
62177
62644
|
translator166,
|
|
62178
62645
|
translator167,
|
|
62179
62646
|
translator168,
|
|
62180
62647
|
translator169,
|
|
62181
62648
|
translator170,
|
|
62182
|
-
|
|
62649
|
+
translator171,
|
|
62650
|
+
translator196
|
|
62183
62651
|
];
|
|
62184
62652
|
propertyTranslatorsByXmlName2 = {};
|
|
62185
62653
|
propertyTranslatorsBySdName2 = {};
|
|
62186
|
-
propertyTranslators17.forEach((
|
|
62187
|
-
propertyTranslatorsByXmlName2[
|
|
62188
|
-
propertyTranslatorsBySdName2[
|
|
62654
|
+
propertyTranslators17.forEach((translator197) => {
|
|
62655
|
+
propertyTranslatorsByXmlName2[translator197.xmlName] = translator197;
|
|
62656
|
+
propertyTranslatorsBySdName2[translator197.sdNodeOrKeyName] = translator197;
|
|
62189
62657
|
});
|
|
62190
|
-
|
|
62658
|
+
translator197 = NodeTranslator.from({
|
|
62191
62659
|
xmlName: "w:numbering",
|
|
62192
62660
|
sdNodeOrKeyName: "numbering",
|
|
62193
62661
|
type: NodeTranslator.translatorTypes.NODE,
|
|
@@ -62199,8 +62667,8 @@ var init_numbering_translator = __esm(() => {
|
|
|
62199
62667
|
const result = {
|
|
62200
62668
|
...encodedAttrs,
|
|
62201
62669
|
...props,
|
|
62202
|
-
...encodePropertiesByKey("w:abstractNum", "abstracts",
|
|
62203
|
-
...encodePropertiesByKey("w:num", "definitions",
|
|
62670
|
+
...encodePropertiesByKey("w:abstractNum", "abstracts", translator181, params2, node3, "abstractNumId"),
|
|
62671
|
+
...encodePropertiesByKey("w:num", "definitions", translator195, params2, node3, "numId")
|
|
62204
62672
|
};
|
|
62205
62673
|
return result;
|
|
62206
62674
|
},
|
|
@@ -62213,8 +62681,8 @@ var init_numbering_translator = __esm(() => {
|
|
|
62213
62681
|
const props = decodeProperties(params2, propertyTranslatorsBySdName2, currentValue);
|
|
62214
62682
|
const elements = [
|
|
62215
62683
|
...props,
|
|
62216
|
-
...decodePropertiesByKey("w:abstractNum", "abstracts",
|
|
62217
|
-
...decodePropertiesByKey("w:num", "definitions",
|
|
62684
|
+
...decodePropertiesByKey("w:abstractNum", "abstracts", translator181, params2, currentValue),
|
|
62685
|
+
...decodePropertiesByKey("w:num", "definitions", translator195, params2, currentValue)
|
|
62218
62686
|
];
|
|
62219
62687
|
const newNode = {
|
|
62220
62688
|
name: "w:numbering",
|
|
@@ -62228,43 +62696,43 @@ var init_numbering_translator = __esm(() => {
|
|
|
62228
62696
|
});
|
|
62229
62697
|
|
|
62230
62698
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/personal/personal-translator.js
|
|
62231
|
-
var
|
|
62699
|
+
var translator198;
|
|
62232
62700
|
var init_personal_translator = __esm(() => {
|
|
62233
62701
|
init_node_translator2();
|
|
62234
62702
|
init_utils();
|
|
62235
|
-
|
|
62703
|
+
translator198 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:personal"));
|
|
62236
62704
|
});
|
|
62237
62705
|
|
|
62238
62706
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/personalCompose/personalCompose-translator.js
|
|
62239
|
-
var
|
|
62707
|
+
var translator199;
|
|
62240
62708
|
var init_personalCompose_translator = __esm(() => {
|
|
62241
62709
|
init_node_translator2();
|
|
62242
62710
|
init_utils();
|
|
62243
|
-
|
|
62711
|
+
translator199 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:personalCompose"));
|
|
62244
62712
|
});
|
|
62245
62713
|
|
|
62246
62714
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/personalReply/personalReply-translator.js
|
|
62247
|
-
var
|
|
62715
|
+
var translator200;
|
|
62248
62716
|
var init_personalReply_translator = __esm(() => {
|
|
62249
62717
|
init_node_translator2();
|
|
62250
62718
|
init_utils();
|
|
62251
|
-
|
|
62719
|
+
translator200 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:personalReply"));
|
|
62252
62720
|
});
|
|
62253
62721
|
|
|
62254
62722
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/rsid/rsid-translator.js
|
|
62255
|
-
var
|
|
62723
|
+
var translator201;
|
|
62256
62724
|
var init_rsid_translator = __esm(() => {
|
|
62257
62725
|
init_node_translator2();
|
|
62258
62726
|
init_utils();
|
|
62259
|
-
|
|
62727
|
+
translator201 = NodeTranslator.from(createSingleIntegerPropertyHandler("w:rsid"));
|
|
62260
62728
|
});
|
|
62261
62729
|
|
|
62262
62730
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/semiHidden/semiHidden-translator.js
|
|
62263
|
-
var
|
|
62731
|
+
var translator202;
|
|
62264
62732
|
var init_semiHidden_translator = __esm(() => {
|
|
62265
62733
|
init_node_translator2();
|
|
62266
62734
|
init_utils();
|
|
62267
|
-
|
|
62735
|
+
translator202 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:semiHidden"));
|
|
62268
62736
|
});
|
|
62269
62737
|
|
|
62270
62738
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/aliases/index.js
|
|
@@ -62298,11 +62766,11 @@ var init_semiHidden = __esm(() => {
|
|
|
62298
62766
|
});
|
|
62299
62767
|
|
|
62300
62768
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/unhideWhenUsed/unhideWhenUsed-translator.js
|
|
62301
|
-
var
|
|
62769
|
+
var translator203;
|
|
62302
62770
|
var init_unhideWhenUsed_translator = __esm(() => {
|
|
62303
62771
|
init_node_translator2();
|
|
62304
62772
|
init_utils();
|
|
62305
|
-
|
|
62773
|
+
translator203 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:unhideWhenUsed"));
|
|
62306
62774
|
});
|
|
62307
62775
|
|
|
62308
62776
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/unhideWhenUsed/index.js
|
|
@@ -62311,11 +62779,11 @@ var init_unhideWhenUsed = __esm(() => {
|
|
|
62311
62779
|
});
|
|
62312
62780
|
|
|
62313
62781
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/qFormat/qFormat-translator.js
|
|
62314
|
-
var
|
|
62782
|
+
var translator204;
|
|
62315
62783
|
var init_qFormat_translator = __esm(() => {
|
|
62316
62784
|
init_node_translator2();
|
|
62317
62785
|
init_utils();
|
|
62318
|
-
|
|
62786
|
+
translator204 = NodeTranslator.from(createSingleBooleanPropertyHandler("w:qFormat"));
|
|
62319
62787
|
});
|
|
62320
62788
|
|
|
62321
62789
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/qFormat/index.js
|
|
@@ -62344,11 +62812,11 @@ var init_personalReply = __esm(() => {
|
|
|
62344
62812
|
});
|
|
62345
62813
|
|
|
62346
62814
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/uiPriority/uiPriority-translator.js
|
|
62347
|
-
var
|
|
62815
|
+
var translator205;
|
|
62348
62816
|
var init_uiPriority_translator = __esm(() => {
|
|
62349
62817
|
init_node_translator2();
|
|
62350
62818
|
init_utils();
|
|
62351
|
-
|
|
62819
|
+
translator205 = NodeTranslator.from(createSingleIntegerPropertyHandler("w:uiPriority"));
|
|
62352
62820
|
});
|
|
62353
62821
|
|
|
62354
62822
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/uiPriority/index.js
|
|
@@ -62362,7 +62830,7 @@ var init_rsid = __esm(() => {
|
|
|
62362
62830
|
});
|
|
62363
62831
|
|
|
62364
62832
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/style/style-translator.js
|
|
62365
|
-
var propertyTranslators18, attributeHandlers4, propertyTranslatorsByXmlName3, propertyTranslatorsBySdName3,
|
|
62833
|
+
var propertyTranslators18, attributeHandlers4, propertyTranslatorsByXmlName3, propertyTranslatorsBySdName3, translator206;
|
|
62366
62834
|
var init_style_translator = __esm(() => {
|
|
62367
62835
|
init_node_translator2();
|
|
62368
62836
|
init_utils();
|
|
@@ -62389,22 +62857,22 @@ var init_style_translator = __esm(() => {
|
|
|
62389
62857
|
init_tcPr();
|
|
62390
62858
|
init_tblStylePr();
|
|
62391
62859
|
propertyTranslators18 = [
|
|
62392
|
-
|
|
62393
|
-
translator183,
|
|
62860
|
+
translator168,
|
|
62394
62861
|
translator184,
|
|
62395
|
-
|
|
62396
|
-
|
|
62397
|
-
|
|
62862
|
+
translator185,
|
|
62863
|
+
translator194,
|
|
62864
|
+
translator191,
|
|
62865
|
+
translator183,
|
|
62398
62866
|
translator122,
|
|
62399
|
-
translator201,
|
|
62400
62867
|
translator202,
|
|
62401
62868
|
translator203,
|
|
62402
|
-
|
|
62403
|
-
|
|
62869
|
+
translator204,
|
|
62870
|
+
translator190,
|
|
62404
62871
|
translator198,
|
|
62405
62872
|
translator199,
|
|
62406
|
-
translator204,
|
|
62407
62873
|
translator200,
|
|
62874
|
+
translator205,
|
|
62875
|
+
translator201,
|
|
62408
62876
|
translator92,
|
|
62409
62877
|
translator46,
|
|
62410
62878
|
translator147,
|
|
@@ -62420,13 +62888,13 @@ var init_style_translator = __esm(() => {
|
|
|
62420
62888
|
];
|
|
62421
62889
|
propertyTranslatorsByXmlName3 = {};
|
|
62422
62890
|
propertyTranslatorsBySdName3 = {};
|
|
62423
|
-
propertyTranslators18.forEach((
|
|
62424
|
-
if (!
|
|
62891
|
+
propertyTranslators18.forEach((translator206) => {
|
|
62892
|
+
if (!translator206)
|
|
62425
62893
|
return;
|
|
62426
|
-
propertyTranslatorsByXmlName3[
|
|
62427
|
-
propertyTranslatorsBySdName3[
|
|
62894
|
+
propertyTranslatorsByXmlName3[translator206.xmlName] = translator206;
|
|
62895
|
+
propertyTranslatorsBySdName3[translator206.sdNodeOrKeyName] = translator206;
|
|
62428
62896
|
});
|
|
62429
|
-
|
|
62897
|
+
translator206 = NodeTranslator.from({
|
|
62430
62898
|
xmlName: "w:style",
|
|
62431
62899
|
sdNodeOrKeyName: "style",
|
|
62432
62900
|
type: NodeTranslator.translatorTypes.NODE,
|
|
@@ -62478,14 +62946,14 @@ var init_style = __esm(() => {
|
|
|
62478
62946
|
});
|
|
62479
62947
|
|
|
62480
62948
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/styles/styles-translator.js
|
|
62481
|
-
var
|
|
62949
|
+
var translator207;
|
|
62482
62950
|
var init_styles_translator = __esm(() => {
|
|
62483
62951
|
init_node_translator2();
|
|
62484
62952
|
init_docDefaults();
|
|
62485
62953
|
init_latentStyles();
|
|
62486
62954
|
init_style();
|
|
62487
62955
|
init_utils();
|
|
62488
|
-
|
|
62956
|
+
translator207 = NodeTranslator.from({
|
|
62489
62957
|
xmlName: "w:styles",
|
|
62490
62958
|
sdNodeOrKeyName: "styles",
|
|
62491
62959
|
type: NodeTranslator.translatorTypes.NODE,
|
|
@@ -62494,12 +62962,12 @@ var init_styles_translator = __esm(() => {
|
|
|
62494
62962
|
const { nodes } = params2;
|
|
62495
62963
|
const node3 = nodes[0];
|
|
62496
62964
|
const props = encodeProperties(params2, {
|
|
62497
|
-
"w:docDefaults":
|
|
62498
|
-
"w:latentStyles":
|
|
62965
|
+
"w:docDefaults": translator187,
|
|
62966
|
+
"w:latentStyles": translator189
|
|
62499
62967
|
});
|
|
62500
62968
|
const result = {
|
|
62501
62969
|
...props,
|
|
62502
|
-
...encodePropertiesByKey("w:style", "styles",
|
|
62970
|
+
...encodePropertiesByKey("w:style", "styles", translator206, params2, node3, "styleId")
|
|
62503
62971
|
};
|
|
62504
62972
|
return result;
|
|
62505
62973
|
},
|
|
@@ -62509,10 +62977,10 @@ var init_styles_translator = __esm(() => {
|
|
|
62509
62977
|
return;
|
|
62510
62978
|
}
|
|
62511
62979
|
const props = decodeProperties(params2, {
|
|
62512
|
-
docDefaults:
|
|
62513
|
-
latentStyles:
|
|
62980
|
+
docDefaults: translator187,
|
|
62981
|
+
latentStyles: translator189
|
|
62514
62982
|
}, currentValue);
|
|
62515
|
-
const elements = [...props, ...decodePropertiesByKey("w:style", "styles",
|
|
62983
|
+
const elements = [...props, ...decodePropertiesByKey("w:style", "styles", translator206, params2, currentValue)];
|
|
62516
62984
|
const newNode = {
|
|
62517
62985
|
name: "w:styles",
|
|
62518
62986
|
type: "element",
|
|
@@ -62532,6 +63000,7 @@ var init_handlers = __esm(() => {
|
|
|
62532
63000
|
init_tableOfContents_translator();
|
|
62533
63001
|
init_index_translator();
|
|
62534
63002
|
init_indexEntry_translator();
|
|
63003
|
+
init_tableOfContentsEntry_translator();
|
|
62535
63004
|
init_autoPageNumber_translator();
|
|
62536
63005
|
init_totalPageNumber_translator();
|
|
62537
63006
|
init_abstractNum_translator();
|
|
@@ -62724,19 +63193,20 @@ var init_handlers = __esm(() => {
|
|
|
62724
63193
|
translator157,
|
|
62725
63194
|
translator158,
|
|
62726
63195
|
translator159,
|
|
63196
|
+
translator165,
|
|
62727
63197
|
translator160,
|
|
62728
63198
|
translator161,
|
|
62729
|
-
translator180,
|
|
62730
63199
|
translator181,
|
|
62731
|
-
translator49,
|
|
62732
63200
|
translator182,
|
|
63201
|
+
translator49,
|
|
63202
|
+
translator183,
|
|
62733
63203
|
translator50,
|
|
62734
63204
|
translator51,
|
|
62735
|
-
|
|
63205
|
+
translator184,
|
|
62736
63206
|
translator3,
|
|
62737
63207
|
translator68,
|
|
62738
63208
|
translator4,
|
|
62739
|
-
|
|
63209
|
+
translator185,
|
|
62740
63210
|
translator5,
|
|
62741
63211
|
translator134,
|
|
62742
63212
|
translator153,
|
|
@@ -62751,7 +63221,7 @@ var init_handlers = __esm(() => {
|
|
|
62751
63221
|
translator38,
|
|
62752
63222
|
translator162,
|
|
62753
63223
|
translator55,
|
|
62754
|
-
|
|
63224
|
+
translator187,
|
|
62755
63225
|
translator132,
|
|
62756
63226
|
translator9,
|
|
62757
63227
|
translator36,
|
|
@@ -62759,7 +63229,7 @@ var init_handlers = __esm(() => {
|
|
|
62759
63229
|
translator31,
|
|
62760
63230
|
translator22,
|
|
62761
63231
|
translator99,
|
|
62762
|
-
|
|
63232
|
+
translator186,
|
|
62763
63233
|
translator35,
|
|
62764
63234
|
translator56,
|
|
62765
63235
|
translator120,
|
|
@@ -62780,39 +63250,39 @@ var init_handlers = __esm(() => {
|
|
|
62780
63250
|
translator163,
|
|
62781
63251
|
translator101,
|
|
62782
63252
|
translator102,
|
|
62783
|
-
|
|
63253
|
+
translator174,
|
|
62784
63254
|
translator58,
|
|
62785
63255
|
translator59,
|
|
62786
63256
|
translator60,
|
|
62787
63257
|
translator33,
|
|
62788
63258
|
translator61,
|
|
62789
63259
|
translator17,
|
|
62790
|
-
|
|
63260
|
+
translator189,
|
|
62791
63261
|
translator72,
|
|
62792
|
-
|
|
62793
|
-
|
|
62794
|
-
|
|
62795
|
-
|
|
62796
|
-
|
|
63262
|
+
translator188,
|
|
63263
|
+
translator191,
|
|
63264
|
+
translator180,
|
|
63265
|
+
translator193,
|
|
63266
|
+
translator177,
|
|
63267
|
+
translator173,
|
|
62797
63268
|
translator172,
|
|
62798
|
-
translator171,
|
|
62799
63269
|
translator105,
|
|
62800
|
-
|
|
62801
|
-
|
|
62802
|
-
|
|
63270
|
+
translator176,
|
|
63271
|
+
translator171,
|
|
63272
|
+
translator190,
|
|
62803
63273
|
translator62,
|
|
62804
|
-
|
|
62805
|
-
|
|
63274
|
+
translator168,
|
|
63275
|
+
translator194,
|
|
62806
63276
|
translator24,
|
|
62807
63277
|
translator109,
|
|
62808
|
-
translator194,
|
|
62809
|
-
translator196,
|
|
62810
|
-
translator177,
|
|
62811
|
-
translator64,
|
|
62812
63278
|
translator195,
|
|
63279
|
+
translator197,
|
|
63280
|
+
translator178,
|
|
63281
|
+
translator64,
|
|
63282
|
+
translator196,
|
|
62813
63283
|
translator65,
|
|
62814
|
-
|
|
62815
|
-
|
|
63284
|
+
translator170,
|
|
63285
|
+
translator166,
|
|
62816
63286
|
translator26,
|
|
62817
63287
|
translator66,
|
|
62818
63288
|
translator67,
|
|
@@ -62820,9 +63290,9 @@ var init_handlers = __esm(() => {
|
|
|
62820
63290
|
translator93,
|
|
62821
63291
|
translator80,
|
|
62822
63292
|
translator78,
|
|
62823
|
-
translator197,
|
|
62824
63293
|
translator198,
|
|
62825
63294
|
translator199,
|
|
63295
|
+
translator200,
|
|
62826
63296
|
translator34,
|
|
62827
63297
|
translator92,
|
|
62828
63298
|
translator79,
|
|
@@ -62832,11 +63302,11 @@ var init_handlers = __esm(() => {
|
|
|
62832
63302
|
translator11,
|
|
62833
63303
|
translator46,
|
|
62834
63304
|
translator12,
|
|
62835
|
-
|
|
63305
|
+
translator201,
|
|
62836
63306
|
translator37,
|
|
62837
63307
|
translator74,
|
|
62838
63308
|
translator133,
|
|
62839
|
-
|
|
63309
|
+
translator202,
|
|
62840
63310
|
translator27,
|
|
62841
63311
|
translator16,
|
|
62842
63312
|
translator20,
|
|
@@ -62845,14 +63315,14 @@ var init_handlers = __esm(() => {
|
|
|
62845
63315
|
translator82,
|
|
62846
63316
|
translator83,
|
|
62847
63317
|
translator84,
|
|
62848
|
-
|
|
63318
|
+
translator175,
|
|
62849
63319
|
translator29,
|
|
62850
63320
|
translator103,
|
|
62851
|
-
|
|
63321
|
+
translator192,
|
|
62852
63322
|
translator8,
|
|
62853
|
-
translator205,
|
|
62854
|
-
translator168,
|
|
62855
63323
|
translator206,
|
|
63324
|
+
translator169,
|
|
63325
|
+
translator207,
|
|
62856
63326
|
translator13,
|
|
62857
63327
|
translator14,
|
|
62858
63328
|
translator164,
|
|
@@ -62884,7 +63354,7 @@ var init_handlers = __esm(() => {
|
|
|
62884
63354
|
translator96,
|
|
62885
63355
|
translator87,
|
|
62886
63356
|
translator106,
|
|
62887
|
-
|
|
63357
|
+
translator167,
|
|
62888
63358
|
translator129,
|
|
62889
63359
|
translator107,
|
|
62890
63360
|
translator125,
|
|
@@ -62894,8 +63364,8 @@ var init_handlers = __esm(() => {
|
|
|
62894
63364
|
translator89,
|
|
62895
63365
|
translator76,
|
|
62896
63366
|
translator7,
|
|
62897
|
-
|
|
62898
|
-
|
|
63367
|
+
translator205,
|
|
63368
|
+
translator203,
|
|
62899
63369
|
translator112,
|
|
62900
63370
|
translator28,
|
|
62901
63371
|
translator19,
|
|
@@ -62906,19 +63376,19 @@ var init_handlers = __esm(() => {
|
|
|
62906
63376
|
translator40,
|
|
62907
63377
|
translator90,
|
|
62908
63378
|
translator91,
|
|
62909
|
-
|
|
63379
|
+
translator204,
|
|
62910
63380
|
translator130,
|
|
62911
63381
|
translator131,
|
|
62912
63382
|
commentRangeStartTranslator,
|
|
62913
63383
|
commentRangeEndTranslator
|
|
62914
63384
|
]));
|
|
62915
|
-
additionalHandlers = Object.freeze(translatorList.reduce((acc,
|
|
62916
|
-
if (typeof
|
|
63385
|
+
additionalHandlers = Object.freeze(translatorList.reduce((acc, translator208) => {
|
|
63386
|
+
if (typeof translator208 === "function")
|
|
62917
63387
|
return acc;
|
|
62918
|
-
const key =
|
|
63388
|
+
const key = translator208?.xmlName;
|
|
62919
63389
|
if (!key)
|
|
62920
63390
|
return acc;
|
|
62921
|
-
acc[key] =
|
|
63391
|
+
acc[key] = translator208;
|
|
62922
63392
|
return acc;
|
|
62923
63393
|
}, {}));
|
|
62924
63394
|
baseHandlers = {
|
|
@@ -64039,7 +64509,7 @@ var footnoteReferenceHandlerEntity;
|
|
|
64039
64509
|
var init_footnoteReferenceImporter = __esm(() => {
|
|
64040
64510
|
init_utils();
|
|
64041
64511
|
init_footnoteReference_translator();
|
|
64042
|
-
footnoteReferenceHandlerEntity = generateV2HandlerEntity("footnoteReferenceHandler",
|
|
64512
|
+
footnoteReferenceHandlerEntity = generateV2HandlerEntity("footnoteReferenceHandler", translator186);
|
|
64043
64513
|
});
|
|
64044
64514
|
|
|
64045
64515
|
// ../../packages/super-editor/src/core/super-converter/v2/importer/tableImporter.js
|
|
@@ -64436,13 +64906,13 @@ function translateStyleDefinitions(docx) {
|
|
|
64436
64906
|
if (!styles)
|
|
64437
64907
|
return [];
|
|
64438
64908
|
const stylesElement = styles.elements[0];
|
|
64439
|
-
const parsedStyles =
|
|
64909
|
+
const parsedStyles = translator207.encode({ nodes: [stylesElement] });
|
|
64440
64910
|
return parsedStyles;
|
|
64441
64911
|
}
|
|
64442
64912
|
function translateNumberingDefinitions(docx) {
|
|
64443
64913
|
const numbering = docx["word/numbering.xml"] ?? baseNumbering;
|
|
64444
64914
|
const numberingElement = numbering.elements[0];
|
|
64445
|
-
const parsedNumbering =
|
|
64915
|
+
const parsedNumbering = translator197.encode({ nodes: [numberingElement] });
|
|
64446
64916
|
return parsedNumbering;
|
|
64447
64917
|
}
|
|
64448
64918
|
function addDefaultStylesIfMissing(styles) {
|
|
@@ -66207,7 +66677,7 @@ function convertToPt2(pixels) {
|
|
|
66207
66677
|
var init_translate_text_watermark = () => {};
|
|
66208
66678
|
|
|
66209
66679
|
// ../../packages/super-editor/src/core/super-converter/v3/handlers/w/pict/pict-translator.js
|
|
66210
|
-
function
|
|
66680
|
+
function encode69({ nodes, ...params2 }) {
|
|
66211
66681
|
const [node3] = nodes;
|
|
66212
66682
|
if (!node3) {
|
|
66213
66683
|
return;
|
|
@@ -66222,7 +66692,7 @@ function encode68({ nodes, ...params2 }) {
|
|
|
66222
66692
|
});
|
|
66223
66693
|
return result;
|
|
66224
66694
|
}
|
|
66225
|
-
function
|
|
66695
|
+
function decode72(params2) {
|
|
66226
66696
|
const { node: node3 } = params2;
|
|
66227
66697
|
if (!node3 || !node3.type) {
|
|
66228
66698
|
return null;
|
|
@@ -66253,7 +66723,7 @@ function decode71(params2) {
|
|
|
66253
66723
|
}
|
|
66254
66724
|
return result;
|
|
66255
66725
|
}
|
|
66256
|
-
var
|
|
66726
|
+
var XML_NODE_NAME33 = "w:pict", SD_NODE_NAME27, validXmlAttributes13, config32, translator208;
|
|
66257
66727
|
var init_pict_translator = __esm(() => {
|
|
66258
66728
|
init_node_translator();
|
|
66259
66729
|
init_pict_node_type_strategy();
|
|
@@ -66262,17 +66732,17 @@ var init_pict_translator = __esm(() => {
|
|
|
66262
66732
|
init_translate_content_block();
|
|
66263
66733
|
init_translate_image_watermark();
|
|
66264
66734
|
init_translate_text_watermark();
|
|
66265
|
-
|
|
66735
|
+
SD_NODE_NAME27 = ["shapeContainer", "contentBlock", "image"];
|
|
66266
66736
|
validXmlAttributes13 = [];
|
|
66267
|
-
|
|
66268
|
-
xmlName:
|
|
66269
|
-
sdNodeOrKeyName:
|
|
66737
|
+
config32 = {
|
|
66738
|
+
xmlName: XML_NODE_NAME33,
|
|
66739
|
+
sdNodeOrKeyName: SD_NODE_NAME27,
|
|
66270
66740
|
type: NodeTranslator.translatorTypes.NODE,
|
|
66271
|
-
encode:
|
|
66272
|
-
decode:
|
|
66741
|
+
encode: encode69,
|
|
66742
|
+
decode: decode72,
|
|
66273
66743
|
attributes: validXmlAttributes13
|
|
66274
66744
|
};
|
|
66275
|
-
|
|
66745
|
+
translator208 = NodeTranslator.from(config32);
|
|
66276
66746
|
});
|
|
66277
66747
|
|
|
66278
66748
|
// ../../packages/super-editor/src/core/super-converter/exporter.js
|
|
@@ -66294,7 +66764,7 @@ function exportSchemaToJson(params2) {
|
|
|
66294
66764
|
bookmarkEnd: translator153,
|
|
66295
66765
|
fieldAnnotation: translator133,
|
|
66296
66766
|
tab: translator47,
|
|
66297
|
-
image: [translator132,
|
|
66767
|
+
image: [translator132, translator208],
|
|
66298
66768
|
hardBreak: translator,
|
|
66299
66769
|
commentRangeStart: commentRangeStartTranslator,
|
|
66300
66770
|
commentRangeEnd: commentRangeEndTranslator,
|
|
@@ -66303,10 +66773,10 @@ function exportSchemaToJson(params2) {
|
|
|
66303
66773
|
permStartBlock: translator154,
|
|
66304
66774
|
permEndBlock: translator155,
|
|
66305
66775
|
commentReference: [],
|
|
66306
|
-
footnoteReference:
|
|
66307
|
-
shapeContainer:
|
|
66308
|
-
shapeTextbox:
|
|
66309
|
-
contentBlock:
|
|
66776
|
+
footnoteReference: translator186,
|
|
66777
|
+
shapeContainer: translator208,
|
|
66778
|
+
shapeTextbox: translator208,
|
|
66779
|
+
contentBlock: translator208,
|
|
66310
66780
|
vectorShape: translateVectorShape,
|
|
66311
66781
|
shapeGroup: translateShapeGroup,
|
|
66312
66782
|
structuredContent: translator133,
|
|
@@ -69272,10 +69742,10 @@ var generateNewListDefinition = ({ numId, listType, level, start, text: text5, f
|
|
|
69272
69742
|
newTranslatedNumbering.definitions = {};
|
|
69273
69743
|
if (!newTranslatedNumbering.abstracts)
|
|
69274
69744
|
newTranslatedNumbering.abstracts = {};
|
|
69275
|
-
newTranslatedNumbering.definitions[numId] =
|
|
69745
|
+
newTranslatedNumbering.definitions[numId] = translator195.encode({
|
|
69276
69746
|
nodes: [newNumDef]
|
|
69277
69747
|
});
|
|
69278
|
-
newTranslatedNumbering.abstracts[newAbstractId] =
|
|
69748
|
+
newTranslatedNumbering.abstracts[newAbstractId] = translator181.encode({
|
|
69279
69749
|
nodes: [newAbstractDef]
|
|
69280
69750
|
});
|
|
69281
69751
|
editor.converter.translatedNumbering = newTranslatedNumbering;
|
|
@@ -69319,8 +69789,8 @@ var generateNewListDefinition = ({ numId, listType, level, start, text: text5, f
|
|
|
69319
69789
|
newTranslatedNumbering.definitions = {};
|
|
69320
69790
|
if (!newTranslatedNumbering.abstracts)
|
|
69321
69791
|
newTranslatedNumbering.abstracts = {};
|
|
69322
|
-
newTranslatedNumbering.definitions[newId] =
|
|
69323
|
-
newTranslatedNumbering.abstracts[newAbstractId] =
|
|
69792
|
+
newTranslatedNumbering.definitions[newId] = translator195.encode({ nodes: [newNumDef] });
|
|
69793
|
+
newTranslatedNumbering.abstracts[newAbstractId] = translator181.encode({ nodes: [newAbstractDef] });
|
|
69324
69794
|
editor.converter.translatedNumbering = newTranslatedNumbering;
|
|
69325
69795
|
editor.converter.numbering = newNumbering;
|
|
69326
69796
|
return newId;
|
|
@@ -71651,7 +72121,7 @@ function stylesApplyAdapter(editor, input, options) {
|
|
|
71651
72121
|
}
|
|
71652
72122
|
const { before, after, changed } = applyPatch2(targetProps, input.patch, channel);
|
|
71653
72123
|
if (changed && !dryRun) {
|
|
71654
|
-
syncDocDefaultsToConvertedXml(converter,
|
|
72124
|
+
syncDocDefaultsToConvertedXml(converter, translator187);
|
|
71655
72125
|
editor.emit("stylesDefaultsChanged");
|
|
71656
72126
|
}
|
|
71657
72127
|
const receipt2 = {
|
|
@@ -79751,34 +80221,42 @@ function resolvePostMutationTocId(doc, sdBlockId) {
|
|
|
79751
80221
|
}
|
|
79752
80222
|
function extractTocInfo(node3) {
|
|
79753
80223
|
const instruction = node3.attrs?.instruction ?? "";
|
|
79754
|
-
const
|
|
80224
|
+
const config33 = parseTocInstruction(instruction);
|
|
80225
|
+
const rightAlign = node3.attrs?.rightAlignPageNumbers;
|
|
79755
80226
|
return {
|
|
79756
80227
|
nodeType: "tableOfContents",
|
|
79757
80228
|
kind: "block",
|
|
79758
80229
|
properties: {
|
|
79759
80230
|
instruction,
|
|
79760
|
-
sourceConfig:
|
|
79761
|
-
displayConfig:
|
|
79762
|
-
|
|
80231
|
+
sourceConfig: config33.source,
|
|
80232
|
+
displayConfig: {
|
|
80233
|
+
...config33.display,
|
|
80234
|
+
...rightAlign !== undefined && { rightAlignPageNumbers: rightAlign }
|
|
80235
|
+
},
|
|
80236
|
+
preservedSwitches: config33.preserved,
|
|
79763
80237
|
entryCount: node3.childCount
|
|
79764
80238
|
}
|
|
79765
80239
|
};
|
|
79766
80240
|
}
|
|
79767
80241
|
function buildTocDiscoveryItem(resolved, evaluatedRevision) {
|
|
79768
80242
|
const instruction = resolved.node.attrs?.instruction ?? "";
|
|
79769
|
-
const
|
|
80243
|
+
const config33 = parseTocInstruction(instruction);
|
|
79770
80244
|
const address2 = {
|
|
79771
80245
|
kind: "block",
|
|
79772
80246
|
nodeType: "tableOfContents",
|
|
79773
80247
|
nodeId: resolved.nodeId
|
|
79774
80248
|
};
|
|
79775
80249
|
const handle2 = buildResolvedHandle(resolved.nodeId, "stable", "tableOfContents");
|
|
80250
|
+
const rightAlign = resolved.node.attrs?.rightAlignPageNumbers;
|
|
79776
80251
|
const domain2 = {
|
|
79777
80252
|
address: address2,
|
|
79778
80253
|
instruction,
|
|
79779
|
-
sourceConfig:
|
|
79780
|
-
displayConfig:
|
|
79781
|
-
|
|
80254
|
+
sourceConfig: config33.source,
|
|
80255
|
+
displayConfig: {
|
|
80256
|
+
...config33.display,
|
|
80257
|
+
...rightAlign !== undefined && { rightAlignPageNumbers: rightAlign }
|
|
80258
|
+
},
|
|
80259
|
+
preserved: config33.preserved,
|
|
79782
80260
|
entryCount: resolved.node.childCount
|
|
79783
80261
|
};
|
|
79784
80262
|
const id2 = `toc:${resolved.nodeId}:${evaluatedRevision}`;
|
|
@@ -79790,11 +80268,99 @@ var init_toc_resolver = __esm(() => {
|
|
|
79790
80268
|
init_errors3();
|
|
79791
80269
|
});
|
|
79792
80270
|
|
|
80271
|
+
// ../../packages/super-editor/src/core/super-converter/field-references/shared/tc-switches.ts
|
|
80272
|
+
function extractEntryText(instruction) {
|
|
80273
|
+
const tcPrefix = /^TC\s+/i;
|
|
80274
|
+
const withoutPrefix = instruction.replace(tcPrefix, "");
|
|
80275
|
+
const quoteMatch = withoutPrefix.match(/^"([^"]*)"/);
|
|
80276
|
+
if (quoteMatch) {
|
|
80277
|
+
const text5 = quoteMatch[1];
|
|
80278
|
+
const rest = withoutPrefix.slice(quoteMatch[0].length);
|
|
80279
|
+
return { text: text5, rest };
|
|
80280
|
+
}
|
|
80281
|
+
const switchStart = withoutPrefix.indexOf("\\");
|
|
80282
|
+
if (switchStart === -1) {
|
|
80283
|
+
return { text: withoutPrefix.trim(), rest: "" };
|
|
80284
|
+
}
|
|
80285
|
+
return { text: withoutPrefix.slice(0, switchStart).trim(), rest: withoutPrefix.slice(switchStart) };
|
|
80286
|
+
}
|
|
80287
|
+
function parseTcInstruction(instruction) {
|
|
80288
|
+
const { text: text5, rest } = extractEntryText(instruction);
|
|
80289
|
+
let level = DEFAULT_LEVEL;
|
|
80290
|
+
let tableIdentifier;
|
|
80291
|
+
let omitPageNumber = false;
|
|
80292
|
+
const rawExtensions = [];
|
|
80293
|
+
let match;
|
|
80294
|
+
SWITCH_PATTERN2.lastIndex = 0;
|
|
80295
|
+
while ((match = SWITCH_PATTERN2.exec(rest)) !== null) {
|
|
80296
|
+
const switchChar = match[1].toLowerCase();
|
|
80297
|
+
const arg = match[2] ?? match[3] ?? "";
|
|
80298
|
+
switch (switchChar) {
|
|
80299
|
+
case "f":
|
|
80300
|
+
if (arg)
|
|
80301
|
+
tableIdentifier = arg;
|
|
80302
|
+
break;
|
|
80303
|
+
case "l": {
|
|
80304
|
+
const parsed = parseInt(arg, 10);
|
|
80305
|
+
if (!isNaN(parsed) && parsed >= 1)
|
|
80306
|
+
level = parsed;
|
|
80307
|
+
break;
|
|
80308
|
+
}
|
|
80309
|
+
case "n":
|
|
80310
|
+
omitPageNumber = true;
|
|
80311
|
+
break;
|
|
80312
|
+
default:
|
|
80313
|
+
rawExtensions.push(arg ? `\\${switchChar} "${arg}"` : `\\${switchChar}`);
|
|
80314
|
+
break;
|
|
80315
|
+
}
|
|
80316
|
+
}
|
|
80317
|
+
const config33 = { text: text5, level, omitPageNumber };
|
|
80318
|
+
if (tableIdentifier !== undefined)
|
|
80319
|
+
config33.tableIdentifier = tableIdentifier;
|
|
80320
|
+
if (rawExtensions.length > 0)
|
|
80321
|
+
config33.rawExtensions = rawExtensions;
|
|
80322
|
+
return config33;
|
|
80323
|
+
}
|
|
80324
|
+
function serializeTcInstruction(config33) {
|
|
80325
|
+
const parts = [`TC "${config33.text}"`];
|
|
80326
|
+
if (config33.tableIdentifier) {
|
|
80327
|
+
parts.push(`\\f "${config33.tableIdentifier}"`);
|
|
80328
|
+
}
|
|
80329
|
+
if (config33.level !== DEFAULT_LEVEL) {
|
|
80330
|
+
parts.push(`\\l "${config33.level}"`);
|
|
80331
|
+
}
|
|
80332
|
+
if (config33.omitPageNumber) {
|
|
80333
|
+
parts.push("\\n");
|
|
80334
|
+
}
|
|
80335
|
+
if (config33.rawExtensions?.length) {
|
|
80336
|
+
parts.push(...config33.rawExtensions);
|
|
80337
|
+
}
|
|
80338
|
+
return parts.join(" ");
|
|
80339
|
+
}
|
|
80340
|
+
function applyTcPatch(existing, patch) {
|
|
80341
|
+
return {
|
|
80342
|
+
text: patch.text ?? existing.text,
|
|
80343
|
+
level: patch.level ?? existing.level,
|
|
80344
|
+
omitPageNumber: patch.omitPageNumber ?? existing.omitPageNumber,
|
|
80345
|
+
tableIdentifier: patch.tableIdentifier ?? existing.tableIdentifier,
|
|
80346
|
+
rawExtensions: existing.rawExtensions
|
|
80347
|
+
};
|
|
80348
|
+
}
|
|
80349
|
+
function areTcConfigsEqual(a, b) {
|
|
80350
|
+
return serializeTcInstruction(a) === serializeTcInstruction(b);
|
|
80351
|
+
}
|
|
80352
|
+
var DEFAULT_LEVEL = 1, SWITCH_PATTERN2;
|
|
80353
|
+
var init_tc_switches = __esm(() => {
|
|
80354
|
+
SWITCH_PATTERN2 = /\\([a-z])(?:\s*(?:"([^"]*)"|([^\s\\]+)))?/gi;
|
|
80355
|
+
});
|
|
80356
|
+
|
|
79793
80357
|
// ../../packages/super-editor/src/document-api-adapters/helpers/toc-entry-builder.ts
|
|
79794
|
-
function
|
|
80358
|
+
function collectTocSources(doc, config33) {
|
|
79795
80359
|
const sources = [];
|
|
79796
|
-
const { outlineLevels } =
|
|
79797
|
-
const useApplied =
|
|
80360
|
+
const { outlineLevels, useAppliedOutlineLevel, tcFieldIdentifier, tcFieldLevels } = config33.source;
|
|
80361
|
+
const useApplied = useAppliedOutlineLevel ?? false;
|
|
80362
|
+
const collectTcFields = tcFieldIdentifier !== undefined || tcFieldLevels !== undefined;
|
|
80363
|
+
let currentParagraphSdBlockId;
|
|
79798
80364
|
doc.descendants((node3, _pos) => {
|
|
79799
80365
|
if (node3.type.name === "tableOfContents")
|
|
79800
80366
|
return false;
|
|
@@ -79803,13 +80369,14 @@ function collectHeadingSources(doc, config32) {
|
|
|
79803
80369
|
const paragraphProps = attrs?.paragraphProperties;
|
|
79804
80370
|
const styleId = paragraphProps?.styleId;
|
|
79805
80371
|
const sdBlockId = attrs?.sdBlockId ?? attrs?.paraId;
|
|
80372
|
+
currentParagraphSdBlockId = sdBlockId;
|
|
79806
80373
|
if (!sdBlockId)
|
|
79807
80374
|
return true;
|
|
79808
|
-
|
|
79809
|
-
|
|
79810
|
-
if (headingLevel >= outlineLevels.from && headingLevel <= outlineLevels.to) {
|
|
79811
|
-
sources.push({ text: flattenText(node3), level: headingLevel, sdBlockId });
|
|
79812
|
-
return
|
|
80375
|
+
if (outlineLevels) {
|
|
80376
|
+
const headingLevel = getHeadingLevel(styleId);
|
|
80377
|
+
if (headingLevel != null && headingLevel >= outlineLevels.from && headingLevel <= outlineLevels.to) {
|
|
80378
|
+
sources.push({ text: flattenText(node3), level: headingLevel, sdBlockId, kind: "heading" });
|
|
80379
|
+
return true;
|
|
79813
80380
|
}
|
|
79814
80381
|
}
|
|
79815
80382
|
if (useApplied && outlineLevels) {
|
|
@@ -79817,11 +80384,32 @@ function collectHeadingSources(doc, config32) {
|
|
|
79817
80384
|
if (rawOutlineLevel != null) {
|
|
79818
80385
|
const tocLevel = rawOutlineLevel + 1;
|
|
79819
80386
|
if (tocLevel >= outlineLevels.from && tocLevel <= outlineLevels.to) {
|
|
79820
|
-
sources.push({ text: flattenText(node3), level: tocLevel, sdBlockId });
|
|
79821
|
-
return
|
|
80387
|
+
sources.push({ text: flattenText(node3), level: tocLevel, sdBlockId, kind: "appliedOutline" });
|
|
80388
|
+
return true;
|
|
79822
80389
|
}
|
|
79823
80390
|
}
|
|
79824
80391
|
}
|
|
80392
|
+
return true;
|
|
80393
|
+
}
|
|
80394
|
+
if (collectTcFields && node3.type.name === "tableOfContentsEntry" && currentParagraphSdBlockId) {
|
|
80395
|
+
const instruction = node3.attrs?.instruction ?? "";
|
|
80396
|
+
const tcConfig = parseTcInstruction(instruction);
|
|
80397
|
+
if (tcFieldIdentifier && tcConfig.tableIdentifier !== tcFieldIdentifier) {
|
|
80398
|
+
return false;
|
|
80399
|
+
}
|
|
80400
|
+
if (tcFieldLevels) {
|
|
80401
|
+
if (tcConfig.level < tcFieldLevels.from || tcConfig.level > tcFieldLevels.to) {
|
|
80402
|
+
return false;
|
|
80403
|
+
}
|
|
80404
|
+
}
|
|
80405
|
+
sources.push({
|
|
80406
|
+
text: tcConfig.text,
|
|
80407
|
+
level: tcConfig.level,
|
|
80408
|
+
sdBlockId: currentParagraphSdBlockId,
|
|
80409
|
+
kind: "tcField",
|
|
80410
|
+
omitPageNumber: tcConfig.omitPageNumber || undefined
|
|
80411
|
+
});
|
|
80412
|
+
return false;
|
|
79825
80413
|
}
|
|
79826
80414
|
return true;
|
|
79827
80415
|
});
|
|
@@ -79836,11 +80424,11 @@ function flattenText(node3) {
|
|
|
79836
80424
|
});
|
|
79837
80425
|
return text5;
|
|
79838
80426
|
}
|
|
79839
|
-
function buildTocEntryParagraphs(sources,
|
|
79840
|
-
return sources.map((source) => buildEntryParagraph(source,
|
|
80427
|
+
function buildTocEntryParagraphs(sources, config33) {
|
|
80428
|
+
return sources.map((source) => buildEntryParagraph(source, config33));
|
|
79841
80429
|
}
|
|
79842
|
-
function buildEntryParagraph(source,
|
|
79843
|
-
const { display } =
|
|
80430
|
+
function buildEntryParagraph(source, config33) {
|
|
80431
|
+
const { display } = config33;
|
|
79844
80432
|
const content3 = [];
|
|
79845
80433
|
const textNode = {
|
|
79846
80434
|
type: "text",
|
|
@@ -79860,31 +80448,64 @@ function buildEntryParagraph(source, config32) {
|
|
|
79860
80448
|
}
|
|
79861
80449
|
content3.push(textNode);
|
|
79862
80450
|
const omitRange = display.omitPageNumberLevels;
|
|
79863
|
-
const
|
|
80451
|
+
const levelOmitted = omitRange && source.level >= omitRange.from && source.level <= omitRange.to;
|
|
80452
|
+
const entryOmitted = source.omitPageNumber;
|
|
80453
|
+
const omitPageNumber = levelOmitted || entryOmitted;
|
|
79864
80454
|
if (!omitPageNumber) {
|
|
79865
80455
|
if (display.separator) {
|
|
79866
80456
|
content3.push({ type: "text", text: display.separator });
|
|
79867
80457
|
} else {
|
|
79868
80458
|
content3.push({ type: "tab" });
|
|
79869
80459
|
}
|
|
79870
|
-
content3.push({
|
|
80460
|
+
content3.push({
|
|
80461
|
+
type: "text",
|
|
80462
|
+
text: "0",
|
|
80463
|
+
marks: [{ type: "tocPageNumber" }]
|
|
80464
|
+
});
|
|
80465
|
+
}
|
|
80466
|
+
const paragraphProperties = {
|
|
80467
|
+
styleId: `TOC${source.level}`
|
|
80468
|
+
};
|
|
80469
|
+
const rightAlign = display.rightAlignPageNumbers !== false;
|
|
80470
|
+
if (rightAlign && !omitPageNumber) {
|
|
80471
|
+
const leader = display.tabLeader && display.tabLeader !== "none" ? TAB_LEADER_MAP[display.tabLeader] ?? undefined : undefined;
|
|
80472
|
+
paragraphProperties.tabStops = [
|
|
80473
|
+
{ tab: { tabType: "right", pos: DEFAULT_RIGHT_TAB_POS, ...leader ? { leader } : {} } }
|
|
80474
|
+
];
|
|
79871
80475
|
}
|
|
79872
80476
|
return {
|
|
79873
80477
|
type: "paragraph",
|
|
79874
80478
|
attrs: {
|
|
79875
|
-
paragraphProperties
|
|
79876
|
-
|
|
79877
|
-
|
|
79878
|
-
sdBlockId: undefined
|
|
80479
|
+
paragraphProperties,
|
|
80480
|
+
sdBlockId: undefined,
|
|
80481
|
+
tocSourceId: source.sdBlockId
|
|
79879
80482
|
},
|
|
79880
80483
|
content: content3
|
|
79881
80484
|
};
|
|
79882
80485
|
}
|
|
80486
|
+
var DEFAULT_RIGHT_TAB_POS = 9350, TAB_LEADER_MAP;
|
|
79883
80487
|
var init_toc_entry_builder = __esm(() => {
|
|
80488
|
+
init_tc_switches();
|
|
79884
80489
|
init_node_address_resolver();
|
|
80490
|
+
TAB_LEADER_MAP = {
|
|
80491
|
+
dot: "dot",
|
|
80492
|
+
hyphen: "hyphen",
|
|
80493
|
+
underscore: "heavy",
|
|
80494
|
+
middleDot: "middleDot"
|
|
80495
|
+
};
|
|
79885
80496
|
});
|
|
79886
80497
|
|
|
79887
80498
|
// ../../packages/super-editor/src/document-api-adapters/plan-engine/toc-wrappers.ts
|
|
80499
|
+
function applyTocPatchTyped(...args2) {
|
|
80500
|
+
try {
|
|
80501
|
+
return applyTocPatch(...args2);
|
|
80502
|
+
} catch (err) {
|
|
80503
|
+
if (err instanceof Error && err.message.startsWith("INVALID_INPUT:")) {
|
|
80504
|
+
throw new DocumentApiValidationError("INVALID_INPUT", err.message.slice("INVALID_INPUT: ".length));
|
|
80505
|
+
}
|
|
80506
|
+
throw err;
|
|
80507
|
+
}
|
|
80508
|
+
}
|
|
79888
80509
|
function tocListWrapper(editor, query2) {
|
|
79889
80510
|
const doc = editor.state.doc;
|
|
79890
80511
|
const revision = getRevision(editor);
|
|
@@ -79957,9 +80578,14 @@ function isTocContentUnchanged(existingNode, newContent) {
|
|
|
79957
80578
|
});
|
|
79958
80579
|
return JSON.stringify(existingEntries) === JSON.stringify(normalized);
|
|
79959
80580
|
}
|
|
79960
|
-
function
|
|
79961
|
-
|
|
79962
|
-
|
|
80581
|
+
function withRightAlign(config33, rightAlignPageNumbers) {
|
|
80582
|
+
if (rightAlignPageNumbers === undefined)
|
|
80583
|
+
return config33;
|
|
80584
|
+
return { ...config33, display: { ...config33.display, rightAlignPageNumbers } };
|
|
80585
|
+
}
|
|
80586
|
+
function materializeTocContent(doc, config33) {
|
|
80587
|
+
const sources = collectTocSources(doc, config33);
|
|
80588
|
+
const entryParagraphs = buildTocEntryParagraphs(sources, config33);
|
|
79963
80589
|
return entryParagraphs.length > 0 ? entryParagraphs : NO_ENTRIES_PLACEHOLDER;
|
|
79964
80590
|
}
|
|
79965
80591
|
function tocConfigureWrapper(editor, input, options) {
|
|
@@ -79967,9 +80593,11 @@ function tocConfigureWrapper(editor, input, options) {
|
|
|
79967
80593
|
const command = requireEditorCommand(editor.commands?.setTableOfContentsInstructionById, "toc.configure");
|
|
79968
80594
|
const resolved = resolveTocTarget(editor.state.doc, input.target);
|
|
79969
80595
|
const currentConfig = parseTocInstruction(resolved.node.attrs?.instruction ?? "");
|
|
79970
|
-
const patched =
|
|
79971
|
-
const
|
|
79972
|
-
|
|
80596
|
+
const patched = applyTocPatchTyped(currentConfig, input.patch);
|
|
80597
|
+
const rightAlignChanged = input.patch.rightAlignPageNumbers !== undefined && input.patch.rightAlignPageNumbers !== resolved.node.attrs?.rightAlignPageNumbers;
|
|
80598
|
+
const effectiveRightAlign = input.patch.rightAlignPageNumbers ?? resolved.node.attrs?.rightAlignPageNumbers;
|
|
80599
|
+
const nextContent = materializeTocContent(editor.state.doc, withRightAlign(patched, effectiveRightAlign));
|
|
80600
|
+
if (areTocConfigsEqual(currentConfig, patched) && !rightAlignChanged) {
|
|
79973
80601
|
return tocFailure("NO_OP", "Configuration patch produced no change.");
|
|
79974
80602
|
}
|
|
79975
80603
|
if (options?.dryRun) {
|
|
@@ -79980,7 +80608,8 @@ function tocConfigureWrapper(editor, input, options) {
|
|
|
79980
80608
|
const receipt2 = runTocCommand(editor, command, {
|
|
79981
80609
|
sdBlockId: commandNodeId,
|
|
79982
80610
|
instruction: serializeTocInstruction(patched),
|
|
79983
|
-
...shouldRefreshContent ? { content: nextContent } : {}
|
|
80611
|
+
...shouldRefreshContent ? { content: nextContent } : {},
|
|
80612
|
+
...rightAlignChanged ? { rightAlignPageNumbers: input.patch.rightAlignPageNumbers } : {}
|
|
79984
80613
|
}, options?.expectedRevision);
|
|
79985
80614
|
if (!receiptApplied(receipt2)) {
|
|
79986
80615
|
return tocFailure("NO_OP", "Configuration change could not be applied.");
|
|
@@ -79990,10 +80619,18 @@ function tocConfigureWrapper(editor, input, options) {
|
|
|
79990
80619
|
}
|
|
79991
80620
|
function tocUpdateWrapper(editor, input, options) {
|
|
79992
80621
|
rejectTrackedMode("toc.update", options);
|
|
80622
|
+
const mode = input.mode ?? "all";
|
|
80623
|
+
if (mode === "pageNumbers") {
|
|
80624
|
+
return tocUpdatePageNumbers(editor, input, options);
|
|
80625
|
+
}
|
|
80626
|
+
return tocUpdateAll(editor, input, options);
|
|
80627
|
+
}
|
|
80628
|
+
function tocUpdateAll(editor, input, options) {
|
|
79993
80629
|
const command = requireEditorCommand(editor.commands?.replaceTableOfContentsContentById, "toc.update");
|
|
79994
80630
|
const resolved = resolveTocTarget(editor.state.doc, input.target);
|
|
79995
|
-
const
|
|
79996
|
-
const
|
|
80631
|
+
const config33 = parseTocInstruction(resolved.node.attrs?.instruction ?? "");
|
|
80632
|
+
const rightAlign = resolved.node.attrs?.rightAlignPageNumbers;
|
|
80633
|
+
const content3 = materializeTocContent(editor.state.doc, withRightAlign(config33, rightAlign));
|
|
79997
80634
|
if (isTocContentUnchanged(resolved.node, content3)) {
|
|
79998
80635
|
return tocFailure("NO_OP", "TOC update produced no change.");
|
|
79999
80636
|
}
|
|
@@ -80006,6 +80643,83 @@ function tocUpdateWrapper(editor, input, options) {
|
|
|
80006
80643
|
}, options?.expectedRevision);
|
|
80007
80644
|
return receiptApplied(receipt2) ? tocSuccess(resolved.nodeId) : tocFailure("NO_OP", "TOC update produced no change.");
|
|
80008
80645
|
}
|
|
80646
|
+
function getPageMap(editor) {
|
|
80647
|
+
const storage = editor.storage;
|
|
80648
|
+
if (!storage)
|
|
80649
|
+
return null;
|
|
80650
|
+
const tocStorage = storage.tableOfContents;
|
|
80651
|
+
if (!tocStorage?.pageMap)
|
|
80652
|
+
return null;
|
|
80653
|
+
if (tocStorage.pageMapDoc !== undefined && tocStorage.pageMapDoc !== editor.state.doc) {
|
|
80654
|
+
return null;
|
|
80655
|
+
}
|
|
80656
|
+
return tocStorage.pageMap;
|
|
80657
|
+
}
|
|
80658
|
+
function tocUpdatePageNumbers(editor, input, options) {
|
|
80659
|
+
const command = requireEditorCommand(editor.commands?.replaceTableOfContentsContentById, "toc.update");
|
|
80660
|
+
const resolved = resolveTocTarget(editor.state.doc, input.target);
|
|
80661
|
+
const config33 = parseTocInstruction(resolved.node.attrs?.instruction ?? "");
|
|
80662
|
+
if (deriveIncludePageNumbers(config33.display.omitPageNumberLevels, config33.source.outlineLevels) === false) {
|
|
80663
|
+
return tocFailure("NO_OP", "TOC configuration excludes page numbers. Nothing to update.");
|
|
80664
|
+
}
|
|
80665
|
+
const pageMap = getPageMap(editor);
|
|
80666
|
+
if (!pageMap) {
|
|
80667
|
+
return tocFailure("CAPABILITY_UNAVAILABLE", 'Page number resolution requires a completed layout. Trigger a render cycle and retry, or use mode "all".');
|
|
80668
|
+
}
|
|
80669
|
+
const { updatedContent, hasPageNumberMarks, anyChanged } = buildPageNumberUpdatedContent(resolved.node, pageMap);
|
|
80670
|
+
if (!hasPageNumberMarks) {
|
|
80671
|
+
return tocFailure("PAGE_NUMBERS_NOT_MATERIALIZED", 'TOC entries do not contain tagged page number runs. Run toc.update with mode "all" first.');
|
|
80672
|
+
}
|
|
80673
|
+
if (!anyChanged) {
|
|
80674
|
+
return tocFailure("NO_OP", "Page numbers are already up to date.");
|
|
80675
|
+
}
|
|
80676
|
+
if (options?.dryRun) {
|
|
80677
|
+
return tocSuccess(resolved.nodeId);
|
|
80678
|
+
}
|
|
80679
|
+
const receipt2 = runTocCommand(editor, command, {
|
|
80680
|
+
sdBlockId: resolved.commandNodeId ?? resolved.nodeId,
|
|
80681
|
+
content: updatedContent
|
|
80682
|
+
}, options?.expectedRevision);
|
|
80683
|
+
return receiptApplied(receipt2) ? tocSuccess(resolved.nodeId) : tocFailure("NO_OP", "Page number update produced no change.");
|
|
80684
|
+
}
|
|
80685
|
+
function buildPageNumberUpdatedContent(tocNode, pageMap) {
|
|
80686
|
+
const updatedContent = [];
|
|
80687
|
+
let hasPageNumberMarks = false;
|
|
80688
|
+
let anyChanged = false;
|
|
80689
|
+
tocNode.forEach((child) => {
|
|
80690
|
+
if (child.type.name !== "paragraph") {
|
|
80691
|
+
updatedContent.push(child.toJSON());
|
|
80692
|
+
return;
|
|
80693
|
+
}
|
|
80694
|
+
const tocSourceId = child.attrs?.tocSourceId;
|
|
80695
|
+
const childJson = child.toJSON();
|
|
80696
|
+
const content3 = childJson.content ?? [];
|
|
80697
|
+
let paragraphChanged = false;
|
|
80698
|
+
const updatedContentArray = content3.map((node3) => {
|
|
80699
|
+
const marks = node3.marks;
|
|
80700
|
+
const hasTocPageNumberMark = marks?.some((m) => m.type === "tocPageNumber");
|
|
80701
|
+
if (!hasTocPageNumberMark)
|
|
80702
|
+
return node3;
|
|
80703
|
+
hasPageNumberMarks = true;
|
|
80704
|
+
if (!tocSourceId)
|
|
80705
|
+
return node3;
|
|
80706
|
+
const pageNumber = pageMap.get(tocSourceId);
|
|
80707
|
+
const newText = pageNumber !== undefined ? String(pageNumber) : "??";
|
|
80708
|
+
if (node3.text !== newText) {
|
|
80709
|
+
paragraphChanged = true;
|
|
80710
|
+
return { ...node3, text: newText };
|
|
80711
|
+
}
|
|
80712
|
+
return node3;
|
|
80713
|
+
});
|
|
80714
|
+
if (paragraphChanged) {
|
|
80715
|
+
anyChanged = true;
|
|
80716
|
+
updatedContent.push({ ...childJson, content: updatedContentArray });
|
|
80717
|
+
} else {
|
|
80718
|
+
updatedContent.push(childJson);
|
|
80719
|
+
}
|
|
80720
|
+
});
|
|
80721
|
+
return { updatedContent, hasPageNumberMarks, anyChanged };
|
|
80722
|
+
}
|
|
80009
80723
|
function tocRemoveWrapper(editor, input, options) {
|
|
80010
80724
|
rejectTrackedMode("toc.remove", options);
|
|
80011
80725
|
const command = requireEditorCommand(editor.commands?.deleteTableOfContentsById, "toc.remove");
|
|
@@ -80030,9 +80744,9 @@ function createTableOfContentsWrapper(editor, input, options) {
|
|
|
80030
80744
|
} else {
|
|
80031
80745
|
pos = resolveBlockInsertionPos(editor, at.target.nodeId, at.kind);
|
|
80032
80746
|
}
|
|
80033
|
-
const
|
|
80034
|
-
const instruction = serializeTocInstruction(
|
|
80035
|
-
const content3 = materializeTocContent(editor.state.doc,
|
|
80747
|
+
const config33 = input.config ? applyTocPatchTyped(DEFAULT_TOC_CONFIG, input.config) : DEFAULT_TOC_CONFIG;
|
|
80748
|
+
const instruction = serializeTocInstruction(config33);
|
|
80749
|
+
const content3 = materializeTocContent(editor.state.doc, withRightAlign(config33, input.config?.rightAlignPageNumbers));
|
|
80036
80750
|
const sdBlockId = v4();
|
|
80037
80751
|
if (options?.dryRun) {
|
|
80038
80752
|
return { success: true, toc: buildTocAddress("(dry-run)") };
|
|
@@ -80041,7 +80755,8 @@ function createTableOfContentsWrapper(editor, input, options) {
|
|
|
80041
80755
|
pos,
|
|
80042
80756
|
instruction,
|
|
80043
80757
|
sdBlockId,
|
|
80044
|
-
content: content3
|
|
80758
|
+
content: content3,
|
|
80759
|
+
...input.config?.rightAlignPageNumbers !== undefined ? { rightAlignPageNumbers: input.config.rightAlignPageNumbers } : {}
|
|
80045
80760
|
}, options?.expectedRevision);
|
|
80046
80761
|
if (!receiptApplied(receipt2)) {
|
|
80047
80762
|
return {
|
|
@@ -80077,6 +80792,270 @@ var init_toc_wrappers = __esm(() => {
|
|
|
80077
80792
|
];
|
|
80078
80793
|
});
|
|
80079
80794
|
|
|
80795
|
+
// ../../packages/super-editor/src/document-api-adapters/helpers/toc-entry-node-id.ts
|
|
80796
|
+
function stableHash2(input) {
|
|
80797
|
+
let hash = 2166136261;
|
|
80798
|
+
for (let index2 = 0;index2 < input.length; index2 += 1) {
|
|
80799
|
+
hash ^= input.charCodeAt(index2);
|
|
80800
|
+
hash = Math.imul(hash, 16777619);
|
|
80801
|
+
}
|
|
80802
|
+
return (hash >>> 0).toString(16).padStart(8, "0");
|
|
80803
|
+
}
|
|
80804
|
+
function resolvePublicTcEntryNodeId(node3, pos) {
|
|
80805
|
+
const instruction = typeof node3.attrs?.instruction === "string" ? node3.attrs.instruction : "";
|
|
80806
|
+
return `tc-entry-${stableHash2(`${pos}:${instruction}`)}`;
|
|
80807
|
+
}
|
|
80808
|
+
|
|
80809
|
+
// ../../packages/super-editor/src/document-api-adapters/helpers/toc-entry-resolver.ts
|
|
80810
|
+
function findAllTcEntryNodes(doc) {
|
|
80811
|
+
const results = [];
|
|
80812
|
+
let currentParagraphSdBlockId;
|
|
80813
|
+
doc.descendants((node3, pos) => {
|
|
80814
|
+
if (node3.type.name === "tableOfContents")
|
|
80815
|
+
return false;
|
|
80816
|
+
if (node3.type.name === "paragraph") {
|
|
80817
|
+
const attrs = node3.attrs;
|
|
80818
|
+
currentParagraphSdBlockId = attrs?.sdBlockId ?? attrs?.paraId;
|
|
80819
|
+
return true;
|
|
80820
|
+
}
|
|
80821
|
+
if (node3.type.name === "tableOfContentsEntry") {
|
|
80822
|
+
const nodeId = resolvePublicTcEntryNodeId(node3, pos);
|
|
80823
|
+
results.push({ node: node3, pos, nodeId, containingParagraphSdBlockId: currentParagraphSdBlockId });
|
|
80824
|
+
return false;
|
|
80825
|
+
}
|
|
80826
|
+
return true;
|
|
80827
|
+
});
|
|
80828
|
+
return results;
|
|
80829
|
+
}
|
|
80830
|
+
function resolveTcEntryTarget(doc, target) {
|
|
80831
|
+
const all3 = findAllTcEntryNodes(doc);
|
|
80832
|
+
const found2 = all3.find((entry) => entry.nodeId === target.nodeId);
|
|
80833
|
+
if (!found2) {
|
|
80834
|
+
throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `Table of contents entry with nodeId "${target.nodeId}" not found.`);
|
|
80835
|
+
}
|
|
80836
|
+
return found2;
|
|
80837
|
+
}
|
|
80838
|
+
function findParagraphBySdBlockId(doc, sdBlockId, editor) {
|
|
80839
|
+
let found2;
|
|
80840
|
+
doc.descendants((node3, pos) => {
|
|
80841
|
+
if (found2)
|
|
80842
|
+
return false;
|
|
80843
|
+
if (node3.type.name === "tableOfContents")
|
|
80844
|
+
return false;
|
|
80845
|
+
if (node3.type.name === "paragraph") {
|
|
80846
|
+
const attrs = node3.attrs;
|
|
80847
|
+
const nodeId = attrs?.sdBlockId ?? attrs?.paraId;
|
|
80848
|
+
if (nodeId === sdBlockId) {
|
|
80849
|
+
found2 = { node: node3, pos, sdBlockId };
|
|
80850
|
+
return false;
|
|
80851
|
+
}
|
|
80852
|
+
}
|
|
80853
|
+
return true;
|
|
80854
|
+
});
|
|
80855
|
+
if (!found2) {
|
|
80856
|
+
if (editor) {
|
|
80857
|
+
try {
|
|
80858
|
+
const block = findBlockByNodeIdOnly(buildBlockIndex(editor), sdBlockId);
|
|
80859
|
+
if (block.node.type.name === "paragraph") {
|
|
80860
|
+
return { node: block.node, pos: block.pos, sdBlockId };
|
|
80861
|
+
}
|
|
80862
|
+
} catch {}
|
|
80863
|
+
}
|
|
80864
|
+
throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `Paragraph with sdBlockId "${sdBlockId}" not found.`);
|
|
80865
|
+
}
|
|
80866
|
+
return found2;
|
|
80867
|
+
}
|
|
80868
|
+
function extractTcEntryInfo(resolved) {
|
|
80869
|
+
const instruction = resolved.node.attrs?.instruction ?? "";
|
|
80870
|
+
const config33 = parseTcInstruction(instruction);
|
|
80871
|
+
return {
|
|
80872
|
+
nodeType: "tableOfContentsEntry",
|
|
80873
|
+
kind: "inline",
|
|
80874
|
+
properties: {
|
|
80875
|
+
instruction,
|
|
80876
|
+
text: config33.text,
|
|
80877
|
+
level: config33.level,
|
|
80878
|
+
tableIdentifier: config33.tableIdentifier,
|
|
80879
|
+
omitPageNumber: config33.omitPageNumber
|
|
80880
|
+
}
|
|
80881
|
+
};
|
|
80882
|
+
}
|
|
80883
|
+
function buildTcEntryDiscoveryItem(resolved, evaluatedRevision) {
|
|
80884
|
+
const instruction = resolved.node.attrs?.instruction ?? "";
|
|
80885
|
+
const config33 = parseTcInstruction(instruction);
|
|
80886
|
+
const address2 = {
|
|
80887
|
+
kind: "inline",
|
|
80888
|
+
nodeType: "tableOfContentsEntry",
|
|
80889
|
+
nodeId: resolved.nodeId
|
|
80890
|
+
};
|
|
80891
|
+
const handle2 = buildResolvedHandle(resolved.nodeId, "ephemeral", "field");
|
|
80892
|
+
const domain2 = {
|
|
80893
|
+
address: address2,
|
|
80894
|
+
instruction,
|
|
80895
|
+
text: config33.text,
|
|
80896
|
+
level: config33.level,
|
|
80897
|
+
tableIdentifier: config33.tableIdentifier,
|
|
80898
|
+
omitPageNumber: config33.omitPageNumber
|
|
80899
|
+
};
|
|
80900
|
+
const id2 = `tc-entry:${resolved.nodeId}:${evaluatedRevision}`;
|
|
80901
|
+
return buildDiscoveryItem(id2, handle2, domain2);
|
|
80902
|
+
}
|
|
80903
|
+
var init_toc_entry_resolver = __esm(() => {
|
|
80904
|
+
init_src();
|
|
80905
|
+
init_tc_switches();
|
|
80906
|
+
init_errors3();
|
|
80907
|
+
init_node_address_resolver();
|
|
80908
|
+
});
|
|
80909
|
+
|
|
80910
|
+
// ../../packages/super-editor/src/document-api-adapters/plan-engine/toc-entry-wrappers.ts
|
|
80911
|
+
function validateTcLevel(level) {
|
|
80912
|
+
if (level === undefined)
|
|
80913
|
+
return;
|
|
80914
|
+
if (!Number.isInteger(level) || level < TC_LEVEL_MIN || level > TC_LEVEL_MAX) {
|
|
80915
|
+
throw new DocumentApiValidationError("INVALID_INPUT", `TC entry level must be an integer between ${TC_LEVEL_MIN} and ${TC_LEVEL_MAX}, got ${level}`, { level });
|
|
80916
|
+
}
|
|
80917
|
+
}
|
|
80918
|
+
function buildEntryAddress(nodeId) {
|
|
80919
|
+
return { kind: "inline", nodeType: "tableOfContentsEntry", nodeId };
|
|
80920
|
+
}
|
|
80921
|
+
function entrySuccess(nodeId) {
|
|
80922
|
+
return { success: true, entry: buildEntryAddress(nodeId) };
|
|
80923
|
+
}
|
|
80924
|
+
function entryFailure(code4, message) {
|
|
80925
|
+
return { success: false, failure: { code: code4, message } };
|
|
80926
|
+
}
|
|
80927
|
+
function toEntryEditorCommand(command) {
|
|
80928
|
+
return command;
|
|
80929
|
+
}
|
|
80930
|
+
function runEntryAction(editor, action, expectedRevision) {
|
|
80931
|
+
return executeDomainCommand(editor, () => {
|
|
80932
|
+
const result = action();
|
|
80933
|
+
if (result)
|
|
80934
|
+
clearIndexCache(editor);
|
|
80935
|
+
return result;
|
|
80936
|
+
}, { expectedRevision });
|
|
80937
|
+
}
|
|
80938
|
+
function runEntryCommand(editor, command, args2, expectedRevision) {
|
|
80939
|
+
const executeCommand = toEntryEditorCommand(command);
|
|
80940
|
+
return runEntryAction(editor, () => executeCommand(args2), expectedRevision);
|
|
80941
|
+
}
|
|
80942
|
+
function receiptApplied2(receipt2) {
|
|
80943
|
+
return receipt2.steps[0]?.effect === "changed";
|
|
80944
|
+
}
|
|
80945
|
+
function tocListEntriesWrapper(editor, query2) {
|
|
80946
|
+
const doc = editor.state.doc;
|
|
80947
|
+
const revision = getRevision(editor);
|
|
80948
|
+
const allEntries = findAllTcEntryNodes(doc);
|
|
80949
|
+
let filtered = allEntries;
|
|
80950
|
+
if (query2?.tableIdentifier !== undefined) {
|
|
80951
|
+
filtered = filtered.filter((entry) => {
|
|
80952
|
+
const config33 = parseTcInstruction(entry.node.attrs?.instruction ?? "");
|
|
80953
|
+
return config33.tableIdentifier === query2.tableIdentifier;
|
|
80954
|
+
});
|
|
80955
|
+
}
|
|
80956
|
+
if (query2?.levelRange) {
|
|
80957
|
+
const { from: from3, to } = query2.levelRange;
|
|
80958
|
+
filtered = filtered.filter((entry) => {
|
|
80959
|
+
const config33 = parseTcInstruction(entry.node.attrs?.instruction ?? "");
|
|
80960
|
+
return config33.level >= from3 && config33.level <= to;
|
|
80961
|
+
});
|
|
80962
|
+
}
|
|
80963
|
+
const allItems = filtered.map((entry) => buildTcEntryDiscoveryItem(entry, revision));
|
|
80964
|
+
const { total, items: paged } = paginate(allItems, query2?.offset, query2?.limit);
|
|
80965
|
+
const effectiveLimit = query2?.limit ?? total;
|
|
80966
|
+
return buildDiscoveryResult({
|
|
80967
|
+
evaluatedRevision: revision,
|
|
80968
|
+
total,
|
|
80969
|
+
items: paged,
|
|
80970
|
+
page: { limit: effectiveLimit, offset: query2?.offset ?? 0, returned: paged.length }
|
|
80971
|
+
});
|
|
80972
|
+
}
|
|
80973
|
+
function tocGetEntryWrapper(editor, input) {
|
|
80974
|
+
const resolved = resolveTcEntryTarget(editor.state.doc, input.target);
|
|
80975
|
+
return extractTcEntryInfo(resolved);
|
|
80976
|
+
}
|
|
80977
|
+
function tocMarkEntryWrapper(editor, input, options) {
|
|
80978
|
+
rejectTrackedMode("toc.markEntry", options);
|
|
80979
|
+
validateTcLevel(input.level);
|
|
80980
|
+
const command = requireEditorCommand(editor.commands?.insertTableOfContentsEntryAt, "toc.markEntry");
|
|
80981
|
+
const paragraph2 = findParagraphBySdBlockId(editor.state.doc, input.target.anchor.nodeId, editor);
|
|
80982
|
+
const instruction = serializeTcInstruction({
|
|
80983
|
+
text: input.text,
|
|
80984
|
+
level: input.level ?? 1,
|
|
80985
|
+
omitPageNumber: input.omitPageNumber ?? false,
|
|
80986
|
+
tableIdentifier: input.tableIdentifier
|
|
80987
|
+
});
|
|
80988
|
+
const insertionPosition = input.target.position ?? "end";
|
|
80989
|
+
const pos = insertionPosition === "start" ? paragraph2.pos + 1 : paragraph2.pos + paragraph2.node.nodeSize - 1;
|
|
80990
|
+
if (options?.dryRun) {
|
|
80991
|
+
return entrySuccess("(dry-run)");
|
|
80992
|
+
}
|
|
80993
|
+
const receipt2 = runEntryCommand(editor, command, { pos, instruction }, options?.expectedRevision);
|
|
80994
|
+
if (!receiptApplied2(receipt2)) {
|
|
80995
|
+
return entryFailure("INVALID_INSERTION_CONTEXT", "TC entry could not be inserted at the requested location.");
|
|
80996
|
+
}
|
|
80997
|
+
const postInsertionId = resolveInsertedEntryId(editor.state.doc, pos, instruction);
|
|
80998
|
+
return entrySuccess(postInsertionId);
|
|
80999
|
+
}
|
|
81000
|
+
function resolveInsertedEntryId(doc, insertPos, instruction) {
|
|
81001
|
+
const allEntries = findAllTcEntryNodes(doc);
|
|
81002
|
+
const matching = allEntries.filter((e) => e.node.attrs?.instruction === instruction);
|
|
81003
|
+
if (matching.length > 0) {
|
|
81004
|
+
matching.sort((a, b) => Math.abs(a.pos - insertPos) - Math.abs(b.pos - insertPos));
|
|
81005
|
+
return matching[0].nodeId;
|
|
81006
|
+
}
|
|
81007
|
+
const closest = allEntries.reduce((best, entry) => Math.abs(entry.pos - insertPos) < Math.abs(best.pos - insertPos) ? entry : best, allEntries[0]);
|
|
81008
|
+
return closest?.nodeId ?? `tc-entry-unknown`;
|
|
81009
|
+
}
|
|
81010
|
+
function tocUnmarkEntryWrapper(editor, input, options) {
|
|
81011
|
+
rejectTrackedMode("toc.unmarkEntry", options);
|
|
81012
|
+
const command = requireEditorCommand(editor.commands?.deleteTableOfContentsEntryAt, "toc.unmarkEntry");
|
|
81013
|
+
const resolved = resolveTcEntryTarget(editor.state.doc, input.target);
|
|
81014
|
+
if (options?.dryRun) {
|
|
81015
|
+
return entrySuccess(resolved.nodeId);
|
|
81016
|
+
}
|
|
81017
|
+
const receipt2 = runEntryCommand(editor, command, { pos: resolved.pos }, options?.expectedRevision);
|
|
81018
|
+
return receiptApplied2(receipt2) ? entrySuccess(resolved.nodeId) : entryFailure("NO_OP", "TC entry removal produced no change.");
|
|
81019
|
+
}
|
|
81020
|
+
function tocEditEntryWrapper(editor, input, options) {
|
|
81021
|
+
rejectTrackedMode("toc.editEntry", options);
|
|
81022
|
+
validateTcLevel(input.patch.level);
|
|
81023
|
+
const command = requireEditorCommand(editor.commands?.updateTableOfContentsEntryAt, "toc.editEntry");
|
|
81024
|
+
const resolved = resolveTcEntryTarget(editor.state.doc, input.target);
|
|
81025
|
+
const currentConfig = parseTcInstruction(resolved.node.attrs?.instruction ?? "");
|
|
81026
|
+
const patched = applyTcPatch(currentConfig, input.patch);
|
|
81027
|
+
if (areTcConfigsEqual(currentConfig, patched)) {
|
|
81028
|
+
return entryFailure("NO_OP", "Edit patch produced no change.");
|
|
81029
|
+
}
|
|
81030
|
+
if (options?.dryRun) {
|
|
81031
|
+
return entrySuccess(resolved.nodeId);
|
|
81032
|
+
}
|
|
81033
|
+
const receipt2 = runEntryCommand(editor, command, { pos: resolved.pos, instruction: serializeTcInstruction(patched) }, options?.expectedRevision);
|
|
81034
|
+
if (!receiptApplied2(receipt2)) {
|
|
81035
|
+
return entryFailure("NO_OP", "TC entry edit could not be applied.");
|
|
81036
|
+
}
|
|
81037
|
+
const postEditId = resolvePostEditEntryId(editor.state.doc, resolved.pos);
|
|
81038
|
+
return entrySuccess(postEditId);
|
|
81039
|
+
}
|
|
81040
|
+
function resolvePostEditEntryId(doc, originalPos) {
|
|
81041
|
+
const allEntries = findAllTcEntryNodes(doc);
|
|
81042
|
+
if (allEntries.length === 0)
|
|
81043
|
+
return `tc-entry-unknown`;
|
|
81044
|
+
const closest = allEntries.reduce((best, entry) => Math.abs(entry.pos - originalPos) < Math.abs(best.pos - originalPos) ? entry : best, allEntries[0]);
|
|
81045
|
+
return closest.nodeId;
|
|
81046
|
+
}
|
|
81047
|
+
var TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9;
|
|
81048
|
+
var init_toc_entry_wrappers = __esm(() => {
|
|
81049
|
+
init_src();
|
|
81050
|
+
init_tc_switches();
|
|
81051
|
+
init_toc_entry_resolver();
|
|
81052
|
+
init_adapter_utils();
|
|
81053
|
+
init_revision_tracker();
|
|
81054
|
+
init_plan_wrappers();
|
|
81055
|
+
init_mutation_helpers();
|
|
81056
|
+
init_index_cache();
|
|
81057
|
+
});
|
|
81058
|
+
|
|
80080
81059
|
// ../../packages/super-editor/src/document-api-adapters/assemble-adapters.ts
|
|
80081
81060
|
function assembleDocumentApiAdapters(editor) {
|
|
80082
81061
|
registerBuiltInExecutors();
|
|
@@ -80225,7 +81204,12 @@ function assembleDocumentApiAdapters(editor) {
|
|
|
80225
81204
|
get: (input) => tocGetWrapper(editor, input),
|
|
80226
81205
|
configure: (input, options) => tocConfigureWrapper(editor, input, options),
|
|
80227
81206
|
update: (input, options) => tocUpdateWrapper(editor, input, options),
|
|
80228
|
-
remove: (input, options) => tocRemoveWrapper(editor, input, options)
|
|
81207
|
+
remove: (input, options) => tocRemoveWrapper(editor, input, options),
|
|
81208
|
+
markEntry: (input, options) => tocMarkEntryWrapper(editor, input, options),
|
|
81209
|
+
unmarkEntry: (input, options) => tocUnmarkEntryWrapper(editor, input, options),
|
|
81210
|
+
listEntries: (query2) => tocListEntriesWrapper(editor, query2),
|
|
81211
|
+
getEntry: (input) => tocGetEntryWrapper(editor, input),
|
|
81212
|
+
editEntry: (input, options) => tocEditEntryWrapper(editor, input, options)
|
|
80229
81213
|
},
|
|
80230
81214
|
query: {
|
|
80231
81215
|
match: (input) => queryMatchAdapter(editor, input)
|
|
@@ -80261,6 +81245,7 @@ var init_assemble_adapters = __esm(() => {
|
|
|
80261
81245
|
init_tables_adapter();
|
|
80262
81246
|
init_history_adapter();
|
|
80263
81247
|
init_toc_wrappers();
|
|
81248
|
+
init_toc_entry_wrappers();
|
|
80264
81249
|
});
|
|
80265
81250
|
|
|
80266
81251
|
// ../../packages/super-editor/src/document-api-adapters/index.ts
|
|
@@ -83197,6 +84182,12 @@ function mapTocError(operationId, error, code4) {
|
|
|
83197
84182
|
if (code4 === "INVALID_TARGET") {
|
|
83198
84183
|
return new CliError("INVALID_ARGUMENT", message, { operationId, details });
|
|
83199
84184
|
}
|
|
84185
|
+
if (code4 === "INVALID_INPUT") {
|
|
84186
|
+
return new CliError("INVALID_INPUT", message, { operationId, details });
|
|
84187
|
+
}
|
|
84188
|
+
if (code4 === "CAPABILITY_UNAVAILABLE") {
|
|
84189
|
+
return new CliError("CAPABILITY_UNAVAILABLE", message, { operationId, details });
|
|
84190
|
+
}
|
|
83200
84191
|
if (code4 === "COMMAND_UNAVAILABLE") {
|
|
83201
84192
|
return new CliError("COMMAND_FAILED", message, { operationId, details });
|
|
83202
84193
|
}
|
|
@@ -83310,6 +84301,12 @@ function mapFailedReceipt(operationId, result) {
|
|
|
83310
84301
|
if (failureCode === "INVALID_TARGET") {
|
|
83311
84302
|
return new CliError("INVALID_ARGUMENT", failureMessage, { operationId, failure });
|
|
83312
84303
|
}
|
|
84304
|
+
if (failureCode === "PAGE_NUMBERS_NOT_MATERIALIZED") {
|
|
84305
|
+
return new CliError("PAGE_NUMBERS_NOT_MATERIALIZED", failureMessage, { operationId, failure });
|
|
84306
|
+
}
|
|
84307
|
+
if (failureCode === "CAPABILITY_UNAVAILABLE") {
|
|
84308
|
+
return new CliError("CAPABILITY_UNAVAILABLE", failureMessage, { operationId, failure });
|
|
84309
|
+
}
|
|
83313
84310
|
return new CliError("COMMAND_FAILED", failureMessage, { operationId, failure });
|
|
83314
84311
|
}
|
|
83315
84312
|
if (family === "tables") {
|