@superdoc-dev/mcp 0.3.0-next.19 → 0.3.0-next.20
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 +1284 -282
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -51837,7 +51837,7 @@ var init_remark_gfm_BhnWr3yf_es = __esm(() => {
|
|
|
51837
51837
|
emptyOptions2 = {};
|
|
51838
51838
|
});
|
|
51839
51839
|
|
|
51840
|
-
// ../../packages/superdoc/dist/chunks/SuperConverter-
|
|
51840
|
+
// ../../packages/superdoc/dist/chunks/SuperConverter-DklB-kc9.es.js
|
|
51841
51841
|
function getExtensionConfigField(extension$1, field, context = { name: "" }) {
|
|
51842
51842
|
const fieldValue = extension$1.config[field];
|
|
51843
51843
|
if (typeof fieldValue === "function")
|
|
@@ -58167,8 +58167,12 @@ function validateBookmarkTarget(target, operationName) {
|
|
|
58167
58167
|
const t = target;
|
|
58168
58168
|
if (t.kind !== "entity" || t.entityType !== "bookmark" || typeof t.name !== "string")
|
|
58169
58169
|
throw new DocumentApiValidationError("INVALID_TARGET", `${operationName} target must be a BookmarkAddress with kind 'entity', entityType 'bookmark', and a string name.`, { target });
|
|
58170
|
+
if (t.story !== undefined)
|
|
58171
|
+
validateStoryLocator(t.story, `${operationName}.target.story`);
|
|
58170
58172
|
}
|
|
58171
58173
|
function executeBookmarksList(adapter, query) {
|
|
58174
|
+
if (query?.in !== undefined)
|
|
58175
|
+
validateStoryLocator(query.in, "bookmarks.list.in");
|
|
58172
58176
|
return adapter.list(query);
|
|
58173
58177
|
}
|
|
58174
58178
|
function executeBookmarksGet(adapter, input) {
|
|
@@ -89751,7 +89755,7 @@ var isRegExp = (value) => {
|
|
|
89751
89755
|
tracked: false,
|
|
89752
89756
|
carrier: runAttributeCarrier(runPropertyKey ?? key),
|
|
89753
89757
|
schema
|
|
89754
|
-
}), INLINE_PROPERTY_REGISTRY, INLINE_PROPERTY_KEY_SET, INLINE_PROPERTY_BY_KEY, UNDERLINE_OBJECT_ALLOWED_KEYS, SHADING_ALLOWED_KEYS, BORDER_ALLOWED_KEYS, FIT_TEXT_ALLOWED_KEYS, LANG_ALLOWED_KEYS, RFONTS_ALLOWED_KEYS, EAST_ASIAN_LAYOUT_ALLOWED_KEYS, STYLISTIC_SET_ALLOWED_KEYS, VERT_ALIGN_VALUES, PROPERTY_VALIDATOR_MAP, NONE_FAILURES, NONE_THROWS, T_NOT_FOUND, T_NOT_FOUND_CAPABLE, T_PLAN_ENGINE, T_NOT_FOUND_COMMAND, T_IMAGE_COMMAND, T_CC_READ, T_CC_MUTATION, T_CC_TYPED, T_CC_TYPED_READ, T_CC_RAW, T_QUERY_MATCH, T_SECTION_CREATE, T_SECTION_READ, T_PARAGRAPH_MUTATION, T_SECTION_MUTATION, T_SECTION_SETTINGS_MUTATION, T_HEADER_FOOTER_MUTATION, T_STORY, T_REF_READ_LIST, T_REF_MUTATION, T_REF_MUTATION_REMOVE, T_REF_INSERT, T_PROTECTION_READ, T_PROTECTION_MUTATION, T_PERM_RANGE_READ, T_PERM_RANGE_MUTATION, FORMAT_INLINE_ALIAS_OPERATION_DEFINITIONS, OPERATION_DEFINITIONS, OPERATION_IDS, COMMAND_CATALOG, PARAGRAPH_ALIGNMENTS, TAB_STOP_ALIGNMENTS, TAB_STOP_LEADERS, BORDER_SIDES, CLEAR_BORDER_SIDES, LINE_RULES, PARAGRAPH_DIRECTIONS, ALIGNMENT_POLICIES, PARAGRAPH_BLOCK_TYPES, SET_STYLE_KEYS, CLEAR_STYLE_KEYS, RESET_DIRECT_FORMATTING_KEYS, SET_ALIGNMENT_KEYS, CLEAR_ALIGNMENT_KEYS, SET_INDENTATION_KEYS, CLEAR_INDENTATION_KEYS, SET_SPACING_KEYS, CLEAR_SPACING_KEYS, SET_KEEP_OPTIONS_KEYS, SET_OUTLINE_LEVEL_KEYS, SET_FLOW_OPTIONS_KEYS, SET_TAB_STOP_KEYS, CLEAR_TAB_STOP_KEYS, CLEAR_ALL_TAB_STOPS_KEYS, SET_BORDER_KEYS, CLEAR_BORDER_KEYS, SET_SHADING_KEYS, CLEAR_SHADING_KEYS, SET_DIRECTION_KEYS, CLEAR_DIRECTION_KEYS, ST_ON_OFF_ON_VALUES, ST_ON_OFF_OFF_VALUES, ST_UNDERLINE_VALUES, ST_UNDERLINE_VALUE_SET, ST_VERTICAL_ALIGN_RUN, ST_EM, ST_TEXT_ALIGNMENT, ST_TEXT_DIRECTION, ST_TEXTBOX_TIGHT_WRAP, ST_TEXT_TRANSFORM, ST_JUSTIFICATION, FONT_FAMILY_SCHEMA, COLOR_SCHEMA, SPACING_SCHEMA, INDENT_SCHEMA, UNDERLINE_SCHEMA, BORDER_PROPERTIES_SCHEMA, SHADING_SCHEMA, LANG_SCHEMA, EAST_ASIAN_LAYOUT_SCHEMA, FIT_TEXT_SCHEMA, NUMBERING_PROPERTIES_SCHEMA, FRAME_PR_SCHEMA, PARAGRAPH_BORDERS_SCHEMA, TAB_STOP_SCHEMA, PROPERTY_REGISTRY, ALLOWED_KEYS_BY_CHANNEL, PROPERTY_INDEX, EXCLUDED_KEYS, INPUT_ALLOWED_KEYS, TARGET_ALLOWED_KEYS, OPTIONS_ALLOWED_KEYS, VALID_CHANNELS, Z_ORDER_RELATIVE_HEIGHT_MAX = 4294967295, nodeTypeValues, blockNodeTypeValues, deletableBlockNodeTypeValues, inlineNodeTypeValues, rangeSchema, textAddressSchema, textTargetSchema, blockNodeAddressSchema, deletableBlockNodeAddressSchema, tableAddressSchema, tableRowAddressSchema, tableCellAddressSchema, tableOrCellAddressSchema, paragraphAddressSchema, headingAddressSchema, listItemAddressSchema, paragraphTargetSchema, sectionAddressSchema, nodeAddressSchema, commentAddressSchema, trackedChangeAddressSchema, entityAddressSchema, selectionTargetSchema, deleteBehaviorSchema, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchBlockSchema, storyLocatorSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, textSelectorSchema, nodeSelectorSchema, sdMutationResolutionSchema, sdMutationSuccessSchema, documentInfoCountsSchema, documentInfoOutlineItemSchema, documentInfoCapabilitiesSchema, documentStylesSchema, documentDefaultsSchema, listKindSchema, listInsertPositionSchema, sectionBreakTypeSchema, sectionOrientationSchema, sectionVerticalAlignSchema, sectionDirectionSchema, sectionHeaderFooterKindSchema, sectionHeaderFooterVariantSchema, sectionLineNumberRestartSchema, sectionPageNumberFormatSchema, sectionRangeDomainSchema, sectionPageMarginsSchema, sectionHeaderFooterMarginsSchema, sectionPageSetupSchema, sectionColumnsSchema, sectionLineNumberingSchema, sectionPageNumberingSchema, sectionHeaderFooterRefsSchema, sectionBorderSpecSchema, sectionPageBordersSchema, sectionMutationSuccessSchema, documentMutationSuccessSchema, paragraphMutationTargetSchema, paragraphMutationSuccessSchema, createSectionBreakSuccessSchema, trackChangeWordRevisionIdsSchema, capabilityReasonsSchema, capabilityFlagSchema, operationRuntimeCapabilitySchema, operationCapabilitiesSchema, inlinePropertyCapabilitySchema, formatCapabilitiesSchema, planEngineCapabilitiesSchema, nullableTableBorderSpecSchema, sdFragmentSchema, placementSchema, nestingPolicySchema, tableCreateLocationSchema, formatInlineAliasOperationSchemas, tocMutationFailureSchema, tocMutationSuccessSchema, tocEntryMutationFailureSchema, tocEntryMutationSuccessSchema, hyperlinkTargetSchema, hyperlinkReadPropertiesSchema, hyperlinkSpecSchema, hyperlinkPatchSchema, hyperlinkDomainSchema, hyperlinkMutationSuccessSchema, hyperlinkMutationFailureSchema, contentControlTargetSchema, contentControlMutationSuccessSchema, contentControlMutationFailureSchema, ccListResultSchema, ccInfoSchema, refFailureSchema, bookmarkAddressSchema, bookmarkMutation, footnoteAddressSchema, footnoteConfigScopeSchema, footnoteNumberingSchema, footnoteMutation, footnoteConfig, crossRefAddressSchema, crossRefTargetSchema, crossRefDisplaySchema, crossRefMutation, indexAddressSchema, indexEntryAddressSchema, indexConfigSchema, indexEntryDataSchema, indexEntryPatchSchema, indexMutation, indexEntryMutation, captionAddressSchema, captionMutation, captionConfig, fieldAddressSchema, fieldMutation, citationAddressSchema, citationSourceAddressSchema, bibliographyAddressSchema, citationMutation, citationSourceMutation, bibliographyMutation, citationPersonSchema, citationSourceFieldsSchema, tocCreateLocationSchema, authoritiesAddressSchema, authorityEntryAddressSchema, authoritiesConfigSchema, authorityEntryDataSchema, authorityEntryPatchSchema, authoritiesMutation, authorityEntryMutation, diffCoverageSchema, diffSummarySchema, diffSnapshotSchema, diffPayloadSchema, GROUP_METADATA, STEP_OP_CATALOG_UNFROZEN, PUBLIC_STEP_OP_CATALOG_UNFROZEN, PUBLIC_MUTATION_STEP_OP_IDS, PUBLIC_MUTATION_STEP_OP_SET, CAPABILITY_REASON_CODES, VALID_EDGE_VALUES, VALID_EDGE_NODE_TYPES, VALID_DOCUMENT_EDGES, VALID_REF_BOUNDARIES, VALID_ANCHOR_KINDS, RESOLVE_RANGE_ALLOWED_KEYS, SELECTION_CURRENT_ALLOWED_KEYS, CREATE_COMMENT_ALLOWED_KEYS, PATCH_COMMENT_ALLOWED_KEYS, STYLE_APPLY_INPUT_ALLOWED_KEYS, INLINE_ALIAS_INPUT_ALLOWED_KEYS, DELETE_INPUT_ALLOWED_KEYS, VALID_BEHAVIORS, CONTENT_KIND_SET, INLINE_KIND_SET, LEGACY_TOP_LEVEL_TYPES, TEXT_INSERT_ALLOWED_KEYS, STRUCTURAL_INSERT_ALLOWED_KEYS, VALID_INSERT_TYPES, LIST_KINDS, LIST_INSERT_POSITIONS, JOIN_DIRECTIONS, MUTATION_SCOPES, LEVEL_ALIGNMENTS, TRAILING_CHARACTERS, LIST_PRESET_IDS, VALID_BLOCK_NODE_TYPES$1, VALID_LIST_KINDS, VALID_INSERT_POSITIONS, VALID_JOIN_DIRECTIONS, VALID_MUTATION_SCOPES, VALID_LEVEL_ALIGNMENTS, VALID_TRAILING_CHARACTERS, VALID_LIST_PRESETS, VALID_CONTINUITY_VALUES, VALID_SEQUENCE_MODES, VALID_LIST_CREATE_MODES, TEXT_REPLACE_ALLOWED_KEYS, STRUCTURAL_REPLACE_ALLOWED_KEYS, VALID_HEADING_LEVELS, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES, REJECTED_DELETE_NODE_TYPES, VALID_BLOCK_NODE_TYPES, SNAPSHOT_VERSIONS, PAYLOAD_VERSIONS, VALID_STYLE_OPTION_FLAGS, TABLE_BORDER_COLOR_PATTERN, VALID_APPLY_TO_VALUES, VALID_BORDER_EDGE_KEYS, HEADER_FOOTER_KINDS$1, HEADER_FOOTER_VARIANTS$1, DEFAULT_SECTIONS_LIST_LIMIT = 250, SECTION_BREAK_TYPES, SECTION_ORIENTATIONS, SECTION_VERTICAL_ALIGNS, SECTION_DIRECTIONS, HEADER_FOOTER_KINDS, HEADER_FOOTER_VARIANTS, LINE_NUMBER_RESTARTS, PAGE_NUMBER_FORMATS, PAGE_BORDER_DISPLAYS, PAGE_BORDER_OFFSET_FROM_VALUES, PAGE_BORDER_Z_ORDER_VALUES, VALID_WRAP_TYPES, VALID_WRAP_SIDES, VALID_IMAGE_SIZE_UNITS, VALID_TOC_UPDATE_MODES, EDIT_ENTRY_PATCH_ALLOWED_KEYS, PATCH_FIELDS, CONTENT_CONTROL_TYPES, LOCK_MODES, CONTENT_CONTROL_APPEARANCES, VALID_NODE_KINDS, VALID_LOCK_MODES$1, VALID_CC_TYPES, VALID_CC_APPEARANCES, VALID_CONTENT_FORMATS, VALID_RAW_PATCH_OPS, VALID_SET_MODES, VALID_CREATE_LOCATION_KINDS, DEFAULT_PROTECTION_STATE, ADAPTER_GATED_PREFIXES, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$217) => ({
|
|
89758
|
+
}), INLINE_PROPERTY_REGISTRY, INLINE_PROPERTY_KEY_SET, INLINE_PROPERTY_BY_KEY, UNDERLINE_OBJECT_ALLOWED_KEYS, SHADING_ALLOWED_KEYS, BORDER_ALLOWED_KEYS, FIT_TEXT_ALLOWED_KEYS, LANG_ALLOWED_KEYS, RFONTS_ALLOWED_KEYS, EAST_ASIAN_LAYOUT_ALLOWED_KEYS, STYLISTIC_SET_ALLOWED_KEYS, VERT_ALIGN_VALUES, PROPERTY_VALIDATOR_MAP, NONE_FAILURES, NONE_THROWS, T_NOT_FOUND, T_NOT_FOUND_CAPABLE, T_PLAN_ENGINE, T_NOT_FOUND_COMMAND, T_IMAGE_COMMAND, T_CC_READ, T_CC_MUTATION, T_CC_TYPED, T_CC_TYPED_READ, T_CC_RAW, T_QUERY_MATCH, T_SECTION_CREATE, T_SECTION_READ, T_PARAGRAPH_MUTATION, T_SECTION_MUTATION, T_SECTION_SETTINGS_MUTATION, T_HEADER_FOOTER_MUTATION, T_STORY, T_REF_READ_LIST, T_REF_MUTATION, T_REF_MUTATION_REMOVE, T_REF_INSERT, T_PROTECTION_READ, T_PROTECTION_MUTATION, T_PERM_RANGE_READ, T_PERM_RANGE_MUTATION, FORMAT_INLINE_ALIAS_OPERATION_DEFINITIONS, OPERATION_DEFINITIONS, OPERATION_IDS, COMMAND_CATALOG, PARAGRAPH_ALIGNMENTS, TAB_STOP_ALIGNMENTS, TAB_STOP_LEADERS, BORDER_SIDES, CLEAR_BORDER_SIDES, LINE_RULES, PARAGRAPH_DIRECTIONS, ALIGNMENT_POLICIES, PARAGRAPH_BLOCK_TYPES, SET_STYLE_KEYS, CLEAR_STYLE_KEYS, RESET_DIRECT_FORMATTING_KEYS, SET_ALIGNMENT_KEYS, CLEAR_ALIGNMENT_KEYS, SET_INDENTATION_KEYS, CLEAR_INDENTATION_KEYS, SET_SPACING_KEYS, CLEAR_SPACING_KEYS, SET_KEEP_OPTIONS_KEYS, SET_OUTLINE_LEVEL_KEYS, SET_FLOW_OPTIONS_KEYS, SET_TAB_STOP_KEYS, CLEAR_TAB_STOP_KEYS, CLEAR_ALL_TAB_STOPS_KEYS, SET_BORDER_KEYS, CLEAR_BORDER_KEYS, SET_SHADING_KEYS, CLEAR_SHADING_KEYS, SET_DIRECTION_KEYS, CLEAR_DIRECTION_KEYS, ST_ON_OFF_ON_VALUES, ST_ON_OFF_OFF_VALUES, ST_UNDERLINE_VALUES, ST_UNDERLINE_VALUE_SET, ST_VERTICAL_ALIGN_RUN, ST_EM, ST_TEXT_ALIGNMENT, ST_TEXT_DIRECTION, ST_TEXTBOX_TIGHT_WRAP, ST_TEXT_TRANSFORM, ST_JUSTIFICATION, FONT_FAMILY_SCHEMA, COLOR_SCHEMA, SPACING_SCHEMA, INDENT_SCHEMA, UNDERLINE_SCHEMA, BORDER_PROPERTIES_SCHEMA, SHADING_SCHEMA, LANG_SCHEMA, EAST_ASIAN_LAYOUT_SCHEMA, FIT_TEXT_SCHEMA, NUMBERING_PROPERTIES_SCHEMA, FRAME_PR_SCHEMA, PARAGRAPH_BORDERS_SCHEMA, TAB_STOP_SCHEMA, PROPERTY_REGISTRY, ALLOWED_KEYS_BY_CHANNEL, PROPERTY_INDEX, EXCLUDED_KEYS, INPUT_ALLOWED_KEYS, TARGET_ALLOWED_KEYS, OPTIONS_ALLOWED_KEYS, VALID_CHANNELS, Z_ORDER_RELATIVE_HEIGHT_MAX = 4294967295, nodeTypeValues, blockNodeTypeValues, deletableBlockNodeTypeValues, inlineNodeTypeValues, rangeSchema, textAddressSchema, textTargetSchema, blockNodeAddressSchema, deletableBlockNodeAddressSchema, tableAddressSchema, tableRowAddressSchema, tableCellAddressSchema, tableOrCellAddressSchema, paragraphAddressSchema, headingAddressSchema, listItemAddressSchema, paragraphTargetSchema, sectionAddressSchema, nodeAddressSchema, commentAddressSchema, trackedChangeAddressSchema, entityAddressSchema, selectionTargetSchema, deleteBehaviorSchema, resolvedHandleSchema, pageInfoSchema, receiptSuccessSchema, textMutationRangeSchema, textMutationResolutionSchema, textMutationSuccessSchema, matchBlockSchema, storyLocatorSchema, trackChangeRefSchema, createParagraphSuccessSchema, createHeadingSuccessSchema, headingLevelSchema, listsInsertSuccessSchema, listsMutateItemSuccessSchema, textSelectorSchema, nodeSelectorSchema, sdMutationResolutionSchema, sdMutationSuccessSchema, documentInfoCountsSchema, documentInfoOutlineItemSchema, documentInfoCapabilitiesSchema, documentStylesSchema, documentDefaultsSchema, listKindSchema, listInsertPositionSchema, sectionBreakTypeSchema, sectionOrientationSchema, sectionVerticalAlignSchema, sectionDirectionSchema, sectionHeaderFooterKindSchema, sectionHeaderFooterVariantSchema, sectionLineNumberRestartSchema, sectionPageNumberFormatSchema, sectionRangeDomainSchema, sectionPageMarginsSchema, sectionHeaderFooterMarginsSchema, sectionPageSetupSchema, sectionColumnsSchema, sectionLineNumberingSchema, sectionPageNumberingSchema, sectionHeaderFooterRefsSchema, sectionBorderSpecSchema, sectionPageBordersSchema, sectionMutationSuccessSchema, documentMutationSuccessSchema, paragraphMutationTargetSchema, paragraphMutationSuccessSchema, createSectionBreakSuccessSchema, trackChangeWordRevisionIdsSchema, capabilityReasonsSchema, capabilityFlagSchema, operationRuntimeCapabilitySchema, operationCapabilitiesSchema, inlinePropertyCapabilitySchema, formatCapabilitiesSchema, planEngineCapabilitiesSchema, nullableTableBorderSpecSchema, sdFragmentSchema, placementSchema, nestingPolicySchema, tableCreateLocationSchema, formatInlineAliasOperationSchemas, tocMutationFailureSchema, tocMutationSuccessSchema, tocEntryMutationFailureSchema, tocEntryMutationSuccessSchema, hyperlinkTargetSchema, hyperlinkReadPropertiesSchema, hyperlinkSpecSchema, hyperlinkPatchSchema, hyperlinkDomainSchema, hyperlinkMutationSuccessSchema, hyperlinkMutationFailureSchema, contentControlTargetSchema, contentControlMutationSuccessSchema, contentControlMutationFailureSchema, ccListResultSchema, ccInfoSchema, refListQueryProperties, refFailureSchema, bookmarkAddressSchema, bookmarkMutation, footnoteAddressSchema, footnoteConfigScopeSchema, footnoteNumberingSchema, footnoteMutation, footnoteConfig, crossRefAddressSchema, crossRefTargetSchema, crossRefDisplaySchema, crossRefMutation, indexAddressSchema, indexEntryAddressSchema, indexConfigSchema, indexEntryDataSchema, indexEntryPatchSchema, indexMutation, indexEntryMutation, captionAddressSchema, captionMutation, captionConfig, fieldAddressSchema, fieldMutation, citationAddressSchema, citationSourceAddressSchema, bibliographyAddressSchema, citationMutation, citationSourceMutation, bibliographyMutation, citationPersonSchema, citationSourceFieldsSchema, tocCreateLocationSchema, authoritiesAddressSchema, authorityEntryAddressSchema, authoritiesConfigSchema, authorityEntryDataSchema, authorityEntryPatchSchema, authoritiesMutation, authorityEntryMutation, diffCoverageSchema, diffSummarySchema, diffSnapshotSchema, diffPayloadSchema, GROUP_METADATA, STEP_OP_CATALOG_UNFROZEN, PUBLIC_STEP_OP_CATALOG_UNFROZEN, PUBLIC_MUTATION_STEP_OP_IDS, PUBLIC_MUTATION_STEP_OP_SET, CAPABILITY_REASON_CODES, VALID_EDGE_VALUES, VALID_EDGE_NODE_TYPES, VALID_DOCUMENT_EDGES, VALID_REF_BOUNDARIES, VALID_ANCHOR_KINDS, RESOLVE_RANGE_ALLOWED_KEYS, SELECTION_CURRENT_ALLOWED_KEYS, CREATE_COMMENT_ALLOWED_KEYS, PATCH_COMMENT_ALLOWED_KEYS, STYLE_APPLY_INPUT_ALLOWED_KEYS, INLINE_ALIAS_INPUT_ALLOWED_KEYS, DELETE_INPUT_ALLOWED_KEYS, VALID_BEHAVIORS, CONTENT_KIND_SET, INLINE_KIND_SET, LEGACY_TOP_LEVEL_TYPES, TEXT_INSERT_ALLOWED_KEYS, STRUCTURAL_INSERT_ALLOWED_KEYS, VALID_INSERT_TYPES, LIST_KINDS, LIST_INSERT_POSITIONS, JOIN_DIRECTIONS, MUTATION_SCOPES, LEVEL_ALIGNMENTS, TRAILING_CHARACTERS, LIST_PRESET_IDS, VALID_BLOCK_NODE_TYPES$1, VALID_LIST_KINDS, VALID_INSERT_POSITIONS, VALID_JOIN_DIRECTIONS, VALID_MUTATION_SCOPES, VALID_LEVEL_ALIGNMENTS, VALID_TRAILING_CHARACTERS, VALID_LIST_PRESETS, VALID_CONTINUITY_VALUES, VALID_SEQUENCE_MODES, VALID_LIST_CREATE_MODES, TEXT_REPLACE_ALLOWED_KEYS, STRUCTURAL_REPLACE_ALLOWED_KEYS, VALID_HEADING_LEVELS, SECTION_BREAK_TYPES$1, SUPPORTED_DELETE_NODE_TYPES, REJECTED_DELETE_NODE_TYPES, VALID_BLOCK_NODE_TYPES, SNAPSHOT_VERSIONS, PAYLOAD_VERSIONS, VALID_STYLE_OPTION_FLAGS, TABLE_BORDER_COLOR_PATTERN, VALID_APPLY_TO_VALUES, VALID_BORDER_EDGE_KEYS, HEADER_FOOTER_KINDS$1, HEADER_FOOTER_VARIANTS$1, DEFAULT_SECTIONS_LIST_LIMIT = 250, SECTION_BREAK_TYPES, SECTION_ORIENTATIONS, SECTION_VERTICAL_ALIGNS, SECTION_DIRECTIONS, HEADER_FOOTER_KINDS, HEADER_FOOTER_VARIANTS, LINE_NUMBER_RESTARTS, PAGE_NUMBER_FORMATS, PAGE_BORDER_DISPLAYS, PAGE_BORDER_OFFSET_FROM_VALUES, PAGE_BORDER_Z_ORDER_VALUES, VALID_WRAP_TYPES, VALID_WRAP_SIDES, VALID_IMAGE_SIZE_UNITS, VALID_TOC_UPDATE_MODES, EDIT_ENTRY_PATCH_ALLOWED_KEYS, PATCH_FIELDS, CONTENT_CONTROL_TYPES, LOCK_MODES, CONTENT_CONTROL_APPEARANCES, VALID_NODE_KINDS, VALID_LOCK_MODES$1, VALID_CC_TYPES, VALID_CC_APPEARANCES, VALID_CONTENT_FORMATS, VALID_RAW_PATCH_OPS, VALID_SET_MODES, VALID_CREATE_LOCATION_KINDS, DEFAULT_PROTECTION_STATE, ADAPTER_GATED_PREFIXES, _buffers, _defaultCollectionId = null, _nextCollectionId = 1, generateV2HandlerEntity = (handlerName, translator$217) => ({
|
|
89755
89759
|
handlerName,
|
|
89756
89760
|
handler: (params) => {
|
|
89757
89761
|
const { nodes } = params;
|
|
@@ -104298,7 +104302,7 @@ var isRegExp = (value) => {
|
|
|
104298
104302
|
state.kern = kernNode.attributes["w:val"];
|
|
104299
104303
|
}
|
|
104300
104304
|
}, SuperConverter;
|
|
104301
|
-
var
|
|
104305
|
+
var init_SuperConverter_DklB_kc9_es = __esm(() => {
|
|
104302
104306
|
init_rolldown_runtime_Bg48TavK_es();
|
|
104303
104307
|
init_jszip_C49i9kUs_es();
|
|
104304
104308
|
init_xml_js_CqGKpaft_es();
|
|
@@ -113571,7 +113575,8 @@ var init_SuperConverter_Dchjy0My_es = __esm(() => {
|
|
|
113571
113575
|
type: "array",
|
|
113572
113576
|
items: ref("TextSegment"),
|
|
113573
113577
|
minItems: 1
|
|
113574
|
-
}
|
|
113578
|
+
},
|
|
113579
|
+
story: ref("StoryLocator")
|
|
113575
113580
|
}, ["kind", "segments"]), objectSchema({
|
|
113576
113581
|
kind: { const: "block" },
|
|
113577
113582
|
nodeType: { enum: [...SELECTION_EDGE_NODE_TYPES] },
|
|
@@ -114945,7 +114950,7 @@ var init_SuperConverter_Dchjy0My_es = __esm(() => {
|
|
|
114945
114950
|
type: "object",
|
|
114946
114951
|
description: "ContentControlInfo"
|
|
114947
114952
|
};
|
|
114948
|
-
|
|
114953
|
+
refListQueryProperties = {
|
|
114949
114954
|
limit: {
|
|
114950
114955
|
type: "integer",
|
|
114951
114956
|
minimum: 1
|
|
@@ -114954,7 +114959,8 @@ var init_SuperConverter_Dchjy0My_es = __esm(() => {
|
|
|
114954
114959
|
type: "integer",
|
|
114955
114960
|
minimum: 0
|
|
114956
114961
|
}
|
|
114957
|
-
}
|
|
114962
|
+
};
|
|
114963
|
+
objectSchema(refListQueryProperties);
|
|
114958
114964
|
refFailureSchema = objectSchema({
|
|
114959
114965
|
success: { const: false },
|
|
114960
114966
|
failure: objectSchema({
|
|
@@ -114966,7 +114972,8 @@ var init_SuperConverter_Dchjy0My_es = __esm(() => {
|
|
|
114966
114972
|
bookmarkAddressSchema = objectSchema({
|
|
114967
114973
|
kind: { const: "entity" },
|
|
114968
114974
|
entityType: { const: "bookmark" },
|
|
114969
|
-
name: { type: "string" }
|
|
114975
|
+
name: { type: "string" },
|
|
114976
|
+
story: ref("StoryLocator")
|
|
114970
114977
|
}, [
|
|
114971
114978
|
"kind",
|
|
114972
114979
|
"entityType",
|
|
@@ -118563,7 +118570,10 @@ var init_SuperConverter_Dchjy0My_es = __esm(() => {
|
|
|
118563
118570
|
]), objectSchema({
|
|
118564
118571
|
success: { const: false },
|
|
118565
118572
|
failure: receiptFailureSchemaFor("headerFooters.parts.delete")
|
|
118566
|
-
}, ["success", "failure"]), { ...buildContentControlSchemas() }, objectSchema({
|
|
118573
|
+
}, ["success", "failure"]), { ...buildContentControlSchemas() }, objectSchema({
|
|
118574
|
+
...refListQueryProperties,
|
|
118575
|
+
in: storyLocatorSchema
|
|
118576
|
+
}), objectSchema({ target: bookmarkAddressSchema }, ["target"]), objectSchema({
|
|
118567
118577
|
name: { type: "string" },
|
|
118568
118578
|
at: textTargetSchema,
|
|
118569
118579
|
tableColumn: objectSchema({
|
|
@@ -141893,7 +141903,7 @@ var init_SuperConverter_Dchjy0My_es = __esm(() => {
|
|
|
141893
141903
|
};
|
|
141894
141904
|
});
|
|
141895
141905
|
|
|
141896
|
-
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-
|
|
141906
|
+
// ../../packages/superdoc/dist/chunks/create-headless-toolbar-lTVVsGdE.es.js
|
|
141897
141907
|
function parseSizeUnit(val = "0") {
|
|
141898
141908
|
const length = val.toString() || "0";
|
|
141899
141909
|
const value = Number.parseFloat(length);
|
|
@@ -144529,8 +144539,8 @@ var CSS_DIMENSION_REGEX, DOM_SIZE_UNITS, Extension = class Extension2 {
|
|
|
144529
144539
|
}
|
|
144530
144540
|
};
|
|
144531
144541
|
};
|
|
144532
|
-
var
|
|
144533
|
-
|
|
144542
|
+
var init_create_headless_toolbar_lTVVsGdE_es = __esm(() => {
|
|
144543
|
+
init_SuperConverter_DklB_kc9_es();
|
|
144534
144544
|
init_constants_DrU4EASo_es();
|
|
144535
144545
|
init_dist_B8HfvhaK_es();
|
|
144536
144546
|
CSS_DIMENSION_REGEX = /[\d-.]+(\w+)$/;
|
|
@@ -198739,7 +198749,7 @@ var init_remark_gfm_eZN6yzWQ_es = __esm(() => {
|
|
|
198739
198749
|
init_remark_gfm_BhnWr3yf_es();
|
|
198740
198750
|
});
|
|
198741
198751
|
|
|
198742
|
-
// ../../packages/superdoc/dist/chunks/src-
|
|
198752
|
+
// ../../packages/superdoc/dist/chunks/src-pzodLUJ-.es.js
|
|
198743
198753
|
function deleteProps(obj, propOrProps) {
|
|
198744
198754
|
const props = typeof propOrProps === "string" ? [propOrProps] : propOrProps;
|
|
198745
198755
|
const removeNested = (target, pathParts, index2 = 0) => {
|
|
@@ -234939,6 +234949,86 @@ function headerFootersPartsDeleteAdapter(editor, input2, options) {
|
|
|
234939
234949
|
partPath
|
|
234940
234950
|
};
|
|
234941
234951
|
}
|
|
234952
|
+
function isSpecialEntry(entry) {
|
|
234953
|
+
return SPECIAL_NOTE_TYPES.has(entry.type ?? "");
|
|
234954
|
+
}
|
|
234955
|
+
function normalizeNoteId(entry) {
|
|
234956
|
+
return String(entry.id ?? "");
|
|
234957
|
+
}
|
|
234958
|
+
function findNoteEntryById(entries, noteId) {
|
|
234959
|
+
if (!Array.isArray(entries))
|
|
234960
|
+
return;
|
|
234961
|
+
let fallback;
|
|
234962
|
+
for (const entry of entries) {
|
|
234963
|
+
if (String(entry.id ?? "") !== noteId)
|
|
234964
|
+
continue;
|
|
234965
|
+
if (!isSpecialEntry(entry))
|
|
234966
|
+
return entry;
|
|
234967
|
+
fallback ??= entry;
|
|
234968
|
+
}
|
|
234969
|
+
return fallback;
|
|
234970
|
+
}
|
|
234971
|
+
function enumerateEffectiveNoteEntries(entries) {
|
|
234972
|
+
if (!Array.isArray(entries))
|
|
234973
|
+
return [];
|
|
234974
|
+
const orderedIds = [];
|
|
234975
|
+
const effectiveById = /* @__PURE__ */ new Map;
|
|
234976
|
+
for (const entry of entries) {
|
|
234977
|
+
const noteId = normalizeNoteId(entry);
|
|
234978
|
+
if (!effectiveById.has(noteId)) {
|
|
234979
|
+
orderedIds.push(noteId);
|
|
234980
|
+
effectiveById.set(noteId, entry);
|
|
234981
|
+
continue;
|
|
234982
|
+
}
|
|
234983
|
+
if (isSpecialEntry(effectiveById.get(noteId)) && !isSpecialEntry(entry))
|
|
234984
|
+
effectiveById.set(noteId, entry);
|
|
234985
|
+
}
|
|
234986
|
+
return orderedIds.map((noteId) => effectiveById.get(noteId));
|
|
234987
|
+
}
|
|
234988
|
+
function normalizeStory(locator) {
|
|
234989
|
+
if (!locator || locator.storyType === "body")
|
|
234990
|
+
return;
|
|
234991
|
+
return locator;
|
|
234992
|
+
}
|
|
234993
|
+
function buildBookmarkAddress(name, story) {
|
|
234994
|
+
const normalizedStory = normalizeStory(story);
|
|
234995
|
+
return normalizedStory ? {
|
|
234996
|
+
kind: "entity",
|
|
234997
|
+
entityType: "bookmark",
|
|
234998
|
+
name,
|
|
234999
|
+
story: normalizedStory
|
|
235000
|
+
} : {
|
|
235001
|
+
kind: "entity",
|
|
235002
|
+
entityType: "bookmark",
|
|
235003
|
+
name
|
|
235004
|
+
};
|
|
235005
|
+
}
|
|
235006
|
+
function findAllBookmarksInDocument(editor) {
|
|
235007
|
+
return collectFromDocumentStories(editor, {
|
|
235008
|
+
collectFromDoc: collectBookmarksFromDoc,
|
|
235009
|
+
collectFromPmJson: collectBookmarksFromPmJson
|
|
235010
|
+
});
|
|
235011
|
+
}
|
|
235012
|
+
function findAllBookmarkMarkersInDocument(editor) {
|
|
235013
|
+
return collectFromDocumentStories(editor, {
|
|
235014
|
+
collectFromDoc: collectBookmarkMarkersFromDoc,
|
|
235015
|
+
collectFromPmJson: collectBookmarkMarkersFromPmJson
|
|
235016
|
+
});
|
|
235017
|
+
}
|
|
235018
|
+
function collectFromDocumentStories(editor, collector) {
|
|
235019
|
+
const results = [];
|
|
235020
|
+
const seenStoryKeys = /* @__PURE__ */ new Set;
|
|
235021
|
+
const converter = editor.converter;
|
|
235022
|
+
seenStoryKeys.add(BODY_STORY_KEY);
|
|
235023
|
+
collector.collectFromDoc(editor.state.doc, BODY_STORY_KEY, results);
|
|
235024
|
+
collectFromHeaderFooterEditors(editor, converter?.headerEditors, results, seenStoryKeys, collector);
|
|
235025
|
+
collectFromHeaderFooterEditors(editor, converter?.footerEditors, results, seenStoryKeys, collector);
|
|
235026
|
+
collectFromHeaderFooterCache(editor, converter?.headers, results, seenStoryKeys, collector);
|
|
235027
|
+
collectFromHeaderFooterCache(editor, converter?.footers, results, seenStoryKeys, collector);
|
|
235028
|
+
collectFromNotes(editor, converter?.footnotes, "footnote", results, seenStoryKeys, collector);
|
|
235029
|
+
collectFromNotes(editor, converter?.endnotes, "endnote", results, seenStoryKeys, collector);
|
|
235030
|
+
return results;
|
|
235031
|
+
}
|
|
234942
235032
|
function findAllBookmarks(doc$12) {
|
|
234943
235033
|
const results = [];
|
|
234944
235034
|
const endPositions = collectBookmarkEndPositions(doc$12);
|
|
@@ -234971,6 +235061,163 @@ function collectBookmarkEndPositions(doc$12) {
|
|
|
234971
235061
|
});
|
|
234972
235062
|
return map$12;
|
|
234973
235063
|
}
|
|
235064
|
+
function collectBookmarksFromDoc(doc$12, storyKey, results) {
|
|
235065
|
+
doc$12.descendants((node2) => {
|
|
235066
|
+
if (node2.type.name === "bookmarkStart")
|
|
235067
|
+
results.push({
|
|
235068
|
+
name: readBookmarkName(node2.attrs),
|
|
235069
|
+
bookmarkId: readBookmarkId(node2.attrs),
|
|
235070
|
+
storyKey
|
|
235071
|
+
});
|
|
235072
|
+
return true;
|
|
235073
|
+
});
|
|
235074
|
+
}
|
|
235075
|
+
function collectBookmarkMarkersFromDoc(doc$12, storyKey, results) {
|
|
235076
|
+
doc$12.descendants((node2) => {
|
|
235077
|
+
if (!isBookmarkMarkerType(node2.type.name))
|
|
235078
|
+
return true;
|
|
235079
|
+
const bookmarkId = readBookmarkId(node2.attrs);
|
|
235080
|
+
if (bookmarkId)
|
|
235081
|
+
results.push({
|
|
235082
|
+
bookmarkId,
|
|
235083
|
+
storyKey,
|
|
235084
|
+
markerType: node2.type.name
|
|
235085
|
+
});
|
|
235086
|
+
return true;
|
|
235087
|
+
});
|
|
235088
|
+
}
|
|
235089
|
+
function collectFromHeaderFooterEditors(hostEditor, editors, results, seenStoryKeys, collector) {
|
|
235090
|
+
if (!Array.isArray(editors))
|
|
235091
|
+
return;
|
|
235092
|
+
for (const entry of editors) {
|
|
235093
|
+
const refId = typeof entry?.id === "string" && entry.id.length > 0 ? entry.id : null;
|
|
235094
|
+
const storyEditor = entry?.editor;
|
|
235095
|
+
if (!refId || !storyEditor?.state?.doc)
|
|
235096
|
+
continue;
|
|
235097
|
+
const storyKey = buildStoryKey({
|
|
235098
|
+
kind: "story",
|
|
235099
|
+
storyType: "headerFooterPart",
|
|
235100
|
+
refId
|
|
235101
|
+
});
|
|
235102
|
+
if (seenStoryKeys.has(storyKey))
|
|
235103
|
+
continue;
|
|
235104
|
+
seenStoryKeys.add(storyKey);
|
|
235105
|
+
collectFromLiveOrDoc(hostEditor, storyKey, storyEditor.state.doc, results, collector);
|
|
235106
|
+
}
|
|
235107
|
+
}
|
|
235108
|
+
function collectFromHeaderFooterCache(hostEditor, collection, results, seenStoryKeys, collector) {
|
|
235109
|
+
if (!collection || typeof collection !== "object")
|
|
235110
|
+
return;
|
|
235111
|
+
for (const [refId, pmJson] of Object.entries(collection)) {
|
|
235112
|
+
if (typeof refId !== "string" || refId.length === 0)
|
|
235113
|
+
continue;
|
|
235114
|
+
const storyKey = buildStoryKey({
|
|
235115
|
+
kind: "story",
|
|
235116
|
+
storyType: "headerFooterPart",
|
|
235117
|
+
refId
|
|
235118
|
+
});
|
|
235119
|
+
if (seenStoryKeys.has(storyKey))
|
|
235120
|
+
continue;
|
|
235121
|
+
seenStoryKeys.add(storyKey);
|
|
235122
|
+
collectFromLiveOrPmJson(hostEditor, storyKey, pmJson, results, collector);
|
|
235123
|
+
}
|
|
235124
|
+
}
|
|
235125
|
+
function collectFromNotes(hostEditor, notes, storyType, results, seenStoryKeys, collector) {
|
|
235126
|
+
for (const note of enumerateEffectiveNoteEntries(notes)) {
|
|
235127
|
+
const noteId = note?.id != null ? String(note.id) : "";
|
|
235128
|
+
if (!noteId)
|
|
235129
|
+
continue;
|
|
235130
|
+
const pmJson = getNotePmJson(note);
|
|
235131
|
+
if (!pmJson)
|
|
235132
|
+
continue;
|
|
235133
|
+
const storyKey = buildStoryKey({
|
|
235134
|
+
kind: "story",
|
|
235135
|
+
storyType,
|
|
235136
|
+
noteId
|
|
235137
|
+
});
|
|
235138
|
+
if (seenStoryKeys.has(storyKey))
|
|
235139
|
+
continue;
|
|
235140
|
+
seenStoryKeys.add(storyKey);
|
|
235141
|
+
collectFromLiveOrPmJson(hostEditor, storyKey, pmJson, results, collector);
|
|
235142
|
+
}
|
|
235143
|
+
}
|
|
235144
|
+
function collectFromLiveOrDoc(hostEditor, storyKey, fallbackDoc, results, collector) {
|
|
235145
|
+
const liveDoc = resolveLiveStorySessionRuntime(hostEditor, storyKey)?.editor?.state?.doc;
|
|
235146
|
+
collector.collectFromDoc(liveDoc ?? fallbackDoc, storyKey, results);
|
|
235147
|
+
}
|
|
235148
|
+
function collectFromLiveOrPmJson(hostEditor, storyKey, fallbackPmJson, results, collector) {
|
|
235149
|
+
const liveDoc = resolveLiveStorySessionRuntime(hostEditor, storyKey)?.editor?.state?.doc;
|
|
235150
|
+
if (liveDoc) {
|
|
235151
|
+
collector.collectFromDoc(liveDoc, storyKey, results);
|
|
235152
|
+
return;
|
|
235153
|
+
}
|
|
235154
|
+
collector.collectFromPmJson(fallbackPmJson, storyKey, results);
|
|
235155
|
+
}
|
|
235156
|
+
function getNotePmJson(note) {
|
|
235157
|
+
if (Array.isArray(note.content))
|
|
235158
|
+
return {
|
|
235159
|
+
type: "doc",
|
|
235160
|
+
content: note.content.length > 0 ? note.content : [{ type: "paragraph" }]
|
|
235161
|
+
};
|
|
235162
|
+
if (note.doc && typeof note.doc === "object")
|
|
235163
|
+
return note.doc;
|
|
235164
|
+
return null;
|
|
235165
|
+
}
|
|
235166
|
+
function collectBookmarksFromPmJson(pmJson, storyKey, results) {
|
|
235167
|
+
if (!isObjectRecord2(pmJson))
|
|
235168
|
+
return;
|
|
235169
|
+
visitPmJson(pmJson, (node2) => {
|
|
235170
|
+
if (node2.type !== "bookmarkStart")
|
|
235171
|
+
return;
|
|
235172
|
+
const name = readBookmarkName(node2.attrs);
|
|
235173
|
+
const bookmarkId = readBookmarkId(node2.attrs);
|
|
235174
|
+
results.push({
|
|
235175
|
+
name,
|
|
235176
|
+
bookmarkId,
|
|
235177
|
+
storyKey
|
|
235178
|
+
});
|
|
235179
|
+
});
|
|
235180
|
+
}
|
|
235181
|
+
function collectBookmarkMarkersFromPmJson(pmJson, storyKey, results) {
|
|
235182
|
+
if (!isObjectRecord2(pmJson))
|
|
235183
|
+
return;
|
|
235184
|
+
visitPmJson(pmJson, (node2) => {
|
|
235185
|
+
if (!isBookmarkMarkerType(node2.type))
|
|
235186
|
+
return;
|
|
235187
|
+
const bookmarkId = readBookmarkId(node2.attrs);
|
|
235188
|
+
if (bookmarkId)
|
|
235189
|
+
results.push({
|
|
235190
|
+
bookmarkId,
|
|
235191
|
+
storyKey,
|
|
235192
|
+
markerType: node2.type
|
|
235193
|
+
});
|
|
235194
|
+
});
|
|
235195
|
+
}
|
|
235196
|
+
function visitPmJson(node2, visitor) {
|
|
235197
|
+
visitor(node2);
|
|
235198
|
+
const content3 = node2.content;
|
|
235199
|
+
if (!Array.isArray(content3))
|
|
235200
|
+
return;
|
|
235201
|
+
for (const child of content3)
|
|
235202
|
+
if (isObjectRecord2(child))
|
|
235203
|
+
visitPmJson(child, visitor);
|
|
235204
|
+
}
|
|
235205
|
+
function isObjectRecord2(value) {
|
|
235206
|
+
return typeof value === "object" && value !== null;
|
|
235207
|
+
}
|
|
235208
|
+
function isBookmarkMarkerType(type) {
|
|
235209
|
+
return type === "bookmarkStart" || type === "bookmarkEnd";
|
|
235210
|
+
}
|
|
235211
|
+
function readBookmarkId(attrs) {
|
|
235212
|
+
if (!isObjectRecord2(attrs) || attrs.id == null)
|
|
235213
|
+
return "";
|
|
235214
|
+
return String(attrs.id);
|
|
235215
|
+
}
|
|
235216
|
+
function readBookmarkName(attrs) {
|
|
235217
|
+
if (!isObjectRecord2(attrs) || typeof attrs.name !== "string")
|
|
235218
|
+
return "";
|
|
235219
|
+
return attrs.name;
|
|
235220
|
+
}
|
|
234974
235221
|
function resolveBookmarkTarget(doc$12, target) {
|
|
234975
235222
|
const found2 = findAllBookmarks(doc$12).find((b$1) => b$1.name === target.name);
|
|
234976
235223
|
if (!found2)
|
|
@@ -234992,17 +235239,13 @@ function nodePositionToPosition(doc$12, pos) {
|
|
|
234992
235239
|
offset: pos
|
|
234993
235240
|
};
|
|
234994
235241
|
}
|
|
234995
|
-
function extractBookmarkInfo(doc$12, resolved) {
|
|
235242
|
+
function extractBookmarkInfo(doc$12, resolved, story) {
|
|
234996
235243
|
const from$1 = nodePositionToPosition(doc$12, resolved.pos);
|
|
234997
235244
|
const to = resolved.endPos !== null ? nodePositionToPosition(doc$12, resolved.endPos) : from$1;
|
|
234998
235245
|
const colFirst = resolved.node.attrs?.colFirst;
|
|
234999
235246
|
const colLast = resolved.node.attrs?.colLast;
|
|
235000
235247
|
const info = {
|
|
235001
|
-
address:
|
|
235002
|
-
kind: "entity",
|
|
235003
|
-
entityType: "bookmark",
|
|
235004
|
-
name: resolved.name
|
|
235005
|
-
},
|
|
235248
|
+
address: buildBookmarkAddress(resolved.name, story),
|
|
235006
235249
|
name: resolved.name,
|
|
235007
235250
|
bookmarkId: resolved.bookmarkId,
|
|
235008
235251
|
range: {
|
|
@@ -235017,17 +235260,13 @@ function extractBookmarkInfo(doc$12, resolved) {
|
|
|
235017
235260
|
};
|
|
235018
235261
|
return info;
|
|
235019
235262
|
}
|
|
235020
|
-
function buildBookmarkDiscoveryItem(doc$12, resolved, evaluatedRevision) {
|
|
235263
|
+
function buildBookmarkDiscoveryItem(doc$12, resolved, evaluatedRevision, story, idScope) {
|
|
235021
235264
|
const from$1 = nodePositionToPosition(doc$12, resolved.pos);
|
|
235022
235265
|
const to = resolved.endPos !== null ? nodePositionToPosition(doc$12, resolved.endPos) : from$1;
|
|
235023
235266
|
const colFirst = resolved.node.attrs?.colFirst;
|
|
235024
235267
|
const colLast = resolved.node.attrs?.colLast;
|
|
235025
235268
|
const domain3 = {
|
|
235026
|
-
address:
|
|
235027
|
-
kind: "entity",
|
|
235028
|
-
entityType: "bookmark",
|
|
235029
|
-
name: resolved.name
|
|
235030
|
-
},
|
|
235269
|
+
address: buildBookmarkAddress(resolved.name, story),
|
|
235031
235270
|
name: resolved.name,
|
|
235032
235271
|
bookmarkId: resolved.bookmarkId,
|
|
235033
235272
|
range: {
|
|
@@ -235041,7 +235280,7 @@ function buildBookmarkDiscoveryItem(doc$12, resolved, evaluatedRevision) {
|
|
|
235041
235280
|
colLast
|
|
235042
235281
|
};
|
|
235043
235282
|
const handle3 = buildResolvedHandle(resolved.name, "stable", "node");
|
|
235044
|
-
return buildDiscoveryItem(`bookmark:${resolved.name}:${evaluatedRevision}`, handle3, domain3);
|
|
235283
|
+
return buildDiscoveryItem(`${idScope ? `bookmark:${encodeURIComponent(idScope)}:` : "bookmark:"}${encodeURIComponent(resolved.name)}:${encodeURIComponent(evaluatedRevision)}`, handle3, domain3);
|
|
235045
235284
|
}
|
|
235046
235285
|
function bookmarkSuccess(address) {
|
|
235047
235286
|
return {
|
|
@@ -235071,22 +235310,106 @@ function parseBookmarkId(raw) {
|
|
|
235071
235310
|
const parsed = Number.parseInt(raw, 10);
|
|
235072
235311
|
return Number.isInteger(parsed) && parsed >= 0 ? parsed : null;
|
|
235073
235312
|
}
|
|
235074
|
-
function allocateBookmarkId(
|
|
235313
|
+
function allocateBookmarkId(editor) {
|
|
235314
|
+
const entries = findAllBookmarkMarkersInDocument(editor);
|
|
235075
235315
|
let maxId = -1;
|
|
235076
|
-
|
|
235077
|
-
|
|
235078
|
-
return true;
|
|
235079
|
-
const id2 = parseBookmarkId(node2.attrs?.id);
|
|
235316
|
+
for (const entry of entries) {
|
|
235317
|
+
const id2 = parseBookmarkId(entry.bookmarkId);
|
|
235080
235318
|
if (id2 !== null && id2 > maxId)
|
|
235081
235319
|
maxId = id2;
|
|
235082
|
-
|
|
235083
|
-
});
|
|
235320
|
+
}
|
|
235084
235321
|
return String(maxId + 1);
|
|
235085
235322
|
}
|
|
235323
|
+
function bookmarkExistsAnywhere(editor, name, exclude, preCollected) {
|
|
235324
|
+
return (preCollected ?? findAllBookmarksInDocument(editor)).some((bookmark) => {
|
|
235325
|
+
if (bookmark.name !== name)
|
|
235326
|
+
return false;
|
|
235327
|
+
if (!exclude)
|
|
235328
|
+
return true;
|
|
235329
|
+
return !(bookmark.storyKey === exclude.storyKey && bookmark.bookmarkId === exclude.bookmarkId);
|
|
235330
|
+
});
|
|
235331
|
+
}
|
|
235332
|
+
function collectBookmarkStorySnapshots(editor, entries) {
|
|
235333
|
+
return [...new Set(entries.map((entry) => entry.storyKey))].flatMap((storyKey) => {
|
|
235334
|
+
const locator = storyKey === "body" ? undefined : parseStoryKey(storyKey);
|
|
235335
|
+
try {
|
|
235336
|
+
const runtime = resolveStoryRuntime(editor, locator);
|
|
235337
|
+
return [{
|
|
235338
|
+
storyKey,
|
|
235339
|
+
runtime,
|
|
235340
|
+
revision: getRevision(runtime.editor)
|
|
235341
|
+
}];
|
|
235342
|
+
} catch (error48) {
|
|
235343
|
+
if (error48 instanceof DocumentApiAdapterError && error48.code === "STORY_NOT_FOUND")
|
|
235344
|
+
return [];
|
|
235345
|
+
throw error48;
|
|
235346
|
+
}
|
|
235347
|
+
});
|
|
235348
|
+
}
|
|
235349
|
+
function buildDocumentBookmarkRevision(hostRevision, snapshots) {
|
|
235350
|
+
if (snapshots.length === 0)
|
|
235351
|
+
return hostRevision;
|
|
235352
|
+
if (snapshots.length === 1 && snapshots[0]?.storyKey === "body")
|
|
235353
|
+
return hostRevision;
|
|
235354
|
+
return `${BOOKMARK_SCAN_REVISION_PREFIX}${[...snapshots].sort((left$1, right$1) => left$1.storyKey.localeCompare(right$1.storyKey)).map((snapshot2) => `${snapshot2.storyKey}@${snapshot2.revision}`).join("|")}`;
|
|
235355
|
+
}
|
|
235356
|
+
function getDocumentBookmarkRevision(editor, preCollected) {
|
|
235357
|
+
return buildDocumentBookmarkRevision(getRevision(editor), collectBookmarkStorySnapshots(editor, preCollected ?? findAllBookmarksInDocument(editor)));
|
|
235358
|
+
}
|
|
235359
|
+
function expectedRevisionMatchesStory(storyEditor, expectedRevision) {
|
|
235360
|
+
return expectedRevision === getRevision(storyEditor);
|
|
235361
|
+
}
|
|
235362
|
+
function expectedRevisionMatchesDocumentScan(hostEditor, expectedRevision) {
|
|
235363
|
+
return expectedRevision.startsWith("bookmark-scan:") && expectedRevision === getDocumentBookmarkRevision(hostEditor);
|
|
235364
|
+
}
|
|
235365
|
+
function checkBookmarkRevision(hostEditor, storyEditor, expectedRevision) {
|
|
235366
|
+
if (expectedRevision === undefined)
|
|
235367
|
+
return;
|
|
235368
|
+
if (expectedRevisionMatchesStory(storyEditor, expectedRevision))
|
|
235369
|
+
return;
|
|
235370
|
+
if (expectedRevisionMatchesDocumentScan(hostEditor, expectedRevision))
|
|
235371
|
+
return;
|
|
235372
|
+
checkRevision(storyEditor, expectedRevision);
|
|
235373
|
+
}
|
|
235374
|
+
function resolveBookmarkMutationStory(editor, target) {
|
|
235375
|
+
if (target.story)
|
|
235376
|
+
return target.story;
|
|
235377
|
+
const matches2 = findAllBookmarksInDocument(editor).filter((bookmark) => bookmark.name === target.name);
|
|
235378
|
+
if (matches2.length > 1)
|
|
235379
|
+
throw new DocumentApiAdapterError("INVALID_INPUT", `Bookmark name "${target.name}" exists in multiple stories. Pass target.story to disambiguate the mutation.`);
|
|
235380
|
+
const entry = matches2[0];
|
|
235381
|
+
if (!entry)
|
|
235382
|
+
throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `Bookmark with name "${target.name}" not found.`);
|
|
235383
|
+
return entry.storyKey === "body" ? undefined : parseStoryKey(entry.storyKey);
|
|
235384
|
+
}
|
|
235086
235385
|
function bookmarksListWrapper(editor, query) {
|
|
235087
|
-
|
|
235088
|
-
|
|
235089
|
-
const
|
|
235386
|
+
if (query?.in)
|
|
235387
|
+
return listBookmarksFromStory(editor, query.in, query);
|
|
235388
|
+
const entries = findAllBookmarksInDocument(editor);
|
|
235389
|
+
const hostRevision = getRevision(editor);
|
|
235390
|
+
const snapshots = collectBookmarkStorySnapshots(editor, entries);
|
|
235391
|
+
const { total, items: paged } = paginate(snapshots.flatMap(({ storyKey, runtime, revision }) => {
|
|
235392
|
+
const doc$12 = runtime.editor.state.doc;
|
|
235393
|
+
return findAllBookmarks(doc$12).map((bookmark) => buildBookmarkDiscoveryItem(doc$12, bookmark, revision, runtime.locator, storyKey));
|
|
235394
|
+
}), query?.offset, query?.limit);
|
|
235395
|
+
const effectiveLimit = query?.limit ?? total;
|
|
235396
|
+
return buildDiscoveryResult({
|
|
235397
|
+
evaluatedRevision: buildDocumentBookmarkRevision(hostRevision, snapshots),
|
|
235398
|
+
total,
|
|
235399
|
+
items: paged,
|
|
235400
|
+
page: {
|
|
235401
|
+
limit: effectiveLimit,
|
|
235402
|
+
offset: query?.offset ?? 0,
|
|
235403
|
+
returned: paged.length
|
|
235404
|
+
}
|
|
235405
|
+
});
|
|
235406
|
+
}
|
|
235407
|
+
function listBookmarksFromStory(editor, storyLocator, query) {
|
|
235408
|
+
const runtime = resolveStoryRuntime(editor, storyLocator);
|
|
235409
|
+
const storyEditor = runtime.editor;
|
|
235410
|
+
const doc$12 = storyEditor.state.doc;
|
|
235411
|
+
const revision = getRevision(storyEditor);
|
|
235412
|
+
const { total, items: paged } = paginate(findAllBookmarks(doc$12).map((bookmark) => buildBookmarkDiscoveryItem(doc$12, bookmark, revision, runtime.locator)), query?.offset, query?.limit);
|
|
235090
235413
|
return buildDiscoveryResult({
|
|
235091
235414
|
evaluatedRevision: revision,
|
|
235092
235415
|
total,
|
|
@@ -235099,100 +235422,128 @@ function bookmarksListWrapper(editor, query) {
|
|
|
235099
235422
|
});
|
|
235100
235423
|
}
|
|
235101
235424
|
function bookmarksGetWrapper(editor, input2) {
|
|
235102
|
-
|
|
235103
|
-
|
|
235425
|
+
if (input2.target.story) {
|
|
235426
|
+
const runtime$1 = resolveStoryRuntime(editor, input2.target.story);
|
|
235427
|
+
const resolved$1 = resolveBookmarkTarget(runtime$1.editor.state.doc, input2.target);
|
|
235428
|
+
return extractBookmarkInfo(runtime$1.editor.state.doc, resolved$1, runtime$1.locator);
|
|
235429
|
+
}
|
|
235430
|
+
const entry = findAllBookmarksInDocument(editor).find((bookmark) => bookmark.name === input2.target.name);
|
|
235431
|
+
if (!entry)
|
|
235432
|
+
throw new DocumentApiAdapterError("TARGET_NOT_FOUND", `Bookmark with name "${input2.target.name}" not found.`);
|
|
235433
|
+
const runtime = resolveStoryRuntime(editor, entry.storyKey === "body" ? undefined : parseStoryKey(entry.storyKey));
|
|
235434
|
+
const resolved = resolveBookmarkTarget(runtime.editor.state.doc, input2.target);
|
|
235435
|
+
return extractBookmarkInfo(runtime.editor.state.doc, resolved, runtime.locator);
|
|
235104
235436
|
}
|
|
235105
235437
|
function bookmarksInsertWrapper(editor, input2, options) {
|
|
235106
235438
|
rejectTrackedMode("bookmarks.insert", options);
|
|
235107
|
-
|
|
235108
|
-
|
|
235109
|
-
const address =
|
|
235110
|
-
|
|
235111
|
-
|
|
235112
|
-
|
|
235113
|
-
|
|
235114
|
-
|
|
235439
|
+
const runtime = resolveWriteStoryRuntime(editor, input2.at.story);
|
|
235440
|
+
const storyEditor = runtime.editor;
|
|
235441
|
+
const address = buildBookmarkAddress(input2.name, runtime.locator);
|
|
235442
|
+
try {
|
|
235443
|
+
checkBookmarkRevision(editor, storyEditor, options?.expectedRevision);
|
|
235444
|
+
const allBookmarks = findAllBookmarksInDocument(editor);
|
|
235445
|
+
if (bookmarkExistsAnywhere(editor, input2.name, undefined, allBookmarks))
|
|
235446
|
+
return bookmarkFailure("NO_OP", `Bookmark with name "${input2.name}" already exists.`);
|
|
235447
|
+
if (options?.dryRun)
|
|
235448
|
+
return bookmarkSuccess(address);
|
|
235449
|
+
const bookmarkStartType = storyEditor.schema.nodes.bookmarkStart;
|
|
235450
|
+
const bookmarkEndType = storyEditor.schema.nodes.bookmarkEnd;
|
|
235451
|
+
if (!bookmarkStartType || !bookmarkEndType)
|
|
235452
|
+
throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "bookmarks.insert requires bookmarkStart and bookmarkEnd node types in the schema.");
|
|
235453
|
+
const resolved = resolveInlineInsertPosition(storyEditor, input2.at, "bookmarks.insert");
|
|
235454
|
+
if (!receiptApplied$6(executeDomainCommand(storyEditor, () => {
|
|
235455
|
+
const bookmarkId = allocateBookmarkId(editor);
|
|
235456
|
+
const startAttrs = {
|
|
235457
|
+
name: input2.name,
|
|
235458
|
+
id: bookmarkId
|
|
235459
|
+
};
|
|
235460
|
+
if (input2.tableColumn) {
|
|
235461
|
+
startAttrs.colFirst = input2.tableColumn.colFirst;
|
|
235462
|
+
startAttrs.colLast = input2.tableColumn.colLast;
|
|
235463
|
+
}
|
|
235464
|
+
const startNode = bookmarkStartType.create(startAttrs);
|
|
235465
|
+
const endNode = bookmarkEndType.create({ id: bookmarkId });
|
|
235466
|
+
const { tr } = storyEditor.state;
|
|
235467
|
+
tr.insert(resolved.to, endNode);
|
|
235468
|
+
tr.insert(resolved.from, startNode);
|
|
235469
|
+
storyEditor.dispatch(tr);
|
|
235470
|
+
clearIndexCache(storyEditor);
|
|
235471
|
+
return true;
|
|
235472
|
+
})))
|
|
235473
|
+
return bookmarkFailure("NO_OP", "Insert operation produced no change.");
|
|
235474
|
+
if (runtime.commit)
|
|
235475
|
+
runtime.commit(editor);
|
|
235115
235476
|
return bookmarkSuccess(address);
|
|
235116
|
-
|
|
235117
|
-
|
|
235118
|
-
|
|
235119
|
-
throw new DocumentApiAdapterError("CAPABILITY_UNAVAILABLE", "bookmarks.insert requires bookmarkStart and bookmarkEnd node types in the schema.");
|
|
235120
|
-
const resolved = resolveInlineInsertPosition(editor, input2.at, "bookmarks.insert");
|
|
235121
|
-
if (!receiptApplied$6(executeDomainCommand(editor, () => {
|
|
235122
|
-
const bookmarkId = allocateBookmarkId(editor.state.doc);
|
|
235123
|
-
const startAttrs = {
|
|
235124
|
-
name: input2.name,
|
|
235125
|
-
id: bookmarkId
|
|
235126
|
-
};
|
|
235127
|
-
if (input2.tableColumn) {
|
|
235128
|
-
startAttrs.colFirst = input2.tableColumn.colFirst;
|
|
235129
|
-
startAttrs.colLast = input2.tableColumn.colLast;
|
|
235130
|
-
}
|
|
235131
|
-
const startNode = bookmarkStartType.create(startAttrs);
|
|
235132
|
-
const endNode = bookmarkEndType.create({ id: bookmarkId });
|
|
235133
|
-
const { tr } = editor.state;
|
|
235134
|
-
tr.insert(resolved.to, endNode);
|
|
235135
|
-
tr.insert(resolved.from, startNode);
|
|
235136
|
-
editor.dispatch(tr);
|
|
235137
|
-
clearIndexCache(editor);
|
|
235138
|
-
return true;
|
|
235139
|
-
}, { expectedRevision: options?.expectedRevision })))
|
|
235140
|
-
return bookmarkFailure("NO_OP", "Insert operation produced no change.");
|
|
235141
|
-
return bookmarkSuccess(address);
|
|
235477
|
+
} finally {
|
|
235478
|
+
disposeEphemeralWriteRuntime(runtime);
|
|
235479
|
+
}
|
|
235142
235480
|
}
|
|
235143
235481
|
function bookmarksRenameWrapper(editor, input2, options) {
|
|
235144
235482
|
rejectTrackedMode("bookmarks.rename", options);
|
|
235145
|
-
const
|
|
235146
|
-
|
|
235147
|
-
|
|
235148
|
-
|
|
235149
|
-
|
|
235150
|
-
|
|
235151
|
-
|
|
235152
|
-
|
|
235153
|
-
|
|
235154
|
-
|
|
235155
|
-
|
|
235483
|
+
const runtime = resolveWriteStoryRuntime(editor, resolveBookmarkMutationStory(editor, input2.target));
|
|
235484
|
+
const storyEditor = runtime.editor;
|
|
235485
|
+
try {
|
|
235486
|
+
checkBookmarkRevision(editor, storyEditor, options?.expectedRevision);
|
|
235487
|
+
const resolved = resolveBookmarkTarget(storyEditor.state.doc, input2.target);
|
|
235488
|
+
if (resolved.name === input2.newName)
|
|
235489
|
+
return bookmarkFailure("NO_OP", "New name is identical to current name.");
|
|
235490
|
+
if (bookmarkExistsAnywhere(editor, input2.newName, {
|
|
235491
|
+
storyKey: runtime.storyKey,
|
|
235492
|
+
bookmarkId: resolved.bookmarkId
|
|
235493
|
+
}))
|
|
235494
|
+
throw new DocumentApiAdapterError("INVALID_INPUT", `bookmarks.rename: a bookmark with name "${input2.newName}" already exists.`);
|
|
235495
|
+
const newAddress = buildBookmarkAddress(input2.newName, runtime.locator);
|
|
235496
|
+
if (options?.dryRun)
|
|
235497
|
+
return bookmarkSuccess(newAddress);
|
|
235498
|
+
if (!receiptApplied$6(executeDomainCommand(storyEditor, () => {
|
|
235499
|
+
const { tr } = storyEditor.state;
|
|
235500
|
+
tr.setNodeMarkup(resolved.pos, undefined, {
|
|
235501
|
+
...resolved.node.attrs,
|
|
235502
|
+
name: input2.newName
|
|
235503
|
+
});
|
|
235504
|
+
storyEditor.dispatch(tr);
|
|
235505
|
+
clearIndexCache(storyEditor);
|
|
235506
|
+
return true;
|
|
235507
|
+
})))
|
|
235508
|
+
return bookmarkFailure("NO_OP", "Rename operation produced no change.");
|
|
235509
|
+
if (runtime.commit)
|
|
235510
|
+
runtime.commit(editor);
|
|
235156
235511
|
return bookmarkSuccess(newAddress);
|
|
235157
|
-
|
|
235158
|
-
|
|
235159
|
-
|
|
235160
|
-
...resolved.node.attrs,
|
|
235161
|
-
name: input2.newName
|
|
235162
|
-
});
|
|
235163
|
-
editor.dispatch(tr);
|
|
235164
|
-
clearIndexCache(editor);
|
|
235165
|
-
return true;
|
|
235166
|
-
}, { expectedRevision: options?.expectedRevision })))
|
|
235167
|
-
return bookmarkFailure("NO_OP", "Rename operation produced no change.");
|
|
235168
|
-
return bookmarkSuccess(newAddress);
|
|
235512
|
+
} finally {
|
|
235513
|
+
disposeEphemeralWriteRuntime(runtime);
|
|
235514
|
+
}
|
|
235169
235515
|
}
|
|
235170
235516
|
function bookmarksRemoveWrapper(editor, input2, options) {
|
|
235171
235517
|
rejectTrackedMode("bookmarks.remove", options);
|
|
235172
|
-
const
|
|
235173
|
-
const
|
|
235174
|
-
|
|
235175
|
-
|
|
235176
|
-
|
|
235177
|
-
|
|
235178
|
-
|
|
235518
|
+
const runtime = resolveWriteStoryRuntime(editor, resolveBookmarkMutationStory(editor, input2.target));
|
|
235519
|
+
const storyEditor = runtime.editor;
|
|
235520
|
+
try {
|
|
235521
|
+
checkBookmarkRevision(editor, storyEditor, options?.expectedRevision);
|
|
235522
|
+
const resolved = resolveBookmarkTarget(storyEditor.state.doc, input2.target);
|
|
235523
|
+
const address = buildBookmarkAddress(resolved.name, runtime.locator);
|
|
235524
|
+
if (options?.dryRun)
|
|
235525
|
+
return bookmarkSuccess(address);
|
|
235526
|
+
if (!receiptApplied$6(executeDomainCommand(storyEditor, () => {
|
|
235527
|
+
const { tr } = storyEditor.state;
|
|
235528
|
+
if (resolved.endPos !== null && resolved.endPos > resolved.pos) {
|
|
235529
|
+
const endNode = tr.doc.nodeAt(resolved.endPos);
|
|
235530
|
+
if (endNode)
|
|
235531
|
+
tr.delete(resolved.endPos, resolved.endPos + endNode.nodeSize);
|
|
235532
|
+
}
|
|
235533
|
+
const startNode = tr.doc.nodeAt(resolved.pos);
|
|
235534
|
+
if (startNode)
|
|
235535
|
+
tr.delete(resolved.pos, resolved.pos + startNode.nodeSize);
|
|
235536
|
+
storyEditor.dispatch(tr);
|
|
235537
|
+
clearIndexCache(storyEditor);
|
|
235538
|
+
return true;
|
|
235539
|
+
})))
|
|
235540
|
+
return bookmarkFailure("NO_OP", "Remove operation produced no change.");
|
|
235541
|
+
if (runtime.commit)
|
|
235542
|
+
runtime.commit(editor);
|
|
235179
235543
|
return bookmarkSuccess(address);
|
|
235180
|
-
|
|
235181
|
-
|
|
235182
|
-
|
|
235183
|
-
const endNode = tr.doc.nodeAt(resolved.endPos);
|
|
235184
|
-
if (endNode)
|
|
235185
|
-
tr.delete(resolved.endPos, resolved.endPos + endNode.nodeSize);
|
|
235186
|
-
}
|
|
235187
|
-
const startNode = tr.doc.nodeAt(resolved.pos);
|
|
235188
|
-
if (startNode)
|
|
235189
|
-
tr.delete(resolved.pos, resolved.pos + startNode.nodeSize);
|
|
235190
|
-
editor.dispatch(tr);
|
|
235191
|
-
clearIndexCache(editor);
|
|
235192
|
-
return true;
|
|
235193
|
-
}, { expectedRevision: options?.expectedRevision })))
|
|
235194
|
-
return bookmarkFailure("NO_OP", "Remove operation produced no change.");
|
|
235195
|
-
return bookmarkSuccess(address);
|
|
235544
|
+
} finally {
|
|
235545
|
+
disposeEphemeralWriteRuntime(runtime);
|
|
235546
|
+
}
|
|
235196
235547
|
}
|
|
235197
235548
|
function getConverter$12(editor) {
|
|
235198
235549
|
return editor.converter ?? undefined;
|
|
@@ -235590,22 +235941,6 @@ function findMarkerPositions(editor, id2) {
|
|
|
235590
235941
|
end: end$1
|
|
235591
235942
|
};
|
|
235592
235943
|
}
|
|
235593
|
-
function isSpecialEntry(entry) {
|
|
235594
|
-
return SPECIAL_NOTE_TYPES.has(entry.type ?? "");
|
|
235595
|
-
}
|
|
235596
|
-
function findNoteEntryById(entries, noteId) {
|
|
235597
|
-
if (!Array.isArray(entries))
|
|
235598
|
-
return;
|
|
235599
|
-
let fallback;
|
|
235600
|
-
for (const entry of entries) {
|
|
235601
|
-
if (String(entry.id ?? "") !== noteId)
|
|
235602
|
-
continue;
|
|
235603
|
-
if (!isSpecialEntry(entry))
|
|
235604
|
-
return entry;
|
|
235605
|
-
fallback ??= entry;
|
|
235606
|
-
}
|
|
235607
|
-
return fallback;
|
|
235608
|
-
}
|
|
235609
235944
|
function getConverterStore(editor) {
|
|
235610
235945
|
return editor.converter ?? {};
|
|
235611
235946
|
}
|
|
@@ -256281,7 +256616,7 @@ function computeAnchorMap(bookmarks, layout, blocks2) {
|
|
|
256281
256616
|
});
|
|
256282
256617
|
return anchorMap;
|
|
256283
256618
|
}
|
|
256284
|
-
async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks, pageGeometryHelper, painterHost, scrollContainer, zoom, scrollPageIntoView, waitForPageMount, getActiveEditor, timeoutMs }) {
|
|
256619
|
+
async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks, resolveAnchorPosition, pageGeometryHelper, painterHost, scrollContainer, zoom, scrollPageIntoView, waitForPageMount, getActiveEditor, timeoutMs }) {
|
|
256285
256620
|
if (!anchor)
|
|
256286
256621
|
return false;
|
|
256287
256622
|
if (!layout)
|
|
@@ -256289,7 +256624,7 @@ async function goToAnchor({ anchor, layout, blocks: blocks2, measures, bookmarks
|
|
|
256289
256624
|
const normalized = anchor.startsWith("#") ? anchor.slice(1) : anchor;
|
|
256290
256625
|
if (!normalized)
|
|
256291
256626
|
return false;
|
|
256292
|
-
const pmPos = bookmarks.get(normalized);
|
|
256627
|
+
const pmPos = bookmarks.get(normalized) ?? resolveAnchorPosition?.(normalized) ?? null;
|
|
256293
256628
|
if (pmPos == null)
|
|
256294
256629
|
return false;
|
|
256295
256630
|
let pageIndex = (selectionToRects(layout, blocks2, measures, pmPos, pmPos + 1, pageGeometryHelper) ?? [])[0]?.pageIndex ?? null;
|
|
@@ -274393,7 +274728,7 @@ var Node$13 = class Node$14 {
|
|
|
274393
274728
|
return () => {};
|
|
274394
274729
|
const handle3 = setInterval(callback, intervalMs);
|
|
274395
274730
|
return () => clearInterval(handle3);
|
|
274396
|
-
}, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, DEFAULT_LEVEL = 1, SWITCH_PATTERN, TOC_BOOKMARK_PREFIX = "_Toc", DEFAULT_RIGHT_TAB_POS = 9350, TAB_LEADER_MAP, NO_ENTRIES_PLACEHOLDER, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2,
|
|
274731
|
+
}, HISTORY_UNSAFE_OPS, CANONICAL_COMMENT_IGNORED_KEYS, INITIAL_HASH, ROUND_CONSTANTS, V1_COVERAGE, V2_COVERAGE, SNAPSHOT_VERSION_V2 = "sd-diff-snapshot/v2", PAYLOAD_VERSION_V1 = "sd-diff-payload/v1", PAYLOAD_VERSION_V2 = "sd-diff-payload/v2", ENGINE_ID = "super-editor", STAGED_CONVERTER_KEYS, DiffServiceError, DEFAULT_LEVEL = 1, SWITCH_PATTERN, TOC_BOOKMARK_PREFIX = "_Toc", DEFAULT_RIGHT_TAB_POS = 9350, TAB_LEADER_MAP, NO_ENTRIES_PLACEHOLDER, TC_LEVEL_MIN = 1, TC_LEVEL_MAX = 9, ALLOWED_WRAP_ATTRS, WRAP_TYPES_SUPPORTING_SIDE, WRAP_TYPES_SUPPORTING_DISTANCES, RELATIVE_HEIGHT_MIN = 0, RELATIVE_HEIGHT_MAX = 4294967295, FORBIDDEN_RAW_PATCH_NAMES, CONTROL_TYPE_SDT_PR_ELEMENTS, DEFAULT_CHECKBOX_SYMBOL_FONT2 = "MS Gothic", DEFAULT_CHECKBOX_CHECKED_HEX2 = "2612", DEFAULT_CHECKBOX_UNCHECKED_HEX2 = "2610", VARIANT_ORDER, KIND_ORDER, HEADER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header", FOOTER_RELATIONSHIP_TYPE3 = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer", DOCUMENT_RELS_PATH2 = "word/_rels/document.xml.rels", HEADER_FILE_PATTERN2, FOOTER_FILE_PATTERN2, SPECIAL_NOTE_TYPES, BOOKMARK_SCAN_REVISION_PREFIX = "bookmark-scan:", SETTINGS_PART, RESTART_POLICY_TO_OOXML, VALID_DISPLAYS, REFERENCE_BLOCK_PREFIX, CAPTION_STYLE_NAMES, CAPTION_PARAGRAPH_STYLE_ID = "Caption", CAPTION_FORMAT_TO_OOXML, DOCUMENT_STAT_FIELD_TYPES, TOA_LEADER_REVERSE_MAP, EDGE_NODE_TYPES, CONTENT_TYPES_PART_ID = "[Content_Types].xml", CONTENT_TYPES_NS = "http://schemas.openxmlformats.org/package/2006/content-types", contentTypesPartDescriptor, empty_exports, init_empty, CURRENT_APP_VERSION2 = "1.29.1", PIXELS_PER_INCH2 = 96, MAX_HEIGHT_BUFFER_PX = 50, MAX_WIDTH_BUFFER_PX = 20, cloneExtensionInstance = (extension2) => {
|
|
274397
274732
|
const extensionLike = extension2;
|
|
274398
274733
|
const config3 = extensionLike?.config;
|
|
274399
274734
|
const ExtensionCtor = extensionLike?.constructor;
|
|
@@ -289621,12 +289956,12 @@ menclose::after {
|
|
|
289621
289956
|
return;
|
|
289622
289957
|
console.log(...args$1);
|
|
289623
289958
|
}, HEADER_FOOTER_INIT_BUDGET_MS = 200, MAX_ZOOM_WARNING_THRESHOLD = 10, MAX_SELECTION_RECTS_PER_USER = 100, SEMANTIC_RESIZE_DEBOUNCE_MS = 120, MIN_SEMANTIC_CONTENT_WIDTH_PX = 1, GLOBAL_PERFORMANCE, PresentationEditor, ICONS, TEXTS, tableActionsOptions;
|
|
289624
|
-
var
|
|
289959
|
+
var init_src_pzodLUJ_es = __esm(() => {
|
|
289625
289960
|
init_rolldown_runtime_Bg48TavK_es();
|
|
289626
|
-
|
|
289961
|
+
init_SuperConverter_DklB_kc9_es();
|
|
289627
289962
|
init_jszip_C49i9kUs_es();
|
|
289628
289963
|
init_uuid_qzgm05fK_es();
|
|
289629
|
-
|
|
289964
|
+
init_create_headless_toolbar_lTVVsGdE_es();
|
|
289630
289965
|
init_constants_DrU4EASo_es();
|
|
289631
289966
|
init_dist_B8HfvhaK_es();
|
|
289632
289967
|
init_unified_Dsuw2be5_es();
|
|
@@ -313516,8 +313851,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
313516
313851
|
KIND_ORDER = ["header", "footer"];
|
|
313517
313852
|
HEADER_FILE_PATTERN2 = /header(\d+)\.xml$/;
|
|
313518
313853
|
FOOTER_FILE_PATTERN2 = /footer(\d+)\.xml$/;
|
|
313519
|
-
SETTINGS_PART = SETTINGS_PART_PATH;
|
|
313520
313854
|
SPECIAL_NOTE_TYPES = new Set(["separator", "continuationSeparator"]);
|
|
313855
|
+
SETTINGS_PART = SETTINGS_PART_PATH;
|
|
313521
313856
|
RESTART_POLICY_TO_OOXML = {
|
|
313522
313857
|
continuous: "continuous",
|
|
313523
313858
|
eachSection: "eachSect",
|
|
@@ -325771,6 +326106,8 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325771
326106
|
if (target.kind === "block")
|
|
325772
326107
|
return await this.#navigateToBlock(target);
|
|
325773
326108
|
if (target.kind === "entity") {
|
|
326109
|
+
if (target.entityType === "bookmark")
|
|
326110
|
+
return await this.#navigateToBookmark(target);
|
|
325774
326111
|
if (target.entityType === "comment")
|
|
325775
326112
|
return await this.#navigateToComment(target.entityId);
|
|
325776
326113
|
if (target.entityType === "trackedChange")
|
|
@@ -325848,6 +326185,28 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325848
326185
|
});
|
|
325849
326186
|
return true;
|
|
325850
326187
|
}
|
|
326188
|
+
async#navigateToBookmark(target) {
|
|
326189
|
+
const editor = this.#editor;
|
|
326190
|
+
if (!editor)
|
|
326191
|
+
return false;
|
|
326192
|
+
let storyKey = resolveStoryKeyFromAddress(target.story);
|
|
326193
|
+
if (!storyKey) {
|
|
326194
|
+
const entry = findAllBookmarksInDocument(editor).find((bookmark) => bookmark.name === target.name);
|
|
326195
|
+
if (!entry)
|
|
326196
|
+
return false;
|
|
326197
|
+
storyKey = entry.storyKey;
|
|
326198
|
+
}
|
|
326199
|
+
if (!storyKey || storyKey === "body") {
|
|
326200
|
+
this.exitActiveStorySurface();
|
|
326201
|
+
return await this.goToAnchor(target.name);
|
|
326202
|
+
}
|
|
326203
|
+
if (this.#navigateToActiveStoryBookmark(target.name, storyKey))
|
|
326204
|
+
return true;
|
|
326205
|
+
const activatedStoryKey = await this.#activateBookmarkStorySurface(storyKey);
|
|
326206
|
+
if (activatedStoryKey)
|
|
326207
|
+
return this.#navigateToActiveStoryBookmark(target.name, activatedStoryKey);
|
|
326208
|
+
return false;
|
|
326209
|
+
}
|
|
325851
326210
|
async#navigateToTrackedChange(entityId, storyKey, preferredPageIndex) {
|
|
325852
326211
|
const editor = this.#editor;
|
|
325853
326212
|
if (!editor)
|
|
@@ -325949,6 +326308,135 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
325949
326308
|
}
|
|
325950
326309
|
return this.#getActiveTrackedChangeStorySurface()?.storyKey === storyKey;
|
|
325951
326310
|
}
|
|
326311
|
+
async#activateBookmarkStorySurface(storyKey) {
|
|
326312
|
+
let locator = null;
|
|
326313
|
+
try {
|
|
326314
|
+
locator = parseStoryKey(storyKey);
|
|
326315
|
+
} catch {
|
|
326316
|
+
return null;
|
|
326317
|
+
}
|
|
326318
|
+
if (!locator || locator.storyType === "body")
|
|
326319
|
+
return null;
|
|
326320
|
+
if (locator.storyType === "footnote" || locator.storyType === "endnote")
|
|
326321
|
+
return this.#activateBookmarkNoteStorySurface(locator);
|
|
326322
|
+
if (locator.storyType === "headerFooterPart" || locator.storyType === "headerFooterSlot")
|
|
326323
|
+
return this.#activateBookmarkHeaderFooterSurface(locator);
|
|
326324
|
+
return null;
|
|
326325
|
+
}
|
|
326326
|
+
async#activateBookmarkNoteStorySurface(locator) {
|
|
326327
|
+
const targetContext = this.#buildNoteLayoutContext({
|
|
326328
|
+
storyType: locator.storyType,
|
|
326329
|
+
noteId: locator.noteId
|
|
326330
|
+
});
|
|
326331
|
+
if ((this.#headerFooterSession?.session?.mode ?? "body") !== "body")
|
|
326332
|
+
this.#headerFooterSession?.exitMode();
|
|
326333
|
+
const firstPageIndex = targetContext?.firstPageIndex ?? 0;
|
|
326334
|
+
const hostWidthPx = targetContext?.hostWidthPx ?? Math.max(1, this.#visibleHost?.clientWidth ?? 1);
|
|
326335
|
+
this.#scrollPageIntoView(firstPageIndex);
|
|
326336
|
+
const totalPageCount = this.#layoutState.layout?.pages?.length ?? 1;
|
|
326337
|
+
const pageNumber = Math.max(1, firstPageIndex + 1);
|
|
326338
|
+
this.#ensureStorySessionManager().activate(locator, {
|
|
326339
|
+
commitPolicy: "onExit",
|
|
326340
|
+
preferHiddenHost: true,
|
|
326341
|
+
hostWidthPx,
|
|
326342
|
+
editorContext: {
|
|
326343
|
+
currentPageNumber: pageNumber,
|
|
326344
|
+
totalPageCount: Math.max(1, totalPageCount),
|
|
326345
|
+
surfaceKind: locator.storyType === "endnote" ? "endnote" : "note"
|
|
326346
|
+
}
|
|
326347
|
+
});
|
|
326348
|
+
const storyKey = buildStoryKey(locator);
|
|
326349
|
+
return await this.#waitForTrackedChangeStorySurface(storyKey) ? storyKey : null;
|
|
326350
|
+
}
|
|
326351
|
+
async#activateBookmarkHeaderFooterSurface(locator) {
|
|
326352
|
+
const region = this.#findHeaderFooterRegionForBookmarkLocator(locator);
|
|
326353
|
+
const expectedRefId = locator.storyType === "headerFooterPart" ? locator.refId : region ? this.#resolveBookmarkHeaderFooterRefId(region, locator) : null;
|
|
326354
|
+
if (!region || !expectedRefId)
|
|
326355
|
+
return null;
|
|
326356
|
+
this.#scrollPageIntoView(region.pageIndex);
|
|
326357
|
+
await this.#waitForPageMount(region.pageIndex, { timeout: PresentationEditor2.ANCHOR_NAV_TIMEOUT_MS });
|
|
326358
|
+
if (!await this.#headerFooterSession?.activateRegion(region, { initialSelection: "defer" }))
|
|
326359
|
+
return null;
|
|
326360
|
+
return buildStoryKey({
|
|
326361
|
+
kind: "story",
|
|
326362
|
+
storyType: "headerFooterPart",
|
|
326363
|
+
refId: expectedRefId
|
|
326364
|
+
});
|
|
326365
|
+
}
|
|
326366
|
+
#resolveBookmarkHeaderFooterRefId(region, locator) {
|
|
326367
|
+
if (region.headerFooterRefId)
|
|
326368
|
+
return region.headerFooterRefId;
|
|
326369
|
+
const page = this.#layoutState.layout?.pages?.[region.pageIndex];
|
|
326370
|
+
if (!page)
|
|
326371
|
+
return null;
|
|
326372
|
+
const refCollection = locator.headerFooterKind === "header" ? page.sectionRefs?.headerRefs : page.sectionRefs?.footerRefs;
|
|
326373
|
+
if (!refCollection)
|
|
326374
|
+
return null;
|
|
326375
|
+
const normalizedRegionVariant = region.sectionType ? normalizeVariant(region.sectionType) : null;
|
|
326376
|
+
const candidates = [
|
|
326377
|
+
region.sectionType,
|
|
326378
|
+
normalizedRegionVariant,
|
|
326379
|
+
locator.variant
|
|
326380
|
+
].filter((variant) => typeof variant === "string" && variant.length > 0);
|
|
326381
|
+
for (const variant of candidates) {
|
|
326382
|
+
const refId = refCollection[variant];
|
|
326383
|
+
if (typeof refId === "string" && refId.length > 0)
|
|
326384
|
+
return refId;
|
|
326385
|
+
}
|
|
326386
|
+
return null;
|
|
326387
|
+
}
|
|
326388
|
+
#findHeaderFooterRegionForBookmarkLocator(locator) {
|
|
326389
|
+
const manager = this.#headerFooterSession;
|
|
326390
|
+
if (!manager)
|
|
326391
|
+
return null;
|
|
326392
|
+
const searchRegions = locator.storyType === "headerFooterSlot" ? locator.headerFooterKind === "header" ? manager.headerRegions : manager.footerRegions : new Map([...manager.headerRegions.entries(), ...manager.footerRegions.entries()]);
|
|
326393
|
+
for (const region of searchRegions.values()) {
|
|
326394
|
+
if (locator.storyType === "headerFooterPart") {
|
|
326395
|
+
if (region.headerFooterRefId === locator.refId)
|
|
326396
|
+
return region;
|
|
326397
|
+
continue;
|
|
326398
|
+
}
|
|
326399
|
+
if (region.sectionId !== locator.section.sectionId)
|
|
326400
|
+
continue;
|
|
326401
|
+
if (region.sectionType && normalizeVariant(region.sectionType) !== locator.variant)
|
|
326402
|
+
continue;
|
|
326403
|
+
return region;
|
|
326404
|
+
}
|
|
326405
|
+
if (locator.storyType === "headerFooterPart") {
|
|
326406
|
+
const layout = this.#layoutState.layout;
|
|
326407
|
+
if (!layout)
|
|
326408
|
+
return null;
|
|
326409
|
+
for (let pageIndex = 0;pageIndex < layout.pages.length; pageIndex += 1) {
|
|
326410
|
+
const page = layout.pages[pageIndex];
|
|
326411
|
+
if (Object.values(page.sectionRefs?.headerRefs ?? {}).includes(locator.refId))
|
|
326412
|
+
return manager.getRegionForPage("header", pageIndex) ?? manager.findRegionForPage("header", pageIndex);
|
|
326413
|
+
if (Object.values(page.sectionRefs?.footerRefs ?? {}).includes(locator.refId))
|
|
326414
|
+
return manager.getRegionForPage("footer", pageIndex) ?? manager.findRegionForPage("footer", pageIndex);
|
|
326415
|
+
}
|
|
326416
|
+
}
|
|
326417
|
+
return null;
|
|
326418
|
+
}
|
|
326419
|
+
#navigateToActiveStoryBookmark(name, storyKey) {
|
|
326420
|
+
const activeSurface = this.#getActiveTrackedChangeStorySurface();
|
|
326421
|
+
if (!activeSurface || activeSurface.storyKey !== storyKey)
|
|
326422
|
+
return false;
|
|
326423
|
+
let resolved;
|
|
326424
|
+
try {
|
|
326425
|
+
resolved = resolveBookmarkTarget(activeSurface.editor.state.doc, {
|
|
326426
|
+
kind: "entity",
|
|
326427
|
+
entityType: "bookmark",
|
|
326428
|
+
name
|
|
326429
|
+
});
|
|
326430
|
+
} catch {
|
|
326431
|
+
return false;
|
|
326432
|
+
}
|
|
326433
|
+
activeSurface.editor.commands?.setTextSelection?.({
|
|
326434
|
+
from: resolved.pos,
|
|
326435
|
+
to: resolved.pos
|
|
326436
|
+
});
|
|
326437
|
+
this.#focusAndRevealActiveStorySelection(activeSurface.editor);
|
|
326438
|
+
return true;
|
|
326439
|
+
}
|
|
325952
326440
|
#navigateToActiveStoryTrackedChange(entityId, storyKey) {
|
|
325953
326441
|
const activeSurface = this.#getActiveTrackedChangeStorySurface();
|
|
325954
326442
|
if (!activeSurface || activeSurface.storyKey !== storyKey)
|
|
@@ -326011,6 +326499,17 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
326011
326499
|
blocks: this.#layoutState.blocks,
|
|
326012
326500
|
measures: this.#layoutState.measures,
|
|
326013
326501
|
bookmarks: this.#layoutState.bookmarks,
|
|
326502
|
+
resolveAnchorPosition: (name) => {
|
|
326503
|
+
try {
|
|
326504
|
+
return resolveBookmarkTarget(this.#editor.state.doc, {
|
|
326505
|
+
kind: "entity",
|
|
326506
|
+
entityType: "bookmark",
|
|
326507
|
+
name
|
|
326508
|
+
}).pos;
|
|
326509
|
+
} catch {
|
|
326510
|
+
return null;
|
|
326511
|
+
}
|
|
326512
|
+
},
|
|
326014
326513
|
pageGeometryHelper: this.#pageGeometryHelper ?? undefined,
|
|
326015
326514
|
painterHost: this.#painterHost,
|
|
326016
326515
|
scrollContainer: this.#scrollContainer ?? this.#visibleHost,
|
|
@@ -326847,11 +327346,11 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
326847
327346
|
];
|
|
326848
327347
|
});
|
|
326849
327348
|
|
|
326850
|
-
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-
|
|
327349
|
+
// ../../packages/superdoc/dist/chunks/create-super-doc-ui-C-uFDEFx.es.js
|
|
326851
327350
|
var ALL_TOOLBAR_COMMAND_IDS, EMPTY_ACTIVE_IDS;
|
|
326852
|
-
var
|
|
326853
|
-
|
|
326854
|
-
|
|
327351
|
+
var init_create_super_doc_ui_C_uFDEFx_es = __esm(() => {
|
|
327352
|
+
init_SuperConverter_DklB_kc9_es();
|
|
327353
|
+
init_create_headless_toolbar_lTVVsGdE_es();
|
|
326855
327354
|
ALL_TOOLBAR_COMMAND_IDS = Object.keys(createToolbarRegistry());
|
|
326856
327355
|
EMPTY_ACTIVE_IDS = Object.freeze([]);
|
|
326857
327356
|
});
|
|
@@ -326869,16 +327368,16 @@ var init_zipper_BxRAi0_5_es = __esm(() => {
|
|
|
326869
327368
|
|
|
326870
327369
|
// ../../packages/superdoc/dist/super-editor.es.js
|
|
326871
327370
|
var init_super_editor_es = __esm(() => {
|
|
326872
|
-
|
|
326873
|
-
|
|
327371
|
+
init_src_pzodLUJ_es();
|
|
327372
|
+
init_SuperConverter_DklB_kc9_es();
|
|
326874
327373
|
init_jszip_C49i9kUs_es();
|
|
326875
327374
|
init_xml_js_CqGKpaft_es();
|
|
326876
|
-
|
|
327375
|
+
init_create_headless_toolbar_lTVVsGdE_es();
|
|
326877
327376
|
init_constants_DrU4EASo_es();
|
|
326878
327377
|
init_dist_B8HfvhaK_es();
|
|
326879
327378
|
init_unified_Dsuw2be5_es();
|
|
326880
327379
|
init_DocxZipper_CUX64E5K_es();
|
|
326881
|
-
|
|
327380
|
+
init_create_super_doc_ui_C_uFDEFx_es();
|
|
326882
327381
|
init_ui_CGB3qmy3_es();
|
|
326883
327382
|
init_eventemitter3_BJrNoN9D_es();
|
|
326884
327383
|
init_errors_C_DoKMoN_es();
|
|
@@ -327702,7 +328201,7 @@ var init_placement = __esm(() => {
|
|
|
327702
328201
|
});
|
|
327703
328202
|
// ../../packages/document-api/src/types/story.types.ts
|
|
327704
328203
|
function isStoryLocator2(value) {
|
|
327705
|
-
if (!
|
|
328204
|
+
if (!isObjectRecord3(value) || value.kind !== "story" || !isStringEnumMember2(value.storyType, STORY_TYPES2)) {
|
|
327706
328205
|
return false;
|
|
327707
328206
|
}
|
|
327708
328207
|
switch (value.storyType) {
|
|
@@ -327744,7 +328243,7 @@ function storyLocatorToKey2(locator) {
|
|
|
327744
328243
|
return `story:endnote:${locator.noteId}`;
|
|
327745
328244
|
}
|
|
327746
328245
|
}
|
|
327747
|
-
function
|
|
328246
|
+
function isObjectRecord3(value) {
|
|
327748
328247
|
return typeof value === "object" && value !== null;
|
|
327749
328248
|
}
|
|
327750
328249
|
function isNonEmptyString2(value) {
|
|
@@ -327757,7 +328256,7 @@ function isOptionalStringEnumMember2(value, allowed) {
|
|
|
327757
328256
|
return value === undefined || isStringEnumMember2(value, allowed);
|
|
327758
328257
|
}
|
|
327759
328258
|
function isSectionAddress2(value) {
|
|
327760
|
-
return
|
|
328259
|
+
return isObjectRecord3(value) && value.kind === "section" && typeof value.sectionId === "string" && value.sectionId.length > 0;
|
|
327761
328260
|
}
|
|
327762
328261
|
var STORY_TYPES2, STORY_HEADER_FOOTER_KINDS2, STORY_HEADER_FOOTER_VARIANTS2, STORY_HEADER_FOOTER_RESOLUTIONS2, STORY_HEADER_FOOTER_ON_WRITE_VALUES2;
|
|
327763
328262
|
var init_story_types = __esm(() => {
|
|
@@ -335483,7 +335982,7 @@ function refConfigSchemas2() {
|
|
|
335483
335982
|
failure: refFailureSchema2
|
|
335484
335983
|
};
|
|
335485
335984
|
}
|
|
335486
|
-
var nodeTypeValues2, blockNodeTypeValues2, deletableBlockNodeTypeValues2, inlineNodeTypeValues2, knownTargetKindValues, SHARED_DEFS, rangeSchema2, positionSchema, inlineAnchorSchema, targetKindSchema, textAddressSchema2, textTargetSchema2, blockNodeAddressSchema2, deletableBlockNodeAddressSchema2, tableAddressSchema2, tableRowAddressSchema2, tableCellAddressSchema2, tableOrCellAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, inlineNodeAddressSchema, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, selectionTargetSchema2, targetLocatorSchema, deleteBehaviorSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationRangeSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchRunSchema, matchBlockSchema2, storyLocatorSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema2, nodeSelectorSchema2, selectorShorthandSchema, sdTextSelectorSchema, sdNodeSelectorSchema, sdSelectorSchema, sdReadOptionsSchema, sdFindInputSchema, sdNodeResultSchema, sdFindResultSchema, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, documentStyleInfoSchema, documentStylesSchema2, documentDefaultsSchema2, documentInfoSchema, listKindSchema2, listInsertPositionSchema2, listItemInfoSchema, listItemDomainItemSchema, listsListResultSchema, sectionBreakTypeSchema2, sectionOrientationSchema2, sectionVerticalAlignSchema2, sectionDirectionSchema2, sectionHeaderFooterKindSchema2, sectionHeaderFooterVariantSchema2, sectionLineNumberRestartSchema2, sectionPageNumberFormatSchema2, sectionRangeDomainSchema2, sectionPageMarginsSchema2, sectionHeaderFooterMarginsSchema2, sectionPageSetupSchema2, sectionColumnsSchema2, sectionLineNumberingSchema2, sectionPageNumberingSchema2, sectionHeaderFooterRefsSchema2, sectionBorderSpecSchema2, sectionPageBordersSchema2, sectionInfoSchema, sectionResolvedHandleSchema, sectionDomainItemSchema, sectionsListResultSchema, sectionMutationSuccessSchema2, documentMutationSuccessSchema2, paragraphMutationTargetSchema2, paragraphMutationSuccessSchema2, createSectionBreakSuccessSchema2, commentInfoSchema, commentDomainItemSchema, commentsListResultSchema, trackChangeWordRevisionIdsSchema2, trackChangeInfoSchema, trackChangeDomainItemSchema, trackChangesListResultSchema, capabilityReasonCodeSchema, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, inlinePropertyCapabilitiesByKeySchema, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, capabilitiesOutputSchema, strictEmptyObjectSchema, tableBorderColorPattern = "^([0-9A-Fa-f]{6}|auto)$", tableBorderSpecSchema, nullableTableBorderSpecSchema2, sdFragmentSchema2, placementSchema2, nestingPolicySchema2, insertInputSchema, tableLocatorSchema, cellLocatorSchema, cellOrTableScopedCellLocatorSchema, tableOrCellLocatorSchema, mergeRangeLocatorSchema, tableCreateLocationSchema2, tableMutationSuccessSchema, createTableSuccessSchema, tableMutationFailureCodes, tableMutationFailureSchema, tableMutationResultSchema, createTableResultSchema, historyActionSuccessSchema, historyActionFailureSchema, formatInlineAliasOperationSchemas2, tocMutationFailureCodes, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureCodes, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, hyperlinkTargetSchema2, hyperlinkReadPropertiesSchema2, hyperlinkDestinationSchema, hyperlinkSpecSchema2, hyperlinkPatchSchema2, hyperlinkDomainSchema2, hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureCodes, hyperlinkMutationFailureSchema2, hyperlinkInfoSchema, contentControlTargetSchema2, contentControlMutationSuccessSchema2, contentControlMutationFailureSchema2, ccListResultSchema2, ccInfoSchema2, refListQuerySchema, discoveryOutputSchema, receiptFailureSchema, refFailureSchema2, bookmarkAddressSchema2, bookmarkMutation2, footnoteAddressSchema2, footnoteConfigScopeSchema2, footnoteNumberingSchema2, footnoteMutation2, footnoteConfig2, crossRefAddressSchema2, crossRefTargetSchema2, crossRefDisplaySchema2, crossRefMutation2, indexAddressSchema2, indexEntryAddressSchema2, indexConfigSchema2, indexEntryDataSchema2, indexEntryPatchSchema2, indexMutation2, indexEntryMutation2, captionAddressSchema2, captionMutation2, captionConfig2, fieldAddressSchema2, fieldMutation2, citationAddressSchema2, citationSourceAddressSchema2, bibliographyAddressSchema2, citationMutation2, citationSourceMutation2, bibliographyMutation2, citationPersonSchema2, citationSourceFieldsSchema2, tocCreateLocationSchema2, authoritiesAddressSchema2, authorityEntryAddressSchema2, authoritiesConfigSchema2, authorityEntryDataSchema2, authorityEntryPatchSchema2, authoritiesMutation2, authorityEntryMutation2, diffCoverageSchema2, diffSummarySchema2, diffSnapshotSchema2, diffPayloadSchema2, diffApplyResultSchema, operationSchemas;
|
|
335985
|
+
var nodeTypeValues2, blockNodeTypeValues2, deletableBlockNodeTypeValues2, inlineNodeTypeValues2, knownTargetKindValues, SHARED_DEFS, rangeSchema2, positionSchema, inlineAnchorSchema, targetKindSchema, textAddressSchema2, textTargetSchema2, blockNodeAddressSchema2, deletableBlockNodeAddressSchema2, tableAddressSchema2, tableRowAddressSchema2, tableCellAddressSchema2, tableOrCellAddressSchema2, paragraphAddressSchema2, headingAddressSchema2, listItemAddressSchema2, paragraphTargetSchema2, sectionAddressSchema2, inlineNodeAddressSchema, nodeAddressSchema2, commentAddressSchema2, trackedChangeAddressSchema2, entityAddressSchema2, selectionTargetSchema2, targetLocatorSchema, deleteBehaviorSchema2, resolvedHandleSchema2, pageInfoSchema2, receiptSuccessSchema2, textMutationRangeSchema2, textMutationResolutionSchema2, textMutationSuccessSchema2, matchRunSchema, matchBlockSchema2, storyLocatorSchema2, trackChangeRefSchema2, createParagraphSuccessSchema2, createHeadingSuccessSchema2, headingLevelSchema2, listsInsertSuccessSchema2, listsMutateItemSuccessSchema2, listsExitSuccessSchema, nodeSummarySchema, nodeInfoSchema, matchContextSchema, unknownNodeDiagnosticSchema, textSelectorSchema2, nodeSelectorSchema2, selectorShorthandSchema, sdTextSelectorSchema, sdNodeSelectorSchema, sdSelectorSchema, sdReadOptionsSchema, sdFindInputSchema, sdNodeResultSchema, sdFindResultSchema, sdMutationResolutionSchema2, sdMutationSuccessSchema2, documentInfoCountsSchema2, documentInfoOutlineItemSchema2, documentInfoCapabilitiesSchema2, documentStyleInfoSchema, documentStylesSchema2, documentDefaultsSchema2, documentInfoSchema, listKindSchema2, listInsertPositionSchema2, listItemInfoSchema, listItemDomainItemSchema, listsListResultSchema, sectionBreakTypeSchema2, sectionOrientationSchema2, sectionVerticalAlignSchema2, sectionDirectionSchema2, sectionHeaderFooterKindSchema2, sectionHeaderFooterVariantSchema2, sectionLineNumberRestartSchema2, sectionPageNumberFormatSchema2, sectionRangeDomainSchema2, sectionPageMarginsSchema2, sectionHeaderFooterMarginsSchema2, sectionPageSetupSchema2, sectionColumnsSchema2, sectionLineNumberingSchema2, sectionPageNumberingSchema2, sectionHeaderFooterRefsSchema2, sectionBorderSpecSchema2, sectionPageBordersSchema2, sectionInfoSchema, sectionResolvedHandleSchema, sectionDomainItemSchema, sectionsListResultSchema, sectionMutationSuccessSchema2, documentMutationSuccessSchema2, paragraphMutationTargetSchema2, paragraphMutationSuccessSchema2, createSectionBreakSuccessSchema2, commentInfoSchema, commentDomainItemSchema, commentsListResultSchema, trackChangeWordRevisionIdsSchema2, trackChangeInfoSchema, trackChangeDomainItemSchema, trackChangesListResultSchema, capabilityReasonCodeSchema, capabilityReasonsSchema2, capabilityFlagSchema2, operationRuntimeCapabilitySchema2, operationCapabilitiesSchema2, inlinePropertyCapabilitySchema2, inlinePropertyCapabilitiesByKeySchema, formatCapabilitiesSchema2, planEngineCapabilitiesSchema2, capabilitiesOutputSchema, strictEmptyObjectSchema, tableBorderColorPattern = "^([0-9A-Fa-f]{6}|auto)$", tableBorderSpecSchema, nullableTableBorderSpecSchema2, sdFragmentSchema2, placementSchema2, nestingPolicySchema2, insertInputSchema, tableLocatorSchema, cellLocatorSchema, cellOrTableScopedCellLocatorSchema, tableOrCellLocatorSchema, mergeRangeLocatorSchema, tableCreateLocationSchema2, tableMutationSuccessSchema, createTableSuccessSchema, tableMutationFailureCodes, tableMutationFailureSchema, tableMutationResultSchema, createTableResultSchema, historyActionSuccessSchema, historyActionFailureSchema, formatInlineAliasOperationSchemas2, tocMutationFailureCodes, tocMutationFailureSchema2, tocMutationSuccessSchema2, tocEntryMutationFailureCodes, tocEntryMutationFailureSchema2, tocEntryMutationSuccessSchema2, hyperlinkTargetSchema2, hyperlinkReadPropertiesSchema2, hyperlinkDestinationSchema, hyperlinkSpecSchema2, hyperlinkPatchSchema2, hyperlinkDomainSchema2, hyperlinkMutationSuccessSchema2, hyperlinkMutationFailureCodes, hyperlinkMutationFailureSchema2, hyperlinkInfoSchema, contentControlTargetSchema2, contentControlMutationSuccessSchema2, contentControlMutationFailureSchema2, ccListResultSchema2, ccInfoSchema2, refListQueryProperties2, refListQuerySchema, discoveryOutputSchema, receiptFailureSchema, refFailureSchema2, bookmarkAddressSchema2, bookmarkMutation2, footnoteAddressSchema2, footnoteConfigScopeSchema2, footnoteNumberingSchema2, footnoteMutation2, footnoteConfig2, crossRefAddressSchema2, crossRefTargetSchema2, crossRefDisplaySchema2, crossRefMutation2, indexAddressSchema2, indexEntryAddressSchema2, indexConfigSchema2, indexEntryDataSchema2, indexEntryPatchSchema2, indexMutation2, indexEntryMutation2, captionAddressSchema2, captionMutation2, captionConfig2, fieldAddressSchema2, fieldMutation2, citationAddressSchema2, citationSourceAddressSchema2, bibliographyAddressSchema2, citationMutation2, citationSourceMutation2, bibliographyMutation2, citationPersonSchema2, citationSourceFieldsSchema2, tocCreateLocationSchema2, authoritiesAddressSchema2, authorityEntryAddressSchema2, authoritiesConfigSchema2, authorityEntryDataSchema2, authorityEntryPatchSchema2, authoritiesMutation2, authorityEntryMutation2, diffCoverageSchema2, diffSummarySchema2, diffSnapshotSchema2, diffPayloadSchema2, diffApplyResultSchema, operationSchemas;
|
|
335487
335986
|
var init_schemas4 = __esm(() => {
|
|
335488
335987
|
init_command_catalog();
|
|
335489
335988
|
init_types4();
|
|
@@ -335537,7 +336036,8 @@ var init_schemas4 = __esm(() => {
|
|
|
335537
336036
|
}, ["blockId", "range"]),
|
|
335538
336037
|
TextTarget: objectSchema2({
|
|
335539
336038
|
kind: { const: "text" },
|
|
335540
|
-
segments: { type: "array", items: ref3("TextSegment"), minItems: 1 }
|
|
336039
|
+
segments: { type: "array", items: ref3("TextSegment"), minItems: 1 },
|
|
336040
|
+
story: ref3("StoryLocator")
|
|
335541
336041
|
}, ["kind", "segments"]),
|
|
335542
336042
|
SelectionEdgeNodeAddress: objectSchema2({
|
|
335543
336043
|
kind: { const: "block" },
|
|
@@ -336560,10 +337060,11 @@ var init_schemas4 = __esm(() => {
|
|
|
336560
337060
|
}, ["success", "failure"]);
|
|
336561
337061
|
ccListResultSchema2 = objectSchema2({ items: { type: "array", items: { type: "object" } }, total: { type: "integer" } }, ["items", "total"]);
|
|
336562
337062
|
ccInfoSchema2 = { type: "object", description: "ContentControlInfo" };
|
|
336563
|
-
|
|
337063
|
+
refListQueryProperties2 = {
|
|
336564
337064
|
limit: { type: "integer", minimum: 1 },
|
|
336565
337065
|
offset: { type: "integer", minimum: 0 }
|
|
336566
|
-
}
|
|
337066
|
+
};
|
|
337067
|
+
refListQuerySchema = objectSchema2(refListQueryProperties2);
|
|
336567
337068
|
discoveryOutputSchema = { type: "object" };
|
|
336568
337069
|
receiptFailureSchema = objectSchema2({
|
|
336569
337070
|
code: { type: "string" },
|
|
@@ -336574,7 +337075,12 @@ var init_schemas4 = __esm(() => {
|
|
|
336574
337075
|
"success",
|
|
336575
337076
|
"failure"
|
|
336576
337077
|
]);
|
|
336577
|
-
bookmarkAddressSchema2 = objectSchema2({
|
|
337078
|
+
bookmarkAddressSchema2 = objectSchema2({
|
|
337079
|
+
kind: { const: "entity" },
|
|
337080
|
+
entityType: { const: "bookmark" },
|
|
337081
|
+
name: { type: "string" },
|
|
337082
|
+
story: ref3("StoryLocator")
|
|
337083
|
+
}, ["kind", "entityType", "name"]);
|
|
336578
337084
|
bookmarkMutation2 = refMutationSchemas2({ bookmark: bookmarkAddressSchema2 }, ["bookmark"]);
|
|
336579
337085
|
footnoteAddressSchema2 = objectSchema2({ kind: { const: "entity" }, entityType: { const: "footnote" }, noteId: { type: "string" } }, ["kind", "entityType", "noteId"]);
|
|
336580
337086
|
footnoteConfigScopeSchema2 = {
|
|
@@ -339942,7 +340448,10 @@ var init_schemas4 = __esm(() => {
|
|
|
339942
340448
|
},
|
|
339943
340449
|
...buildContentControlSchemas2(),
|
|
339944
340450
|
"bookmarks.list": {
|
|
339945
|
-
input:
|
|
340451
|
+
input: objectSchema2({
|
|
340452
|
+
...refListQueryProperties2,
|
|
340453
|
+
in: storyLocatorSchema2
|
|
340454
|
+
}),
|
|
339946
340455
|
output: discoveryOutputSchema
|
|
339947
340456
|
},
|
|
339948
340457
|
"bookmarks.get": {
|
|
@@ -343432,7 +343941,7 @@ var init_diff = __esm(() => {
|
|
|
343432
343941
|
});
|
|
343433
343942
|
|
|
343434
343943
|
// ../../packages/document-api/src/tables/tables.ts
|
|
343435
|
-
function
|
|
343944
|
+
function isObjectRecord4(value) {
|
|
343436
343945
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
343437
343946
|
}
|
|
343438
343947
|
function validateTableLocator2(input2, operationName) {
|
|
@@ -343459,7 +343968,7 @@ function validateRowLocator2(input2, operationName) {
|
|
|
343459
343968
|
}
|
|
343460
343969
|
return;
|
|
343461
343970
|
}
|
|
343462
|
-
if (!
|
|
343971
|
+
if (!isObjectRecord4(input2.target) || input2.target.kind !== "block")
|
|
343463
343972
|
return;
|
|
343464
343973
|
if (input2.target.nodeType === "table" && input2.rowIndex == null) {
|
|
343465
343974
|
throw new DocumentApiValidationError3("INVALID_TARGET", `${operationName}: rowIndex is required when target is a table.`);
|
|
@@ -343479,7 +343988,7 @@ function validateCellOrTableScopedCellLocator2(input2, operationName) {
|
|
|
343479
343988
|
throw new DocumentApiValidationError3("INVALID_TARGET", `${operationName}: both rowIndex and columnIndex are required when using table-scoped cell targeting. ` + `Provide both or neither.`, { fields: ["rowIndex", "columnIndex"] });
|
|
343480
343989
|
}
|
|
343481
343990
|
const hasCoordinates = hasTableScopedCellCoordinates2(input2);
|
|
343482
|
-
if (
|
|
343991
|
+
if (isObjectRecord4(input2.target) && input2.target.kind === "block") {
|
|
343483
343992
|
if (input2.target.nodeType === "tableCell" && hasCoordinates) {
|
|
343484
343993
|
throw new DocumentApiValidationError3("INVALID_TARGET", `${operationName}: rowIndex/columnIndex must not be provided when target is a cell node. ` + `Either pass a table target with coordinates, or pass a cell target without coordinates.`, { fields: ["rowIndex", "columnIndex"] });
|
|
343485
343994
|
}
|
|
@@ -345112,8 +345621,14 @@ function validateBookmarkTarget2(target, operationName) {
|
|
|
345112
345621
|
if (t.kind !== "entity" || t.entityType !== "bookmark" || typeof t.name !== "string") {
|
|
345113
345622
|
throw new DocumentApiValidationError3("INVALID_TARGET", `${operationName} target must be a BookmarkAddress with kind 'entity', entityType 'bookmark', and a string name.`, { target });
|
|
345114
345623
|
}
|
|
345624
|
+
if (t.story !== undefined) {
|
|
345625
|
+
validateStoryLocator2(t.story, `${operationName}.target.story`);
|
|
345626
|
+
}
|
|
345115
345627
|
}
|
|
345116
345628
|
function executeBookmarksList2(adapter, query2) {
|
|
345629
|
+
if (query2?.in !== undefined) {
|
|
345630
|
+
validateStoryLocator2(query2.in, "bookmarks.list.in");
|
|
345631
|
+
}
|
|
345117
345632
|
return adapter.list(query2);
|
|
345118
345633
|
}
|
|
345119
345634
|
function executeBookmarksGet2(adapter, input2) {
|
|
@@ -345140,6 +345655,7 @@ function executeBookmarksRemove2(adapter, input2, options) {
|
|
|
345140
345655
|
var init_bookmarks = __esm(() => {
|
|
345141
345656
|
init_errors5();
|
|
345142
345657
|
init_validation_primitives();
|
|
345658
|
+
init_story_validator();
|
|
345143
345659
|
});
|
|
345144
345660
|
|
|
345145
345661
|
// ../../packages/document-api/src/protection/protection.ts
|
|
@@ -364509,6 +365025,12 @@ var init_section_mutation_wrapper = __esm(() => {
|
|
|
364509
365025
|
init_section_projection_access();
|
|
364510
365026
|
});
|
|
364511
365027
|
|
|
365028
|
+
// ../../packages/super-editor/src/editors/v1/core/presentation-editor/header-footer/header-footer-variant.ts
|
|
365029
|
+
var VALID_VARIANTS2;
|
|
365030
|
+
var init_header_footer_variant = __esm(() => {
|
|
365031
|
+
VALID_VARIANTS2 = new Set(["default", "first", "even"]);
|
|
365032
|
+
});
|
|
365033
|
+
|
|
364512
365034
|
// ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/header-footer-slot-materialization.ts
|
|
364513
365035
|
function cleanupCreatedPart2(editor, partPath) {
|
|
364514
365036
|
const partId = partPath;
|
|
@@ -364588,7 +365110,6 @@ function ensureExplicitHeaderFooterSlot2(editor, input2) {
|
|
|
364588
365110
|
}
|
|
364589
365111
|
return result;
|
|
364590
365112
|
}
|
|
364591
|
-
var VALID_VARIANTS2;
|
|
364592
365113
|
var init_header_footer_slot_materialization = __esm(() => {
|
|
364593
365114
|
init_sections_resolver();
|
|
364594
365115
|
init_section_projection_access();
|
|
@@ -364598,7 +365119,7 @@ var init_header_footer_slot_materialization = __esm(() => {
|
|
|
364598
365119
|
init_section_mutation_wrapper();
|
|
364599
365120
|
init_compound_mutation();
|
|
364600
365121
|
init_part_invalidation_registry();
|
|
364601
|
-
|
|
365122
|
+
init_header_footer_variant();
|
|
364602
365123
|
});
|
|
364603
365124
|
|
|
364604
365125
|
// ../../packages/super-editor/src/editors/v1/document-api-adapters/story-runtime/header-footer-story-runtime.ts
|
|
@@ -452731,7 +453252,86 @@ var init_header_footers_adapter = __esm(() => {
|
|
|
452731
453252
|
FOOTER_FILE_PATTERN4 = /footer(\d+)\.xml$/;
|
|
452732
453253
|
});
|
|
452733
453254
|
|
|
453255
|
+
// ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/note-entry-lookup.ts
|
|
453256
|
+
function isSpecialEntry2(entry) {
|
|
453257
|
+
return SPECIAL_NOTE_TYPES2.has(entry.type ?? "");
|
|
453258
|
+
}
|
|
453259
|
+
function normalizeNoteId2(entry) {
|
|
453260
|
+
return String(entry.id ?? "");
|
|
453261
|
+
}
|
|
453262
|
+
function findNoteEntryById2(entries, noteId) {
|
|
453263
|
+
if (!Array.isArray(entries))
|
|
453264
|
+
return;
|
|
453265
|
+
let fallback;
|
|
453266
|
+
for (const entry of entries) {
|
|
453267
|
+
if (String(entry.id ?? "") !== noteId)
|
|
453268
|
+
continue;
|
|
453269
|
+
if (!isSpecialEntry2(entry))
|
|
453270
|
+
return entry;
|
|
453271
|
+
fallback ??= entry;
|
|
453272
|
+
}
|
|
453273
|
+
return fallback;
|
|
453274
|
+
}
|
|
453275
|
+
function enumerateEffectiveNoteEntries2(entries) {
|
|
453276
|
+
if (!Array.isArray(entries))
|
|
453277
|
+
return [];
|
|
453278
|
+
const orderedIds = [];
|
|
453279
|
+
const effectiveById = new Map;
|
|
453280
|
+
for (const entry of entries) {
|
|
453281
|
+
const noteId = normalizeNoteId2(entry);
|
|
453282
|
+
if (!effectiveById.has(noteId)) {
|
|
453283
|
+
orderedIds.push(noteId);
|
|
453284
|
+
effectiveById.set(noteId, entry);
|
|
453285
|
+
continue;
|
|
453286
|
+
}
|
|
453287
|
+
const current = effectiveById.get(noteId);
|
|
453288
|
+
if (isSpecialEntry2(current) && !isSpecialEntry2(entry)) {
|
|
453289
|
+
effectiveById.set(noteId, entry);
|
|
453290
|
+
}
|
|
453291
|
+
}
|
|
453292
|
+
return orderedIds.map((noteId) => effectiveById.get(noteId));
|
|
453293
|
+
}
|
|
453294
|
+
var SPECIAL_NOTE_TYPES2;
|
|
453295
|
+
var init_note_entry_lookup = __esm(() => {
|
|
453296
|
+
SPECIAL_NOTE_TYPES2 = new Set(["separator", "continuationSeparator"]);
|
|
453297
|
+
});
|
|
453298
|
+
|
|
452734
453299
|
// ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/bookmark-resolver.ts
|
|
453300
|
+
function normalizeStory2(locator) {
|
|
453301
|
+
if (!locator || locator.storyType === "body")
|
|
453302
|
+
return;
|
|
453303
|
+
return locator;
|
|
453304
|
+
}
|
|
453305
|
+
function buildBookmarkAddress2(name, story) {
|
|
453306
|
+
const normalizedStory = normalizeStory2(story);
|
|
453307
|
+
return normalizedStory ? { kind: "entity", entityType: "bookmark", name, story: normalizedStory } : { kind: "entity", entityType: "bookmark", name };
|
|
453308
|
+
}
|
|
453309
|
+
function findAllBookmarksInDocument2(editor) {
|
|
453310
|
+
return collectFromDocumentStories2(editor, {
|
|
453311
|
+
collectFromDoc: collectBookmarksFromDoc2,
|
|
453312
|
+
collectFromPmJson: collectBookmarksFromPmJson2
|
|
453313
|
+
});
|
|
453314
|
+
}
|
|
453315
|
+
function findAllBookmarkMarkersInDocument2(editor) {
|
|
453316
|
+
return collectFromDocumentStories2(editor, {
|
|
453317
|
+
collectFromDoc: collectBookmarkMarkersFromDoc2,
|
|
453318
|
+
collectFromPmJson: collectBookmarkMarkersFromPmJson2
|
|
453319
|
+
});
|
|
453320
|
+
}
|
|
453321
|
+
function collectFromDocumentStories2(editor, collector) {
|
|
453322
|
+
const results = [];
|
|
453323
|
+
const seenStoryKeys = new Set;
|
|
453324
|
+
const converter = editor.converter;
|
|
453325
|
+
seenStoryKeys.add(BODY_STORY_KEY2);
|
|
453326
|
+
collector.collectFromDoc(editor.state.doc, BODY_STORY_KEY2, results);
|
|
453327
|
+
collectFromHeaderFooterEditors2(editor, converter?.headerEditors, results, seenStoryKeys, collector);
|
|
453328
|
+
collectFromHeaderFooterEditors2(editor, converter?.footerEditors, results, seenStoryKeys, collector);
|
|
453329
|
+
collectFromHeaderFooterCache2(editor, converter?.headers, results, seenStoryKeys, collector);
|
|
453330
|
+
collectFromHeaderFooterCache2(editor, converter?.footers, results, seenStoryKeys, collector);
|
|
453331
|
+
collectFromNotes2(editor, converter?.footnotes, "footnote", results, seenStoryKeys, collector);
|
|
453332
|
+
collectFromNotes2(editor, converter?.endnotes, "endnote", results, seenStoryKeys, collector);
|
|
453333
|
+
return results;
|
|
453334
|
+
}
|
|
452735
453335
|
function findAllBookmarks2(doc6) {
|
|
452736
453336
|
const results = [];
|
|
452737
453337
|
const endPositions = collectBookmarkEndPositions2(doc6);
|
|
@@ -452758,6 +453358,146 @@ function collectBookmarkEndPositions2(doc6) {
|
|
|
452758
453358
|
});
|
|
452759
453359
|
return map10;
|
|
452760
453360
|
}
|
|
453361
|
+
function collectBookmarksFromDoc2(doc6, storyKey, results) {
|
|
453362
|
+
doc6.descendants((node4) => {
|
|
453363
|
+
if (node4.type.name === "bookmarkStart") {
|
|
453364
|
+
results.push({
|
|
453365
|
+
name: readBookmarkName2(node4.attrs),
|
|
453366
|
+
bookmarkId: readBookmarkId2(node4.attrs),
|
|
453367
|
+
storyKey
|
|
453368
|
+
});
|
|
453369
|
+
}
|
|
453370
|
+
return true;
|
|
453371
|
+
});
|
|
453372
|
+
}
|
|
453373
|
+
function collectBookmarkMarkersFromDoc2(doc6, storyKey, results) {
|
|
453374
|
+
doc6.descendants((node4) => {
|
|
453375
|
+
if (!isBookmarkMarkerType2(node4.type.name))
|
|
453376
|
+
return true;
|
|
453377
|
+
const bookmarkId = readBookmarkId2(node4.attrs);
|
|
453378
|
+
if (bookmarkId) {
|
|
453379
|
+
results.push({ bookmarkId, storyKey, markerType: node4.type.name });
|
|
453380
|
+
}
|
|
453381
|
+
return true;
|
|
453382
|
+
});
|
|
453383
|
+
}
|
|
453384
|
+
function collectFromHeaderFooterEditors2(hostEditor, editors, results, seenStoryKeys, collector) {
|
|
453385
|
+
if (!Array.isArray(editors))
|
|
453386
|
+
return;
|
|
453387
|
+
for (const entry of editors) {
|
|
453388
|
+
const refId = typeof entry?.id === "string" && entry.id.length > 0 ? entry.id : null;
|
|
453389
|
+
const storyEditor = entry?.editor;
|
|
453390
|
+
if (!refId || !storyEditor?.state?.doc)
|
|
453391
|
+
continue;
|
|
453392
|
+
const storyKey = buildStoryKey2({ kind: "story", storyType: "headerFooterPart", refId });
|
|
453393
|
+
if (seenStoryKeys.has(storyKey))
|
|
453394
|
+
continue;
|
|
453395
|
+
seenStoryKeys.add(storyKey);
|
|
453396
|
+
collectFromLiveOrDoc2(hostEditor, storyKey, storyEditor.state.doc, results, collector);
|
|
453397
|
+
}
|
|
453398
|
+
}
|
|
453399
|
+
function collectFromHeaderFooterCache2(hostEditor, collection, results, seenStoryKeys, collector) {
|
|
453400
|
+
if (!collection || typeof collection !== "object")
|
|
453401
|
+
return;
|
|
453402
|
+
for (const [refId, pmJson] of Object.entries(collection)) {
|
|
453403
|
+
if (typeof refId !== "string" || refId.length === 0)
|
|
453404
|
+
continue;
|
|
453405
|
+
const storyKey = buildStoryKey2({ kind: "story", storyType: "headerFooterPart", refId });
|
|
453406
|
+
if (seenStoryKeys.has(storyKey))
|
|
453407
|
+
continue;
|
|
453408
|
+
seenStoryKeys.add(storyKey);
|
|
453409
|
+
collectFromLiveOrPmJson2(hostEditor, storyKey, pmJson, results, collector);
|
|
453410
|
+
}
|
|
453411
|
+
}
|
|
453412
|
+
function collectFromNotes2(hostEditor, notes, storyType, results, seenStoryKeys, collector) {
|
|
453413
|
+
for (const note of enumerateEffectiveNoteEntries2(notes)) {
|
|
453414
|
+
const noteId = note?.id != null ? String(note.id) : "";
|
|
453415
|
+
if (!noteId)
|
|
453416
|
+
continue;
|
|
453417
|
+
const pmJson = getNotePmJson2(note);
|
|
453418
|
+
if (!pmJson)
|
|
453419
|
+
continue;
|
|
453420
|
+
const storyKey = buildStoryKey2({ kind: "story", storyType, noteId });
|
|
453421
|
+
if (seenStoryKeys.has(storyKey))
|
|
453422
|
+
continue;
|
|
453423
|
+
seenStoryKeys.add(storyKey);
|
|
453424
|
+
collectFromLiveOrPmJson2(hostEditor, storyKey, pmJson, results, collector);
|
|
453425
|
+
}
|
|
453426
|
+
}
|
|
453427
|
+
function collectFromLiveOrDoc2(hostEditor, storyKey, fallbackDoc, results, collector) {
|
|
453428
|
+
const liveDoc = resolveLiveStorySessionRuntime2(hostEditor, storyKey)?.editor?.state?.doc;
|
|
453429
|
+
collector.collectFromDoc(liveDoc ?? fallbackDoc, storyKey, results);
|
|
453430
|
+
}
|
|
453431
|
+
function collectFromLiveOrPmJson2(hostEditor, storyKey, fallbackPmJson, results, collector) {
|
|
453432
|
+
const liveDoc = resolveLiveStorySessionRuntime2(hostEditor, storyKey)?.editor?.state?.doc;
|
|
453433
|
+
if (liveDoc) {
|
|
453434
|
+
collector.collectFromDoc(liveDoc, storyKey, results);
|
|
453435
|
+
return;
|
|
453436
|
+
}
|
|
453437
|
+
collector.collectFromPmJson(fallbackPmJson, storyKey, results);
|
|
453438
|
+
}
|
|
453439
|
+
function getNotePmJson2(note) {
|
|
453440
|
+
if (Array.isArray(note.content)) {
|
|
453441
|
+
return {
|
|
453442
|
+
type: "doc",
|
|
453443
|
+
content: note.content.length > 0 ? note.content : [{ type: "paragraph" }]
|
|
453444
|
+
};
|
|
453445
|
+
}
|
|
453446
|
+
if (note.doc && typeof note.doc === "object") {
|
|
453447
|
+
return note.doc;
|
|
453448
|
+
}
|
|
453449
|
+
return null;
|
|
453450
|
+
}
|
|
453451
|
+
function collectBookmarksFromPmJson2(pmJson, storyKey, results) {
|
|
453452
|
+
if (!isObjectRecord5(pmJson))
|
|
453453
|
+
return;
|
|
453454
|
+
visitPmJson2(pmJson, (node4) => {
|
|
453455
|
+
if (node4.type !== "bookmarkStart")
|
|
453456
|
+
return;
|
|
453457
|
+
const name = readBookmarkName2(node4.attrs);
|
|
453458
|
+
const bookmarkId = readBookmarkId2(node4.attrs);
|
|
453459
|
+
results.push({ name, bookmarkId, storyKey });
|
|
453460
|
+
});
|
|
453461
|
+
}
|
|
453462
|
+
function collectBookmarkMarkersFromPmJson2(pmJson, storyKey, results) {
|
|
453463
|
+
if (!isObjectRecord5(pmJson))
|
|
453464
|
+
return;
|
|
453465
|
+
visitPmJson2(pmJson, (node4) => {
|
|
453466
|
+
if (!isBookmarkMarkerType2(node4.type))
|
|
453467
|
+
return;
|
|
453468
|
+
const bookmarkId = readBookmarkId2(node4.attrs);
|
|
453469
|
+
if (bookmarkId) {
|
|
453470
|
+
results.push({ bookmarkId, storyKey, markerType: node4.type });
|
|
453471
|
+
}
|
|
453472
|
+
});
|
|
453473
|
+
}
|
|
453474
|
+
function visitPmJson2(node4, visitor) {
|
|
453475
|
+
visitor(node4);
|
|
453476
|
+
const content5 = node4.content;
|
|
453477
|
+
if (!Array.isArray(content5))
|
|
453478
|
+
return;
|
|
453479
|
+
for (const child of content5) {
|
|
453480
|
+
if (isObjectRecord5(child)) {
|
|
453481
|
+
visitPmJson2(child, visitor);
|
|
453482
|
+
}
|
|
453483
|
+
}
|
|
453484
|
+
}
|
|
453485
|
+
function isObjectRecord5(value) {
|
|
453486
|
+
return typeof value === "object" && value !== null;
|
|
453487
|
+
}
|
|
453488
|
+
function isBookmarkMarkerType2(type) {
|
|
453489
|
+
return type === "bookmarkStart" || type === "bookmarkEnd";
|
|
453490
|
+
}
|
|
453491
|
+
function readBookmarkId2(attrs) {
|
|
453492
|
+
if (!isObjectRecord5(attrs) || attrs.id == null)
|
|
453493
|
+
return "";
|
|
453494
|
+
return String(attrs.id);
|
|
453495
|
+
}
|
|
453496
|
+
function readBookmarkName2(attrs) {
|
|
453497
|
+
if (!isObjectRecord5(attrs) || typeof attrs.name !== "string")
|
|
453498
|
+
return "";
|
|
453499
|
+
return attrs.name;
|
|
453500
|
+
}
|
|
452761
453501
|
function resolveBookmarkTarget2(doc6, target) {
|
|
452762
453502
|
const all6 = findAllBookmarks2(doc6);
|
|
452763
453503
|
const found3 = all6.find((b2) => b2.name === target.name);
|
|
@@ -452777,13 +453517,13 @@ function nodePositionToPosition2(doc6, pos) {
|
|
|
452777
453517
|
}
|
|
452778
453518
|
return { blockId: "", offset: pos };
|
|
452779
453519
|
}
|
|
452780
|
-
function extractBookmarkInfo2(doc6, resolved) {
|
|
453520
|
+
function extractBookmarkInfo2(doc6, resolved, story) {
|
|
452781
453521
|
const from4 = nodePositionToPosition2(doc6, resolved.pos);
|
|
452782
453522
|
const to = resolved.endPos !== null ? nodePositionToPosition2(doc6, resolved.endPos) : from4;
|
|
452783
453523
|
const colFirst = resolved.node.attrs?.colFirst;
|
|
452784
453524
|
const colLast = resolved.node.attrs?.colLast;
|
|
452785
453525
|
const info = {
|
|
452786
|
-
address:
|
|
453526
|
+
address: buildBookmarkAddress2(resolved.name, story),
|
|
452787
453527
|
name: resolved.name,
|
|
452788
453528
|
bookmarkId: resolved.bookmarkId,
|
|
452789
453529
|
range: { from: from4, to }
|
|
@@ -452793,13 +453533,13 @@ function extractBookmarkInfo2(doc6, resolved) {
|
|
|
452793
453533
|
}
|
|
452794
453534
|
return info;
|
|
452795
453535
|
}
|
|
452796
|
-
function buildBookmarkDiscoveryItem2(doc6, resolved, evaluatedRevision) {
|
|
453536
|
+
function buildBookmarkDiscoveryItem2(doc6, resolved, evaluatedRevision, story, idScope) {
|
|
452797
453537
|
const from4 = nodePositionToPosition2(doc6, resolved.pos);
|
|
452798
453538
|
const to = resolved.endPos !== null ? nodePositionToPosition2(doc6, resolved.endPos) : from4;
|
|
452799
453539
|
const colFirst = resolved.node.attrs?.colFirst;
|
|
452800
453540
|
const colLast = resolved.node.attrs?.colLast;
|
|
452801
453541
|
const domain4 = {
|
|
452802
|
-
address:
|
|
453542
|
+
address: buildBookmarkAddress2(resolved.name, story),
|
|
452803
453543
|
name: resolved.name,
|
|
452804
453544
|
bookmarkId: resolved.bookmarkId,
|
|
452805
453545
|
range: { from: from4, to }
|
|
@@ -452808,12 +453548,16 @@ function buildBookmarkDiscoveryItem2(doc6, resolved, evaluatedRevision) {
|
|
|
452808
453548
|
domain4.tableColumn = { colFirst, colLast };
|
|
452809
453549
|
}
|
|
452810
453550
|
const handle4 = buildResolvedHandle2(resolved.name, "stable", "node");
|
|
452811
|
-
const
|
|
453551
|
+
const idPrefix = idScope ? `bookmark:${encodeURIComponent(idScope)}:` : "bookmark:";
|
|
453552
|
+
const id2 = `${idPrefix}${encodeURIComponent(resolved.name)}:${encodeURIComponent(evaluatedRevision)}`;
|
|
452812
453553
|
return buildDiscoveryItem2(id2, handle4, domain4);
|
|
452813
453554
|
}
|
|
452814
453555
|
var init_bookmark_resolver = __esm(() => {
|
|
452815
453556
|
init_src();
|
|
452816
453557
|
init_errors4();
|
|
453558
|
+
init_story_key();
|
|
453559
|
+
init_live_story_session_runtime_registry();
|
|
453560
|
+
init_note_entry_lookup();
|
|
452817
453561
|
});
|
|
452818
453562
|
|
|
452819
453563
|
// ../../packages/super-editor/src/editors/v1/document-api-adapters/plan-engine/bookmark-wrappers.ts
|
|
@@ -452836,23 +453580,116 @@ function parseBookmarkId2(raw) {
|
|
|
452836
453580
|
const parsed = Number.parseInt(raw, 10);
|
|
452837
453581
|
return Number.isInteger(parsed) && parsed >= 0 ? parsed : null;
|
|
452838
453582
|
}
|
|
452839
|
-
function allocateBookmarkId2(
|
|
453583
|
+
function allocateBookmarkId2(editor) {
|
|
453584
|
+
const entries = findAllBookmarkMarkersInDocument2(editor);
|
|
452840
453585
|
let maxId = -1;
|
|
452841
|
-
|
|
452842
|
-
|
|
452843
|
-
return true;
|
|
452844
|
-
const id2 = parseBookmarkId2(node4.attrs?.id);
|
|
453586
|
+
for (const entry of entries) {
|
|
453587
|
+
const id2 = parseBookmarkId2(entry.bookmarkId);
|
|
452845
453588
|
if (id2 !== null && id2 > maxId)
|
|
452846
453589
|
maxId = id2;
|
|
452847
|
-
|
|
452848
|
-
});
|
|
453590
|
+
}
|
|
452849
453591
|
return String(maxId + 1);
|
|
452850
453592
|
}
|
|
453593
|
+
function bookmarkExistsAnywhere2(editor, name, exclude, preCollected) {
|
|
453594
|
+
const entries = preCollected ?? findAllBookmarksInDocument2(editor);
|
|
453595
|
+
return entries.some((bookmark) => {
|
|
453596
|
+
if (bookmark.name !== name)
|
|
453597
|
+
return false;
|
|
453598
|
+
if (!exclude)
|
|
453599
|
+
return true;
|
|
453600
|
+
return !(bookmark.storyKey === exclude.storyKey && bookmark.bookmarkId === exclude.bookmarkId);
|
|
453601
|
+
});
|
|
453602
|
+
}
|
|
453603
|
+
function collectBookmarkStorySnapshots2(editor, entries) {
|
|
453604
|
+
const storyKeys = [...new Set(entries.map((entry) => entry.storyKey))];
|
|
453605
|
+
return storyKeys.flatMap((storyKey) => {
|
|
453606
|
+
const locator = storyKey === BODY_STORY_KEY2 ? undefined : parseStoryKey2(storyKey);
|
|
453607
|
+
try {
|
|
453608
|
+
const runtime = resolveStoryRuntime2(editor, locator);
|
|
453609
|
+
return [{ storyKey, runtime, revision: getRevision2(runtime.editor) }];
|
|
453610
|
+
} catch (error48) {
|
|
453611
|
+
if (error48 instanceof DocumentApiAdapterError3 && error48.code === "STORY_NOT_FOUND") {
|
|
453612
|
+
return [];
|
|
453613
|
+
}
|
|
453614
|
+
throw error48;
|
|
453615
|
+
}
|
|
453616
|
+
});
|
|
453617
|
+
}
|
|
453618
|
+
function buildDocumentBookmarkRevision2(hostRevision, snapshots) {
|
|
453619
|
+
if (snapshots.length === 0) {
|
|
453620
|
+
return hostRevision;
|
|
453621
|
+
}
|
|
453622
|
+
if (snapshots.length === 1 && snapshots[0]?.storyKey === BODY_STORY_KEY2) {
|
|
453623
|
+
return hostRevision;
|
|
453624
|
+
}
|
|
453625
|
+
const parts = [...snapshots].sort((left2, right2) => left2.storyKey.localeCompare(right2.storyKey)).map((snapshot2) => `${snapshot2.storyKey}@${snapshot2.revision}`);
|
|
453626
|
+
return `${BOOKMARK_SCAN_REVISION_PREFIX2}${parts.join("|")}`;
|
|
453627
|
+
}
|
|
453628
|
+
function getDocumentBookmarkRevision2(editor, preCollected) {
|
|
453629
|
+
const hostRevision = getRevision2(editor);
|
|
453630
|
+
const entries = preCollected ?? findAllBookmarksInDocument2(editor);
|
|
453631
|
+
const snapshots = collectBookmarkStorySnapshots2(editor, entries);
|
|
453632
|
+
return buildDocumentBookmarkRevision2(hostRevision, snapshots);
|
|
453633
|
+
}
|
|
453634
|
+
function expectedRevisionMatchesStory2(storyEditor, expectedRevision) {
|
|
453635
|
+
return expectedRevision === getRevision2(storyEditor);
|
|
453636
|
+
}
|
|
453637
|
+
function expectedRevisionMatchesDocumentScan2(hostEditor, expectedRevision) {
|
|
453638
|
+
return expectedRevision.startsWith(BOOKMARK_SCAN_REVISION_PREFIX2) && expectedRevision === getDocumentBookmarkRevision2(hostEditor);
|
|
453639
|
+
}
|
|
453640
|
+
function checkBookmarkRevision2(hostEditor, storyEditor, expectedRevision) {
|
|
453641
|
+
if (expectedRevision === undefined)
|
|
453642
|
+
return;
|
|
453643
|
+
if (expectedRevisionMatchesStory2(storyEditor, expectedRevision)) {
|
|
453644
|
+
return;
|
|
453645
|
+
}
|
|
453646
|
+
if (expectedRevisionMatchesDocumentScan2(hostEditor, expectedRevision)) {
|
|
453647
|
+
return;
|
|
453648
|
+
}
|
|
453649
|
+
checkRevision2(storyEditor, expectedRevision);
|
|
453650
|
+
}
|
|
453651
|
+
function resolveBookmarkMutationStory2(editor, target) {
|
|
453652
|
+
if (target.story) {
|
|
453653
|
+
return target.story;
|
|
453654
|
+
}
|
|
453655
|
+
const matches3 = findAllBookmarksInDocument2(editor).filter((bookmark) => bookmark.name === target.name);
|
|
453656
|
+
if (matches3.length > 1) {
|
|
453657
|
+
throw new DocumentApiAdapterError3("INVALID_INPUT", `Bookmark name "${target.name}" exists in multiple stories. Pass target.story to disambiguate the mutation.`);
|
|
453658
|
+
}
|
|
453659
|
+
const entry = matches3[0];
|
|
453660
|
+
if (!entry) {
|
|
453661
|
+
throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", `Bookmark with name "${target.name}" not found.`);
|
|
453662
|
+
}
|
|
453663
|
+
return entry.storyKey === BODY_STORY_KEY2 ? undefined : parseStoryKey2(entry.storyKey);
|
|
453664
|
+
}
|
|
452851
453665
|
function bookmarksListWrapper2(editor, query2) {
|
|
452852
|
-
|
|
452853
|
-
|
|
453666
|
+
if (query2?.in) {
|
|
453667
|
+
return listBookmarksFromStory2(editor, query2.in, query2);
|
|
453668
|
+
}
|
|
453669
|
+
const entries = findAllBookmarksInDocument2(editor);
|
|
453670
|
+
const hostRevision = getRevision2(editor);
|
|
453671
|
+
const snapshots = collectBookmarkStorySnapshots2(editor, entries);
|
|
453672
|
+
const allItems = snapshots.flatMap(({ storyKey, runtime, revision }) => {
|
|
453673
|
+
const doc6 = runtime.editor.state.doc;
|
|
453674
|
+
const bookmarks = findAllBookmarks2(doc6);
|
|
453675
|
+
return bookmarks.map((bookmark) => buildBookmarkDiscoveryItem2(doc6, bookmark, revision, runtime.locator, storyKey));
|
|
453676
|
+
});
|
|
453677
|
+
const { total, items: paged } = paginate2(allItems, query2?.offset, query2?.limit);
|
|
453678
|
+
const effectiveLimit = query2?.limit ?? total;
|
|
453679
|
+
return buildDiscoveryResult2({
|
|
453680
|
+
evaluatedRevision: buildDocumentBookmarkRevision2(hostRevision, snapshots),
|
|
453681
|
+
total,
|
|
453682
|
+
items: paged,
|
|
453683
|
+
page: { limit: effectiveLimit, offset: query2?.offset ?? 0, returned: paged.length }
|
|
453684
|
+
});
|
|
453685
|
+
}
|
|
453686
|
+
function listBookmarksFromStory2(editor, storyLocator, query2) {
|
|
453687
|
+
const runtime = resolveStoryRuntime2(editor, storyLocator);
|
|
453688
|
+
const storyEditor = runtime.editor;
|
|
453689
|
+
const doc6 = storyEditor.state.doc;
|
|
453690
|
+
const revision = getRevision2(storyEditor);
|
|
452854
453691
|
const bookmarks = findAllBookmarks2(doc6);
|
|
452855
|
-
const allItems = bookmarks.map((
|
|
453692
|
+
const allItems = bookmarks.map((bookmark) => buildBookmarkDiscoveryItem2(doc6, bookmark, revision, runtime.locator));
|
|
452856
453693
|
const { total, items: paged } = paginate2(allItems, query2?.offset, query2?.limit);
|
|
452857
453694
|
const effectiveLimit = query2?.limit ?? total;
|
|
452858
453695
|
return buildDiscoveryResult2({
|
|
@@ -452863,106 +453700,144 @@ function bookmarksListWrapper2(editor, query2) {
|
|
|
452863
453700
|
});
|
|
452864
453701
|
}
|
|
452865
453702
|
function bookmarksGetWrapper2(editor, input2) {
|
|
452866
|
-
|
|
452867
|
-
|
|
453703
|
+
if (input2.target.story) {
|
|
453704
|
+
const runtime2 = resolveStoryRuntime2(editor, input2.target.story);
|
|
453705
|
+
const resolved2 = resolveBookmarkTarget2(runtime2.editor.state.doc, input2.target);
|
|
453706
|
+
return extractBookmarkInfo2(runtime2.editor.state.doc, resolved2, runtime2.locator);
|
|
453707
|
+
}
|
|
453708
|
+
const entry = findAllBookmarksInDocument2(editor).find((bookmark) => bookmark.name === input2.target.name);
|
|
453709
|
+
if (!entry) {
|
|
453710
|
+
throw new DocumentApiAdapterError3("TARGET_NOT_FOUND", `Bookmark with name "${input2.target.name}" not found.`);
|
|
453711
|
+
}
|
|
453712
|
+
const locator = entry.storyKey === BODY_STORY_KEY2 ? undefined : parseStoryKey2(entry.storyKey);
|
|
453713
|
+
const runtime = resolveStoryRuntime2(editor, locator);
|
|
453714
|
+
const resolved = resolveBookmarkTarget2(runtime.editor.state.doc, input2.target);
|
|
453715
|
+
return extractBookmarkInfo2(runtime.editor.state.doc, resolved, runtime.locator);
|
|
452868
453716
|
}
|
|
452869
453717
|
function bookmarksInsertWrapper2(editor, input2, options) {
|
|
452870
453718
|
rejectTrackedMode2("bookmarks.insert", options);
|
|
452871
|
-
const
|
|
452872
|
-
|
|
452873
|
-
|
|
452874
|
-
|
|
452875
|
-
|
|
452876
|
-
|
|
452877
|
-
|
|
452878
|
-
|
|
452879
|
-
const bookmarkStartType = editor.schema.nodes.bookmarkStart;
|
|
452880
|
-
const bookmarkEndType = editor.schema.nodes.bookmarkEnd;
|
|
452881
|
-
if (!bookmarkStartType || !bookmarkEndType) {
|
|
452882
|
-
throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "bookmarks.insert requires bookmarkStart and bookmarkEnd node types in the schema.");
|
|
452883
|
-
}
|
|
452884
|
-
const resolved = resolveInlineInsertPosition2(editor, input2.at, "bookmarks.insert");
|
|
452885
|
-
const receipt2 = executeDomainCommand2(editor, () => {
|
|
452886
|
-
const bookmarkId = allocateBookmarkId2(editor.state.doc);
|
|
452887
|
-
const startAttrs = {
|
|
452888
|
-
name: input2.name,
|
|
452889
|
-
id: bookmarkId
|
|
452890
|
-
};
|
|
452891
|
-
if (input2.tableColumn) {
|
|
452892
|
-
startAttrs.colFirst = input2.tableColumn.colFirst;
|
|
452893
|
-
startAttrs.colLast = input2.tableColumn.colLast;
|
|
453719
|
+
const runtime = resolveWriteStoryRuntime2(editor, input2.at.story);
|
|
453720
|
+
const storyEditor = runtime.editor;
|
|
453721
|
+
const address2 = buildBookmarkAddress2(input2.name, runtime.locator);
|
|
453722
|
+
try {
|
|
453723
|
+
checkBookmarkRevision2(editor, storyEditor, options?.expectedRevision);
|
|
453724
|
+
const allBookmarks = findAllBookmarksInDocument2(editor);
|
|
453725
|
+
if (bookmarkExistsAnywhere2(editor, input2.name, undefined, allBookmarks)) {
|
|
453726
|
+
return bookmarkFailure2("NO_OP", `Bookmark with name "${input2.name}" already exists.`);
|
|
452894
453727
|
}
|
|
452895
|
-
|
|
452896
|
-
|
|
452897
|
-
|
|
452898
|
-
|
|
452899
|
-
|
|
452900
|
-
|
|
452901
|
-
|
|
452902
|
-
|
|
452903
|
-
|
|
452904
|
-
|
|
452905
|
-
|
|
453728
|
+
if (options?.dryRun) {
|
|
453729
|
+
return bookmarkSuccess2(address2);
|
|
453730
|
+
}
|
|
453731
|
+
const bookmarkStartType = storyEditor.schema.nodes.bookmarkStart;
|
|
453732
|
+
const bookmarkEndType = storyEditor.schema.nodes.bookmarkEnd;
|
|
453733
|
+
if (!bookmarkStartType || !bookmarkEndType) {
|
|
453734
|
+
throw new DocumentApiAdapterError3("CAPABILITY_UNAVAILABLE", "bookmarks.insert requires bookmarkStart and bookmarkEnd node types in the schema.");
|
|
453735
|
+
}
|
|
453736
|
+
const resolved = resolveInlineInsertPosition2(storyEditor, input2.at, "bookmarks.insert");
|
|
453737
|
+
const receipt2 = executeDomainCommand2(storyEditor, () => {
|
|
453738
|
+
const bookmarkId = allocateBookmarkId2(editor);
|
|
453739
|
+
const startAttrs = {
|
|
453740
|
+
name: input2.name,
|
|
453741
|
+
id: bookmarkId
|
|
453742
|
+
};
|
|
453743
|
+
if (input2.tableColumn) {
|
|
453744
|
+
startAttrs.colFirst = input2.tableColumn.colFirst;
|
|
453745
|
+
startAttrs.colLast = input2.tableColumn.colLast;
|
|
453746
|
+
}
|
|
453747
|
+
const startNode = bookmarkStartType.create(startAttrs);
|
|
453748
|
+
const endNode = bookmarkEndType.create({ id: bookmarkId });
|
|
453749
|
+
const { tr } = storyEditor.state;
|
|
453750
|
+
tr.insert(resolved.to, endNode);
|
|
453751
|
+
tr.insert(resolved.from, startNode);
|
|
453752
|
+
storyEditor.dispatch(tr);
|
|
453753
|
+
clearIndexCache2(storyEditor);
|
|
453754
|
+
return true;
|
|
453755
|
+
});
|
|
453756
|
+
if (!receiptApplied5(receipt2)) {
|
|
453757
|
+
return bookmarkFailure2("NO_OP", "Insert operation produced no change.");
|
|
453758
|
+
}
|
|
453759
|
+
if (runtime.commit)
|
|
453760
|
+
runtime.commit(editor);
|
|
453761
|
+
return bookmarkSuccess2(address2);
|
|
453762
|
+
} finally {
|
|
453763
|
+
disposeEphemeralWriteRuntime2(runtime);
|
|
452906
453764
|
}
|
|
452907
|
-
return bookmarkSuccess2(address2);
|
|
452908
453765
|
}
|
|
452909
453766
|
function bookmarksRenameWrapper2(editor, input2, options) {
|
|
452910
453767
|
rejectTrackedMode2("bookmarks.rename", options);
|
|
452911
|
-
const
|
|
452912
|
-
|
|
452913
|
-
|
|
452914
|
-
|
|
452915
|
-
|
|
452916
|
-
|
|
452917
|
-
|
|
452918
|
-
|
|
452919
|
-
|
|
452920
|
-
|
|
452921
|
-
|
|
452922
|
-
|
|
452923
|
-
|
|
452924
|
-
|
|
452925
|
-
|
|
452926
|
-
|
|
452927
|
-
|
|
453768
|
+
const runtime = resolveWriteStoryRuntime2(editor, resolveBookmarkMutationStory2(editor, input2.target));
|
|
453769
|
+
const storyEditor = runtime.editor;
|
|
453770
|
+
try {
|
|
453771
|
+
checkBookmarkRevision2(editor, storyEditor, options?.expectedRevision);
|
|
453772
|
+
const resolved = resolveBookmarkTarget2(storyEditor.state.doc, input2.target);
|
|
453773
|
+
if (resolved.name === input2.newName) {
|
|
453774
|
+
return bookmarkFailure2("NO_OP", "New name is identical to current name.");
|
|
453775
|
+
}
|
|
453776
|
+
if (bookmarkExistsAnywhere2(editor, input2.newName, { storyKey: runtime.storyKey, bookmarkId: resolved.bookmarkId })) {
|
|
453777
|
+
throw new DocumentApiAdapterError3("INVALID_INPUT", `bookmarks.rename: a bookmark with name "${input2.newName}" already exists.`);
|
|
453778
|
+
}
|
|
453779
|
+
const newAddress = buildBookmarkAddress2(input2.newName, runtime.locator);
|
|
453780
|
+
if (options?.dryRun) {
|
|
453781
|
+
return bookmarkSuccess2(newAddress);
|
|
453782
|
+
}
|
|
453783
|
+
const receipt2 = executeDomainCommand2(storyEditor, () => {
|
|
453784
|
+
const { tr } = storyEditor.state;
|
|
453785
|
+
tr.setNodeMarkup(resolved.pos, undefined, {
|
|
453786
|
+
...resolved.node.attrs,
|
|
453787
|
+
name: input2.newName
|
|
453788
|
+
});
|
|
453789
|
+
storyEditor.dispatch(tr);
|
|
453790
|
+
clearIndexCache2(storyEditor);
|
|
453791
|
+
return true;
|
|
452928
453792
|
});
|
|
452929
|
-
|
|
452930
|
-
|
|
452931
|
-
|
|
452932
|
-
|
|
452933
|
-
|
|
452934
|
-
return
|
|
453793
|
+
if (!receiptApplied5(receipt2)) {
|
|
453794
|
+
return bookmarkFailure2("NO_OP", "Rename operation produced no change.");
|
|
453795
|
+
}
|
|
453796
|
+
if (runtime.commit)
|
|
453797
|
+
runtime.commit(editor);
|
|
453798
|
+
return bookmarkSuccess2(newAddress);
|
|
453799
|
+
} finally {
|
|
453800
|
+
disposeEphemeralWriteRuntime2(runtime);
|
|
452935
453801
|
}
|
|
452936
|
-
return bookmarkSuccess2(newAddress);
|
|
452937
453802
|
}
|
|
452938
453803
|
function bookmarksRemoveWrapper2(editor, input2, options) {
|
|
452939
453804
|
rejectTrackedMode2("bookmarks.remove", options);
|
|
452940
|
-
const
|
|
452941
|
-
const
|
|
452942
|
-
|
|
452943
|
-
|
|
452944
|
-
|
|
452945
|
-
|
|
452946
|
-
|
|
452947
|
-
|
|
452948
|
-
const endNode = tr.doc.nodeAt(resolved.endPos);
|
|
452949
|
-
if (endNode) {
|
|
452950
|
-
tr.delete(resolved.endPos, resolved.endPos + endNode.nodeSize);
|
|
452951
|
-
}
|
|
453805
|
+
const runtime = resolveWriteStoryRuntime2(editor, resolveBookmarkMutationStory2(editor, input2.target));
|
|
453806
|
+
const storyEditor = runtime.editor;
|
|
453807
|
+
try {
|
|
453808
|
+
checkBookmarkRevision2(editor, storyEditor, options?.expectedRevision);
|
|
453809
|
+
const resolved = resolveBookmarkTarget2(storyEditor.state.doc, input2.target);
|
|
453810
|
+
const address2 = buildBookmarkAddress2(resolved.name, runtime.locator);
|
|
453811
|
+
if (options?.dryRun) {
|
|
453812
|
+
return bookmarkSuccess2(address2);
|
|
452952
453813
|
}
|
|
452953
|
-
const
|
|
452954
|
-
|
|
452955
|
-
|
|
453814
|
+
const receipt2 = executeDomainCommand2(storyEditor, () => {
|
|
453815
|
+
const { tr } = storyEditor.state;
|
|
453816
|
+
if (resolved.endPos !== null && resolved.endPos > resolved.pos) {
|
|
453817
|
+
const endNode = tr.doc.nodeAt(resolved.endPos);
|
|
453818
|
+
if (endNode) {
|
|
453819
|
+
tr.delete(resolved.endPos, resolved.endPos + endNode.nodeSize);
|
|
453820
|
+
}
|
|
453821
|
+
}
|
|
453822
|
+
const startNode = tr.doc.nodeAt(resolved.pos);
|
|
453823
|
+
if (startNode) {
|
|
453824
|
+
tr.delete(resolved.pos, resolved.pos + startNode.nodeSize);
|
|
453825
|
+
}
|
|
453826
|
+
storyEditor.dispatch(tr);
|
|
453827
|
+
clearIndexCache2(storyEditor);
|
|
453828
|
+
return true;
|
|
453829
|
+
});
|
|
453830
|
+
if (!receiptApplied5(receipt2)) {
|
|
453831
|
+
return bookmarkFailure2("NO_OP", "Remove operation produced no change.");
|
|
452956
453832
|
}
|
|
452957
|
-
|
|
452958
|
-
|
|
452959
|
-
return
|
|
452960
|
-
}
|
|
452961
|
-
|
|
452962
|
-
return bookmarkFailure2("NO_OP", "Remove operation produced no change.");
|
|
453833
|
+
if (runtime.commit)
|
|
453834
|
+
runtime.commit(editor);
|
|
453835
|
+
return bookmarkSuccess2(address2);
|
|
453836
|
+
} finally {
|
|
453837
|
+
disposeEphemeralWriteRuntime2(runtime);
|
|
452963
453838
|
}
|
|
452964
|
-
return bookmarkSuccess2(address2);
|
|
452965
453839
|
}
|
|
453840
|
+
var BOOKMARK_SCAN_REVISION_PREFIX2 = "bookmark-scan:";
|
|
452966
453841
|
var init_bookmark_wrappers = __esm(() => {
|
|
452967
453842
|
init_src();
|
|
452968
453843
|
init_bookmark_resolver();
|
|
@@ -452972,6 +453847,8 @@ var init_bookmark_wrappers = __esm(() => {
|
|
|
452972
453847
|
init_mutation_helpers();
|
|
452973
453848
|
init_index_cache();
|
|
452974
453849
|
init_errors4();
|
|
453850
|
+
init_resolve_story_runtime();
|
|
453851
|
+
init_story_key();
|
|
452975
453852
|
});
|
|
452976
453853
|
|
|
452977
453854
|
// ../../packages/super-editor/src/editors/v1/document-api-adapters/protection-adapter.ts
|
|
@@ -453662,28 +454539,6 @@ var init_permission_ranges_adapter = __esm(() => {
|
|
|
453662
454539
|
init_permission_ranges2();
|
|
453663
454540
|
});
|
|
453664
454541
|
|
|
453665
|
-
// ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/note-entry-lookup.ts
|
|
453666
|
-
function isSpecialEntry2(entry) {
|
|
453667
|
-
return SPECIAL_NOTE_TYPES2.has(entry.type ?? "");
|
|
453668
|
-
}
|
|
453669
|
-
function findNoteEntryById2(entries, noteId) {
|
|
453670
|
-
if (!Array.isArray(entries))
|
|
453671
|
-
return;
|
|
453672
|
-
let fallback;
|
|
453673
|
-
for (const entry of entries) {
|
|
453674
|
-
if (String(entry.id ?? "") !== noteId)
|
|
453675
|
-
continue;
|
|
453676
|
-
if (!isSpecialEntry2(entry))
|
|
453677
|
-
return entry;
|
|
453678
|
-
fallback ??= entry;
|
|
453679
|
-
}
|
|
453680
|
-
return fallback;
|
|
453681
|
-
}
|
|
453682
|
-
var SPECIAL_NOTE_TYPES2;
|
|
453683
|
-
var init_note_entry_lookup = __esm(() => {
|
|
453684
|
-
SPECIAL_NOTE_TYPES2 = new Set(["separator", "continuationSeparator"]);
|
|
453685
|
-
});
|
|
453686
|
-
|
|
453687
454542
|
// ../../packages/super-editor/src/editors/v1/document-api-adapters/helpers/footnote-resolver.ts
|
|
453688
454543
|
function getConverterStore2(editor) {
|
|
453689
454544
|
return editor.converter ?? {};
|
|
@@ -459106,6 +459961,153 @@ SEQUENCE SHAPE (merge / split):
|
|
|
459106
459961
|
"range"
|
|
459107
459962
|
]
|
|
459108
459963
|
}
|
|
459964
|
+
},
|
|
459965
|
+
story: {
|
|
459966
|
+
oneOf: [
|
|
459967
|
+
{
|
|
459968
|
+
type: "object",
|
|
459969
|
+
properties: {
|
|
459970
|
+
kind: {
|
|
459971
|
+
const: "story",
|
|
459972
|
+
type: "string"
|
|
459973
|
+
},
|
|
459974
|
+
storyType: {
|
|
459975
|
+
const: "body",
|
|
459976
|
+
type: "string"
|
|
459977
|
+
}
|
|
459978
|
+
},
|
|
459979
|
+
required: [
|
|
459980
|
+
"kind",
|
|
459981
|
+
"storyType"
|
|
459982
|
+
]
|
|
459983
|
+
},
|
|
459984
|
+
{
|
|
459985
|
+
type: "object",
|
|
459986
|
+
properties: {
|
|
459987
|
+
kind: {
|
|
459988
|
+
const: "story",
|
|
459989
|
+
type: "string"
|
|
459990
|
+
},
|
|
459991
|
+
storyType: {
|
|
459992
|
+
const: "headerFooterSlot",
|
|
459993
|
+
type: "string"
|
|
459994
|
+
},
|
|
459995
|
+
section: {
|
|
459996
|
+
type: "object",
|
|
459997
|
+
properties: {
|
|
459998
|
+
kind: {
|
|
459999
|
+
const: "section",
|
|
460000
|
+
type: "string"
|
|
460001
|
+
},
|
|
460002
|
+
sectionId: {
|
|
460003
|
+
type: "string"
|
|
460004
|
+
}
|
|
460005
|
+
},
|
|
460006
|
+
required: [
|
|
460007
|
+
"kind",
|
|
460008
|
+
"sectionId"
|
|
460009
|
+
]
|
|
460010
|
+
},
|
|
460011
|
+
headerFooterKind: {
|
|
460012
|
+
enum: [
|
|
460013
|
+
"header",
|
|
460014
|
+
"footer"
|
|
460015
|
+
]
|
|
460016
|
+
},
|
|
460017
|
+
variant: {
|
|
460018
|
+
enum: [
|
|
460019
|
+
"default",
|
|
460020
|
+
"first",
|
|
460021
|
+
"even"
|
|
460022
|
+
]
|
|
460023
|
+
},
|
|
460024
|
+
resolution: {
|
|
460025
|
+
enum: [
|
|
460026
|
+
"effective",
|
|
460027
|
+
"explicit"
|
|
460028
|
+
]
|
|
460029
|
+
},
|
|
460030
|
+
onWrite: {
|
|
460031
|
+
enum: [
|
|
460032
|
+
"materializeIfInherited",
|
|
460033
|
+
"editResolvedPart",
|
|
460034
|
+
"error"
|
|
460035
|
+
]
|
|
460036
|
+
}
|
|
460037
|
+
},
|
|
460038
|
+
required: [
|
|
460039
|
+
"kind",
|
|
460040
|
+
"storyType",
|
|
460041
|
+
"section",
|
|
460042
|
+
"headerFooterKind",
|
|
460043
|
+
"variant"
|
|
460044
|
+
]
|
|
460045
|
+
},
|
|
460046
|
+
{
|
|
460047
|
+
type: "object",
|
|
460048
|
+
properties: {
|
|
460049
|
+
kind: {
|
|
460050
|
+
const: "story",
|
|
460051
|
+
type: "string"
|
|
460052
|
+
},
|
|
460053
|
+
storyType: {
|
|
460054
|
+
const: "headerFooterPart",
|
|
460055
|
+
type: "string"
|
|
460056
|
+
},
|
|
460057
|
+
refId: {
|
|
460058
|
+
type: "string"
|
|
460059
|
+
}
|
|
460060
|
+
},
|
|
460061
|
+
required: [
|
|
460062
|
+
"kind",
|
|
460063
|
+
"storyType",
|
|
460064
|
+
"refId"
|
|
460065
|
+
]
|
|
460066
|
+
},
|
|
460067
|
+
{
|
|
460068
|
+
type: "object",
|
|
460069
|
+
properties: {
|
|
460070
|
+
kind: {
|
|
460071
|
+
const: "story",
|
|
460072
|
+
type: "string"
|
|
460073
|
+
},
|
|
460074
|
+
storyType: {
|
|
460075
|
+
const: "footnote",
|
|
460076
|
+
type: "string"
|
|
460077
|
+
},
|
|
460078
|
+
noteId: {
|
|
460079
|
+
type: "string"
|
|
460080
|
+
}
|
|
460081
|
+
},
|
|
460082
|
+
required: [
|
|
460083
|
+
"kind",
|
|
460084
|
+
"storyType",
|
|
460085
|
+
"noteId"
|
|
460086
|
+
]
|
|
460087
|
+
},
|
|
460088
|
+
{
|
|
460089
|
+
type: "object",
|
|
460090
|
+
properties: {
|
|
460091
|
+
kind: {
|
|
460092
|
+
const: "story",
|
|
460093
|
+
type: "string"
|
|
460094
|
+
},
|
|
460095
|
+
storyType: {
|
|
460096
|
+
const: "endnote",
|
|
460097
|
+
type: "string"
|
|
460098
|
+
},
|
|
460099
|
+
noteId: {
|
|
460100
|
+
type: "string"
|
|
460101
|
+
}
|
|
460102
|
+
},
|
|
460103
|
+
required: [
|
|
460104
|
+
"kind",
|
|
460105
|
+
"storyType",
|
|
460106
|
+
"noteId"
|
|
460107
|
+
]
|
|
460108
|
+
}
|
|
460109
|
+
],
|
|
460110
|
+
description: "Story scope. Defaults to document body when omitted. Use {kind:'story', storyType:'body'} for body, or other storyType values for headers, footers, footnotes, endnotes."
|
|
459109
460111
|
}
|
|
459110
460112
|
},
|
|
459111
460113
|
required: [
|