@a3s-lab/office 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +22 -5
  2. package/dist/{0~7231.js → 0~4808.js} +189 -2
  3. package/dist/0~5050.js +10 -1
  4. package/dist/{0~7360.js → 0~7240.js} +244 -15
  5. package/dist/0~document-editor.js +622 -125
  6. package/dist/0~work-docx-export.js +214 -26
  7. package/dist/0~work-docx-import.js +17 -6
  8. package/dist/0~work-office-diagnostics.js +25 -4
  9. package/dist/4104.js +1 -1
  10. package/dist/4121.js +412 -11
  11. package/dist/6282.js +431 -2
  12. package/dist/internal/features/work/editors/document-command-catalog.d.ts +27 -0
  13. package/dist/internal/features/work/editors/document-dom-selection.d.ts +7 -0
  14. package/dist/internal/features/work/editors/document-editor-support.d.ts +1 -0
  15. package/dist/internal/features/work/editors/document-index-dialog.d.ts +10 -0
  16. package/dist/internal/features/work/editors/document-index-entry-dialog.d.ts +10 -0
  17. package/dist/internal/features/work/editors/document-references-ribbon.d.ts +19 -0
  18. package/dist/internal/features/work/editors/document-toolbar.d.ts +4 -1
  19. package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +3 -0
  20. package/dist/internal/features/work/work-document-index-fields.d.ts +19 -0
  21. package/dist/internal/features/work/work-document-index-nodes.d.ts +32 -0
  22. package/dist/internal/features/work/work-document-index.d.ts +63 -0
  23. package/dist/internal/features/work/work-docx-import.d.ts +3 -1
  24. package/dist/internal/features/work/work-docx-index-export.d.ts +14 -0
  25. package/dist/internal/features/work/work-docx-index-import.d.ts +23 -0
  26. package/dist/office-kernel.wasm +0 -0
  27. package/dist/styles.css +296 -0
  28. package/docs/latest/en/browser-editor-architecture.md +14 -0
  29. package/package.json +4 -1
package/dist/6282.js CHANGED
@@ -21,7 +21,7 @@ import { CellSelection, TableMap, isInTable, selectedRect } from "@tiptap/pm/tab
21
21
  import font_family from "@tiptap/extension-text-style/font-family";
22
22
  import { TextStyle } from "@tiptap/extension-text-style";
23
23
  import extension_highlight from "@tiptap/extension-highlight";
24
- import { documentRunBorderDomAttributes, DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE, DOCUMENT_RUN_SHADING_ATTRIBUTE, serializeDocumentRunBorder, documentScriptFontSlotFromElement, documentScriptFontsForAllText, serializeDocumentScriptFonts, primeDocumentIntegrityFeatures, uniqueDocumentParagraphIdentity, documentScriptFontsDomAttributes, documentHighlightForCssColor, documentTableOfContentsValueFromElement, normalizeDocumentScriptFonts, buildDocumentTableOfContentsEntries, serializeDocumentParagraphShading, documentHasIntegrityFeature, parseDocumentRunBorder, normalizeDocumentParagraphId, DOCUMENT_PARAGRAPH_TEXT_ID_ATTRIBUTE, documentProofingLanguagesFromElement, normalizeDocumentProofingLanguages, parseDocumentParagraphBordersElement, parseDocumentParagraphBorders, documentScriptFontsFromElement, DOCUMENT_RUN_BORDER_ATTRIBUTE, normalizeDocumentTableOfContentsValue, DOCUMENT_PARAGRAPH_ID_ATTRIBUTE, documentNoProofFromElement, normalizeDocumentRunShading, documentScriptFontSegments, documentFontNameFromCssFamily, documentRunShadingDomAttributes, parseDocumentScriptFonts, normalizeDocumentRunBorder, normalizeDocumentParagraphBorder, serializeDocumentParagraphBorders, parseDocxThemeReference, parseDocumentRunShading, DOCUMENT_HIGHLIGHT_ATTRIBUTE, serializeDocumentRunShading, workDocumentOutlineLevel, DOCUMENT_PARAGRAPH_BORDERS_ATTRIBUTE, createDocumentParagraphIdentityRegistry, DOCUMENT_NO_PROOF_ATTRIBUTE, serializeDocxThemeReference, documentRunBorderIsVisible, normalizeDocumentTableOfContentsHtml, cssDocumentFontFamily, documentParagraphShadingDomAttributes, DOCUMENT_PROOFING_LANGUAGES_ATTRIBUTE, documentParagraphBordersDomAttributes, DOCUMENT_SCRIPT_FONTS_ATTRIBUTE, normalizeDocumentHighlight, normalizeDocumentParagraphIdentity, createOfficeId as createWorkId, DEFAULT_DOCUMENT_TABLE_OF_CONTENTS_OPTIONS, documentHighlightFromElement, normalizeDocumentLanguageTag, parseDocumentParagraphShading, normalizeDocumentNoProof, parseDocumentParagraphShadingElement, createDocumentParagraphIdentity, documentHighlightDomAttributes, DocumentParagraphIdentity, parseDocumentRunShadingElement, parseDocumentProofingLanguages, collectWorkDocumentOutline, documentScriptFontSlotFromHint, normalizeDocumentTableOfContentsOptions, documentBorderPresentation, documentScriptFontFamilyForRendering, parseDocumentRunBorderElement, documentProofingDomAttributes, normalizeDocumentScriptFontSlot, serializeDocumentProofingLanguages } from "./4121.js";
24
+ import { documentRunBorderDomAttributes, DOCUMENT_SCRIPT_FONT_SLOT_ATTRIBUTE, DOCUMENT_RUN_SHADING_ATTRIBUTE, serializeDocumentRunBorder, documentScriptFontSlotFromElement, documentScriptFontsForAllText, serializeDocumentScriptFonts, primeDocumentIntegrityFeatures, uniqueDocumentParagraphIdentity, documentScriptFontsDomAttributes, documentHighlightForCssColor, documentTableOfContentsValueFromElement, buildDocumentIndexEntries, normalizeDocumentScriptFonts, buildDocumentTableOfContentsEntries, serializeDocumentParagraphShading, documentHasIntegrityFeature, parseDocumentRunBorder, documentIndexValueFromElement, normalizeDocumentParagraphId, DOCUMENT_PARAGRAPH_TEXT_ID_ATTRIBUTE, documentProofingLanguagesFromElement, normalizeDocumentProofingLanguages, normalizeDocumentIndexOptions, parseDocumentParagraphBordersElement, parseDocumentParagraphBorders, documentScriptFontsFromElement, DOCUMENT_RUN_BORDER_ATTRIBUTE, normalizeDocumentTableOfContentsValue, DOCUMENT_PARAGRAPH_ID_ATTRIBUTE, documentNoProofFromElement, normalizeDocumentRunShading, documentIndexEntryFromElement, documentScriptFontSegments, normalizeDocumentIndexEntry, documentFontNameFromCssFamily, documentRunShadingDomAttributes, normalizeDocumentIndexEntryDraft, parseDocumentScriptFonts, normalizeDocumentRunBorder, normalizeDocumentParagraphBorder, serializeDocumentParagraphBorders, parseDocxThemeReference, parseDocumentRunShading, DOCUMENT_HIGHLIGHT_ATTRIBUTE, serializeDocumentRunShading, workDocumentOutlineLevel, DOCUMENT_PARAGRAPH_BORDERS_ATTRIBUTE, createDocumentParagraphIdentityRegistry, DOCUMENT_NO_PROOF_ATTRIBUTE, serializeDocxThemeReference, documentRunBorderIsVisible, normalizeDocumentTableOfContentsHtml, cssDocumentFontFamily, documentParagraphShadingDomAttributes, normalizeDocumentIndexValue, DOCUMENT_PROOFING_LANGUAGES_ATTRIBUTE, documentParagraphBordersDomAttributes, DOCUMENT_SCRIPT_FONTS_ATTRIBUTE, normalizeDocumentHighlight, normalizeDocumentParagraphIdentity, createOfficeId as createWorkId, DEFAULT_DOCUMENT_TABLE_OF_CONTENTS_OPTIONS, DEFAULT_DOCUMENT_INDEX_OPTIONS, documentHighlightFromElement, normalizeDocumentLanguageTag, parseDocumentParagraphShading, normalizeDocumentNoProof, parseDocumentParagraphShadingElement, createDocumentParagraphIdentity, documentHighlightDomAttributes, DocumentParagraphIdentity, parseDocumentRunShadingElement, parseDocumentProofingLanguages, collectWorkDocumentOutline, documentScriptFontSlotFromHint, normalizeDocumentTableOfContentsOptions, documentBorderPresentation, documentScriptFontFamilyForRendering, parseDocumentRunBorderElement, documentProofingDomAttributes, normalizeDocumentScriptFontSlot, serializeDocumentProofingLanguages } from "./4121.js";
25
25
  import { workOfficeCollaborationJsonEqual, canonicalWorkOfficeCollaborationJson, isWorkOfficeCollaborationRecord, cloneWorkOfficeCollaborationJson } from "./4650.js";
