ooxml-ui 1.20.0 → 1.22.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/README.md +18 -9
- package/dist/{chunk-4XPAPETH.js → chunk-DRBAJ5UO.js} +2 -1
- package/dist/{chunk-UB36NYDT.js → chunk-REJECZGV.js} +1 -1
- package/dist/docx/building-blocks-actions.d.ts +54 -0
- package/dist/docx/building-blocks-status.d.ts +34 -0
- package/dist/docx/building-blocks.d.ts +20 -4
- package/dist/docx/editor-core.d.ts +5 -0
- package/dist/docx/element-api.d.ts +12 -0
- package/dist/docx/index.d.ts +3 -1
- package/dist/docx/insert-controller.d.ts +2 -0
- package/dist/docx/locales/en-app.d.ts +1 -0
- package/dist/docx/locales/en.d.ts +1 -0
- package/dist/docx/localization-strings.d.ts +1 -0
- package/dist/docx/surface-navigation.d.ts +8 -0
- package/dist/docx.js +337 -11
- package/dist/index.js +2 -2
- package/dist/parse-worker.js +5 -1
- package/dist/pptx/{chunk-ABDWUQRQ.cjs → chunk-72NIN6QF.cjs} +275 -60
- package/dist/pptx/{chunk-F6P7VS5I.mjs → chunk-VGOIAVPA.mjs} +266 -61
- package/dist/pptx/dom/index.cjs +209 -209
- package/dist/pptx/dom/index.mjs +2 -2
- package/dist/pptx/index.cjs +2926 -2886
- package/dist/pptx/index.mjs +1 -1
- package/dist/pptx/render/collaboration-options.d.ts +11 -9
- package/dist/pptx/render/collaboration-options.d.ts.map +1 -1
- package/dist/pptx/render/collaboration-owned-session.d.ts +34 -0
- package/dist/pptx/render/collaboration-owned-session.d.ts.map +1 -0
- package/dist/pptx/render/collaboration-state.d.ts +47 -0
- package/dist/pptx/render/collaboration-state.d.ts.map +1 -0
- package/dist/pptx/render/collaboration-writeback.d.ts +28 -1
- package/dist/pptx/render/collaboration-writeback.d.ts.map +1 -1
- package/dist/pptx/render/index.d.ts +2 -0
- package/dist/pptx/render/index.d.ts.map +1 -1
- package/dist/pptx/render/morph-predicates.d.ts +7 -0
- package/dist/pptx/render/morph-predicates.d.ts.map +1 -1
- package/dist/pptx/render/viewer-props-manifest.d.ts.map +1 -1
- package/dist/pptx/types.d.ts +25 -2
- package/dist/pptx/types.d.ts.map +1 -1
- package/dist/pptx/web-components/office-aliases.d.ts +1 -1
- package/dist/teams.js +1 -1
- package/dist/visio/building-blocks-shapes.d.ts +9 -0
- package/dist/visio/building-blocks-toolbar.d.ts +87 -0
- package/dist/visio/building-blocks.d.ts +9 -32
- package/dist/visio/canvas-editing.d.ts +45 -0
- package/dist/visio/canvas-keys.d.ts +9 -0
- package/dist/visio/canvas-services.d.ts +18 -0
- package/dist/visio/collaboration-types.d.ts +2 -2
- package/dist/visio/controller.d.ts +31 -1
- package/dist/visio/diagram-tool.d.ts +11 -0
- package/dist/visio/index.d.ts +1 -1
- package/dist/visio/viewer-clipboard.d.ts +7 -1
- package/dist/visio/viewer-delete.d.ts +10 -0
- package/dist/visio/viewer-presence-overlay.d.ts +12 -0
- package/dist/visio/viewer-presence.d.ts +19 -0
- package/dist/visio/viewer-share-sync.d.ts +15 -10
- package/dist/visio/viewer-share.d.ts +9 -7
- package/dist/visio/viewer-stencil.d.ts +8 -0
- package/dist/visio/viewer-write-back.d.ts +32 -0
- package/dist/visio/worker-parser.d.ts +11 -1
- package/dist/visio.js +19930 -19210
- package/dist/xlsx/building-blocks.d.ts +34 -0
- package/dist/xlsx/editor-core.d.ts +8 -0
- package/dist/xlsx/element-api.d.ts +12 -1
- package/dist/xlsx/events.d.ts +12 -1
- package/dist/xlsx/grid/alert-route.d.ts +21 -0
- package/dist/xlsx/index.d.ts +2 -1
- package/dist/xlsx/surface-actions.d.ts +73 -0
- package/dist/xlsx.js +190 -23
- package/package.json +2 -2
package/dist/docx.js
CHANGED
|
@@ -9,7 +9,7 @@ import './chunk-YZH2QS7J.js';
|
|
|
9
9
|
import './chunk-QLHCGV4C.js';
|
|
10
10
|
import './chunk-XL77FR4B.js';
|
|
11
11
|
import { optionStrings, normalizeLocale, SUPPORTED_OFFICE_LOCALES, interpolate } from 'ooxml-core/i18n';
|
|
12
|
-
import { markSpecs, imageNodeSpec, fieldMarkerNodeSpec, noteReferenceNodeSpec, pageBreakNodeSpec, hardBreakNodeSpec, commentHistoryAttributes, tableCellStyle, tableStyle, createToggleFormat, expectDefined, controlFromData, paragraphBoxCss, normalizeThemeMode, applyThemeColors, refreshWordYjsPresence, normalizeRibbonActions, DirtyState, isFormsProtected, isWordYjsRemoteTransaction, REMOTE_TRANSACTION_META, repairCollaborativeDocumentIds, HEADER_FOOTER_INPUT, wordYjsPluginKey, wordYjsRedo, wordYjsUndo, restoreSectionParts, commentThreadsFromDoc, restoreNoteParts, CollaborationClient, createCollaborationIdGenerator, WordYjsCollaboration, insertContentControl, sectionPartsJson, NotePartsStep, notePartsJson, SectionPartsStep, fitZoomPercent, hasChangeAtCursor, hasAnyChange, commentIdsAtSelection, commentAnchors,
|
|
12
|
+
import { markSpecs, imageNodeSpec, fieldMarkerNodeSpec, noteReferenceNodeSpec, pageBreakNodeSpec, hardBreakNodeSpec, commentHistoryAttributes, tableCellStyle, tableStyle, createToggleFormat, expectDefined, controlFromData, paragraphBoxCss, normalizeThemeMode, applyThemeColors, refreshWordYjsPresence, normalizeRibbonActions, DirtyState, isFormsProtected, isWordYjsRemoteTransaction, REMOTE_TRANSACTION_META, repairCollaborativeDocumentIds, HEADER_FOOTER_INPUT, wordYjsPluginKey, wordYjsRedo, wordYjsUndo, documentWordCount, restoreSectionParts, commentThreadsFromDoc, restoreNoteParts, CollaborationClient, createCollaborationIdGenerator, WordYjsCollaboration, insertContentControl, sectionPartsJson, NotePartsStep, notePartsJson, SectionPartsStep, fitZoomPercent, hasChangeAtCursor, hasAnyChange, commentIdsAtSelection, commentAnchors, fieldGuardPlugin, tableStructureGuardPlugin, contentControlPlugin, formFieldGuardPlugin, symbolFontPlugin, positionalTabInputPlugin, trackChangesPlugin, wordYjsPresencePlugin, chartNodeSpec, placementClass, removeCommentThread, removeCommentAnchor, deleteComment, updateCommentThreads, addComment, toggleTrackChanges, goToNextChange, goToPreviousChange, rejectAllChanges, acceptAllChanges, rejectChangeAtCursor, acceptChangeAtCursor, goToComment, appendInlineNode, sameJson, sameRuns, PARAGRAPH_KEEP_KEYS, paragraphFromAttrs, parseBordersJson, isNavigableHref, setReviewRecordingPreferences, nodeNumbering, controlAtSelection, paragraphFormattingRevision, inlineNodeRun, formattingRevision, insertWordHardBreak, paragraphAttrs, resolveCellVisuals, themeDrawing, ribbonActionIdForLabel, removeWordLink, fieldResultRanges, wordLinkRangeAt, ligatureCss as ligatureCss$1, toggleCheckboxControl, formFieldBeside, formFieldOfNode, formFieldLocked, toggleFormCheckboxAt, runToInlineNodes as runToInlineNodes$1, insertedTextMarks, backstageFocus, applyRunFormattingPatch, clearDirectRunFormatting, applyWordLink, deleteFieldSelection, emptySimpleFieldResult, ligatureStyle, wordHighlightColors, swatchColor, cssBorderSide, countWords, chooseListItem, chooseDate, selectFormDropDownAt, updateControlProperties, resolveComment, replyToComment, CollaborationAuthority } from 'ooxml-core/docx/ui';
|
|
13
13
|
export { CollaborationAuthority, CollaborationClient, RIBBON_ACTION_IDS, RIBBON_ACTION_LABELS, createCollaborationIdGenerator, darkTheme, isRibbonActionId, lightTheme, normalizeRibbonActions, repairCollaborativeDocumentIds, themeToCssVars } from 'ooxml-core/docx/ui';
|
|
14
14
|
import { createDocument, saveDocx, sectionsFromLayout, sectionLayoutJson, sectionsOf, pageSizeOf, columnPreset, applyPageSetup, withSection, computeListLabels, numberNotesInOrder, tocEntries, resolveNumberingLevel, tableOfFiguresInstruction, findTableOfContents, ensureListDefinition, equalColumnDraft, readColumnDraft, PAGE_SIZE_OPTIONS, PAGE_SIZES, readPageSetup, isRunHiddenForReview, resolveTableStyleFormatting, resolveParagraphFormatting, displayListLabel, setTitlePage, setLineNumbering, setVerticalAlign, setPageNumbering, ST_NumberFormat, unequalColumnPreset, setColumns, setOrientation, setPageSize, setMargins, lineSpacingLabel, formatNoteNumber, cellSourceBlocks, reviewDocumentFormatting, reviewFormattingWarnings, listRevisions, plainText, resolveRunFormatting, removedByEdit, tocHyperlinks, DEFAULT_TOC_INSTRUCTION, tocBookmarks, buildTableOfContents, tocCaptionLabel, twips as twips$1, signedTwips, formatListNumber, columnTextWidth, validColumnDraft, validatePageSetup, presetOf, LIGATURE_VALUES, isLigatures, reviewRunFormatting, resolveThemeColorReference, lineSpacingValue, canEditControlContent, controlDate, formDropDownIndex, shapeSvg, isStHighlightColor, transformCase, DEFAULT_TABLE_BORDERS, parseLineSpacingValue, twipsAttr, SHAPE_PALETTE, isHeadingListKind, twipsFromPixels, isFieldLocked, styleRefSource, parseStyleReference, bodyStyleRefResult, isDirectionalPreset, headingLevel, reviewParagraphFormatting, isValidLanguageTag, WORD, newShape, withFieldCodeFormatting, fieldResultRun, DEFAULT_DRAWN_SHAPE, fieldName, lineSpacingOptions, createListDefinition, linkStylesToList, headingListLevels, halfPointsFromPoints, changeColumnWidth, changeColumnGap, documentStats } from 'ooxml-core/docx';
|
|
15
15
|
import { loadDocument } from 'ooxml-core/docx/load';
|
|
@@ -1276,6 +1276,7 @@ var deApp = {
|
|
|
1276
1276
|
"Next page section break": "Abschnittswechsel (n\xE4chste Seite)",
|
|
1277
1277
|
"Continuous section break": "Abschnittswechsel (fortlaufend)",
|
|
1278
1278
|
"Next page": "N\xE4chste Seite",
|
|
1279
|
+
"Previous page": "Vorherige Seite",
|
|
1279
1280
|
Continuous: "Fortlaufend",
|
|
1280
1281
|
"Page numbers": "Seitenzahlen",
|
|
1281
1282
|
"Page number format": "Seitenzahlformat",
|
|
@@ -2106,6 +2107,7 @@ var enApp = {
|
|
|
2106
2107
|
"Next page section break": "Next page section break",
|
|
2107
2108
|
"Continuous section break": "Continuous section break",
|
|
2108
2109
|
"Next page": "Next page",
|
|
2110
|
+
"Previous page": "Previous page",
|
|
2109
2111
|
Continuous: "Continuous",
|
|
2110
2112
|
"Page numbers": "Page numbers",
|
|
2111
2113
|
"Page number format": "Page number format",
|
|
@@ -2806,6 +2808,7 @@ var esApp = {
|
|
|
2806
2808
|
"Next page section break": "Salto de secci\xF3n (p\xE1gina siguiente)",
|
|
2807
2809
|
"Continuous section break": "Salto de secci\xF3n (continuo)",
|
|
2808
2810
|
"Next page": "P\xE1gina siguiente",
|
|
2811
|
+
"Previous page": "P\xE1gina anterior",
|
|
2809
2812
|
Continuous: "Continuo",
|
|
2810
2813
|
"Page numbers": "N\xFAmeros de p\xE1gina",
|
|
2811
2814
|
"Page number format": "Formato de n\xFAmero de p\xE1gina",
|
|
@@ -3505,6 +3508,7 @@ var frApp = {
|
|
|
3505
3508
|
"Next page section break": "Saut de section (page suivante)",
|
|
3506
3509
|
"Continuous section break": "Saut de section (continu)",
|
|
3507
3510
|
"Next page": "Page suivante",
|
|
3511
|
+
"Previous page": "Page pr\xE9c\xE9dente",
|
|
3508
3512
|
Continuous: "Continu",
|
|
3509
3513
|
"Page numbers": "Num\xE9ros de page",
|
|
3510
3514
|
"Page number format": "Format des num\xE9ros de page",
|
|
@@ -4206,6 +4210,7 @@ var zhCNApp = {
|
|
|
4206
4210
|
"Next page section break": "\u5206\u8282\u7B26\uFF08\u4E0B\u4E00\u9875\uFF09",
|
|
4207
4211
|
"Continuous section break": "\u5206\u8282\u7B26\uFF08\u8FDE\u7EED\uFF09",
|
|
4208
4212
|
"Next page": "\u4E0B\u4E00\u9875",
|
|
4213
|
+
"Previous page": "\u4E0A\u4E00\u9875",
|
|
4209
4214
|
Continuous: "\u8FDE\u7EED",
|
|
4210
4215
|
"Page numbers": "\u9875\u7801",
|
|
4211
4216
|
"Page number format": "\u9875\u7801\u683C\u5F0F",
|
|
@@ -19364,21 +19369,27 @@ var InsertController = class {
|
|
|
19364
19369
|
async insertSelectedPicture() {
|
|
19365
19370
|
const file = this.pictureInput.files?.[0];
|
|
19366
19371
|
this.pictureInput.value = "";
|
|
19372
|
+
if (file) await this.insertPictureFile(file);
|
|
19373
|
+
}
|
|
19374
|
+
/** Stages `file` and inserts it at the selection; false when it could not be inserted. */
|
|
19375
|
+
async insertPictureFile(file) {
|
|
19367
19376
|
const view = this.host.view();
|
|
19368
|
-
if (!
|
|
19377
|
+
if (!view?.editable) return false;
|
|
19369
19378
|
try {
|
|
19370
19379
|
const staged = await stagePicture(file, this.host.contentWidth(), this.host.newMediaPartName);
|
|
19371
|
-
if (this.host.view() !== view || !view.editable) return;
|
|
19380
|
+
if (this.host.view() !== view || !view.editable) return false;
|
|
19372
19381
|
this.host.stageMedia?.(staged.image.partName, staged.media);
|
|
19373
19382
|
if (staged.svg && staged.image.svgPartName)
|
|
19374
19383
|
this.host.stageMedia?.(staged.image.svgPartName, staged.svg);
|
|
19375
19384
|
this.pendingMedia.set(staged.image.partName, staged.media);
|
|
19376
19385
|
if (staged.svg && staged.image.svgPartName)
|
|
19377
19386
|
this.pendingMedia.set(staged.image.svgPartName, staged.svg);
|
|
19378
|
-
insertPicture(view, staged.image);
|
|
19387
|
+
const inserted = insertPicture(view, staged.image);
|
|
19379
19388
|
focusView(view);
|
|
19389
|
+
return inserted;
|
|
19380
19390
|
} catch (cause) {
|
|
19381
19391
|
this.host.reportError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
19392
|
+
return false;
|
|
19382
19393
|
}
|
|
19383
19394
|
}
|
|
19384
19395
|
};
|
|
@@ -19563,6 +19574,8 @@ var EditorCore = class {
|
|
|
19563
19574
|
readOnly = false;
|
|
19564
19575
|
/** Set before mounting to render only the document surface. */
|
|
19565
19576
|
surfaceOnly = false;
|
|
19577
|
+
/** Host-owned workflows for surface mode (link, find and replace, picture picker). */
|
|
19578
|
+
surfaceActions = {};
|
|
19566
19579
|
locale = "en";
|
|
19567
19580
|
reviewAuthor = "Author";
|
|
19568
19581
|
theme = "auto";
|
|
@@ -19711,6 +19724,7 @@ var EditorCore = class {
|
|
|
19711
19724
|
this.wordText
|
|
19712
19725
|
);
|
|
19713
19726
|
syncPageState(this);
|
|
19727
|
+
if (this.surfaceOnly) this.element.dispatchEvent(new CustomEvent("editor-state-change"));
|
|
19714
19728
|
}
|
|
19715
19729
|
};
|
|
19716
19730
|
|
|
@@ -24402,6 +24416,117 @@ function routeRibbonAction(core, action) {
|
|
|
24402
24416
|
focusView(target);
|
|
24403
24417
|
}
|
|
24404
24418
|
}
|
|
24419
|
+
function moveFor(event) {
|
|
24420
|
+
const word = event.ctrlKey || event.altKey;
|
|
24421
|
+
switch (event.key) {
|
|
24422
|
+
case "ArrowLeft":
|
|
24423
|
+
return { direction: "backward", granularity: word ? "word" : "character" };
|
|
24424
|
+
case "ArrowRight":
|
|
24425
|
+
return { direction: "forward", granularity: word ? "word" : "character" };
|
|
24426
|
+
case "ArrowUp":
|
|
24427
|
+
return { direction: "backward", granularity: "line" };
|
|
24428
|
+
case "ArrowDown":
|
|
24429
|
+
return { direction: "forward", granularity: "line" };
|
|
24430
|
+
case "Home":
|
|
24431
|
+
return {
|
|
24432
|
+
direction: "backward",
|
|
24433
|
+
granularity: event.ctrlKey ? "documentboundary" : "lineboundary"
|
|
24434
|
+
};
|
|
24435
|
+
case "End":
|
|
24436
|
+
return {
|
|
24437
|
+
direction: "forward",
|
|
24438
|
+
granularity: event.ctrlKey ? "documentboundary" : "lineboundary"
|
|
24439
|
+
};
|
|
24440
|
+
default:
|
|
24441
|
+
return void 0;
|
|
24442
|
+
}
|
|
24443
|
+
}
|
|
24444
|
+
function attachSurfaceNavigation(core) {
|
|
24445
|
+
const canvas = core.shell.canvas;
|
|
24446
|
+
if (!canvas) return () => {
|
|
24447
|
+
};
|
|
24448
|
+
const doc = canvas.ownerDocument;
|
|
24449
|
+
canvas.tabIndex = -1;
|
|
24450
|
+
const domSelection = () => {
|
|
24451
|
+
const root = core.view?.root;
|
|
24452
|
+
return root?.getSelection?.() ?? doc.getSelection();
|
|
24453
|
+
};
|
|
24454
|
+
const ends = () => {
|
|
24455
|
+
const selection = domSelection();
|
|
24456
|
+
if (!selection) return void 0;
|
|
24457
|
+
if (selection.anchorNode && selection.anchorNode === selection.focusNode) {
|
|
24458
|
+
const root2 = core.view?.root;
|
|
24459
|
+
if (!(root2 instanceof ShadowRoot) || root2.host !== selection.anchorNode)
|
|
24460
|
+
return {
|
|
24461
|
+
anchor: selection.anchorNode,
|
|
24462
|
+
anchorOffset: selection.anchorOffset,
|
|
24463
|
+
focus: selection.focusNode,
|
|
24464
|
+
focusOffset: selection.focusOffset
|
|
24465
|
+
};
|
|
24466
|
+
}
|
|
24467
|
+
const root = core.view?.root;
|
|
24468
|
+
const composed = selection.getComposedRanges;
|
|
24469
|
+
if (root instanceof ShadowRoot && typeof composed === "function") {
|
|
24470
|
+
const range = composed.call(selection, { shadowRoots: [root] })[0];
|
|
24471
|
+
if (range)
|
|
24472
|
+
return {
|
|
24473
|
+
anchor: range.startContainer,
|
|
24474
|
+
anchorOffset: range.startOffset,
|
|
24475
|
+
focus: range.endContainer,
|
|
24476
|
+
focusOffset: range.endOffset
|
|
24477
|
+
};
|
|
24478
|
+
}
|
|
24479
|
+
return {
|
|
24480
|
+
anchor: selection.anchorNode,
|
|
24481
|
+
anchorOffset: selection.anchorOffset,
|
|
24482
|
+
focus: selection.focusNode,
|
|
24483
|
+
focusOffset: selection.focusOffset
|
|
24484
|
+
};
|
|
24485
|
+
};
|
|
24486
|
+
const mirror = () => {
|
|
24487
|
+
const view = core.view;
|
|
24488
|
+
if (!view || view.isDestroyed || view.editable) return;
|
|
24489
|
+
const found = ends();
|
|
24490
|
+
if (!found?.anchor || !found.focus) return;
|
|
24491
|
+
if (!view.dom.contains(found.anchor) || !view.dom.contains(found.focus)) return;
|
|
24492
|
+
try {
|
|
24493
|
+
const $anchor = view.state.doc.resolve(view.posAtDOM(found.anchor, found.anchorOffset));
|
|
24494
|
+
const $head = view.state.doc.resolve(view.posAtDOM(found.focus, found.focusOffset));
|
|
24495
|
+
const next = TextSelection.between($anchor, $head);
|
|
24496
|
+
if (next.eq(view.state.selection)) return;
|
|
24497
|
+
view.dispatch(view.state.tr.setSelection(next));
|
|
24498
|
+
} catch {
|
|
24499
|
+
}
|
|
24500
|
+
};
|
|
24501
|
+
doc.addEventListener("selectionchange", mirror);
|
|
24502
|
+
const onKeyDown = (event) => {
|
|
24503
|
+
const view = core.view;
|
|
24504
|
+
if (!view || view.isDestroyed || view.editable || event.defaultPrevented) return;
|
|
24505
|
+
if (event.target !== canvas && !view.dom.contains(event.target)) return;
|
|
24506
|
+
const selection = domSelection();
|
|
24507
|
+
if (!selection) return;
|
|
24508
|
+
const mod = event.ctrlKey || event.metaKey;
|
|
24509
|
+
if (mod && event.key.toLowerCase() === "a") {
|
|
24510
|
+
selection.selectAllChildren(view.dom);
|
|
24511
|
+
event.preventDefault();
|
|
24512
|
+
return;
|
|
24513
|
+
}
|
|
24514
|
+
const move = moveFor(event);
|
|
24515
|
+
if (!move || event.metaKey || typeof selection.modify !== "function") return;
|
|
24516
|
+
if (!view.dom.contains(ends()?.anchor ?? null)) {
|
|
24517
|
+
selection.selectAllChildren(view.dom);
|
|
24518
|
+
selection.collapseToStart();
|
|
24519
|
+
}
|
|
24520
|
+
selection.modify(event.shiftKey ? "extend" : "move", move.direction, move.granularity);
|
|
24521
|
+
event.preventDefault();
|
|
24522
|
+
mirror();
|
|
24523
|
+
};
|
|
24524
|
+
canvas.addEventListener("keydown", onKeyDown);
|
|
24525
|
+
return () => {
|
|
24526
|
+
doc.removeEventListener("selectionchange", mirror);
|
|
24527
|
+
canvas.removeEventListener("keydown", onKeyDown);
|
|
24528
|
+
};
|
|
24529
|
+
}
|
|
24405
24530
|
|
|
24406
24531
|
// src/docx/page-navigator.ts
|
|
24407
24532
|
var THUMBNAIL_WIDTH = 120;
|
|
@@ -25289,6 +25414,7 @@ function buildShell(core, api) {
|
|
|
25289
25414
|
const { element, shell } = core;
|
|
25290
25415
|
if (shell.paper) {
|
|
25291
25416
|
attachPrintEditing(core);
|
|
25417
|
+
if (core.surfaceOnly) attachSurface(core);
|
|
25292
25418
|
return;
|
|
25293
25419
|
}
|
|
25294
25420
|
element.classList.add("dve-host");
|
|
@@ -25336,6 +25462,7 @@ function buildShell(core, api) {
|
|
|
25336
25462
|
Object.assign(shell, { canvas, paper });
|
|
25337
25463
|
attachPrintEditing(core);
|
|
25338
25464
|
attachCanvasClick(core);
|
|
25465
|
+
attachSurface(core);
|
|
25339
25466
|
applyShellLabels(element, paper, core.locale);
|
|
25340
25467
|
return;
|
|
25341
25468
|
}
|
|
@@ -25422,6 +25549,9 @@ function applyRibbonAddIns(core) {
|
|
|
25422
25549
|
syncRibbonAddIns(toolbar, core.ribbonAddIns, { panelClass: "ribbon-panel" });
|
|
25423
25550
|
if (toolbar.querySelector("[data-add-in]") !== before) refitRibbon(toolbar);
|
|
25424
25551
|
}
|
|
25552
|
+
function attachSurface(core) {
|
|
25553
|
+
core.shell.surfaceNavigation ??= attachSurfaceNavigation(core);
|
|
25554
|
+
}
|
|
25425
25555
|
function attachPrintEditing(core) {
|
|
25426
25556
|
const { shell } = core;
|
|
25427
25557
|
if (shell.printEditing || !shell.printLayout || !shell.paper) return;
|
|
@@ -25511,6 +25641,110 @@ function reflectAttribute(element, name, value) {
|
|
|
25511
25641
|
if (name === "locale" && current2 !== null && normalizeEditorLocale(current2) === value) return;
|
|
25512
25642
|
element.setAttribute(name, value);
|
|
25513
25643
|
}
|
|
25644
|
+
|
|
25645
|
+
// src/docx/building-blocks-actions.ts
|
|
25646
|
+
function hyperlinkRequest(core) {
|
|
25647
|
+
const view = core.targetView();
|
|
25648
|
+
if (!view) return void 0;
|
|
25649
|
+
const { from: from2, to } = view.state.selection;
|
|
25650
|
+
return {
|
|
25651
|
+
href: linkAtSelection(view)?.href ?? null,
|
|
25652
|
+
text: view.state.doc.textBetween(from2, to, " "),
|
|
25653
|
+
apply: (href, text) => core.canEditBody() && applyLink(view, { href }, text),
|
|
25654
|
+
remove: () => core.canEditBody() && removeLink(view)
|
|
25655
|
+
};
|
|
25656
|
+
}
|
|
25657
|
+
function findReplaceRequest(core) {
|
|
25658
|
+
const controller = new SearchController(() => core.targetView());
|
|
25659
|
+
return {
|
|
25660
|
+
get status() {
|
|
25661
|
+
return controller.status;
|
|
25662
|
+
},
|
|
25663
|
+
get canReplace() {
|
|
25664
|
+
return core.canEditBody();
|
|
25665
|
+
},
|
|
25666
|
+
search: (query, caseSensitive) => controller.search(query, caseSensitive),
|
|
25667
|
+
findNext: () => controller.findNext() !== null,
|
|
25668
|
+
findPrevious: () => controller.findPrevious() !== null,
|
|
25669
|
+
replaceOne: (replacement) => core.canEditBody() && controller.replaceOne(replacement),
|
|
25670
|
+
replaceAll: (replacement) => core.canEditBody() ? controller.replaceAll(replacement) : 0
|
|
25671
|
+
};
|
|
25672
|
+
}
|
|
25673
|
+
function wordHostActionProps(core) {
|
|
25674
|
+
const ready = () => Boolean(core.targetView()) && !core.loading;
|
|
25675
|
+
const editable2 = () => ready() && core.canEditBody() && Boolean(core.targetView()?.editable);
|
|
25676
|
+
const linkEnabled = () => editable2() && Boolean(core.surfaceActions.onOpenHyperlinkDialog);
|
|
25677
|
+
const findEnabled = () => ready() && Boolean(core.surfaceActions.onOpenFindReplace);
|
|
25678
|
+
const pictureEnabled = () => editable2() && Boolean(core.surfaceActions.onOpenImagePicker);
|
|
25679
|
+
const supplied = core.surfaceActions;
|
|
25680
|
+
return {
|
|
25681
|
+
/** Which workflows the host supplied a callback for, whether or not they are usable now. */
|
|
25682
|
+
hostWorkflows: {
|
|
25683
|
+
hyperlink: Boolean(supplied.onOpenHyperlinkDialog),
|
|
25684
|
+
findReplace: Boolean(supplied.onOpenFindReplace),
|
|
25685
|
+
picture: Boolean(supplied.onOpenImagePicker)
|
|
25686
|
+
},
|
|
25687
|
+
canInsertLink: linkEnabled(),
|
|
25688
|
+
canFindReplace: findEnabled(),
|
|
25689
|
+
canInsertPicture: pictureEnabled(),
|
|
25690
|
+
/** Opens the host's link dialog for the selection. Returns false when not enabled. */
|
|
25691
|
+
openHyperlinkDialog: () => {
|
|
25692
|
+
const open = core.surfaceActions.onOpenHyperlinkDialog;
|
|
25693
|
+
const request = linkEnabled() && open ? hyperlinkRequest(core) : void 0;
|
|
25694
|
+
if (!request || !open) return false;
|
|
25695
|
+
open(request);
|
|
25696
|
+
return true;
|
|
25697
|
+
},
|
|
25698
|
+
/** Opens the host's find and replace workflow. Returns false when not enabled. */
|
|
25699
|
+
openFindReplace: () => {
|
|
25700
|
+
const open = core.surfaceActions.onOpenFindReplace;
|
|
25701
|
+
if (!findEnabled() || !open) return false;
|
|
25702
|
+
open(findReplaceRequest(core));
|
|
25703
|
+
return true;
|
|
25704
|
+
},
|
|
25705
|
+
/** Opens the host's picture picker. Returns false when not enabled. */
|
|
25706
|
+
openImagePicker: () => {
|
|
25707
|
+
const open = core.surfaceActions.onOpenImagePicker;
|
|
25708
|
+
if (!pictureEnabled() || !open) return false;
|
|
25709
|
+
open({
|
|
25710
|
+
insert: (file) => editable2() ? core.inserts.insertPictureFile(file) : Promise.resolve(false)
|
|
25711
|
+
});
|
|
25712
|
+
return true;
|
|
25713
|
+
}
|
|
25714
|
+
};
|
|
25715
|
+
}
|
|
25716
|
+
|
|
25717
|
+
// src/docx/building-blocks.ts
|
|
25718
|
+
var ALIGNMENTS2 = {
|
|
25719
|
+
left: "left",
|
|
25720
|
+
start: "left",
|
|
25721
|
+
center: "center",
|
|
25722
|
+
right: "right",
|
|
25723
|
+
end: "right",
|
|
25724
|
+
justify: "justify",
|
|
25725
|
+
both: "justify"
|
|
25726
|
+
};
|
|
25727
|
+
var TOOLBAR_LABELS = [
|
|
25728
|
+
"Bold",
|
|
25729
|
+
"Italic",
|
|
25730
|
+
"Underline",
|
|
25731
|
+
"Undo",
|
|
25732
|
+
"Redo",
|
|
25733
|
+
"Font",
|
|
25734
|
+
"Font size",
|
|
25735
|
+
"Align left",
|
|
25736
|
+
"Align center",
|
|
25737
|
+
"Align right",
|
|
25738
|
+
"Justify",
|
|
25739
|
+
"Bulleted list",
|
|
25740
|
+
"Numbered list",
|
|
25741
|
+
"Insert link",
|
|
25742
|
+
"Find",
|
|
25743
|
+
"Insert picture"
|
|
25744
|
+
];
|
|
25745
|
+
function listState(kind) {
|
|
25746
|
+
return kind === "decimal" ? "number" : kind;
|
|
25747
|
+
}
|
|
25514
25748
|
function wordToolbarProps(core) {
|
|
25515
25749
|
const view = core.targetView();
|
|
25516
25750
|
const state = view?.state;
|
|
@@ -25530,7 +25764,7 @@ function wordToolbarProps(core) {
|
|
|
25530
25764
|
const font = effectiveFont(state, text, paragraph2);
|
|
25531
25765
|
add("fontFamily", font.family);
|
|
25532
25766
|
add("fontSize", font.size);
|
|
25533
|
-
add("alignment", String(paragraph2.attrs.align ?? "left"));
|
|
25767
|
+
add("alignment", ALIGNMENTS2[String(paragraph2.attrs.align ?? "left")] ?? "left");
|
|
25534
25768
|
};
|
|
25535
25769
|
if (state.selection.empty)
|
|
25536
25770
|
sample(
|
|
@@ -25555,13 +25789,12 @@ function wordToolbarProps(core) {
|
|
|
25555
25789
|
const shared = state && wordYjsPluginKey.getState(state);
|
|
25556
25790
|
return {
|
|
25557
25791
|
labels: Object.fromEntries(
|
|
25558
|
-
|
|
25559
|
-
label,
|
|
25560
|
-
translate(core.locale, label)
|
|
25561
|
-
])
|
|
25792
|
+
TOOLBAR_LABELS.map((label) => [label, translate(core.locale, label)])
|
|
25562
25793
|
),
|
|
25563
25794
|
canEdit,
|
|
25564
|
-
list:
|
|
25795
|
+
list: listState(
|
|
25796
|
+
state ? listKindOf(state.selection.$from.parent, core.model.numberingCatalog) : null
|
|
25797
|
+
),
|
|
25565
25798
|
selection: state ? { from: state.selection.from, to: state.selection.to } : null,
|
|
25566
25799
|
bold: value("bold", false),
|
|
25567
25800
|
italic: value("italic", false),
|
|
@@ -25579,7 +25812,79 @@ function wordToolbarProps(core) {
|
|
|
25579
25812
|
onAlignmentChange: (alignment) => run({ type: "align", value: alignment }),
|
|
25580
25813
|
onListChange: (kind) => run({ type: "list", key: kind }),
|
|
25581
25814
|
onUndo: () => run({ type: "history", key: "undo" }),
|
|
25582
|
-
onRedo: () => run({ type: "history", key: "redo" })
|
|
25815
|
+
onRedo: () => run({ type: "history", key: "redo" }),
|
|
25816
|
+
...wordHostActionProps(core)
|
|
25817
|
+
};
|
|
25818
|
+
}
|
|
25819
|
+
var ZOOM_STEP = 10;
|
|
25820
|
+
var clamp2 = (value, low, high) => Math.min(Math.max(value, low), high);
|
|
25821
|
+
function wordNavigationProps(core) {
|
|
25822
|
+
const { printLayout } = core.shell;
|
|
25823
|
+
const viewMode = core.pages.viewMode;
|
|
25824
|
+
const status = viewMode === "print" ? printLayout?.pageStatus() ?? null : null;
|
|
25825
|
+
const page2 = status?.current ?? 1;
|
|
25826
|
+
const pageCount = status?.total ?? 1;
|
|
25827
|
+
const live = () => core.pages.viewMode === "print" ? core.shell.printLayout?.pageStatus() : null;
|
|
25828
|
+
const goTo = (target) => {
|
|
25829
|
+
const now = live();
|
|
25830
|
+
if (!now || !Number.isFinite(target)) return false;
|
|
25831
|
+
core.shell.printLayout?.scrollToPage(clamp2(Math.round(target), 1, now.total));
|
|
25832
|
+
core.refreshControls();
|
|
25833
|
+
return true;
|
|
25834
|
+
};
|
|
25835
|
+
return {
|
|
25836
|
+
labels: {
|
|
25837
|
+
"Previous page": translate(core.locale, "Previous page"),
|
|
25838
|
+
"Next page": translate(core.locale, "Next page"),
|
|
25839
|
+
"Layout view": translate(core.locale, "Layout view"),
|
|
25840
|
+
Draft: translate(core.locale, "Draft"),
|
|
25841
|
+
"Print Layout": translate(core.locale, "Print Layout")
|
|
25842
|
+
},
|
|
25843
|
+
viewMode,
|
|
25844
|
+
/** False in Draft, where there are no pages to move between. */
|
|
25845
|
+
pagesAvailable: status !== null,
|
|
25846
|
+
page: page2,
|
|
25847
|
+
pageCount,
|
|
25848
|
+
pageText: formatPageStatus(core.locale, page2, pageCount),
|
|
25849
|
+
canGoPrevious: status !== null && page2 > 1,
|
|
25850
|
+
canGoNext: status !== null && page2 < pageCount,
|
|
25851
|
+
onGoToPage: goTo,
|
|
25852
|
+
onPreviousPage: () => {
|
|
25853
|
+
const now = live();
|
|
25854
|
+
return Boolean(now && now.current > 1) && goTo((now?.current ?? 1) - 1);
|
|
25855
|
+
},
|
|
25856
|
+
onNextPage: () => {
|
|
25857
|
+
const now = live();
|
|
25858
|
+
return Boolean(now && now.current < now.total) && goTo((now?.current ?? 1) + 1);
|
|
25859
|
+
},
|
|
25860
|
+
onViewModeChange: (mode) => {
|
|
25861
|
+
if (mode !== "draft" && mode !== "print") return false;
|
|
25862
|
+
core.pages.setViewMode(mode);
|
|
25863
|
+
return true;
|
|
25864
|
+
}
|
|
25865
|
+
};
|
|
25866
|
+
}
|
|
25867
|
+
function wordStatusProps(core) {
|
|
25868
|
+
const doc = core.view?.state.doc;
|
|
25869
|
+
const words = doc ? documentWordCount(doc, core.element.lang || void 0) : 0;
|
|
25870
|
+
const zoom = Math.round(core.pages.zoom * 100);
|
|
25871
|
+
const setZoom = (percent) => {
|
|
25872
|
+
if (!Number.isFinite(percent)) return false;
|
|
25873
|
+
core.pages.setZoom(clamp2(Math.round(percent), ZOOM_MIN, ZOOM_MAX));
|
|
25874
|
+
core.refreshControls();
|
|
25875
|
+
return true;
|
|
25876
|
+
};
|
|
25877
|
+
const level = () => Math.round(core.pages.zoom * 100);
|
|
25878
|
+
return {
|
|
25879
|
+
labels: { Zoom: translate(core.locale, "Zoom") },
|
|
25880
|
+
words,
|
|
25881
|
+
wordText: formatWordCount(core.locale, words),
|
|
25882
|
+
zoom,
|
|
25883
|
+
minZoom: ZOOM_MIN,
|
|
25884
|
+
maxZoom: ZOOM_MAX,
|
|
25885
|
+
onZoomChange: setZoom,
|
|
25886
|
+
onZoomIn: () => setZoom(level() + ZOOM_STEP),
|
|
25887
|
+
onZoomOut: () => setZoom(level() - ZOOM_STEP)
|
|
25583
25888
|
};
|
|
25584
25889
|
}
|
|
25585
25890
|
|
|
@@ -25599,6 +25904,25 @@ var DocxEditorApi = class extends HTMLElementBase {
|
|
|
25599
25904
|
getToolbarProps() {
|
|
25600
25905
|
return wordToolbarProps(this.core);
|
|
25601
25906
|
}
|
|
25907
|
+
/** Page, view mode and navigation callbacks for custom page controls. */
|
|
25908
|
+
getNavigationProps() {
|
|
25909
|
+
return wordNavigationProps(this.core);
|
|
25910
|
+
}
|
|
25911
|
+
/** Word count and zoom for custom status controls. */
|
|
25912
|
+
getStatusProps() {
|
|
25913
|
+
return wordStatusProps(this.core);
|
|
25914
|
+
}
|
|
25915
|
+
/**
|
|
25916
|
+
* Host-owned dialogs for surface mode: `onOpenHyperlinkDialog`, `onOpenFindReplace` and
|
|
25917
|
+
* `onOpenImagePicker`. A workflow without its callback is reported as not enabled.
|
|
25918
|
+
*/
|
|
25919
|
+
get surfaceActions() {
|
|
25920
|
+
return this.core.surfaceActions;
|
|
25921
|
+
}
|
|
25922
|
+
set surfaceActions(value) {
|
|
25923
|
+
this.core.surfaceActions = { ...value };
|
|
25924
|
+
if (this.core.view) this.core.refreshControls();
|
|
25925
|
+
}
|
|
25602
25926
|
get loading() {
|
|
25603
25927
|
return this.core.loading;
|
|
25604
25928
|
}
|
|
@@ -25869,6 +26193,8 @@ var DocxEditorElement = class extends DocxEditorApi {
|
|
|
25869
26193
|
}
|
|
25870
26194
|
disconnectedCallback() {
|
|
25871
26195
|
const { core } = this;
|
|
26196
|
+
core.shell.surfaceNavigation?.();
|
|
26197
|
+
delete core.shell.surfaceNavigation;
|
|
25872
26198
|
core.shell.printStoryEditing?.();
|
|
25873
26199
|
core.shell.printNoteEditing?.();
|
|
25874
26200
|
core.shell.printFloats?.destroy();
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { OFFICE_UI_TAGS, registerOfficeUi } from './chunk-
|
|
1
|
+
export { OFFICE_UI_TAGS, registerOfficeUi } from './chunk-REJECZGV.js';
|
|
2
2
|
export { RIBBON_ADD_IN_EVENT, defineRibbonAddInElements, syncRibbonAddIns } from './chunk-C7B7TJ2J.js';
|
|
3
3
|
export { OfficeUiSmartArt, defineSmartArt, renderDiagramDrawing } from './chunk-QBXYGKPB.js';
|
|
4
|
-
export { EMOJI, OfficeUiActivityFeed, OfficeUiAppRail, OfficeUiAvatar, OfficeUiCalendarAgenda, OfficeUiCalendarView, OfficeUiCallControls, OfficeUiCallGrid, OfficeUiChannelList, OfficeUiChatComposer, OfficeUiChatList, OfficeUiChatSidebar, OfficeUiPeoplePicker, OfficeUiPrejoin, QUICK_REACTIONS, TEAMS_TAGS, TeamsApp, TeamsChannelTab, TeamsContentPreview, TeamsController, TeamsElement, TeamsFilesPanel, TeamsSettings, activityTime, applyTeamsProps, colorFor, createTeams, dayKind, dayLabel, defineActivityFeed, defineAppRail, defineAvatar, defineCalendarAgenda, defineCalendarView, defineCallControls, defineCallGrid, defineChannelList, defineChatComposer, defineChatList, defineChatSidebar, definePeoplePicker, definePrejoin, defineTeamsApp, defineTeamsChannelTab, defineTeamsContentPreview, defineTeamsFilesPanel, defineTeamsSettings, formatElapsed, formatSize, formatTime, formatWhen, icon, listenTeamsEvents, loadConfig, loadIdentity, parseIceLines, registerTeams, safeStorage, saveConfig, saveIdentity, withStyles } from './chunk-
|
|
4
|
+
export { EMOJI, OfficeUiActivityFeed, OfficeUiAppRail, OfficeUiAvatar, OfficeUiCalendarAgenda, OfficeUiCalendarView, OfficeUiCallControls, OfficeUiCallGrid, OfficeUiChannelList, OfficeUiChatComposer, OfficeUiChatList, OfficeUiChatSidebar, OfficeUiPeoplePicker, OfficeUiPrejoin, QUICK_REACTIONS, TEAMS_TAGS, TeamsApp, TeamsChannelTab, TeamsContentPreview, TeamsController, TeamsElement, TeamsFilesPanel, TeamsSettings, activityTime, applyTeamsProps, colorFor, createTeams, dayKind, dayLabel, defineActivityFeed, defineAppRail, defineAvatar, defineCalendarAgenda, defineCalendarView, defineCallControls, defineCallGrid, defineChannelList, defineChatComposer, defineChatList, defineChatSidebar, definePeoplePicker, definePrejoin, defineTeamsApp, defineTeamsChannelTab, defineTeamsContentPreview, defineTeamsFilesPanel, defineTeamsSettings, formatElapsed, formatSize, formatTime, formatWhen, icon, listenTeamsEvents, loadConfig, loadIdentity, parseIceLines, registerTeams, safeStorage, saveConfig, saveIdentity, withStyles } from './chunk-DRBAJ5UO.js';
|
|
5
5
|
export { TeamsPresentationPreview, defineTeamsPresentationPreview } from './chunk-FHO7TEWA.js';
|
|
6
6
|
export { BUILDING_BLOCKS_CSS, LEGACY_OFFICE_THEME_TOKENS, THEME_CSS, THEME_STYLE_ID, installOfficeUiTheme, installOfficeUiThemeFor, legacyThemeAliases, legacyThemeBridge, prepareOfficeUiBlock, shadcnBridge, themeBridge } from './chunk-T5ARELU2.js';
|
|
7
7
|
export { CONTROL_DEFINERS, DEFAULT_COMMENTS_LABELS, DEFAULT_OFFICE_PROFILE, EMPTY_MENU_STATE, OFFICE_AVATAR_SWATCHES, OFFICE_COLOR_SWATCHES, OFFICE_COLOR_SWATCH_HEXES, OFFICE_PROFILE_STORAGE_KEY, OFFICE_SYMBOLS, OFFICE_TITLE_BAR_SEARCH_LIMIT, OFFICE_TOAST_VISIBLE_LIMIT, assignKeyTips, attachKeyTips, attachRibbonGroupOverflow, clampFlyoutPosition, clampOptionNumber, clearOfficeProfile, commentInitials, createRibbonOverflow, defineAccount, defineBackstage, defineButton, defineChartPicker, defineCheckbox, defineColorCustom, defineColorGrid, defineCommandSearch, defineCommentsPane, defineContextMenu, defineDialog, defineDialogFooter, defineFindBar, defineGallery, defineIcon, defineMenuButton, defineMenuItem, defineMenuSeparator, defineOptionsDialog, definePasteOptions, definePrintPreview, defineRadio, defineReadOnlyBanner, defineRibbon, defineRibbonActions, defineRibbonGroup, defineRibbonSection, defineRibbonStack, defineRibbonToggle, defineRuler, defineSearchField, defineSelect, defineStatusBar, defineStatusItem, defineSwitch, defineSymbolPicker, defineTabStrip, defineTaskPane, defineTitleBar, defineToasts, defineToolbar, defineZoomSlider, fitRibbonGroups, formatCommentTime, glyph, nextEnabledIndex, optionText, optionsLabels, parseOfficeSymbolCode, parseSvgPreview, personalizeSection, profileInitials, readOfficeProfile, registerControls, rulerDivisions, runKeyTips, sanitizeOfficeProfile, typeAheadIndex, unavailableCategory, unavailableControl, userInterfaceSection, writeOfficeProfile } from './chunk-TJ245GDD.js';
|
package/dist/parse-worker.js
CHANGED
|
@@ -6,7 +6,11 @@ var worker = self;
|
|
|
6
6
|
worker.onmessage = async (event) => {
|
|
7
7
|
if (event.origin && event.origin !== self.location.origin) return;
|
|
8
8
|
try {
|
|
9
|
-
const
|
|
9
|
+
const request = event.data;
|
|
10
|
+
const document = request instanceof ArrayBuffer ? await loadVisio(request, { metafileConverter: convertMetafileToSvgTree }) : await loadVisio(request.bytes, {
|
|
11
|
+
metafileConverter: convertMetafileToSvgTree,
|
|
12
|
+
pages: request.pages
|
|
13
|
+
});
|
|
10
14
|
worker.postMessage({ ok: true, document });
|
|
11
15
|
} catch (cause) {
|
|
12
16
|
worker.postMessage({
|