@stll/folio-core 0.4.0 → 0.6.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.
- package/dist/ai-edits/apply.d.ts +3 -9
- package/dist/ai-edits/apply.js +94 -14
- package/dist/ai-edits/blockRange.d.ts +33 -0
- package/dist/ai-edits/blockRange.js +58 -0
- package/dist/ai-edits/headless.d.ts +37 -4
- package/dist/ai-edits/headless.js +134 -16
- package/dist/ai-edits/index.d.ts +5 -3
- package/dist/ai-edits/index.js +3 -2
- package/dist/ai-edits/snapshot.d.ts +14 -2
- package/dist/ai-edits/snapshot.js +12 -1
- package/dist/ai-edits/types.d.ts +42 -3
- package/dist/compat/eigenpal.d.ts +3 -2
- package/dist/compat/eigenpal.js +6 -5
- package/dist/controller/layoutPipeline.d.ts +1 -0
- package/dist/controller/layoutPipeline.js +35 -137
- package/dist/controller/layoutScheduler.d.ts +2 -1
- package/dist/controller/layoutScheduler.js +6 -0
- package/dist/document-operations.d.ts +139 -0
- package/dist/document-operations.js +578 -0
- package/dist/docx/blockContentParser.js +17 -7
- package/dist/docx/encryption/agileDecryption.js +2 -1
- package/dist/docx/encryption/compoundFile.js +4 -2
- package/dist/docx/footnoteParser.d.ts +1 -17
- package/dist/docx/footnoteParser.js +1 -27
- package/dist/docx/groupDrawingParser.d.ts +8 -0
- package/dist/docx/groupDrawingParser.js +131 -0
- package/dist/docx/numberingParser.d.ts +3 -1
- package/dist/docx/numberingParser.js +8 -2
- package/dist/docx/paragraphParser.js +9 -3
- package/dist/docx/runParser.js +8 -1
- package/dist/docx/selectiveXmlPatch.js +4 -10
- package/dist/docx/serializer/numberingSerializer.js +3 -1
- package/dist/docx/settingsParser.d.ts +6 -3
- package/dist/docx/settingsParser.js +2 -0
- package/dist/docx/xmlParser.js +11 -4
- package/dist/i18n/messages/catalogs.gen.d.ts +1054 -34
- package/dist/i18n/messages/catalogs.gen.js +1122 -68
- package/dist/i18n/messages/messages.gen.d.ts +62 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +6 -5
- package/dist/layout-bridge/convert/footnoteLayout.d.ts +37 -1
- package/dist/layout-bridge/convert/footnoteLayout.js +138 -14
- package/dist/layout-bridge/convert/headerFooterLayout.d.ts +5 -7
- package/dist/layout-bridge/convert/headerFooterLayout.js +5 -7
- package/dist/layout-bridge/convert/toFlowBlocks.js +56 -19
- package/dist/layout-engine/index.d.ts +6 -5
- package/dist/layout-engine/index.js +143 -30
- package/dist/layout-engine/keep-together.d.ts +13 -8
- package/dist/layout-engine/keep-together.js +40 -25
- package/dist/layout-engine/layoutInstrumentation.d.ts +11 -1
- package/dist/layout-engine/layoutInstrumentation.js +10 -1
- package/dist/layout-engine/measure/measureBlocks.js +50 -18
- package/dist/layout-engine/measure/measureParagraph.js +61 -15
- package/dist/layout-engine/paginator.d.ts +2 -1
- package/dist/layout-engine/paginator.js +9 -3
- package/dist/layout-engine/textBoxGroup.d.ts +7 -0
- package/dist/layout-engine/textBoxGroup.js +8 -0
- package/dist/layout-engine/types.d.ts +30 -9
- package/dist/layout-engine/types.js +20 -2
- package/dist/layout-painter/renderPage.d.ts +15 -1
- package/dist/layout-painter/renderPage.js +27 -11
- package/dist/layout-painter/renderParagraph.js +18 -8
- package/dist/layout-painter/renderTable.js +10 -7
- package/dist/managers/DocumentLoaderManager.js +12 -5
- package/dist/model.js +1 -1
- package/dist/paged-layout/pageText.d.ts +14 -0
- package/dist/paged-layout/pageText.js +21 -0
- package/dist/prosemirror/attrs/index.js +2 -0
- package/dist/prosemirror/commands/comments.js +75 -5
- package/dist/prosemirror/commands/hyperlink.js +4 -2
- package/dist/prosemirror/commands/image.js +2 -1
- package/dist/prosemirror/commands/propertyChangeScope.d.ts +68 -0
- package/dist/prosemirror/commands/propertyChangeScope.js +242 -0
- package/dist/prosemirror/conversion/fromProseDoc.js +14 -3
- package/dist/prosemirror/conversion/toProseDoc.js +29 -8
- package/dist/prosemirror/extensions/core/ParagraphExtension.js +2 -0
- package/dist/prosemirror/extensions/features/ListExtension.js +6 -0
- package/dist/prosemirror/extensions/nodes/TableExtension.js +10 -11
- package/dist/prosemirror/findReplaceSelection.js +2 -1
- package/dist/prosemirror/schema/nodes.d.ts +10 -5
- package/dist/prosemirror/styles/resolvedStyleAttrs.js +1 -0
- package/dist/prosemirror/utils/tabCalculator.js +4 -2
- package/dist/redline.d.ts +20 -0
- package/dist/redline.js +127 -0
- package/dist/server.d.ts +7 -3
- package/dist/server.js +6 -2
- package/dist/symbols.d.ts +35 -0
- package/dist/symbols.js +512 -0
- package/dist/utils/clipboard.js +3 -3
- package/dist/utils/fontLoader.js +3 -0
- package/dist/utils/fontResolver.js +48 -1
- package/dist/utils/zoom.d.ts +21 -0
- package/dist/utils/zoom.js +21 -0
- package/dist/version-comparison.d.ts +92 -0
- package/dist/version-comparison.js +436 -0
- package/package.json +3 -3
- package/dist/paged-layout/headerFooterMargins.d.ts +0 -75
- package/dist/paged-layout/headerFooterMargins.js +0 -122
|
@@ -35,6 +35,7 @@ type Messages = {
|
|
|
35
35
|
"red": "Red";
|
|
36
36
|
"yellow": "Yellow";
|
|
37
37
|
};
|
|
38
|
+
"custom": "Custom";
|
|
38
39
|
"customColor": "Custom Color";
|
|
39
40
|
"noColor": "No color";
|
|
40
41
|
"standardColors": "Standard Colors";
|
|
@@ -59,6 +60,7 @@ type Messages = {
|
|
|
59
60
|
"closeDialog": "Close";
|
|
60
61
|
"insert": "Insert";
|
|
61
62
|
"px": "px";
|
|
63
|
+
"remove": "Remove";
|
|
62
64
|
"update": "Update";
|
|
63
65
|
};
|
|
64
66
|
"contentControlDateAriaLabel": "Pick a date";
|
|
@@ -122,13 +124,16 @@ type Messages = {
|
|
|
122
124
|
"title": "Footnote & Endnote Properties";
|
|
123
125
|
};
|
|
124
126
|
"hyperlink": {
|
|
127
|
+
"addressLabel": "Address";
|
|
125
128
|
"bookmarkLabel": "Bookmark";
|
|
126
129
|
"bookmarkPlaceholder": "Select a bookmark";
|
|
127
130
|
"displayTextHint": "Defaults to the selected text";
|
|
128
131
|
"displayTextLabel": "Display text";
|
|
129
132
|
"displayTextPlaceholder": "Text to display";
|
|
130
133
|
"invalidUrl": "Enter a valid URL";
|
|
134
|
+
"linkTo": "Link to";
|
|
131
135
|
"removeLink": "Remove link";
|
|
136
|
+
"screenTipLabel": "Screen tip";
|
|
132
137
|
"tabBookmark": "Bookmark";
|
|
133
138
|
"tabWebAddress": "Web address";
|
|
134
139
|
"titleEdit": "Edit hyperlink";
|
|
@@ -150,9 +155,11 @@ type Messages = {
|
|
|
150
155
|
"top": "Top";
|
|
151
156
|
};
|
|
152
157
|
"alignment": "Alignment";
|
|
158
|
+
"distanceFromText": "Distance from text (px)";
|
|
153
159
|
"horizontal": "Horizontal";
|
|
154
160
|
"offset": "Offset";
|
|
155
161
|
"offsetPx": "Offset (px)";
|
|
162
|
+
"position": "Position";
|
|
156
163
|
"relativeOptions": {
|
|
157
164
|
"character": "Character";
|
|
158
165
|
"column": "Column";
|
|
@@ -173,12 +180,17 @@ type Messages = {
|
|
|
173
180
|
"dashed": "Dashed";
|
|
174
181
|
"dotted": "Dotted";
|
|
175
182
|
"double": "Double";
|
|
183
|
+
"groove": "Groove";
|
|
184
|
+
"inset": "Inset";
|
|
185
|
+
"outset": "Outset";
|
|
186
|
+
"ridge": "Ridge";
|
|
176
187
|
"solid": "Solid";
|
|
177
188
|
};
|
|
178
189
|
"color": "Color";
|
|
179
190
|
"dimensions": "Dimensions";
|
|
180
191
|
"heightLabel": "Height";
|
|
181
192
|
"lockAspectRatio": "Lock aspect ratio";
|
|
193
|
+
"preview": "Preview";
|
|
182
194
|
"style": "Style";
|
|
183
195
|
"textWrapping": "Text wrapping";
|
|
184
196
|
"title": "Image Properties";
|
|
@@ -193,6 +205,11 @@ type Messages = {
|
|
|
193
205
|
"wrapRight": "Wrap right";
|
|
194
206
|
};
|
|
195
207
|
};
|
|
208
|
+
"insertImage": {
|
|
209
|
+
"altText": "Alt text";
|
|
210
|
+
"imageFile": "Image file";
|
|
211
|
+
"title": "Insert Image";
|
|
212
|
+
};
|
|
196
213
|
"insertSymbol": {
|
|
197
214
|
"categories": {
|
|
198
215
|
"arrows": "Arrows";
|
|
@@ -209,18 +226,19 @@ type Messages = {
|
|
|
209
226
|
"title": "Insert symbol";
|
|
210
227
|
};
|
|
211
228
|
"insertTable": {
|
|
212
|
-
"autofit": "Autofit";
|
|
229
|
+
"autofit": "Autofit to contents";
|
|
213
230
|
"columnWidthLabel": "Column width";
|
|
214
231
|
"columnsLabel": "Columns";
|
|
215
232
|
"fixedWidth": "Fixed width";
|
|
216
233
|
"hoverToSelect": "Hover to select table size";
|
|
217
234
|
"insertButton": "Insert";
|
|
218
235
|
"orSpecifySize": "Or specify size";
|
|
236
|
+
"plainTable": "Plain table";
|
|
219
237
|
"rowsLabel": "Rows";
|
|
220
238
|
"sizeSelector": "Table size selector";
|
|
221
239
|
"style": "Style";
|
|
222
240
|
"tableSize": "{cols} × {rows} table";
|
|
223
|
-
"title": "Insert
|
|
241
|
+
"title": "Insert Table";
|
|
224
242
|
"validationHint": "Rows: {minRows}–{maxRows}, columns: {minCols}–{maxCols}";
|
|
225
243
|
};
|
|
226
244
|
"pageSetup": {
|
|
@@ -245,6 +263,16 @@ type Messages = {
|
|
|
245
263
|
"sizeLabel": "Size";
|
|
246
264
|
"title": "Page Setup";
|
|
247
265
|
"top": "Top";
|
|
266
|
+
"unitInches": "in";
|
|
267
|
+
};
|
|
268
|
+
"pasteSpecial": {
|
|
269
|
+
"pasteMode": "Paste mode";
|
|
270
|
+
"title": "Paste Special";
|
|
271
|
+
};
|
|
272
|
+
"splitCell": {
|
|
273
|
+
"mergeBeforeSplit": "Merge selected cells before splitting";
|
|
274
|
+
"splitButton": "Split";
|
|
275
|
+
"title": "Split Cell";
|
|
248
276
|
};
|
|
249
277
|
"tableProperties": {
|
|
250
278
|
"alignOptions": {
|
|
@@ -266,6 +294,23 @@ type Messages = {
|
|
|
266
294
|
"percentage": "Percentage";
|
|
267
295
|
};
|
|
268
296
|
};
|
|
297
|
+
"watermark": {
|
|
298
|
+
"color": "Color";
|
|
299
|
+
"diagonal": "Diagonal";
|
|
300
|
+
"font": "Font";
|
|
301
|
+
"imageRelationshipId": "Header image relationship id";
|
|
302
|
+
"imageTarget": "Image target";
|
|
303
|
+
"noWatermark": "No watermark";
|
|
304
|
+
"opacity": "Opacity";
|
|
305
|
+
"pictureWatermark": "Picture watermark";
|
|
306
|
+
"scale": "Scale";
|
|
307
|
+
"targetIsExternalUrl": "Target is an external URL";
|
|
308
|
+
"text": "Text";
|
|
309
|
+
"textWatermark": "Text watermark";
|
|
310
|
+
"title": "Watermark";
|
|
311
|
+
"type": "Type";
|
|
312
|
+
"washout": "Washout";
|
|
313
|
+
};
|
|
269
314
|
};
|
|
270
315
|
"discardChanges": "Discard";
|
|
271
316
|
"dismiss": "Dismiss";
|
|
@@ -338,6 +383,17 @@ type Messages = {
|
|
|
338
383
|
"superscriptShortcut": "Superscript (Ctrl+Shift+=)";
|
|
339
384
|
};
|
|
340
385
|
"formattingToolbar": "Formatting toolbar";
|
|
386
|
+
"headerFooter": {
|
|
387
|
+
"closeFooterEditing": "Close footer editing";
|
|
388
|
+
"closeHeaderEditing": "Close header editing";
|
|
389
|
+
"footer": "Footer";
|
|
390
|
+
"header": "Header";
|
|
391
|
+
"insertPageCount": "Insert total page count";
|
|
392
|
+
"insertPageNumber": "Insert current page number";
|
|
393
|
+
"options": "Options";
|
|
394
|
+
"removeFooter": "Remove footer";
|
|
395
|
+
"removeHeader": "Remove header";
|
|
396
|
+
};
|
|
341
397
|
"hideDetails": "Hide details";
|
|
342
398
|
"historyGroup": "History";
|
|
343
399
|
"imageOverlay": {
|
|
@@ -399,6 +455,7 @@ type Messages = {
|
|
|
399
455
|
};
|
|
400
456
|
"listFormatting": "List formatting";
|
|
401
457
|
"listsGroup": "Lists";
|
|
458
|
+
"loadDocumentFailedTitle": "Failed to Load Document";
|
|
402
459
|
"loadingDocument": "Loading document...";
|
|
403
460
|
"loadingEditor": "Loading editor...";
|
|
404
461
|
"lockFile": "Lock file";
|
|
@@ -411,8 +468,10 @@ type Messages = {
|
|
|
411
468
|
"moreFormatting": "More formatting";
|
|
412
469
|
"networkError": "Network error. Please check your internet connection and try again.";
|
|
413
470
|
"nextChange": "Next Change";
|
|
471
|
+
"noDocumentLoaded": "No document loaded";
|
|
414
472
|
"numberedList": "Numbered List";
|
|
415
473
|
"parseError": "The document could not be parsed. It may be corrupted or in an unsupported format.";
|
|
474
|
+
"parseErrorTitle": "Unable to Parse Document";
|
|
416
475
|
"paste": "Paste";
|
|
417
476
|
"pasteUnformatted": "Paste without formatting";
|
|
418
477
|
"previousChange": "Previous Change";
|
|
@@ -572,6 +631,7 @@ type Messages = {
|
|
|
572
631
|
"viewGroup": "View";
|
|
573
632
|
"viewer": {
|
|
574
633
|
"pageIndicator": "Page {current} of {total}";
|
|
634
|
+
"pageOfTotal": "{current} of {total}";
|
|
575
635
|
};
|
|
576
636
|
"zoom": {
|
|
577
637
|
"zoomIn": "Zoom in";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockPreviewRun, FolioAIComment, FolioAIEditAppliedOperation, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, FolioAIEditReviewMeta, FolioAIEditSeverity, FolioAIEditSkipReason, FolioAIEditSkippedOperation, FolioAIEditSnapshot, FolioAISignatureParty } from "./ai-edits/types.js";
|
|
1
|
+
import { FolioAIBlock, FolioAIBlockAnchor, FolioAIBlockKind, FolioAIBlockPreviewRun, FolioAIComment, FolioAIEditAppliedOperation, FolioAIEditApplyMode, FolioAIEditApplyResult, FolioAIEditOperation, FolioAIEditPrecondition, FolioAIEditReviewMeta, FolioAIEditSeverity, FolioAIEditSkipReason, FolioAIEditSkippedOperation, FolioAIEditSnapshot, FolioAISignatureParty } from "./ai-edits/types.js";
|
|
2
2
|
import { applyFolioAIEditOperations } from "./ai-edits/apply.js";
|
|
3
3
|
import { document_d_exports } from "./types/document.js";
|
|
4
|
+
import { ApplyFolioDocumentOperationsOptions, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, FolioDocumentOperation, FolioDocumentOperationAffectedTarget, FolioDocumentOperationBatch, FolioDocumentOperationCapabilities, FolioDocumentOperationIssue, FolioDocumentOperationMode, FolioDocumentOperationPrecondition, FolioDocumentOperationReceipt, FolioDocumentOperationRecovery, FolioDocumentOperationResult, FolioDocumentOperationStatus, FolioDocumentOperationType, FolioDocumentOperationUndoFailureReason, FolioDocumentOperationUndoHandle, FolioDocumentOperationUndoResult, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
|
|
4
5
|
import { createFolioAIEditSnapshot, hashFolioAIBlockText, normalizeFolioAIBlockText } from "./ai-edits/snapshot.js";
|
|
5
6
|
import { DeriveBlockIdInput, FolioBlockId, deriveBlockId, getFolioParaIdFromBlockId, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
|
|
6
7
|
import { WordDiffSegment, diffWordSegments } from "./ai-edits/word-diff.js";
|
|
@@ -26,4 +27,4 @@ import { toMarkdown, toMarkdownResult } from "./markdown/index.js";
|
|
|
26
27
|
import { EmbeddedFont, EmbeddedFontParts, extractEmbeddedFonts, getEmbeddedFontFaces } from "./fonts/embeddedFonts.js";
|
|
27
28
|
import { getGoogleFontsEnabled, setGoogleFontsEnabled } from "./utils/fontResolver.js";
|
|
28
29
|
type Document = document_d_exports.Document;
|
|
29
|
-
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyResult, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocxCompatibility, type EmbeddedFont, type EmbeddedFontParts, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type ImageMeta, type ImageRef, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applySuggestions, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, deriveBlockId, diffWordSegments, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, isFolioBlockId, isSequentialFolioBlockId, isSuggestionStale, normalizeFolioAIBlockText, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
|
30
|
+
export { type AIBarStatus, type AIChatMode, type AICitation, type AICitationRange, type AICitationSource, type AIGenerateInput, type AISuggestion, type AISuggestionApplyMode, type AISuggestionPreset, type AISuggestionSeverity, type AISuggestionStatus, type AcceptAutocompleteResult, type AnonymizationMatch, type AnonymizationTerm, type ApplyFolioDocumentOperationsOptions, type ApplyResult, type AutocompleteSuggestionPluginOptions, type AutocompleteSuggestionState, type AutocompleteSuggestionStatus, type AutocompleteTriggerCheck, type AutocompleteTriggerOptions, type AutocompleteTriggerSkipReason, type CreateEmptyDocumentOptions, DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, type DeriveBlockIdInput, type DirectiveKind, type DirectiveRange, type Document, type DocxCompatibility, type EmbeddedFont, type EmbeddedFontParts, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, type FolioAIBlock, type FolioAIBlockAnchor, type FolioAIBlockKind, type FolioAIBlockPreviewRun, type FolioAIComment, type FolioAIEditAppliedOperation, type FolioAIEditApplyMode, type FolioAIEditApplyResult, type FolioAIEditOperation, type FolioAIEditPrecondition, type FolioAIEditReviewMeta, type FolioAIEditSeverity, type FolioAIEditSkipReason, type FolioAIEditSkippedOperation, type FolioAIEditSnapshot, type FolioAISignatureParty, type FolioBlockId, type FolioDocumentOperation, type FolioDocumentOperationAffectedTarget, type FolioDocumentOperationBatch, type FolioDocumentOperationCapabilities, type FolioDocumentOperationIssue, type FolioDocumentOperationMode, type FolioDocumentOperationPrecondition, type FolioDocumentOperationReceipt, type FolioDocumentOperationRecovery, type FolioDocumentOperationResult, type FolioDocumentOperationStatus, type FolioDocumentOperationType, type FolioDocumentOperationUndoFailureReason, type FolioDocumentOperationUndoHandle, type FolioDocumentOperationUndoResult, type ImageMeta, type ImageRef, InvalidFolioDocumentOperationBatchError, type MarkdownOptions, type MarkdownResult, type PositionalText, type ResolvedAnchor, type TemplatePreviewSpan, type TemplatePreviewValue, type TemplatePreviewValues, type TemplateSlashMenuKeyAction, type TemplateSlashMenuState, UnsupportedFolioDocumentOperationVersionError, type WordDiffSegment, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, deriveBlockId, diffWordSegments, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { deriveBlockId, getFolioParaIdFromBlockId, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
|
|
2
|
+
import { createFolioAIEditSnapshot, hashFolioAIBlockText, normalizeFolioAIBlockText } from "./ai-edits/snapshot.js";
|
|
3
|
+
import { diffWordSegments } from "./ai-edits/word-diff.js";
|
|
4
|
+
import { applyFolioAIEditOperations } from "./ai-edits/apply.js";
|
|
5
|
+
import { FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, applyFolioDocumentOperations, assertSupportedFolioDocumentOperationVersion, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, isFolioDocumentOperationModeSupported, isSupportedFolioDocumentOperationVersion, parseFolioDocumentOperationBatch } from "./document-operations.js";
|
|
1
6
|
import { createEmptyDocument } from "./utils/createDocument.js";
|
|
2
7
|
import { createDocx } from "./docx/rezip.js";
|
|
3
|
-
import { deriveBlockId, getFolioParaIdFromBlockId, isFolioBlockId, isSequentialFolioBlockId } from "./types/block-id.js";
|
|
4
8
|
import { DEFAULT_AI_SUGGESTION_PRESETS } from "./ai-suggestions/types.js";
|
|
5
9
|
import { buildPositionalText } from "./ai-suggestions/text-positions.js";
|
|
6
10
|
import { isSuggestionStale, resolveSuggestionAnchor } from "./ai-suggestions/conflict.js";
|
|
7
11
|
import { applySuggestions } from "./ai-suggestions/apply.js";
|
|
8
|
-
import { createFolioAIEditSnapshot, hashFolioAIBlockText, normalizeFolioAIBlockText } from "./ai-edits/snapshot.js";
|
|
9
|
-
import { diffWordSegments } from "./ai-edits/word-diff.js";
|
|
10
|
-
import { applyFolioAIEditOperations } from "./ai-edits/apply.js";
|
|
11
12
|
import { setAISuggestionsMeta, setFocusedSuggestionMeta } from "./prosemirror/plugins/aiSuggestionDecorations.js";
|
|
12
13
|
import { getGoogleFontsEnabled, setGoogleFontsEnabled } from "./utils/fontResolver.js";
|
|
13
14
|
import { scrollFolioPositionIntoView } from "./paged-layout/scrollToPmPosition.js";
|
|
@@ -21,4 +22,4 @@ import { DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, acceptAutocompleteSuggestion, acc
|
|
|
21
22
|
import { fromMarkdown } from "./markdown/fromMarkdown.js";
|
|
22
23
|
import { toMarkdown, toMarkdownResult } from "./markdown/index.js";
|
|
23
24
|
import { extractEmbeddedFonts, getEmbeddedFontFaces } from "./fonts/embeddedFonts.js";
|
|
24
|
-
export { DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applySuggestions, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, deriveBlockId, diffWordSegments, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, isFolioBlockId, isSequentialFolioBlockId, isSuggestionStale, normalizeFolioAIBlockText, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
|
25
|
+
export { DEFAULT_AI_SUGGESTION_PRESETS, DEFAULT_AUTOCOMPLETE_DEAD_ZONE_NODES, FOLIO_DOCUMENT_OPERATION_BATCH_MODES, FOLIO_DOCUMENT_OPERATION_CONTRACT_VERSION, FOLIO_DOCUMENT_OPERATION_MODES, FOLIO_DOCUMENT_OPERATION_MODES_BY_TYPE, FOLIO_DOCUMENT_OPERATION_PRECONDITIONS, FOLIO_DOCUMENT_OPERATION_STORIES, FOLIO_DOCUMENT_OPERATION_TYPES, InvalidFolioDocumentOperationBatchError, UnsupportedFolioDocumentOperationVersionError, acceptAutocompleteSuggestion, acceptAutocompleteWord, anonymizationDecorationsKey, appendAutocompleteToken, applyFolioAIEditOperations, applyFolioDocumentOperations, applySuggestions, assertSupportedFolioDocumentOperationVersion, autocompleteSuggestionKey, autocompleteSuggestionPlugin, buildPositionalText, clearAutocompleteSuggestion, clearTemplateSlashMenu, consumeTemplateSlashQuery, createAICitationDecorationsPlugin, createDocx, createEmptyDocument, createFolioAIEditSnapshot, deriveBlockId, diffWordSegments, extractEmbeddedFonts, finishAutocompleteSuggestion, fromMarkdown, getAnonymizationMatches, getAutocompleteSuggestion, getEmbeddedFontFaces, getFolioCaretViewportRect, getFolioDocumentOperationCapabilities, getFolioDocumentOperationIssues, getFolioDocumentOperationReceipts, getFolioParaIdFromBlockId, getFolioSelectionViewportRect, getGoogleFontsEnabled, getTemplateDirectives, getTemplateSlashMenu, hashFolioAIBlockText, isFolioBlockId, isFolioDocumentOperationModeSupported, isSequentialFolioBlockId, isSuggestionStale, isSupportedFolioDocumentOperationVersion, normalizeFolioAIBlockText, parseFolioDocumentOperationBatch, resetTemplateSlashQuery, resolveSuggestionAnchor, scanDirectives, scrollFolioPositionIntoView, setAICitationsMeta, setAISuggestionsMeta, setActiveCitationMeta, setAnonymizationTermsMeta, setFocusedSuggestionMeta, setGoogleFontsEnabled, setTemplatePreviewValues, shouldTriggerAutocomplete, startAutocompleteSuggestion, templateSlashMenuKey, toMarkdown, toMarkdownResult };
|
|
@@ -23,6 +23,42 @@ declare function collectFootnoteRefs(blocks: FlowBlock[]): {
|
|
|
23
23
|
footnoteId: number;
|
|
24
24
|
pmPos: number;
|
|
25
25
|
}[];
|
|
26
|
+
/**
|
|
27
|
+
* Scan FlowBlocks for runs with endnoteRefId set, in document order.
|
|
28
|
+
* Same recursive walk as `collectFootnoteRefs`.
|
|
29
|
+
*/
|
|
30
|
+
declare function collectEndnoteRefs(blocks: FlowBlock[]): {
|
|
31
|
+
endnoteId: number;
|
|
32
|
+
pmPos: number;
|
|
33
|
+
}[];
|
|
34
|
+
type NumberableNote = {
|
|
35
|
+
id: number;
|
|
36
|
+
noteType?: document_d_exports.Footnote["noteType"];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Assign sequential display numbers (1, 2, 3, …) to notes in order of first
|
|
40
|
+
* reference. Word numbers footnotes/endnotes by reference order, not by their
|
|
41
|
+
* `w:id` values, which may be non-contiguous or out of document order. Only
|
|
42
|
+
* `normal` notes are numbered; separator/continuation notes and refs to
|
|
43
|
+
* missing notes consume no number.
|
|
44
|
+
*/
|
|
45
|
+
declare function computeNoteDisplayNumbers(notes: readonly NumberableNote[], refNoteIds: readonly number[]): Map<number, number>;
|
|
46
|
+
type NoteDisplayNumberMaps = {
|
|
47
|
+
/** footnote `w:id` → sequential display number */footnoteNumbers?: ReadonlyMap<number, number>; /** endnote `w:id` → sequential display number */
|
|
48
|
+
endnoteNumbers?: ReadonlyMap<number, number>;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Rewrite body reference-marker run text from the raw `w:id` (which the PM
|
|
52
|
+
* doc stores as the marker text; the save path serializes from the mark
|
|
53
|
+
* attrs, never from this text) to the sequential display number, so the
|
|
54
|
+
* inline marker matches the number rendered in the note area. Must run
|
|
55
|
+
* before measurement so marker widths match the painted digits. Untouched
|
|
56
|
+
* blocks/runs are returned by reference so the painter's fingerprinting and
|
|
57
|
+
* the incremental measure path see them unchanged. Runs keep their PM range,
|
|
58
|
+
* so click-to-position still resolves into the marker (same contract as the
|
|
59
|
+
* template preview substitution).
|
|
60
|
+
*/
|
|
61
|
+
declare function remapNoteMarkerText(blocks: FlowBlock[], maps: NoteDisplayNumberMaps): FlowBlock[];
|
|
26
62
|
/**
|
|
27
63
|
* After layout, determine which footnotes appear on which pages.
|
|
28
64
|
* Checks each page's fragments to see if any footnoteRef PM positions fall within.
|
|
@@ -54,4 +90,4 @@ declare function calculateFootnoteReservedHeights(pageFootnoteMap: Map<number, n
|
|
|
54
90
|
height: number;
|
|
55
91
|
}>): Map<number, number>;
|
|
56
92
|
//#endregion
|
|
57
|
-
export { ConvertFootnoteOptions, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, MeasureBlocksFn, applyFootnotePresentation, buildFootnoteContentMap, calculateFootnoteReservedHeights, collectFootnoteRefs, convertFootnoteToContent, mapFootnotesToPages };
|
|
93
|
+
export { ConvertFootnoteOptions, FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, MeasureBlocksFn, NoteDisplayNumberMaps, applyFootnotePresentation, buildFootnoteContentMap, calculateFootnoteReservedHeights, collectEndnoteRefs, collectFootnoteRefs, computeNoteDisplayNumbers, convertFootnoteToContent, mapFootnotesToPages, remapNoteMarkerText };
|
|
@@ -16,20 +16,149 @@ const FOOTNOTE_FONT_SIZE = 8;
|
|
|
16
16
|
* area.
|
|
17
17
|
*/
|
|
18
18
|
function collectFootnoteRefs(blocks) {
|
|
19
|
+
return collectNoteRefs(blocks, "footnoteRefId").map(({ noteId, pmPos }) => ({
|
|
20
|
+
footnoteId: noteId,
|
|
21
|
+
pmPos
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Scan FlowBlocks for runs with endnoteRefId set, in document order.
|
|
26
|
+
* Same recursive walk as `collectFootnoteRefs`.
|
|
27
|
+
*/
|
|
28
|
+
function collectEndnoteRefs(blocks) {
|
|
29
|
+
return collectNoteRefs(blocks, "endnoteRefId").map(({ noteId, pmPos }) => ({
|
|
30
|
+
endnoteId: noteId,
|
|
31
|
+
pmPos
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
function collectNoteRefs(blocks, idKey) {
|
|
19
35
|
const refs = [];
|
|
20
36
|
const walk = (containerBlocks) => {
|
|
21
|
-
for (const block of containerBlocks) if (block.kind === "paragraph") {
|
|
22
|
-
|
|
23
|
-
|
|
37
|
+
for (const block of containerBlocks) if (block.kind === "paragraph") for (const run of block.runs) {
|
|
38
|
+
if (run.kind !== "text") continue;
|
|
39
|
+
const noteId = run[idKey];
|
|
40
|
+
if (noteId !== void 0) refs.push({
|
|
41
|
+
noteId,
|
|
24
42
|
pmPos: run.pmStart ?? 0
|
|
25
43
|
});
|
|
26
|
-
}
|
|
44
|
+
}
|
|
45
|
+
else if (block.kind === "table") for (const row of block.rows) for (const cell of row.cells) walk(cell.blocks);
|
|
27
46
|
else if (block.kind === "textBox") walk(block.content);
|
|
28
47
|
};
|
|
29
48
|
walk(blocks);
|
|
30
49
|
return refs;
|
|
31
50
|
}
|
|
32
51
|
/**
|
|
52
|
+
* Assign sequential display numbers (1, 2, 3, …) to notes in order of first
|
|
53
|
+
* reference. Word numbers footnotes/endnotes by reference order, not by their
|
|
54
|
+
* `w:id` values, which may be non-contiguous or out of document order. Only
|
|
55
|
+
* `normal` notes are numbered; separator/continuation notes and refs to
|
|
56
|
+
* missing notes consume no number.
|
|
57
|
+
*/
|
|
58
|
+
function computeNoteDisplayNumbers(notes, refNoteIds) {
|
|
59
|
+
const numberable = /* @__PURE__ */ new Set();
|
|
60
|
+
for (const note of notes) if (note.noteType === "normal") numberable.add(note.id);
|
|
61
|
+
const displayNumbers = /* @__PURE__ */ new Map();
|
|
62
|
+
let nextNumber = 1;
|
|
63
|
+
for (const noteId of refNoteIds) {
|
|
64
|
+
if (displayNumbers.has(noteId) || !numberable.has(noteId)) continue;
|
|
65
|
+
displayNumbers.set(noteId, nextNumber);
|
|
66
|
+
nextNumber++;
|
|
67
|
+
}
|
|
68
|
+
return displayNumbers;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Rewrite body reference-marker run text from the raw `w:id` (which the PM
|
|
72
|
+
* doc stores as the marker text; the save path serializes from the mark
|
|
73
|
+
* attrs, never from this text) to the sequential display number, so the
|
|
74
|
+
* inline marker matches the number rendered in the note area. Must run
|
|
75
|
+
* before measurement so marker widths match the painted digits. Untouched
|
|
76
|
+
* blocks/runs are returned by reference so the painter's fingerprinting and
|
|
77
|
+
* the incremental measure path see them unchanged. Runs keep their PM range,
|
|
78
|
+
* so click-to-position still resolves into the marker (same contract as the
|
|
79
|
+
* template preview substitution).
|
|
80
|
+
*/
|
|
81
|
+
function remapNoteMarkerText(blocks, maps) {
|
|
82
|
+
if ((maps.footnoteNumbers?.size ?? 0) === 0 && (maps.endnoteNumbers?.size ?? 0) === 0) return blocks;
|
|
83
|
+
let changed = false;
|
|
84
|
+
const next = blocks.map((block) => {
|
|
85
|
+
const remapped = remapNoteMarkerBlock(block, maps);
|
|
86
|
+
changed ||= remapped !== block;
|
|
87
|
+
return remapped;
|
|
88
|
+
});
|
|
89
|
+
return changed ? next : blocks;
|
|
90
|
+
}
|
|
91
|
+
function remapNoteMarkerBlock(block, maps) {
|
|
92
|
+
if (block.kind === "paragraph") return remapNoteMarkerParagraph(block, maps);
|
|
93
|
+
if (block.kind === "table") {
|
|
94
|
+
let tableChanged = false;
|
|
95
|
+
const rows = block.rows.map((row) => {
|
|
96
|
+
let rowChanged = false;
|
|
97
|
+
const cells = row.cells.map((cell) => {
|
|
98
|
+
let cellChanged = false;
|
|
99
|
+
const cellBlocks = cell.blocks.map((cellBlock) => {
|
|
100
|
+
const remapped = remapNoteMarkerBlock(cellBlock, maps);
|
|
101
|
+
cellChanged ||= remapped !== cellBlock;
|
|
102
|
+
return remapped;
|
|
103
|
+
});
|
|
104
|
+
return cellChanged ? {
|
|
105
|
+
...cell,
|
|
106
|
+
blocks: cellBlocks
|
|
107
|
+
} : cell;
|
|
108
|
+
});
|
|
109
|
+
rowChanged = cells.some((cell, index) => cell !== row.cells[index]);
|
|
110
|
+
tableChanged ||= rowChanged;
|
|
111
|
+
return rowChanged ? {
|
|
112
|
+
...row,
|
|
113
|
+
cells
|
|
114
|
+
} : row;
|
|
115
|
+
});
|
|
116
|
+
return tableChanged ? {
|
|
117
|
+
...block,
|
|
118
|
+
rows
|
|
119
|
+
} : block;
|
|
120
|
+
}
|
|
121
|
+
if (block.kind === "textBox") {
|
|
122
|
+
let boxChanged = false;
|
|
123
|
+
const content = block.content.map((paragraph) => {
|
|
124
|
+
const remapped = remapNoteMarkerParagraph(paragraph, maps);
|
|
125
|
+
boxChanged ||= remapped !== paragraph;
|
|
126
|
+
return remapped;
|
|
127
|
+
});
|
|
128
|
+
return boxChanged ? {
|
|
129
|
+
...block,
|
|
130
|
+
content
|
|
131
|
+
} : block;
|
|
132
|
+
}
|
|
133
|
+
return block;
|
|
134
|
+
}
|
|
135
|
+
function remapNoteMarkerParagraph(block, maps) {
|
|
136
|
+
let changed = false;
|
|
137
|
+
const runs = block.runs.map((run) => {
|
|
138
|
+
const remapped = remapNoteMarkerRun(run, maps);
|
|
139
|
+
changed ||= remapped !== run;
|
|
140
|
+
return remapped;
|
|
141
|
+
});
|
|
142
|
+
return changed ? {
|
|
143
|
+
...block,
|
|
144
|
+
runs
|
|
145
|
+
} : block;
|
|
146
|
+
}
|
|
147
|
+
function remapNoteMarkerRun(run, maps) {
|
|
148
|
+
if (run.kind !== "text") return run;
|
|
149
|
+
const displayNumber = getRunDisplayNumber(run, maps);
|
|
150
|
+
if (displayNumber === void 0) return run;
|
|
151
|
+
const text = String(displayNumber);
|
|
152
|
+
return run.text === text ? run : {
|
|
153
|
+
...run,
|
|
154
|
+
text
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function getRunDisplayNumber(run, maps) {
|
|
158
|
+
if (run.footnoteRefId !== void 0) return maps.footnoteNumbers?.get(run.footnoteRefId);
|
|
159
|
+
if (run.endnoteRefId !== void 0) return maps.endnoteNumbers?.get(run.endnoteRefId);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
33
162
|
* After layout, determine which footnotes appear on which pages.
|
|
34
163
|
* Checks each page's fragments to see if any footnoteRef PM positions fall within.
|
|
35
164
|
*
|
|
@@ -279,16 +408,11 @@ function buildFootnoteContentMap(footnotes, footnoteRefs, contentWidth, options
|
|
|
279
408
|
const contentMap = /* @__PURE__ */ new Map();
|
|
280
409
|
const footnoteById = /* @__PURE__ */ new Map();
|
|
281
410
|
for (const fn of footnotes) if (fn.noteType === "normal") footnoteById.set(fn.id, fn);
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
if (seen.has(ref.footnoteId)) continue;
|
|
286
|
-
seen.add(ref.footnoteId);
|
|
287
|
-
const footnote = footnoteById.get(ref.footnoteId);
|
|
411
|
+
const displayNumbers = computeNoteDisplayNumbers(footnotes, footnoteRefs.map((ref) => ref.footnoteId));
|
|
412
|
+
for (const [footnoteId, displayNumber] of displayNumbers) {
|
|
413
|
+
const footnote = footnoteById.get(footnoteId);
|
|
288
414
|
if (!footnote) continue;
|
|
289
|
-
|
|
290
|
-
contentMap.set(ref.footnoteId, content);
|
|
291
|
-
displayNumber++;
|
|
415
|
+
contentMap.set(footnoteId, convertFootnoteToContent(footnote, displayNumber, contentWidth, options));
|
|
292
416
|
}
|
|
293
417
|
return contentMap;
|
|
294
418
|
}
|
|
@@ -313,4 +437,4 @@ function calculateFootnoteReservedHeights(pageFootnoteMap, footnoteContentMap) {
|
|
|
313
437
|
return reserved;
|
|
314
438
|
}
|
|
315
439
|
//#endregion
|
|
316
|
-
export { FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, applyFootnotePresentation, buildFootnoteContentMap, calculateFootnoteReservedHeights, collectFootnoteRefs, convertFootnoteToContent, mapFootnotesToPages };
|
|
440
|
+
export { FOOTNOTE_ENTRY_MARGIN_BOTTOM, FOOTNOTE_FALLBACK_LINE_HEIGHT, FOOTNOTE_SEPARATOR_HEIGHT, applyFootnotePresentation, buildFootnoteContentMap, calculateFootnoteReservedHeights, collectEndnoteRefs, collectFootnoteRefs, computeNoteDisplayNumbers, convertFootnoteToContent, mapFootnotesToPages, remapNoteMarkerText };
|
|
@@ -20,13 +20,11 @@ declare function calculateHeaderFooterVisualBounds(blocks: FlowBlock[], measures
|
|
|
20
20
|
visualBottom: number;
|
|
21
21
|
};
|
|
22
22
|
/**
|
|
23
|
-
* Compute
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* page-hash invalidation signal), but the margin extender needs the flow-only
|
|
29
|
-
* extent.
|
|
23
|
+
* Compute flow-only header/footer bounds, excluding anchored/floating objects
|
|
24
|
+
* such as full-page letterheads and watermarks. Word positions those objects on
|
|
25
|
+
* the page independently from header/footer flow. Keeping them in
|
|
26
|
+
* `visualBottom` is still correct for rendering and page-hash invalidation;
|
|
27
|
+
* these bounds separately describe the in-flow portion for API consumers.
|
|
30
28
|
*/
|
|
31
29
|
declare function calculateHeaderFooterMarginPushBounds(blocks: FlowBlock[], measures: Measure[], flowHeight: number, metrics: HeaderFooterMetrics): {
|
|
32
30
|
top: number;
|
|
@@ -225,13 +225,11 @@ function calculateHeaderFooterVisualBounds(blocks, measures, flowHeight, metrics
|
|
|
225
225
|
};
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
|
-
* Compute
|
|
229
|
-
*
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
* page-hash invalidation signal), but the margin extender needs the flow-only
|
|
234
|
-
* extent.
|
|
228
|
+
* Compute flow-only header/footer bounds, excluding anchored/floating objects
|
|
229
|
+
* such as full-page letterheads and watermarks. Word positions those objects on
|
|
230
|
+
* the page independently from header/footer flow. Keeping them in
|
|
231
|
+
* `visualBottom` is still correct for rendering and page-hash invalidation;
|
|
232
|
+
* these bounds separately describe the in-flow portion for API consumers.
|
|
235
233
|
*/
|
|
236
234
|
function calculateHeaderFooterMarginPushBounds(blocks, measures, flowHeight, metrics) {
|
|
237
235
|
let top = 0;
|