26
26
  import { assertWorkOfficeCollaborationEditable, markWorkOfficeCollaborationInitialized, assertWorkOfficeCollaborationOrigin, initializeWorkOfficeCollaborationMetadata, assertWorkOfficeCollaborationWritable, OfficeCollaborationError as WorkOfficeCollaborationError, readOfficeCollaborationMetadata as readWorkOfficeCollaborationMetadata, registerWorkOfficeCollaborationInitializer } from "./9787.js";
27
27
  import * as __rspack_external_yjs from "yjs";
@@ -12583,6 +12583,433 @@ function syncImageDimension(element, dimension, value) {
12583
12583
  element.style.removeProperty(dimension);
12584
12584
  element.removeAttribute(dimension);
12585
12585
  }
12586
+ const DocumentIndexEntry = core_Node.create({
12587
+ name: 'documentIndexEntry',
12588
+ group: 'inline',
12589
+ inline: true,
12590
+ atom: true,
12591
+ selectable: true,
12592
+ draggable: false,
12593
+ addAttributes () {
12594
+ return {
12595
+ id: work_document_index_nodes_hiddenAttribute(''),
12596
+ mainEntry: work_document_index_nodes_hiddenAttribute(''),
12597
+ subEntry: work_document_index_nodes_hiddenAttribute(''),
12598
+ crossReference: work_document_index_nodes_hiddenAttribute(''),
12599
+ pageBold: work_document_index_nodes_hiddenAttribute(false),
12600
+ pageItalic: work_document_index_nodes_hiddenAttribute(false)
12601
+ };
12602
+ },
12603
+ addCommands () {
12604
+ return {
12605
+ markDocumentIndexEntry: (value)=>(props)=>markDocumentIndexEntryCommand(props, value),
12606
+ updateDocumentIndexEntry: (value)=>(props)=>updateDocumentIndexEntryCommand(props, value)
12607
+ };
12608
+ },
12609
+ parseHTML () {
12610
+ return [
12611
+ {
12612
+ tag: 'span[data-document-index-entry]',
12613
+ getAttrs: (node)=>{
12614
+ if (!(node instanceof HTMLElement)) return false;
12615
+ const value = documentIndexEntryFromElement(node);
12616
+ return value ? indexEntryNodeAttributes(value) : false;
12617
+ }
12618
+ }
12619
+ ];
12620
+ },
12621
+ renderHTML ({ node, HTMLAttributes }) {
12622
+ const value = normalizeDocumentIndexEntry(node.attrs);
12623
+ if (!value) return [
12624
+ 'span',
12625
+ {
12626
+ hidden: 'true'
12627
+ }
12628
+ ];
12629
+ const detail = indexEntryLabel(value);
12630
+ return [
12631
+ 'span',
12632
+ mergeAttributes(HTMLAttributes, {
12633
+ 'data-document-index-entry': 'true',
12634
+ 'data-index-entry-id': value.id,
12635
+ 'data-index-main-entry': value.mainEntry,
12636
+ 'data-index-sub-entry': value.subEntry,
12637
+ 'data-index-cross-reference': value.crossReference,
12638
+ 'data-index-page-bold': String(value.pageBold),
12639
+ 'data-index-page-italic': String(value.pageItalic),
12640
+ class: 'work-document-index-entry',
12641
+ contenteditable: 'false',
12642
+ 'aria-label': `索引项:${detail}`
12643
+ }),
12644
+ [
12645
+ 'span',
12646
+ {
12647
+ 'aria-hidden': 'true'
12648
+ },
12649
+ '索引项'
12650
+ ],
12651
+ [
12652
+ 'strong',
12653
+ detail
12654
+ ]
12655
+ ];
12656
+ },
12657
+ renderText () {
12658
+ return '';
12659
+ }
12660
+ });
12661
+ const DocumentIndex = core_Node.create({
12662
+ name: 'documentIndex',
12663
+ group: 'block',
12664
+ atom: true,
12665
+ selectable: true,
12666
+ draggable: false,
12667
+ addAttributes () {
12668
+ return {
12669
+ id: work_document_index_nodes_hiddenAttribute(''),
12670
+ columns: work_document_index_nodes_hiddenAttribute(1),
12671
+ format: work_document_index_nodes_hiddenAttribute('indented'),
12672
+ rightAlignPageNumbers: work_document_index_nodes_hiddenAttribute(true),
12673
+ leader: work_document_index_nodes_hiddenAttribute('dot'),
12674
+ entries: work_document_index_nodes_hiddenAttribute([]),
12675
+ truncated: work_document_index_nodes_hiddenAttribute(false)
12676
+ };
12677
+ },
12678
+ addCommands () {
12679
+ return {
12680
+ insertDocumentIndex: (options = DEFAULT_DOCUMENT_INDEX_OPTIONS, buildOptions)=>(props)=>insertDocumentIndexCommand(props, options, buildOptions),
12681
+ updateDocumentIndex: (options, buildOptions)=>(props)=>updateDocumentIndexCommand(props, options, buildOptions),
12682
+ refreshDocumentIndexes: (buildOptions)=>(props)=>refreshDocumentIndexesCommand(props, buildOptions)
12683
+ };
12684
+ },
12685
+ parseHTML () {
12686
+ return [
12687
+ {
12688
+ tag: 'div[data-document-index]',
12689
+ getAttrs: (node)=>{
12690
+ if (!(node instanceof HTMLElement)) return false;
12691
+ return indexNodeAttributes(documentIndexValueFromElement(node));
12692
+ }
12693
+ }
12694
+ ];
12695
+ },
12696
+ renderHTML ({ node, HTMLAttributes }) {
12697
+ const value = normalizeDocumentIndexValue({
12698
+ id: work_document_index_nodes_stringAttribute(node.attrs.id) || 'document-index',
12699
+ options: indexOptionsFromAttributes(node.attrs),
12700
+ entries: Array.isArray(node.attrs.entries) ? node.attrs.entries : [],
12701
+ truncated: Boolean(node.attrs.truncated)
12702
+ });
12703
+ const rows = value.entries.length ? value.entries.map((entry)=>indexEntrySpec(entry)) : [
12704
+ [
12705
+ 'li',
12706
+ {
12707
+ class: 'work-document-index-empty'
12708
+ },
12709
+ '没有已标记的索引项'
12710
+ ]
12711
+ ];
12712
+ return [
12713
+ 'div',
12714
+ mergeAttributes(HTMLAttributes, {
12715
+ 'data-document-index': 'true',
12716
+ 'data-index-id': value.id,
12717
+ 'data-index-columns': String(value.options.columns),
12718
+ 'data-index-format': value.options.format,
12719
+ 'data-index-right-align-page-numbers': String(value.options.rightAlignPageNumbers),
12720
+ 'data-index-leader': value.options.leader,
12721
+ 'data-index-entries': JSON.stringify(value.entries),
12722
+ 'data-index-truncated': String(value.truncated),
12723
+ class: 'work-document-index',
12724
+ contenteditable: 'false',
12725
+ 'aria-label': '索引'
12726
+ }),
12727
+ [
12728
+ 'div',
12729
+ {
12730
+ class: 'work-document-index-header'
12731
+ },
12732
+ [
12733
+ 'strong',
12734
+ '索引'
12735
+ ],
12736
+ [
12737
+ 'span',
12738
+ value.truncated ? "仅显示前 512 项" : `${value.entries.length} 项`
12739
+ ]
12740
+ ],
12741
+ [
12742
+ 'ol',
12743
+ {
12744
+ class: 'work-document-index-list'
12745
+ },
12746
+ ...rows
12747
+ ]
12748
+ ];
12749
+ },
12750
+ renderText ({ node }) {
12751
+ const entries = Array.isArray(node.attrs.entries) ? node.attrs.entries : [];
12752
+ return entries.map((entry)=>[
12753
+ entry.mainEntry,
12754
+ entry.subEntry,
12755
+ entry.crossReference
12756
+ ].filter(Boolean).join(' ')).join('\n');
12757
+ },
12758
+ addProseMirrorPlugins () {
12759
+ return [
12760
+ new Plugin({
12761
+ props: {
12762
+ handleDOMEvents: {
12763
+ click: (view, event)=>{
12764
+ if (!(event.target instanceof Element)) return false;
12765
+ const link = event.target.closest('[data-document-index] [data-index-target]');
12766
+ const targetId = link?.dataset.indexTarget?.trim();
12767
+ if (!link || !targetId) return false;
12768
+ let targetPosition = null;
12769
+ view.state.doc.descendants((node, position)=>{
12770
+ if (null !== targetPosition) return false;
12771
+ if ('documentIndexEntry' === node.type.name && node.attrs.id === targetId) {
12772
+ targetPosition = position;
12773
+ return false;
12774
+ }
12775
+ return true;
12776
+ });
12777
+ if (null === targetPosition) return false;
12778
+ event.preventDefault();
12779
+ view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, targetPosition)).scrollIntoView());
12780
+ view.focus();
12781
+ return true;
12782
+ }
12783
+ }
12784
+ }
12785
+ })
12786
+ ];
12787
+ }
12788
+ });
12789
+ function selectedDocumentIndexEntry(editor) {
12790
+ const selection = editor.state.selection;
12791
+ if (!(selection instanceof NodeSelection) || 'documentIndexEntry' !== selection.node.type.name) return null;
12792
+ return normalizeDocumentIndexEntry(selection.node.attrs);
12793
+ }
12794
+ function selectedDocumentIndexOptions(editor) {
12795
+ const selection = editor.state.selection;
12796
+ if (!(selection instanceof NodeSelection) || 'documentIndex' !== selection.node.type.name) return null;
12797
+ return indexOptionsFromAttributes(selection.node.attrs);
12798
+ }
12799
+ function selectedDocumentIndexDraft(editor) {
12800
+ const selected = selectedDocumentIndexEntry(editor);
12801
+ if (selected) return {
12802
+ mainEntry: selected.mainEntry,
12803
+ subEntry: selected.subEntry,
12804
+ crossReference: selected.crossReference,
12805
+ pageBold: selected.pageBold,
12806
+ pageItalic: selected.pageItalic
12807
+ };
12808
+ const { from, to } = editor.state.selection;
12809
+ const mainEntry = editor.state.doc.textBetween(from, to, ' ').replace(/\s+/g, ' ').trim();
12810
+ return normalizeDocumentIndexEntryDraft({
12811
+ mainEntry
12812
+ });
12813
+ }
12814
+ function documentHasIndex(editor) {
12815
+ return documentHasNode(editor, 'documentIndex');
12816
+ }
12817
+ function markDocumentIndexEntryCommand({ dispatch, editor, state, tr }, source) {
12818
+ const value = normalizeDocumentIndexEntryDraft(source);
12819
+ const nodeType = editor.schema.nodes.documentIndexEntry;
12820
+ if (!value || !nodeType) return false;
12821
+ const selection = state.selection;
12822
+ if (selection instanceof NodeSelection && 'documentIndexEntry' === selection.node.type.name) return updateDocumentIndexEntryCommand({
12823
+ dispatch,
12824
+ editor,
12825
+ state,
12826
+ tr
12827
+ }, value);
12828
+ if (!dispatch) return true;
12829
+ const position = selection.to;
12830
+ const node = nodeType.create({
12831
+ id: createWorkId('index-entry'),
12832
+ ...value
12833
+ });
12834
+ tr.insert(position, node);
12835
+ tr.setSelection(TextSelection.near(tr.doc.resolve(position + node.nodeSize)));
12836
+ tr.scrollIntoView();
12837
+ return tr.docChanged;
12838
+ }
12839
+ function updateDocumentIndexEntryCommand({ dispatch, state, tr }, source) {
12840
+ const selection = state.selection;
12841
+ const value = normalizeDocumentIndexEntryDraft(source);
12842
+ if (!value || !(selection instanceof NodeSelection) || 'documentIndexEntry' !== selection.node.type.name) return false;
12843
+ if (!dispatch) return true;
12844
+ tr.setNodeMarkup(selection.from, void 0, {
12845
+ ...selection.node.attrs,
12846
+ ...value
12847
+ });
12848
+ tr.scrollIntoView();
12849
+ return tr.docChanged;
12850
+ }
12851
+ function insertDocumentIndexCommand({ dispatch, editor, tr }, source, buildOptions = {}) {
12852
+ const nodeType = editor.schema.nodes.documentIndex;
12853
+ if (!nodeType) return false;
12854
+ if (!dispatch) return true;
12855
+ const options = normalizeDocumentIndexOptions(source);
12856
+ const built = buildDocumentIndexEntries(tr.doc, buildOptions);
12857
+ tr.replaceSelectionWith(nodeType.create({
12858
+ id: createWorkId('index'),
12859
+ ...options,
12860
+ ...built
12861
+ }), false);
12862
+ tr.scrollIntoView();
12863
+ return true;
12864
+ }
12865
+ function updateDocumentIndexCommand({ dispatch, state, tr }, source, buildOptions = {}) {
12866
+ const selection = state.selection;
12867
+ if (!(selection instanceof NodeSelection) || 'documentIndex' !== selection.node.type.name) return false;
12868
+ if (!dispatch) return true;
12869
+ const options = normalizeDocumentIndexOptions(source);
12870
+ const built = buildDocumentIndexEntries(tr.doc, buildOptions);
12871
+ tr.setNodeMarkup(selection.from, void 0, {
12872
+ ...selection.node.attrs,
12873
+ ...options,
12874
+ ...built
12875
+ });
12876
+ tr.scrollIntoView();
12877
+ return tr.docChanged;
12878
+ }
12879
+ function refreshDocumentIndexesCommand({ dispatch, state, tr }, buildOptions = {}) {
12880
+ const updates = [];
12881
+ const built = buildDocumentIndexEntries(state.doc, buildOptions);
12882
+ state.doc.descendants((node, position)=>{
12883
+ if ('documentIndex' !== node.type.name) return;
12884
+ if (JSON.stringify(node.attrs.entries) === JSON.stringify(built.entries) && Boolean(node.attrs.truncated) === built.truncated) return;
12885
+ updates.push({
12886
+ position,
12887
+ attrs: {
12888
+ ...node.attrs,
12889
+ ...built
12890
+ }
12891
+ });
12892
+ });
12893
+ if (!updates.length) return false;
12894
+ if (!dispatch) return true;
12895
+ for (const update of updates)tr.setNodeMarkup(update.position, void 0, update.attrs);
12896
+ tr.scrollIntoView();
12897
+ return tr.docChanged;
12898
+ }
12899
+ function indexEntryNodeAttributes(value) {
12900
+ return {
12901
+ ...value
12902
+ };
12903
+ }
12904
+ function indexNodeAttributes(value) {
12905
+ return {
12906
+ id: value.id,
12907
+ ...value.options,
12908
+ entries: value.entries,
12909
+ truncated: value.truncated
12910
+ };
12911
+ }
12912
+ function indexOptionsFromAttributes(attrs) {
12913
+ return normalizeDocumentIndexOptions({
12914
+ columns: Number(attrs.columns),
12915
+ format: 'run-in' === attrs.format ? 'run-in' : 'indented',
12916
+ rightAlignPageNumbers: Boolean(attrs.rightAlignPageNumbers),
12917
+ leader: 'string' == typeof attrs.leader ? attrs.leader : 'dot'
12918
+ });
12919
+ }
12920
+ function indexEntrySpec(entry) {
12921
+ const term = [
12922
+ [
12923
+ 'span',
12924
+ {
12925
+ class: 'work-document-index-main'
12926
+ },
12927
+ entry.mainEntry
12928
+ ]
12929
+ ];
12930
+ if (entry.subEntry) term.push([
12931
+ 'span',
12932
+ {
12933
+ class: 'work-document-index-sub'
12934
+ },
12935
+ entry.subEntry
12936
+ ]);
12937
+ const pages = entry.crossReference ? [
12938
+ [
12939
+ 'span',
12940
+ {
12941
+ class: 'work-document-index-cross-reference'
12942
+ },
12943
+ `参见 ${entry.crossReference}`
12944
+ ]
12945
+ ] : entry.pages.flatMap((page, index)=>{
12946
+ const targetId = page.targetIds[0] ?? '';
12947
+ const result = [];
12948
+ if (index > 0) result.push([
12949
+ 'span',
12950
+ {
12951
+ 'aria-hidden': 'true'
12952
+ },
12953
+ ', '
12954
+ ]);
12955
+ result.push([
12956
+ 'a',
12957
+ {
12958
+ href: `#${targetId}`,
12959
+ 'data-index-target': targetId,
12960
+ tabindex: '-1',
12961
+ class: [
12962
+ page.pageBold ? 'bold' : '',
12963
+ page.pageItalic ? 'italic' : ''
12964
+ ].filter(Boolean).join(' ') || void 0
12965
+ },
12966
+ String(page.pageNumber)
12967
+ ]);
12968
+ return result;
12969
+ });
12970
+ return [
12971
+ 'li',
12972
+ {
12973
+ 'data-index-main-entry': entry.mainEntry,
12974
+ 'data-index-sub-entry': entry.subEntry
12975
+ },
12976
+ ...term,
12977
+ [
12978
+ 'i',
12979
+ {
12980
+ 'aria-hidden': 'true'
12981
+ }
12982
+ ],
12983
+ [
12984
+ 'span',
12985
+ {
12986
+ class: 'work-document-index-pages'
12987
+ },
12988
+ ...pages
12989
+ ]
12990
+ ];
12991
+ }
12992
+ function indexEntryLabel(value) {
12993
+ const term = value.subEntry ? `${value.mainEntry} › ${value.subEntry}` : value.mainEntry;
12994
+ return value.crossReference ? `${term} · 参见 ${value.crossReference}` : term;
12995
+ }
12996
+ function documentHasNode(editor, typeName) {
12997
+ let found = false;
12998
+ editor.state.doc.descendants((node)=>{
12999
+ if (node.type.name === typeName) found = true;
13000
+ return !found;
13001
+ });
13002
+ return found;
13003
+ }
13004
+ function work_document_index_nodes_hiddenAttribute(defaultValue) {
13005
+ return {
13006
+ default: defaultValue,
13007
+ rendered: false
13008
+ };
13009
+ }
13010
+ function work_document_index_nodes_stringAttribute(value) {
13011
+ return 'string' == typeof value ? value.trim() : '';
13012
+ }
12586
13013
  const DocumentLazyBlock = core_Node.create({
12587
13014
  name: DOCUMENT_LAZY_BLOCK_NODE,
12588
13015
  group: 'block',
@@ -18877,6 +19304,8 @@ function createWorkDocumentExtensions(options = {}) {
18877
19304
  citationExtension,
18878
19305
  DocumentBibliography,
18879
19306
  DocumentTableOfContents,
19307
+ DocumentIndexEntry,
19308
+ DocumentIndex,
18880
19309
  DocumentField,
18881
19310
  DocumentEquation,
18882
19311
  commentExtension,
@@ -20736,4 +21165,4 @@ function registerDocumentPageSurfaceGeometry(element, provider) {
20736
21165
  function documentPageSurfaceGeometryForElement(element) {
20737
21166
  return documentPageSurfaceProviders.get(element)?.() ?? null;
20738
21167
  }
20739
- export { DEFAULT_DOCUMENT_TABLE_CELL_FORMAT, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, DEFAULT_DOCUMENT_TABLE_GEOMETRY, DOCUMENT_BOOKMARK_DUPLICATE_MESSAGE, DOCUMENT_CHUNK_HYDRATION_META, DOCUMENT_CHUNK_PAGINATION_META, DOCUMENT_CHUNK_VISIBLE_IDS_META, DOCUMENT_LEGACY_TEXT_EFFECT_NAMES, DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE, DOCUMENT_PAGE_BORDER_EDGES, DOCUMENT_PAGE_MARGIN_KEYS, DOCUMENT_STRIKE_STYLE_ATTRIBUTE, DOCUMENT_TABLE_ROW_ID_ATTRIBUTE, DOCUMENT_TABLE_ROW_TEXT_ID_ATTRIBUTE, DOCUMENT_TABLE_STYLE_OPTIONS, DOCUMENT_UNDERLINE_STYLE_ATTRIBUTE, DocumentCharacterFormatting, DocumentEquation, DocumentFontFamily, DocumentHighlight, DocumentImage, DocumentParagraphFormatting, DocumentScriptFontFormatting, DocumentStrike, DocumentSubscript, DocumentSuperscript, DocumentTableRowIdentity, DocumentTextStyle, DocumentUnderline, MAX_DOCUMENT_IMAGE_RELATIVE_HEIGHT, MAX_DOCUMENT_NUMBERING_START, activeDocumentBookmark, activeDocumentSection, activeDocumentTableStyle, applyDocumentImageCropToElement, applyDocumentImageIdentityToElement, applyDocumentImageLayerToElement, applyDocumentImageWrapContourToElement, applyDocumentPageGeometry, applyDocumentTableGeometryToElement, applyDocumentTableRowIdentityToElement, applyDocumentTextCaseStyle, canChangeDocumentIndent, canInsertDocumentComment, canSetDocumentTableRowRepeatHeader, clampDocumentMargin, collectDocumentChanges, collectDocumentCommentAnchors, collectDocumentNotes, collectDocumentTextLayoutParagraphs, createDocumentBibliography, createDocumentEquationElement, createDocumentImageIdentityRegistry, createDocumentNoteElement, createSchemaDerivedWorkDocumentModel, createSchemaValidatedWorkDocumentModel, createWorkDocumentExtensions, createWorkDocumentModel, createWorkDocumentModelFromContent, createWorkOfficeDocumentCollaborationBinding as createOfficeDocumentCollaborationBinding, defaultDocumentImageWrapContour, documentAutoLineHeight, documentBookmarkNameExists, documentBookmarkReferenceInstruction, documentBulletListStyle, documentCaptionKind, documentCaptionLabel, documentCharacterPositionDomAttributes, documentCharacterPositionHalfPointsFromElement, documentCharacterPositionPoints, documentCharacterScaleDomAttributes, documentCharacterScalePercentFromElement, documentCharacterSpacingDomAttributes, documentCharacterSpacingPoints, documentCharacterSpacingTwipsFromElement, documentChunkMountedIds, documentCitationCount, documentCitationInstruction, documentCitationStyle, documentCitationStyleDetails, documentCitationTags, documentCitationTagsFromInstruction, documentCommentDraftRange, documentCommentViews, documentContentLayoutProperties, documentEmphasisMarkDomAttributes, documentEmphasisMarkFromElement, documentEquationFromElement, documentEquationText, documentHasTableOfContents, documentHiddenTextDomAttributes, documentHiddenTextFromElement, documentHiddenTextKeyboardShortcut, documentImageCropFromElement, documentImageIdentityFromElement, documentImageLayerFromElement, documentImageLayoutFromElement, documentImageLayoutOptions, documentImagePositionFromElement, documentImageProperties, documentImageWrapContourFromElement, documentInitialSectionLayout, documentKerningDomAttributes, documentKerningIsEffective, documentKerningThresholdHalfPointsFromElement, documentKerningThresholdPoints, documentLazyHtmlChunkFragment, documentLazyHtmlProjection, documentLazyHtmlProjectionFingerprint, documentLegacyTextEffectsConflict, documentLegacyTextEffectsCss, documentLegacyTextEffectsDomAttributes, documentLegacyTextEffectsFromElement, documentLegacyTextEffectsFromTextStyleAttributes, documentModelForContent, documentModelForHtml, documentModelHasTrustedInitialIntegrityFeatures, documentModelUsesWindowing, documentNoteKey, documentNoteKind, documentOrderedListState, documentPageBordersVisible, documentPageChromeLegacyFields, documentPageGeometryForLayout, documentPageHorizontalMarginTwips, documentPageMarginBody, documentPageMarginsForLayout, documentPageMetrics, documentPageSurfaceGeometryForElement, documentPaperSizeForGeometry, documentParagraphDirection, documentParagraphIndent, documentParagraphPagination, documentParagraphSpacing, documentParagraphTabStops, documentSectionById, documentSectionDomAttributes, documentSections, documentStrikeDomAttributes, documentStrikeFormattingFromElement, documentStrikeStyle, documentTabLeaderLabel, documentTableBordersFromElement, documentTableCellFormat, documentTableCellMarginOverridesFromElement, documentTableColumnPercentagesFromElement, documentTableGeometryFromElement, documentTableHorizontalAlignment, documentTableRowIdentityFromElement, documentTableRowOptions, documentTableSizing, documentTextCaseFromWordFlags, documentTextCaseKeyboardShortcuts, documentTextLayoutBatches, documentTextStatistics, documentTransactionsOnlyHydrateChunks, documentUnderlineColor, documentUnderlineDomAttributes, documentUnderlineFormattingFromElement, documentUnderlineKeyboardShortcuts, documentUnderlineStyle, documentWordLineHeightFactor, docxBookmarkReferenceTarget, docxDocumentFieldKind, editorDocumentBookmarkReferenceTargets, editorDocumentCaptionTargets, importedDocumentCharacterFormatting, initializeWorkOfficeDocumentCollaboration as initializeOfficeDocumentCollaboration, invalidateDocumentLazyHtmlProjection, isContourImageLayout, isValidDocumentCitationTag, materializeLazyDocumentEditorRoot, materializeWorkDocumentContent, measureDocumentLayoutBlocksIncrementally, millimetersToPixels, mountWorkLiveDocumentCapture, nextDocumentTabAlignment, normalizeDocumentBookmarkName, normalizeDocumentBookmarkNativeId, normalizeDocumentBookmarkReferencesHtml, normalizeDocumentBookmarksHtml, normalizeDocumentCaptionsHtml, normalizeDocumentCharacterPositionHalfPoints, normalizeDocumentCharacterScalePercent, normalizeDocumentCharacterSpacingTwips, normalizeDocumentCitationsHtml, normalizeDocumentColumns, normalizeDocumentEmphasisMark, normalizeDocumentEquation, normalizeDocumentFieldsHtml, normalizeDocumentHiddenText, normalizeDocumentHtml, normalizeDocumentImageAlignment, normalizeDocumentImageCrop, normalizeDocumentImageIdentity, normalizeDocumentImageLayer, normalizeDocumentImageLayoutOptions, normalizeDocumentImagePosition, normalizeDocumentImageWrapContour, normalizeDocumentImageWrapSide, normalizeDocumentKerningThresholdHalfPoints, normalizeDocumentLegacyTextEffect, normalizeDocumentLegacyTextEffects, normalizeDocumentNotesHtml, normalizeDocumentPageBorders, normalizeDocumentPageChrome, normalizeDocumentPageGeometry, normalizeDocumentPageMargins, normalizeDocumentPaperSource, normalizeDocumentParagraphIndent, normalizeDocumentStrikeStyle, normalizeDocumentTabStops, normalizeDocumentTableBorderStyle, normalizeDocumentTableBorderWidth, normalizeDocumentTableRowHeightRule, normalizeDocumentTableRowIdentity, normalizeDocumentTableVerticalAlign, normalizeDocumentTextCase, normalizeDocumentUnderlineColor, normalizeDocumentUnderlineStyle, normalizeTableColor, normalizedTabPosition, pageTwipsToMillimeters, parseDocumentCharacterFormatting, parseDocumentParagraphFormatting, patchDocumentLazyHtmlProjection, positionWorkLiveDocumentCapture, readWorkOfficeDocumentCollaboration as readOfficeDocumentCollaboration, registerDocumentPageSurfaceGeometry, renderDocumentAutoLineHeight, renderDocumentTableBorders, renderDocumentTableCellMarginOverrides, resolveDocumentPageBorders, resolveDocumentPageChrome, resolveDocumentPageMargins, resolveDocumentPageSize, resolveWorkDocumentEditorInput, retainAnchoredDocumentComments, sanitizeDocumentPageChromeHtml, selectedDocumentChunkId, selectedDocumentTableOfContentsOptions, serializeDocumentParagraphFormatting, serializeDocumentTabStops, serializeWorkDocumentNode, setCustomDocumentColumns, supportedDocxBookmarkReferenceInstruction, syncDocumentContentFromHtml, transferChangedDocumentTextStatistics, uniqueDocumentImageIdentity, updateDocumentColumnWidth, updateDocumentCustomPageMillimeters, updateDocumentGutterPosition, updateDocumentMirrorMargins, updateDocumentPageChromeVariant, updateDocumentPageMarginMillimeters, updateDocumentPageMarginMode, updateDocumentPageOrientation, updateDocumentPaperSizePreset, validateDocumentBookmarkName, windowDocumentModel, workDocumentSchema, workOfficeDocumentCollaborationFragment as officeDocumentCollaborationFragment, work_document_page_margins_twipsToMillimeters, wrapsBesideImage };
21168
+ export { DEFAULT_DOCUMENT_TABLE_CELL_FORMAT, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, DEFAULT_DOCUMENT_TABLE_GEOMETRY, DOCUMENT_BOOKMARK_DUPLICATE_MESSAGE, DOCUMENT_CHUNK_HYDRATION_META, DOCUMENT_CHUNK_PAGINATION_META, DOCUMENT_CHUNK_VISIBLE_IDS_META, DOCUMENT_LEGACY_TEXT_EFFECT_NAMES, DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE, DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE, DOCUMENT_PAGE_BORDER_EDGES, DOCUMENT_PAGE_MARGIN_KEYS, DOCUMENT_STRIKE_STYLE_ATTRIBUTE, DOCUMENT_TABLE_ROW_ID_ATTRIBUTE, DOCUMENT_TABLE_ROW_TEXT_ID_ATTRIBUTE, DOCUMENT_TABLE_STYLE_OPTIONS, DOCUMENT_UNDERLINE_STYLE_ATTRIBUTE, DocumentCharacterFormatting, DocumentEquation, DocumentFontFamily, DocumentHighlight, DocumentImage, DocumentParagraphFormatting, DocumentScriptFontFormatting, DocumentStrike, DocumentSubscript, DocumentSuperscript, DocumentTableRowIdentity, DocumentTextStyle, DocumentUnderline, MAX_DOCUMENT_IMAGE_RELATIVE_HEIGHT, MAX_DOCUMENT_NUMBERING_START, activeDocumentBookmark, activeDocumentSection, activeDocumentTableStyle, applyDocumentImageCropToElement, applyDocumentImageIdentityToElement, applyDocumentImageLayerToElement, applyDocumentImageWrapContourToElement, applyDocumentPageGeometry, applyDocumentTableGeometryToElement, applyDocumentTableRowIdentityToElement, applyDocumentTextCaseStyle, canChangeDocumentIndent, canInsertDocumentComment, canSetDocumentTableRowRepeatHeader, clampDocumentMargin, collectDocumentChanges, collectDocumentCommentAnchors, collectDocumentNotes, collectDocumentTextLayoutParagraphs, createDocumentBibliography, createDocumentEquationElement, createDocumentImageIdentityRegistry, createDocumentNoteElement, createSchemaDerivedWorkDocumentModel, createSchemaValidatedWorkDocumentModel, createWorkDocumentExtensions, createWorkDocumentModel, createWorkDocumentModelFromContent, createWorkOfficeDocumentCollaborationBinding as createOfficeDocumentCollaborationBinding, defaultDocumentImageWrapContour, documentAutoLineHeight, documentBookmarkNameExists, documentBookmarkReferenceInstruction, documentBulletListStyle, documentCaptionKind, documentCaptionLabel, documentCharacterPositionDomAttributes, documentCharacterPositionHalfPointsFromElement, documentCharacterPositionPoints, documentCharacterScaleDomAttributes, documentCharacterScalePercentFromElement, documentCharacterSpacingDomAttributes, documentCharacterSpacingPoints, documentCharacterSpacingTwipsFromElement, documentChunkMountedIds, documentCitationCount, documentCitationInstruction, documentCitationStyle, documentCitationStyleDetails, documentCitationTags, documentCitationTagsFromInstruction, documentCommentDraftRange, documentCommentViews, documentContentLayoutProperties, documentEmphasisMarkDomAttributes, documentEmphasisMarkFromElement, documentEquationFromElement, documentEquationText, documentHasIndex, documentHasTableOfContents, documentHiddenTextDomAttributes, documentHiddenTextFromElement, documentHiddenTextKeyboardShortcut, documentImageCropFromElement, documentImageIdentityFromElement, documentImageLayerFromElement, documentImageLayoutFromElement, documentImageLayoutOptions, documentImagePositionFromElement, documentImageProperties, documentImageWrapContourFromElement, documentInitialSectionLayout, documentKerningDomAttributes, documentKerningIsEffective, documentKerningThresholdHalfPointsFromElement, documentKerningThresholdPoints, documentLazyHtmlChunkFragment, documentLazyHtmlProjection, documentLazyHtmlProjectionFingerprint, documentLegacyTextEffectsConflict, documentLegacyTextEffectsCss, documentLegacyTextEffectsDomAttributes, documentLegacyTextEffectsFromElement, documentLegacyTextEffectsFromTextStyleAttributes, documentModelForContent, documentModelForHtml, documentModelHasTrustedInitialIntegrityFeatures, documentModelUsesWindowing, documentNoteKey, documentNoteKind, documentOrderedListState, documentPageBordersVisible, documentPageChromeLegacyFields, documentPageGeometryForLayout, documentPageHorizontalMarginTwips, documentPageMarginBody, documentPageMarginsForLayout, documentPageMetrics, documentPageSurfaceGeometryForElement, documentPaperSizeForGeometry, documentParagraphDirection, documentParagraphIndent, documentParagraphPagination, documentParagraphSpacing, documentParagraphTabStops, documentSectionById, documentSectionDomAttributes, documentSections, documentStrikeDomAttributes, documentStrikeFormattingFromElement, documentStrikeStyle, documentTabLeaderLabel, documentTableBordersFromElement, documentTableCellFormat, documentTableCellMarginOverridesFromElement, documentTableColumnPercentagesFromElement, documentTableGeometryFromElement, documentTableHorizontalAlignment, documentTableRowIdentityFromElement, documentTableRowOptions, documentTableSizing, documentTextCaseFromWordFlags, documentTextCaseKeyboardShortcuts, documentTextLayoutBatches, documentTextStatistics, documentTransactionsOnlyHydrateChunks, documentUnderlineColor, documentUnderlineDomAttributes, documentUnderlineFormattingFromElement, documentUnderlineKeyboardShortcuts, documentUnderlineStyle, documentWordLineHeightFactor, docxBookmarkReferenceTarget, docxDocumentFieldKind, editorDocumentBookmarkReferenceTargets, editorDocumentCaptionTargets, importedDocumentCharacterFormatting, initializeWorkOfficeDocumentCollaboration as initializeOfficeDocumentCollaboration, invalidateDocumentLazyHtmlProjection, isContourImageLayout, isValidDocumentCitationTag, materializeLazyDocumentEditorRoot, materializeWorkDocumentContent, measureDocumentLayoutBlocksIncrementally, millimetersToPixels, mountWorkLiveDocumentCapture, nextDocumentTabAlignment, normalizeDocumentBookmarkName, normalizeDocumentBookmarkNativeId, normalizeDocumentBookmarkReferencesHtml, normalizeDocumentBookmarksHtml, normalizeDocumentCaptionsHtml, normalizeDocumentCharacterPositionHalfPoints, normalizeDocumentCharacterScalePercent, normalizeDocumentCharacterSpacingTwips, normalizeDocumentCitationsHtml, normalizeDocumentColumns, normalizeDocumentEmphasisMark, normalizeDocumentEquation, normalizeDocumentFieldsHtml, normalizeDocumentHiddenText, normalizeDocumentHtml, normalizeDocumentImageAlignment, normalizeDocumentImageCrop, normalizeDocumentImageIdentity, normalizeDocumentImageLayer, normalizeDocumentImageLayoutOptions, normalizeDocumentImagePosition, normalizeDocumentImageWrapContour, normalizeDocumentImageWrapSide, normalizeDocumentKerningThresholdHalfPoints, normalizeDocumentLegacyTextEffect, normalizeDocumentLegacyTextEffects, normalizeDocumentNotesHtml, normalizeDocumentPageBorders, normalizeDocumentPageChrome, normalizeDocumentPageGeometry, normalizeDocumentPageMargins, normalizeDocumentPaperSource, normalizeDocumentParagraphIndent, normalizeDocumentStrikeStyle, normalizeDocumentTabStops, normalizeDocumentTableBorderStyle, normalizeDocumentTableBorderWidth, normalizeDocumentTableRowHeightRule, normalizeDocumentTableRowIdentity, normalizeDocumentTableVerticalAlign, normalizeDocumentTextCase, normalizeDocumentUnderlineColor, normalizeDocumentUnderlineStyle, normalizeTableColor, normalizedTabPosition, pageTwipsToMillimeters, parseDocumentCharacterFormatting, parseDocumentParagraphFormatting, patchDocumentLazyHtmlProjection, positionWorkLiveDocumentCapture, readWorkOfficeDocumentCollaboration as readOfficeDocumentCollaboration, registerDocumentPageSurfaceGeometry, renderDocumentAutoLineHeight, renderDocumentTableBorders, renderDocumentTableCellMarginOverrides, resolveDocumentPageBorders, resolveDocumentPageChrome, resolveDocumentPageMargins, resolveDocumentPageSize, resolveWorkDocumentEditorInput, retainAnchoredDocumentComments, sanitizeDocumentPageChromeHtml, selectedDocumentChunkId, selectedDocumentIndexDraft, selectedDocumentIndexEntry, selectedDocumentIndexOptions, selectedDocumentTableOfContentsOptions, serializeDocumentParagraphFormatting, serializeDocumentTabStops, serializeWorkDocumentNode, setCustomDocumentColumns, supportedDocxBookmarkReferenceInstruction, syncDocumentContentFromHtml, transferChangedDocumentTextStatistics, uniqueDocumentImageIdentity, updateDocumentColumnWidth, updateDocumentCustomPageMillimeters, updateDocumentGutterPosition, updateDocumentMirrorMargins, updateDocumentPageChromeVariant, updateDocumentPageMarginMillimeters, updateDocumentPageMarginMode, updateDocumentPageOrientation, updateDocumentPaperSizePreset, validateDocumentBookmarkName, windowDocumentModel, workDocumentSchema, workOfficeDocumentCollaborationFragment as officeDocumentCollaborationFragment, work_document_page_margins_twipsToMillimeters, wrapsBesideImage };
@@ -616,6 +616,33 @@ export declare const documentCommandCatalog: {
616
616
  readonly group: "tableOfContents";
617
617
  };
618
618
  };
619
+ readonly markIndexEntry: {
620
+ readonly id: "references.markIndexEntry";
621
+ readonly label: "标记索引项";
622
+ readonly location: {
623
+ readonly area: "ribbon";
624
+ readonly tab: "references";
625
+ readonly group: "index";
626
+ };
627
+ };
628
+ readonly index: {
629
+ readonly id: "references.index";
630
+ readonly label: "插入或自定义索引";
631
+ readonly location: {
632
+ readonly area: "ribbon";
633
+ readonly tab: "references";
634
+ readonly group: "index";
635
+ };
636
+ };
637
+ readonly refreshIndex: {
638
+ readonly id: "references.refreshIndex";
639
+ readonly label: "更新索引";
640
+ readonly location: {
641
+ readonly area: "ribbon";
642
+ readonly tab: "references";
643
+ readonly group: "index";
644
+ };
645
+ };
619
646
  readonly refreshFields: {
620
647
  readonly id: "references.refreshFields";
621
648
  readonly label: "更新域";
@@ -0,0 +1,7 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ /**
3
+ * Reconciles a visible browser text selection before a capture-phase command
4
+ * snapshots editor state. Selection-change delivery can lag behind a keyboard
5
+ * shortcut under load, leaving ProseMirror with an older collapsed selection.
6
+ */
7
+ export declare function synchronizeDocumentEditorSelectionFromDom(editor: Editor): boolean;
@@ -28,3 +28,4 @@ interface CustomSelectionMenuItem<Context> {
28
28
  export declare function customSelectionMenuItems<Context>(items: readonly CustomSelectionMenuItem<Context>[], createAction: () => CustomSelectionAction<Context>): WorkspaceContextMenuItem[];
29
29
  export declare function documentPageCount(editor: Editor): number;
30
30
  export declare function documentCurrentPage(editor: Editor): number;
31
+ export declare function documentHasRefreshableFields(editor: Editor): boolean;
@@ -0,0 +1,10 @@
1
+ import type { WorkDocumentIndexOptions } from '../work-document-index';
2
+ export interface DocumentIndexDialogProps {
3
+ editing: boolean;
4
+ options: WorkDocumentIndexOptions;
5
+ restoreFocusTarget: () => HTMLElement | null;
6
+ onCancel: () => void;
7
+ onOptionsChange: (options: WorkDocumentIndexOptions) => void;
8
+ onSubmit: () => void;
9
+ }
10
+ export declare function DocumentIndexDialog({ editing, options, restoreFocusTarget, onCancel, onOptionsChange, onSubmit, }: DocumentIndexDialogProps): import("react").JSX.Element;
@@ -0,0 +1,10 @@
1
+ import type { WorkDocumentIndexEntryDraft } from '../work-document-index';
2
+ export interface DocumentIndexEntryDialogProps {
3
+ editing: boolean;
4
+ value: WorkDocumentIndexEntryDraft;
5
+ restoreFocusTarget: () => HTMLElement | null;
6
+ onCancel: () => void;
7
+ onChange: (value: WorkDocumentIndexEntryDraft) => void;
8
+ onSubmit: () => void;
9
+ }
10
+ export declare function DocumentIndexEntryDialog({ editing, value, restoreFocusTarget, onCancel, onChange, onSubmit, }: DocumentIndexEntryDialogProps): import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import type { Editor } from '@tiptap/core';
2
+ import type { WorkDocumentCaptionKind } from '../work-document-captions';
3
+ import type { WorkDocumentNoteKind } from '../work-document-notes';
4
+ export interface DocumentReferencesRibbonProps {
5
+ editor: Editor;
6
+ citationsOpen: boolean;
7
+ citationSourceCount: number;
8
+ onInsertNote: (kind: WorkDocumentNoteKind) => void;
9
+ onInsertCaption: (kind: WorkDocumentCaptionKind) => void;
10
+ onInsertCrossReference: () => void;
11
+ onOpenTableOfContents: () => void;
12
+ onRefreshTableOfContents: () => void;
13
+ onOpenIndexEntry: () => void;
14
+ onOpenIndex: () => void;
15
+ onRefreshIndex: () => void;
16
+ onToggleCitations: () => void;
17
+ onRefreshFields: () => void;
18
+ }
19
+ export declare function DocumentReferencesRibbon({ editor, citationsOpen, citationSourceCount, onInsertNote, onInsertCaption, onInsertCrossReference, onOpenTableOfContents, onRefreshTableOfContents, onOpenIndexEntry, onOpenIndex, onRefreshIndex, onToggleCitations, onRefreshFields, }: DocumentReferencesRibbonProps): import("react").JSX.Element;
@@ -58,11 +58,14 @@ interface DocumentToolbarProps {
58
58
  onInsertCaption: (kind: WorkDocumentCaptionKind) => void;
59
59
  onInsertCrossReference: () => void;
60
60
  onOpenTableOfContents: () => void;
61
+ onOpenIndexEntry: () => void;
62
+ onOpenIndex: () => void;
61
63
  citationsOpen: boolean;
62
64
  citationSourceCount: number;
63
65
  onToggleCitations: () => void;
64
66
  onInsertField: (kind: WorkDocumentFieldKind) => void;
65
67
  onRefreshFields: () => void;
68
+ onRefreshIndex: () => void;
66
69
  onRefreshTableOfContents: () => void;
67
70
  canInsertComment: boolean;
68
71
  onInsertComment: () => void;
@@ -81,5 +84,5 @@ interface DocumentToolbarProps {
81
84
  onOpenWordCount: () => void;
82
85
  onOpenFindReplace: (mode: DocumentFindReplaceMode) => void;
83
86
  }
84
- export declare function DocumentToolbar({ editor, defaultRibbonCollapsed, reviewOnly, suggestionOnly, history, layoutOpen, layout, layoutFonts, navigationOpen, pageColor, showPageNumbers, showHiddenText, showRulers, spellcheckEnabled, viewMode, zoom, pageChromeEditor, pageChromeEditingPart, pageChromeShowPageNumber, onRequestImage, onPageChromeEditingPartChange, onClosePageChrome, onTogglePageChromePageNumber, onToggleLayout, onLayoutChange, onOpenLayout, onToggleNavigation, onTogglePageNumbers, onToggleHiddenText, onToggleRulers, onPageColorChange, onToggleSpellcheck, onViewModeChange, onZoomChange, onZoomFit, onInsertSection, onInsertNote, onInsertCaption, onInsertCrossReference, onOpenTableOfContents, citationsOpen, citationSourceCount, onToggleCitations, onInsertField, onRefreshFields, onRefreshTableOfContents, canInsertComment, onInsertComment, commentsOpen, commentCount, onToggleComments, trackChanges, changesOpen, changeCount, findReplaceMode, fileActions, onRibbonTabChange, onToggleTrackChanges, onToggleChanges, onDecideChange, onOpenWordCount, onOpenFindReplace, }: DocumentToolbarProps): import("react").JSX.Element;
87
+ export declare function DocumentToolbar({ editor, defaultRibbonCollapsed, reviewOnly, suggestionOnly, history, layoutOpen, layout, layoutFonts, navigationOpen, pageColor, showPageNumbers, showHiddenText, showRulers, spellcheckEnabled, viewMode, zoom, pageChromeEditor, pageChromeEditingPart, pageChromeShowPageNumber, onRequestImage, onPageChromeEditingPartChange, onClosePageChrome, onTogglePageChromePageNumber, onToggleLayout, onLayoutChange, onOpenLayout, onToggleNavigation, onTogglePageNumbers, onToggleHiddenText, onToggleRulers, onPageColorChange, onToggleSpellcheck, onViewModeChange, onZoomChange, onZoomFit, onInsertSection, onInsertNote, onInsertCaption, onInsertCrossReference, onOpenTableOfContents, onOpenIndexEntry, onOpenIndex, citationsOpen, citationSourceCount, onToggleCitations, onInsertField, onRefreshFields, onRefreshIndex, onRefreshTableOfContents, canInsertComment, onInsertComment, commentsOpen, commentCount, onToggleComments, trackChanges, changesOpen, changeCount, findReplaceMode, fileActions, onRibbonTabChange, onToggleTrackChanges, onToggleChanges, onDecideChange, onOpenWordCount, onOpenFindReplace, }: DocumentToolbarProps): import("react").JSX.Element;
85
88
  export {};
@@ -11,8 +11,11 @@ export interface DocumentInsertCommands {
11
11
  insertField: (kind: WorkDocumentFieldKind) => void;
12
12
  insertImage: (file: File) => Promise<void>;
13
13
  insertNote: (kind: WorkDocumentNoteKind) => boolean;
14
+ openIndexEntry: () => void;
15
+ openIndex: () => void;
14
16
  openTableOfContents: () => void;
15
17
  refreshFields: () => boolean;
18
+ refreshIndex: () => boolean;
16
19
  refreshTableOfContents: () => boolean;
17
20
  }
18
21
  export declare function useDocumentInsertCommands({ contentRef, editor, resolveFieldContext, }: {
@@ -0,0 +1,19 @@
1
+ import { type WorkDocumentIndexEntryDraft, type WorkDocumentIndexOptions } from './work-document-index';
2
+ export type WorkDocumentIndexEntryInstructionResult = {
3
+ supported: true;
4
+ value: WorkDocumentIndexEntryDraft;
5
+ } | {
6
+ supported: false;
7
+ reason: 'not-index-entry' | 'invalid-instruction' | 'invalid-entry' | 'unsupported-switch';
8
+ };
9
+ export type WorkDocumentIndexInstructionResult = {
10
+ supported: true;
11
+ options: WorkDocumentIndexOptions;
12
+ } | {
13
+ supported: false;
14
+ reason: 'not-index' | 'invalid-instruction' | 'invalid-columns' | 'unsupported-switch';
15
+ };
16
+ export declare function parseDocumentIndexEntryInstruction(instruction: string): WorkDocumentIndexEntryInstructionResult;
17
+ export declare function documentIndexEntryInstruction(source: WorkDocumentIndexEntryDraft): string;
18
+ export declare function parseDocumentIndexInstruction(instruction: string): WorkDocumentIndexInstructionResult;
19
+ export declare function documentIndexInstruction(source: WorkDocumentIndexOptions): string;