ooxml-ui 1.34.0 → 1.36.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/custom-elements.json +14 -1
- package/dist/chart/format-pane-analysis.d.ts +0 -1
- package/dist/chart/format-pane-effects.d.ts +0 -1
- package/dist/chart/format-pane-fill-kinds.d.ts +0 -1
- package/dist/chart/format-pane-fill-line.d.ts +0 -1
- package/dist/chart/format-pane-targets.d.ts +0 -1
- package/dist/chart/format-pane-text.d.ts +0 -1
- package/dist/chrome/tab-drag.d.ts +27 -0
- package/dist/chrome/tab-drag.d.ts.map +1 -0
- package/dist/chrome/tab-strip.d.ts +25 -1
- package/dist/chrome/tab-strip.d.ts.map +1 -1
- package/dist/{chunk-CDC5MAZS.js → chunk-6VF4FEMY.js} +1 -1
- package/dist/chunk-7RRN2GPO.js +19 -0
- package/dist/{chunk-3AOIYE3R.js → chunk-7ST5QRD5.js} +1 -1
- package/dist/{chunk-6TS7ASDJ.js → chunk-C4KI635Q.js} +2 -17
- package/dist/{chunk-CALEXPBD.js → chunk-GZNBWWJ5.js} +840 -51
- package/dist/{chunk-KYXSQFDB.js → chunk-QAX4FAB7.js} +139 -4
- package/dist/{chunk-SWDVBUBW.js → chunk-Z4DML5NW.js} +3 -3
- package/dist/controls.d.ts +1 -1
- package/dist/controls.d.ts.map +1 -1
- package/dist/controls.js +1 -1
- package/dist/docx/building-blocks-actions.d.ts +2 -2
- package/dist/docx/editable-region-view.d.ts +4 -0
- package/dist/docx/editor-chrome.d.ts +1 -1
- package/dist/docx/editor-core.d.ts +4 -0
- package/dist/docx/editor-plugins.d.ts +3 -0
- package/dist/docx/file-commands.d.ts +5 -0
- package/dist/docx/format-dialogs.d.ts +6 -1
- package/dist/docx/insert-controller.d.ts +5 -0
- package/dist/docx/list-commands.d.ts +3 -1
- package/dist/docx/list-marker-display.d.ts +1 -1
- package/dist/docx/locales/en-app.d.ts +0 -1
- package/dist/docx/locales/en-ribbon.d.ts +51 -0
- package/dist/docx/locales/en.d.ts +51 -1
- package/dist/docx/localization-strings.d.ts +51 -1
- package/dist/docx/paragraph-styles.d.ts +1 -1
- package/dist/docx/print-picture.d.ts +4 -0
- package/dist/docx/protection-controls.d.ts +4 -0
- package/dist/docx/restrict-editing-pane.d.ts +14 -0
- package/dist/docx/ribbon-action.d.ts +4 -0
- package/dist/docx/ribbon-icons.d.ts +1 -0
- package/dist/docx/search-controller.d.ts +12 -5
- package/dist/docx/search-document.d.ts +32 -0
- package/dist/docx.js +1227 -390
- package/dist/export/pdf-embedded-font.d.ts +65 -0
- package/dist/export/pdf-fonts.d.ts +14 -0
- package/dist/export/pdf-vector.d.ts +84 -0
- package/dist/image-native-size.d.ts +43 -0
- package/dist/image-native-size.d.ts.map +1 -0
- package/dist/index.js +5 -5
- package/dist/picture-artistic-filters.d.ts +9 -0
- package/dist/picture-artistic-filters.d.ts.map +1 -0
- package/dist/picture-artistic-preview.d.ts +3 -0
- package/dist/picture-artistic-preview.d.ts.map +1 -0
- package/dist/picture-effects.d.ts +3 -1
- package/dist/picture-effects.d.ts.map +1 -0
- package/dist/picture-paint.d.ts +23 -0
- package/dist/picture-paint.d.ts.map +1 -0
- package/dist/picture-pixels.d.ts +11 -0
- package/dist/picture-pixels.d.ts.map +1 -0
- package/dist/picture-standard-filter.d.ts +6 -0
- package/dist/picture-standard-filter.d.ts.map +1 -0
- package/dist/picture-view.d.ts +10 -0
- package/dist/picture-view.d.ts.map +1 -0
- package/dist/pptx/ai/bridge-factory.d.ts +4 -1
- package/dist/pptx/ai/bridge-factory.d.ts.map +1 -1
- package/dist/pptx/ai/config.d.ts +1 -1
- package/dist/pptx/ai/config.d.ts.map +1 -1
- package/dist/pptx/ai/host.cjs +36 -36
- package/dist/pptx/ai/host.mjs +1 -1
- package/dist/pptx/ai/index.cjs +50 -43
- package/dist/pptx/ai/index.mjs +10 -3
- package/dist/pptx/ai/system-prompt.d.ts +1 -1
- package/dist/pptx/ai/system-prompt.d.ts.map +1 -1
- package/dist/pptx/ai/tool-summary.d.ts.map +1 -1
- package/dist/pptx/ai/tools/mcp-registry.d.ts.map +1 -1
- package/dist/pptx/{chart-3d-view-scene-HNL4NWJT.mjs → chart-3d-view-scene-BKNMGRGO.mjs} +3 -25
- package/dist/pptx/{chart-3d-view-scene-OPVBTZL5.cjs → chart-3d-view-scene-V55XPBBF.cjs} +39 -61
- package/dist/pptx/{chunk-KGDMMWIY.mjs → chunk-2AK5MS6H.mjs} +11 -0
- package/dist/pptx/{chunk-M55PNMFQ.cjs → chunk-4OKSYRYA.cjs} +11 -0
- package/dist/pptx/{chunk-CH4Z6H6C.mjs → chunk-4RSRCNRM.mjs} +1192 -382
- package/dist/pptx/{chunk-TDIJHLS5.cjs → chunk-6JJD3LFT.cjs} +1532 -715
- package/dist/pptx/{chunk-46HIE4IE.cjs → chunk-CRV7G4GC.cjs} +8 -0
- package/dist/pptx/{chunk-S3L5NNCK.cjs → chunk-FROIGMTI.cjs} +1 -1
- package/dist/pptx/{chunk-S5I64Y55.cjs → chunk-HIRBPTML.cjs} +12 -12
- package/dist/pptx/{chunk-D4LJJ7Z7.cjs → chunk-KJICUZXM.cjs} +171 -540
- package/dist/pptx/{chunk-7DT3UJQB.mjs → chunk-KNCCSPAV.mjs} +7 -3
- package/dist/pptx/{chunk-RZVEPTLN.mjs → chunk-QK6LJT3K.mjs} +140 -529
- package/dist/pptx/{chunk-ZS5EVODY.cjs → chunk-SI7GQYSL.cjs} +52 -48
- package/dist/pptx/{chunk-LCCRLB7Q.mjs → chunk-UHDWWRTX.mjs} +1 -1
- package/dist/pptx/{chunk-6MEBLCNK.mjs → chunk-WQI3NLMY.mjs} +8 -0
- package/dist/pptx/{chunk-SPOECCPV.mjs → chunk-WZHYA2B3.mjs} +1 -1
- package/dist/pptx/dom/elements/smartart.d.ts.map +1 -1
- package/dist/pptx/dom/index.cjs +427 -427
- package/dist/pptx/dom/index.mjs +10 -10
- package/dist/pptx/export/html2canvas-clone.cjs +6 -6
- package/dist/pptx/export/html2canvas-clone.mjs +1 -1
- package/dist/pptx/i18n/index.cjs +6 -6
- package/dist/pptx/i18n/index.mjs +1 -1
- package/dist/pptx/i18n/translations-en.d.ts.map +1 -1
- package/dist/pptx/index.cjs +3361 -3353
- package/dist/pptx/index.mjs +5 -5
- package/dist/pptx/render/chart-3d-projection.d.ts +5 -54
- package/dist/pptx/render/chart-3d-projection.d.ts.map +1 -1
- package/dist/pptx/render/chart-3d-shading.d.ts +7 -10
- package/dist/pptx/render/chart-3d-shading.d.ts.map +1 -1
- package/dist/pptx/render/chart-combo-stock.cjs +3 -3
- package/dist/pptx/render/chart-combo-stock.mjs +1 -1
- package/dist/pptx/render/chart-funnel-sunburst.d.ts +1 -1
- package/dist/pptx/render/chart-funnel-sunburst.d.ts.map +1 -1
- package/dist/pptx/render/chart-map-projection.d.ts +2 -37
- package/dist/pptx/render/chart-map-projection.d.ts.map +1 -1
- package/dist/pptx/render/chart-overlays.cjs +7 -7
- package/dist/pptx/render/chart-overlays.mjs +1 -1
- package/dist/pptx/render/chart-region-map-alias.d.ts +1 -11
- package/dist/pptx/render/chart-region-map-alias.d.ts.map +1 -1
- package/dist/pptx/render/chart-region-map-colors.d.ts +1 -3
- package/dist/pptx/render/chart-region-map-colors.d.ts.map +1 -1
- package/dist/pptx/render/chart-region-map-data.d.ts +2 -44
- package/dist/pptx/render/chart-region-map-data.d.ts.map +1 -1
- package/dist/pptx/render/chart-region-map-view.d.ts.map +1 -1
- package/dist/pptx/render/chart-surface-treemap.cjs +4 -4
- package/dist/pptx/render/chart-surface-treemap.mjs +1 -1
- package/dist/pptx/render/chart-view-model-types.d.ts +2 -0
- package/dist/pptx/render/chart-view-model-types.d.ts.map +1 -1
- package/dist/pptx/render/chart-view-model.cjs +44 -44
- package/dist/pptx/render/chart-view-model.mjs +1 -1
- package/dist/pptx/render/chart-waterfall-map.cjs +6 -6
- package/dist/pptx/render/chart-waterfall-map.mjs +1 -1
- package/dist/pptx/render/controller/custom-shows-controller.d.ts +93 -0
- package/dist/pptx/render/controller/custom-shows-controller.d.ts.map +1 -0
- package/dist/pptx/render/controller/index.d.ts +2 -0
- package/dist/pptx/render/controller/index.d.ts.map +1 -1
- package/dist/pptx/render/custom-shows.d.ts +10 -2
- package/dist/pptx/render/custom-shows.d.ts.map +1 -1
- package/dist/pptx/render/editor-key-target.d.ts.map +1 -1
- package/dist/pptx/render/image-effect-filter-values.d.ts +1 -10
- package/dist/pptx/render/image-effect-filter-values.d.ts.map +1 -1
- package/dist/pptx/render/image-effects.d.ts +1 -0
- package/dist/pptx/render/image-effects.d.ts.map +1 -1
- package/dist/pptx/render/image-native-size.d.ts +1 -42
- package/dist/pptx/render/image-native-size.d.ts.map +1 -1
- package/dist/pptx/render/image-tiling.d.ts.map +1 -1
- package/dist/pptx/render/index.d.ts +1 -1
- package/dist/pptx/render/index.d.ts.map +1 -1
- package/dist/pptx/render/render-cache.d.ts +1 -3
- package/dist/pptx/render/render-cache.d.ts.map +1 -1
- package/dist/pptx/render/smartart-drawing.d.ts +3 -0
- package/dist/pptx/render/smartart-drawing.d.ts.map +1 -1
- package/dist/pptx/render/smartart-picture-image.d.ts +9 -0
- package/dist/pptx/render/smartart-picture-image.d.ts.map +1 -0
- package/dist/pptx/render/smartart-reflow-to-shapes.d.ts.map +1 -1
- package/dist/pptx/{smartart-insert-preview-RQUFRLSV.mjs → smartart-insert-preview-JH5TXECK.mjs} +6 -6
- package/dist/pptx/{smartart-insert-preview-YKNB37GE.cjs → smartart-insert-preview-QWROEVZL.cjs} +7 -7
- package/dist/render-cache.d.ts +4 -0
- package/dist/render-cache.d.ts.map +1 -0
- package/dist/smartart/smartart-paint.d.ts +2 -1
- package/dist/smartart/smartart-picture.d.ts +4 -3
- package/dist/smartart/smartart-text-pane-tools.d.ts +0 -1
- package/dist/smartart.d.ts +3 -0
- package/dist/smartart.js +1 -1
- package/dist/teams.js +2 -2
- package/dist/theme-bridge.d.ts +0 -1
- package/dist/theme.d.ts +0 -1
- package/dist/touch-targets.d.ts +0 -1
- package/dist/visio/binding.d.ts +2 -1
- package/dist/visio/canvas-editing.d.ts +2 -0
- package/dist/visio/controller.d.ts +3 -0
- package/dist/visio/pdf-path.d.ts +37 -0
- package/dist/visio/pdf-svg-gradient.d.ts +23 -0
- package/dist/visio/pdf-svg-style.d.ts +20 -0
- package/dist/visio/pdf-svg-text.d.ts +8 -0
- package/dist/visio/pdf-svg.d.ts +22 -0
- package/dist/visio/ribbon-action.d.ts +47 -5
- package/dist/visio/ribbon-arrange.d.ts +9 -0
- package/dist/visio/ribbon-contextual-formats.d.ts +18 -0
- package/dist/visio/ribbon-org-chart.d.ts +7 -0
- package/dist/visio/ribbon-router.d.ts +18 -0
- package/dist/visio/ribbon-shape-format.d.ts +7 -0
- package/dist/visio/ribbon-size-fields.d.ts +5 -0
- package/dist/visio/ribbon-swimlane.d.ts +9 -0
- package/dist/visio/ribbon-themes.d.ts +13 -3
- package/dist/visio/ribbon.d.ts +5 -1
- package/dist/visio/shapes-files-ui.d.ts +1 -1
- package/dist/visio/template-thumbnails.d.ts +10 -0
- package/dist/visio/viewer-backstage.d.ts +9 -3
- package/dist/visio/viewer-chart-editor.d.ts +2 -1
- package/dist/visio/viewer-contextual-tabs.d.ts +21 -0
- package/dist/visio/viewer-diagram-parts.d.ts +9 -1
- package/dist/visio/viewer-element.d.ts +10 -0
- package/dist/visio/viewer-export.d.ts +1 -6
- package/dist/visio/viewer-file-commands.d.ts +6 -1
- package/dist/visio/viewer-guides.d.ts +8 -1
- package/dist/visio/viewer-inline-size.d.ts +15 -0
- package/dist/visio/viewer-insert-dialog.d.ts +1 -0
- package/dist/visio/viewer-new-drawing.d.ts +3 -2
- package/dist/visio/viewer-org-chart.d.ts +19 -0
- package/dist/visio/viewer-pdf-options.d.ts +26 -0
- package/dist/visio/viewer-pdf.d.ts +47 -0
- package/dist/visio/viewer-picture-format.d.ts +20 -0
- package/dist/visio/viewer-resize-handles.d.ts +13 -1
- package/dist/visio/viewer-swimlanes.d.ts +34 -0
- package/dist/visio.js +4079 -742
- package/dist/xlsx/dialogs/audit-dialogs.d.ts +9 -0
- package/dist/xlsx/dialogs/custom-autofilter.d.ts +12 -0
- package/dist/xlsx/dialogs/custom-lists.d.ts +6 -0
- package/dist/xlsx/dialogs/filter-dates.d.ts +4 -0
- package/dist/xlsx/dialogs/help-dialogs.d.ts +2 -2
- package/dist/xlsx/dialogs/sort-dialog.d.ts +3 -3
- package/dist/xlsx/dialogs/text-to-columns.d.ts +0 -7
- package/dist/xlsx/dialogs/top10-filter.d.ts +5 -0
- package/dist/xlsx/dialogs/watch-window.d.ts +4 -0
- package/dist/xlsx/grid/audit-layer.d.ts +3 -0
- package/dist/xlsx/grid/filter-buttons.d.ts +11 -0
- package/dist/xlsx/grid/filter-menu.d.ts +10 -0
- package/dist/xlsx/grid/filter-presets.d.ts +19 -0
- package/dist/xlsx/grid/grid-view.d.ts +23 -1
- package/dist/xlsx/grid/pane-chrome.d.ts +2 -0
- package/dist/xlsx/grid/split-bars.d.ts +2 -0
- package/dist/xlsx/grid/styles.d.ts +1 -1
- package/dist/xlsx/sheet-tabs/drag.d.ts +1 -2
- package/dist/xlsx.js +1991 -450
- package/package.json +2 -2
package/dist/docx.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { defineChartExOptions,
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { defineChartExOptions, statusLayout, watchStatusWidth, compactPageText } from './chunk-C4KI635Q.js';
|
|
2
|
+
import { chartExSpaceFormatSource } from './chunk-7RRN2GPO.js';
|
|
3
|
+
import { syncRibbonAddIns, createHostBackstagePages, withHostMenuItems } from './chunk-6VF4FEMY.js';
|
|
4
|
+
export { RIBBON_ADD_IN_EVENT } from './chunk-6VF4FEMY.js';
|
|
5
|
+
import { defineSmartArt, smartArtColorsGalleryState, smartArtStylesGalleryState, SmartArtTextPaneController, pictureNeedsSvg, pictureSvg, defineSmartArtPicker } from './chunk-GZNBWWJ5.js';
|
|
5
6
|
import { legacyThemeAliases, legacyThemeBridge, installOfficeUiThemeFor } from './chunk-T5ARELU2.js';
|
|
6
|
-
import { createRibbonOverflow, defineRibbon, defineChartFormatPane, defineRuler, defineChartDataSheet, defineChartPicker, createDialogSession, defineCommentsPane, defineDialog, buildFontCatalog, defineGallery, defineSearchField, defineSwitch, defineTitleBar, defineRibbonActions, defineBackstage, defineStatusBar, defineZoomSlider, defineContextMenu, defineColorGrid, runKeyTips, defineOptionsDialog, assignKeyTips, optionsLabels, userInterfaceSection, personalizeSection, optionText, unavailableCategory } from './chunk-
|
|
7
|
+
import { createRibbonOverflow, defineRibbon, defineChartFormatPane, defineRuler, defineChartDataSheet, defineChartPicker, createDialogSession, defineCommentsPane, defineDialog, buildFontCatalog, defineGallery, defineSearchField, defineSwitch, defineTitleBar, defineRibbonActions, defineBackstage, defineStatusBar, defineZoomSlider, defineContextMenu, defineColorGrid, runKeyTips, defineOptionsDialog, assignKeyTips, optionsLabels, userInterfaceSection, personalizeSection, optionText, unavailableCategory } from './chunk-QAX4FAB7.js';
|
|
7
8
|
import { registerIcon } from './chunk-M6GF5ED2.js';
|
|
8
9
|
import './chunk-4OBMFPGF.js';
|
|
9
10
|
import './chunk-YZH2QS7J.js';
|
|
@@ -12,11 +13,11 @@ import './chunk-QLHCGV4C.js';
|
|
|
12
13
|
import './chunk-XL77FR4B.js';
|
|
13
14
|
import { optionStrings, normalizeLocale, SUPPORTED_OFFICE_LOCALES, interpolate } from 'ooxml-core/i18n';
|
|
14
15
|
import { DIAGRAM_UI_STRINGS, DIAGRAM_ADD_SHAPE_COMMANDS, DEFAULT_GENERATED_DIAGRAM_SCHEME, DIAGRAM_DESIGN_GROUPS, DIAGRAM_INSERT_PRESETS, DIAGRAM_DESIGN_COMMANDS, DIAGRAM_COLOR_ENTRIES, DIAGRAM_STYLE_ENTRIES, DIAGRAM_INSERT_CATEGORIES, DIAGRAM_ADD_SHAPE_LABEL } from 'ooxml-core/diagram';
|
|
15
|
-
import { markSpecs, imageNodeSpec, fieldMarkerNodeSpec, noteReferenceNodeSpec, pageBreakNodeSpec, hardBreakNodeSpec, commentHistoryAttributes, tableCellStyle, tableStyle, createToggleFormat, expectDefined, controlFromData, paragraphBoxCss, WORD_CAPABILITY_ACTIONS, normalizeThemeMode, applyThemeColors, refreshWordYjsPresence, tableGrid, RESTRUCTURE_TABLE_META, normalizeRibbonActions, DirtyState,
|
|
16
|
+
import { markSpecs, imageNodeSpec, fieldMarkerNodeSpec, noteReferenceNodeSpec, pageBreakNodeSpec, hardBreakNodeSpec, commentHistoryAttributes, tableCellStyle, tableStyle, createToggleFormat, expectDefined, controlFromData, paragraphBoxCss, WORD_CAPABILITY_ACTIONS, normalizeThemeMode, applyThemeColors, refreshWordYjsPresence, tableGrid, RESTRUCTURE_TABLE_META, normalizeRibbonActions, DirtyState, locksStories, isWordYjsRemoteTransaction, REMOTE_TRANSACTION_META, repairCollaborativeDocumentIds, HEADER_FOOTER_INPUT, splitCell, closeRect, mergeCells, deleteColumns, insertColumn, deleteRow, insertRow, rowSpanOf, continuationsOf, wordYjsPluginKey, wordYjsRedo, wordYjsUndo, documentWordCount, restoreSectionParts, commentThreadsFromDoc, restoreNoteParts, CollaborationClient, createCollaborationIdGenerator, WordYjsCollaboration, insertContentControl, sectionPartsJson, NotePartsStep, notePartsJson, SectionPartsStep, fitZoomPercent, hasChangeAtCursor, hasAnyChange, commentIdsAtSelection, commentAnchors, forcesTrackChanges, fieldGuardPlugin, tableStructureGuardPlugin, contentControlPlugin, formFieldGuardPlugin, editRestrictionPlugin, symbolFontPlugin, positionalTabInputPlugin, trackChangesPlugin, wordYjsPresencePlugin, placementClass, removeCommentThread, removeCommentAnchor, deleteComment, updateCommentThreads, addComment, toggleTrackChanges, goToNextChange, goToPreviousChange, rejectAllChanges, acceptAllChanges, rejectChangeAtCursor, acceptChangeAtCursor, goToComment, selectedChart, appendInlineNode, sameJson, sameRuns, PARAGRAPH_KEEP_KEYS, paragraphFromAttrs, parseBordersJson, isNavigableHref, setReviewRecordingPreferences, setEditableRegion, insertChartImage, nodeNumbering, controlAtSelection, paragraphFormattingRevision, inlineNodeRun, formattingRevision, editRestrictionOf, editableRanges, insertWordHardBreak, paragraphAttrs, resolveCellVisuals, previewDocxDiagram, themeDrawing, chartNodeSpec, FindPatternError, replacementParts, replaceSelectedChart, ribbonActionIdForLabel, removeWordLink, fieldResultRanges, wordLinkRangeAt, nextEditableRegion, editRestrictionKey, ligatureCss as ligatureCss$1, toggleCheckboxControl, formFieldBeside, formFieldOfNode, formFieldLocked, toggleFormCheckboxAt, runToInlineNodes as runToInlineNodes$1, findMatches, backstageFocus, applyRunFormattingPatch, clearDirectRunFormatting, applyWordLink, deleteFieldSelection, emptySimpleFieldResult, ligatureStyle, wordHighlightColors, swatchColor, cssBorderSide, countWords, FIND_OBJECT, FIND_PARAGRAPH_MARK, FIND_LINE_BREAK, FIND_PAGE_BREAK, insertedTextMarks, chooseListItem, chooseDate, selectFormDropDownAt, updateControlProperties, WORD_CAPABILITY_MENU_ITEMS, WORD_CAPABILITY_SHORTCUTS, WORD_CAPABILITY_BACKSTAGE_PAGES, WORD_CAPABILITY_FILE_COMMANDS, resolveComment, replyToComment, CollaborationAuthority } from 'ooxml-core/docx/ui';
|
|
16
17
|
export { CollaborationAuthority, CollaborationClient, RIBBON_ACTION_IDS, RIBBON_ACTION_LABELS, WORD_CAPABILITY_IDS, createCollaborationIdGenerator, darkTheme, isRibbonActionId, lightTheme, normalizeRibbonActions, repairCollaborativeDocumentIds, themeToCssVars } from 'ooxml-core/docx/ui';
|
|
17
|
-
import { createDocument, saveDocx, sectionsFromLayout, sectionLayoutJson, sectionsOf, pageSizeOf, columnPreset, applyPageSetup, withSection, computeListLabels, numberNotesInOrder, tocEntries, editDocxChartEx, editDocxChart, resolveNumberingLevel, formatDocxDiagram, createDocxDiagram, insertedDiagramPartNames, changeDocxDiagramLayout, tableOfFiguresInstruction, findTableOfContents, applyDocxChartDataSheetEdits, docxChartDataSheet, newDocxChart, newChartImage, docxChartPaint, 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, diagramColorTheme, plainText, resolveRunFormatting, removedByEdit, editDocxDiagram, 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,
|
|
18
|
+
import { createDocument, saveDocx, sectionsFromLayout, sectionLayoutJson, sectionsOf, pageSizeOf, columnPreset, applyPageSetup, withSection, computeListLabels, numberNotesInOrder, tocEntries, editDocxChartEx, editDocxChart, resolveNumberingLevel, formatDocxDiagram, createDocxDiagram, insertedDiagramPartNames, changeDocxDiagramLayout, tableOfFiguresInstruction, findTableOfContents, enforceProtection, verifyProtectionPassword, applyDocxChartDataSheetEdits, docxChartDataSheet, newDocxChart, newChartImage, docxChartPaint, 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, diagramColorTheme, plainText, resolveRunFormatting, removedByEdit, editDocxDiagram, tocHyperlinks, DEFAULT_TOC_INSTRUCTION, tocBookmarks, buildTableOfContents, tocCaptionLabel, twips as twips$1, signedTwips, formatListNumber, columnTextWidth, validColumnDraft, validatePageSetup, presetOf, LIGATURE_VALUES, isLigatures, reviewRunFormatting, resolveThemeColorReference, pictureBulletSizePt, lineSpacingValue, canEditControlContent, controlDate, formDropDownIndex, shapeSvg, isStHighlightColor, transformCase, DEFAULT_TABLE_BORDERS, parseLineSpacingValue, twipsAttr, SHAPE_PALETTE, isHeadingListKind, headingListLevels, createListDefinition, linkStylesToList, twipsFromPixels, isFieldLocked, styleRefSource, parseStyleReference, bodyStyleRefResult, isDirectionalPreset, headingLevel, reviewParagraphFormatting, isValidLanguageTag, WORD, newShape, withFieldCodeFormatting, fieldResultRun, DEFAULT_DRAWN_SHAPE, fieldName, lineSpacingOptions, createPictureBulletList, halfPointsFromPoints, changeColumnWidth, changeColumnGap, documentStats } from 'ooxml-core/docx';
|
|
18
19
|
import { loadDocument } from 'ooxml-core/docx/load';
|
|
19
|
-
import { Schema, Fragment, DOMSerializer, Mark } from 'prosemirror-model';
|
|
20
|
+
import { Schema, Fragment, DOMSerializer, Slice, Mark } from 'prosemirror-model';
|
|
20
21
|
import { parseOmml, convertOmmlToLatex, convertOmmlToMathMl, EQUATION_GALLERY, latexToOmmlXml } from 'ooxml-core/math';
|
|
21
22
|
import { closeHistory, redo, undo, history } from 'prosemirror-history';
|
|
22
23
|
import { PluginKey, TextSelection, Selection, EditorState, Plugin, NodeSelection } from 'prosemirror-state';
|
|
@@ -38,7 +39,7 @@ var enSplitCells = {
|
|
|
38
39
|
"Split the cell into this many columns and rows.": "Split the cell into this many columns and rows."
|
|
39
40
|
};
|
|
40
41
|
var fromValues = (values2) => Object.fromEntries(
|
|
41
|
-
Object.keys(enSplitCells).map((
|
|
42
|
+
Object.keys(enSplitCells).map((key3, index) => [key3, values2[index]])
|
|
42
43
|
);
|
|
43
44
|
var frSplitCells = fromValues([
|
|
44
45
|
"Fusionner les cellules",
|
|
@@ -112,7 +113,7 @@ var enColumns = {
|
|
|
112
113
|
"Unequal column widths are preserved. Select Equal column width to replace them with equal columns.": "Unequal column widths are preserved. Select Equal column width to replace them with equal columns.",
|
|
113
114
|
"Enter whole columns and spacing that leaves at least 0.5 inch for each column.": "Enter whole columns and spacing that leaves at least 0.5 inch for each column."
|
|
114
115
|
};
|
|
115
|
-
var fromValues2 = (values2) => Object.fromEntries(Object.keys(enColumns).map((
|
|
116
|
+
var fromValues2 = (values2) => Object.fromEntries(Object.keys(enColumns).map((key3, index) => [key3, values2[index]]));
|
|
116
117
|
var frColumns = fromValues2([
|
|
117
118
|
"Colonne",
|
|
118
119
|
"Autres colonnes\u2026",
|
|
@@ -193,7 +194,7 @@ var keys = [
|
|
|
193
194
|
"(No style)",
|
|
194
195
|
"Add tab stop at (inches)"
|
|
195
196
|
];
|
|
196
|
-
var from = (values2) => Object.fromEntries(keys.map((
|
|
197
|
+
var from = (values2) => Object.fromEntries(keys.map((key3, i) => [key3, values2[i]]));
|
|
197
198
|
var enMultilevelList = from(keys);
|
|
198
199
|
var frMultilevelList = from([
|
|
199
200
|
"D\xE9finir une nouvelle liste \xE0 plusieurs niveaux",
|
|
@@ -344,7 +345,7 @@ var enFontAdvanced = {
|
|
|
344
345
|
"Review advanced formatting in Print Layout.": "Review advanced formatting in Print Layout."
|
|
345
346
|
};
|
|
346
347
|
var values = (items) => Object.fromEntries(
|
|
347
|
-
Object.keys(enFontAdvanced).map((
|
|
348
|
+
Object.keys(enFontAdvanced).map((key3, index) => [key3, items[index]])
|
|
348
349
|
);
|
|
349
350
|
var frFontAdvanced = values([
|
|
350
351
|
"Param\xE8tres avanc\xE9s",
|
|
@@ -407,7 +408,7 @@ var labels = [
|
|
|
407
408
|
"Contextual Historical Discretional"
|
|
408
409
|
];
|
|
409
410
|
function translated(words) {
|
|
410
|
-
const basic = new Map(labels.slice(0, 6).map((
|
|
411
|
+
const basic = new Map(labels.slice(0, 6).map((key3, index) => [key3, words[index]]));
|
|
411
412
|
return Object.fromEntries(
|
|
412
413
|
labels.map((label2) => [
|
|
413
414
|
label2,
|
|
@@ -460,7 +461,7 @@ var enNavigation = {
|
|
|
460
461
|
"Apply a heading style to see document headings here.": "Apply a heading style to see document headings here."
|
|
461
462
|
};
|
|
462
463
|
var fromValues3 = (values2) => Object.fromEntries(
|
|
463
|
-
Object.keys(enNavigation).map((
|
|
464
|
+
Object.keys(enNavigation).map((key3, index) => [key3, values2[index]])
|
|
464
465
|
);
|
|
465
466
|
var frNavigation = fromValues3([
|
|
466
467
|
"Volet de navigation",
|
|
@@ -506,7 +507,7 @@ var enDropCap = {
|
|
|
506
507
|
"Lines to drop": "Lines to drop",
|
|
507
508
|
"Enter a font, 1 to 10 lines and a distance from 0 to 22 inches.": "Enter a font, 1 to 10 lines and a distance from 0 to 22 inches."
|
|
508
509
|
};
|
|
509
|
-
var fromValues4 = (values2) => Object.fromEntries(Object.keys(enDropCap).map((
|
|
510
|
+
var fromValues4 = (values2) => Object.fromEntries(Object.keys(enDropCap).map((key3, index) => [key3, values2[index]]));
|
|
510
511
|
var frDropCap = fromValues4([
|
|
511
512
|
"Options de lettrine",
|
|
512
513
|
"Options de lettrine\u2026",
|
|
@@ -546,7 +547,7 @@ var enLineNumbers = {
|
|
|
546
547
|
"Enter whole numbers from 1 to 32767 and a distance from 0 to 22 inches.": "Enter whole numbers from 1 to 32767 and a distance from 0 to 22 inches."
|
|
547
548
|
};
|
|
548
549
|
var fromValues5 = (values2) => Object.fromEntries(
|
|
549
|
-
Object.keys(enLineNumbers).map((
|
|
550
|
+
Object.keys(enLineNumbers).map((key3, index) => [key3, values2[index]])
|
|
550
551
|
);
|
|
551
552
|
var frLineNumbers = fromValues5([
|
|
552
553
|
"Ajouter la num\xE9rotation des lignes",
|
|
@@ -1473,7 +1474,6 @@ var deApp = {
|
|
|
1473
1474
|
"Save As": "Speichern unter",
|
|
1474
1475
|
"Save a copy of this document to your device.": "Speichern Sie eine Kopie dieses Dokuments auf Ihrem Ger\xE4t.",
|
|
1475
1476
|
"Word Document (*.docx)": "Word-Dokument (*.docx)",
|
|
1476
|
-
"Word 97-2003 Document (*.doc)": "Word 97-2003-Dokument (*.doc)",
|
|
1477
1477
|
"Paper size": "Papierformat",
|
|
1478
1478
|
"Printing uses the browser print dialog. Page breaks come from Print Layout, which approximates Word.": "Der Druck verwendet den Druckdialog des Browsers. Seitenumbr\xFCche stammen aus dem Seitenlayout, das Word nur ann\xE4hert.",
|
|
1479
1479
|
Export: "Exportieren",
|
|
@@ -1715,7 +1715,7 @@ var enTableProperties = {
|
|
|
1715
1715
|
"Enter a measurement within the displayed range.": "Enter a measurement within the displayed range."
|
|
1716
1716
|
};
|
|
1717
1717
|
var fromValues6 = (values2) => Object.fromEntries(
|
|
1718
|
-
Object.keys(enTableProperties).map((
|
|
1718
|
+
Object.keys(enTableProperties).map((key3, index) => [key3, values2[index]])
|
|
1719
1719
|
);
|
|
1720
1720
|
var frTableProperties = fromValues6([
|
|
1721
1721
|
"Propri\xE9t\xE9s du tableau",
|
|
@@ -2086,6 +2086,7 @@ var deRibbon = {
|
|
|
2086
2086
|
"Numbered list": "Nummerierung",
|
|
2087
2087
|
"Decrease list level": "Listenebene verringern",
|
|
2088
2088
|
"Increase list level": "Listenebene erh\xF6hen",
|
|
2089
|
+
"Picture bullet...": "Bildaufz\xE4hlungszeichen...",
|
|
2089
2090
|
"Remove list": "Liste entfernen",
|
|
2090
2091
|
"Insert row above": "Zeile oberhalb einf\xFCgen",
|
|
2091
2092
|
"Insert row below": "Zeile unterhalb einf\xFCgen",
|
|
@@ -2142,6 +2143,29 @@ var deRibbon = {
|
|
|
2142
2143
|
"Close search": "Suche schlie\xDFen",
|
|
2143
2144
|
"Search results": "Suchergebnisse",
|
|
2144
2145
|
"Enter text to search": "Suchtext eingeben",
|
|
2146
|
+
"Invalid search pattern": "Ung\xFCltiges Suchmuster",
|
|
2147
|
+
"More >>": "Mehr >>",
|
|
2148
|
+
"<< Less": "<< Weniger",
|
|
2149
|
+
"Search options": "Suchoptionen",
|
|
2150
|
+
"Find whole words only": "Nur ganze W\xF6rter suchen",
|
|
2151
|
+
"Use wildcards": "Platzhalter verwenden",
|
|
2152
|
+
"Match prefix": "Pr\xE4fix ber\xFCcksichtigen",
|
|
2153
|
+
"Match suffix": "Suffix ber\xFCcksichtigen",
|
|
2154
|
+
"Ignore punctuation characters": "Satzzeichen ignorieren",
|
|
2155
|
+
"Ignore white-space characters": "Leerraum ignorieren",
|
|
2156
|
+
"Special characters": "Sonderzeichen",
|
|
2157
|
+
"Paragraph Mark": "Absatzmarke",
|
|
2158
|
+
"Tab Character": "Tabstoppzeichen",
|
|
2159
|
+
"Any Character": "Beliebiges Zeichen",
|
|
2160
|
+
"Any Digit": "Beliebige Ziffer",
|
|
2161
|
+
"Any Letter": "Beliebiger Buchstabe",
|
|
2162
|
+
"Caret Character": "Caret-Zeichen",
|
|
2163
|
+
"Manual Line Break": "Manueller Zeilenumbruch",
|
|
2164
|
+
"Page Break": "Seitenwechsel",
|
|
2165
|
+
"Optional Hyphen": "Bedingter Trennstrich",
|
|
2166
|
+
"Nonbreaking Hyphen": "Gesch\xFCtzter Bindestrich",
|
|
2167
|
+
"Nonbreaking Space": "Gesch\xFCtztes Leerzeichen",
|
|
2168
|
+
"White Space": "Leerraum",
|
|
2145
2169
|
"No matches": "Keine Treffer",
|
|
2146
2170
|
"matches one": "Treffer",
|
|
2147
2171
|
"matches many": "Treffer",
|
|
@@ -2248,7 +2272,34 @@ var deRibbon = {
|
|
|
2248
2272
|
Finish: "Fertig stellen",
|
|
2249
2273
|
"Finish & Merge": "Fertig stellen und zusammenf\xFChren",
|
|
2250
2274
|
Help: "Hilfe",
|
|
2251
|
-
"Not available in this editor": "In diesem Editor nicht verf\xFCgbar"
|
|
2275
|
+
"Not available in this editor": "In diesem Editor nicht verf\xFCgbar",
|
|
2276
|
+
Protect: "Sch\xFCtzen",
|
|
2277
|
+
"Restrict editing": "Bearbeitung einschr\xE4nken",
|
|
2278
|
+
"Formatting restrictions": "Formatierungseinschr\xE4nkungen",
|
|
2279
|
+
"Limit formatting to a selection of styles": "Formatierung auf eine Auswahl von Formatvorlagen beschr\xE4nken",
|
|
2280
|
+
"Editing restrictions": "Bearbeitungseinschr\xE4nkungen",
|
|
2281
|
+
"Allow only this type of editing in the document": "Nur diese Art der Bearbeitung im Dokument zulassen",
|
|
2282
|
+
"No changes (Read only)": "Keine \xC4nderungen (schreibgesch\xFCtzt)",
|
|
2283
|
+
"Filling in forms": "Ausf\xFCllen von Formularen",
|
|
2284
|
+
"Exceptions (optional)": "Ausnahmen (optional)",
|
|
2285
|
+
Everyone: "Jeder",
|
|
2286
|
+
"Start enforcement": "Schutz anwenden",
|
|
2287
|
+
"Yes, start enforcing protection": "Ja, Schutz jetzt anwenden",
|
|
2288
|
+
"Enter new password (optional)": "Neues Kennwort eingeben (optional)",
|
|
2289
|
+
"Reenter password to confirm": "Kennwort zur Best\xE4tigung erneut eingeben",
|
|
2290
|
+
Password: "Kennwort",
|
|
2291
|
+
"Stop protection": "Schutz aufheben",
|
|
2292
|
+
"The document is protected": "Das Dokument ist gesch\xFCtzt",
|
|
2293
|
+
"The passwords do not match": "Die Kennw\xF6rter stimmen nicht \xFCberein",
|
|
2294
|
+
"Incorrect password": "Falsches Kennwort",
|
|
2295
|
+
"This protection uses a password that cannot be checked here": "Dieser Schutz verwendet ein Kennwort, das hier nicht gepr\xFCft werden kann",
|
|
2296
|
+
"Select text first": "Markieren Sie zuerst Text",
|
|
2297
|
+
"This exception continues into another paragraph; change it in Word": "Diese Ausnahme reicht in einen anderen Absatz; \xE4ndern Sie sie in Word",
|
|
2298
|
+
"Choose the type of editing to allow": "W\xE4hlen Sie die zul\xE4ssige Art der Bearbeitung",
|
|
2299
|
+
"Editing is restricted by document protection": "Die Bearbeitung ist durch den Dokumentschutz eingeschr\xE4nkt",
|
|
2300
|
+
"Highlight the regions I can edit": "Bereiche hervorheben, die ich bearbeiten kann",
|
|
2301
|
+
"Find next region I can edit": "N\xE4chsten Bereich suchen, den ich bearbeiten kann",
|
|
2302
|
+
"There are no regions you can edit": "Es gibt keine Bereiche, die Sie bearbeiten k\xF6nnen"
|
|
2252
2303
|
};
|
|
2253
2304
|
|
|
2254
2305
|
// src/docx/locales/de.ts
|
|
@@ -2307,7 +2358,6 @@ var enApp = {
|
|
|
2307
2358
|
"Save As": "Save As",
|
|
2308
2359
|
"Save a copy of this document to your device.": "Save a copy of this document to your device.",
|
|
2309
2360
|
"Word Document (*.docx)": "Word Document (*.docx)",
|
|
2310
|
-
"Word 97-2003 Document (*.doc)": "Word 97-2003 Document (*.doc)",
|
|
2311
2361
|
"Paper size": "Paper size",
|
|
2312
2362
|
"Printing uses the browser print dialog. Page breaks come from Print Layout, which approximates Word.": "Printing uses the browser print dialog. Page breaks come from Print Layout, which approximates Word.",
|
|
2313
2363
|
Export: "Export",
|
|
@@ -2790,6 +2840,7 @@ var enRibbon = {
|
|
|
2790
2840
|
"Numbered list": "Numbered list",
|
|
2791
2841
|
"Decrease list level": "Decrease list level",
|
|
2792
2842
|
"Increase list level": "Increase list level",
|
|
2843
|
+
"Picture bullet...": "Picture bullet...",
|
|
2793
2844
|
"Remove list": "Remove list",
|
|
2794
2845
|
"Insert row above": "Insert row above",
|
|
2795
2846
|
"Insert row below": "Insert row below",
|
|
@@ -2846,6 +2897,29 @@ var enRibbon = {
|
|
|
2846
2897
|
"Close search": "Close search",
|
|
2847
2898
|
"Search results": "Search results",
|
|
2848
2899
|
"Enter text to search": "Enter text to search",
|
|
2900
|
+
"Invalid search pattern": "Invalid search pattern",
|
|
2901
|
+
"More >>": "More >>",
|
|
2902
|
+
"<< Less": "<< Less",
|
|
2903
|
+
"Search options": "Search options",
|
|
2904
|
+
"Find whole words only": "Find whole words only",
|
|
2905
|
+
"Use wildcards": "Use wildcards",
|
|
2906
|
+
"Match prefix": "Match prefix",
|
|
2907
|
+
"Match suffix": "Match suffix",
|
|
2908
|
+
"Ignore punctuation characters": "Ignore punctuation characters",
|
|
2909
|
+
"Ignore white-space characters": "Ignore white-space characters",
|
|
2910
|
+
"Special characters": "Special characters",
|
|
2911
|
+
"Paragraph Mark": "Paragraph Mark",
|
|
2912
|
+
"Tab Character": "Tab Character",
|
|
2913
|
+
"Any Character": "Any Character",
|
|
2914
|
+
"Any Digit": "Any Digit",
|
|
2915
|
+
"Any Letter": "Any Letter",
|
|
2916
|
+
"Caret Character": "Caret Character",
|
|
2917
|
+
"Manual Line Break": "Manual Line Break",
|
|
2918
|
+
"Page Break": "Page Break",
|
|
2919
|
+
"Optional Hyphen": "Optional Hyphen",
|
|
2920
|
+
"Nonbreaking Hyphen": "Nonbreaking Hyphen",
|
|
2921
|
+
"Nonbreaking Space": "Nonbreaking Space",
|
|
2922
|
+
"White Space": "White Space",
|
|
2849
2923
|
"No matches": "0 matches",
|
|
2850
2924
|
"matches one": "match",
|
|
2851
2925
|
"matches many": "matches",
|
|
@@ -2952,7 +3026,34 @@ var enRibbon = {
|
|
|
2952
3026
|
Finish: "Finish",
|
|
2953
3027
|
"Finish & Merge": "Finish & Merge",
|
|
2954
3028
|
Help: "Help",
|
|
2955
|
-
"Not available in this editor": "Not available in this editor"
|
|
3029
|
+
"Not available in this editor": "Not available in this editor",
|
|
3030
|
+
Protect: "Protect",
|
|
3031
|
+
"Restrict editing": "Restrict editing",
|
|
3032
|
+
"Formatting restrictions": "Formatting restrictions",
|
|
3033
|
+
"Limit formatting to a selection of styles": "Limit formatting to a selection of styles",
|
|
3034
|
+
"Editing restrictions": "Editing restrictions",
|
|
3035
|
+
"Allow only this type of editing in the document": "Allow only this type of editing in the document",
|
|
3036
|
+
"No changes (Read only)": "No changes (Read only)",
|
|
3037
|
+
"Filling in forms": "Filling in forms",
|
|
3038
|
+
"Exceptions (optional)": "Exceptions (optional)",
|
|
3039
|
+
Everyone: "Everyone",
|
|
3040
|
+
"Start enforcement": "Start enforcement",
|
|
3041
|
+
"Yes, start enforcing protection": "Yes, start enforcing protection",
|
|
3042
|
+
"Enter new password (optional)": "Enter new password (optional)",
|
|
3043
|
+
"Reenter password to confirm": "Reenter password to confirm",
|
|
3044
|
+
Password: "Password",
|
|
3045
|
+
"Stop protection": "Stop protection",
|
|
3046
|
+
"The document is protected": "The document is protected",
|
|
3047
|
+
"The passwords do not match": "The passwords do not match",
|
|
3048
|
+
"Incorrect password": "Incorrect password",
|
|
3049
|
+
"This protection uses a password that cannot be checked here": "This protection uses a password that cannot be checked here",
|
|
3050
|
+
"Select text first": "Select text first",
|
|
3051
|
+
"This exception continues into another paragraph; change it in Word": "This exception continues into another paragraph; change it in Word",
|
|
3052
|
+
"Choose the type of editing to allow": "Choose the type of editing to allow",
|
|
3053
|
+
"Editing is restricted by document protection": "Editing is restricted by document protection",
|
|
3054
|
+
"Highlight the regions I can edit": "Highlight the regions I can edit",
|
|
3055
|
+
"Find next region I can edit": "Find next region I can edit",
|
|
3056
|
+
"There are no regions you can edit": "There are no regions you can edit"
|
|
2956
3057
|
};
|
|
2957
3058
|
|
|
2958
3059
|
// src/docx/locales/en.ts
|
|
@@ -3011,7 +3112,6 @@ var esApp = {
|
|
|
3011
3112
|
"Save As": "Guardar como",
|
|
3012
3113
|
"Save a copy of this document to your device.": "Guarde una copia de este documento en su dispositivo.",
|
|
3013
3114
|
"Word Document (*.docx)": "Documento de Word (*.docx)",
|
|
3014
|
-
"Word 97-2003 Document (*.doc)": "Documento de Word 97-2003 (*.doc)",
|
|
3015
3115
|
"Paper size": "Tama\xF1o del papel",
|
|
3016
3116
|
"Printing uses the browser print dialog. Page breaks come from Print Layout, which approximates Word.": "La impresi\xF3n usa el cuadro de di\xE1logo del navegador. Los saltos de p\xE1gina provienen del dise\xF1o de impresi\xF3n, que aproxima a Word.",
|
|
3017
3117
|
Export: "Exportar",
|
|
@@ -3494,6 +3594,7 @@ var esRibbon = {
|
|
|
3494
3594
|
"Numbered list": "Numeraci\xF3n",
|
|
3495
3595
|
"Decrease list level": "Disminuir nivel de lista",
|
|
3496
3596
|
"Increase list level": "Aumentar nivel de lista",
|
|
3597
|
+
"Picture bullet...": "Vi\xF1eta de imagen...",
|
|
3497
3598
|
"Remove list": "Quitar lista",
|
|
3498
3599
|
"Insert row above": "Insertar fila encima",
|
|
3499
3600
|
"Insert row below": "Insertar fila debajo",
|
|
@@ -3550,6 +3651,29 @@ var esRibbon = {
|
|
|
3550
3651
|
"Close search": "Cerrar b\xFAsqueda",
|
|
3551
3652
|
"Search results": "Resultados de la b\xFAsqueda",
|
|
3552
3653
|
"Enter text to search": "Escriba el texto que desea buscar",
|
|
3654
|
+
"Invalid search pattern": "Patr\xF3n de b\xFAsqueda no v\xE1lido",
|
|
3655
|
+
"More >>": "M\xE1s >>",
|
|
3656
|
+
"<< Less": "<< Menos",
|
|
3657
|
+
"Search options": "Opciones de b\xFAsqueda",
|
|
3658
|
+
"Find whole words only": "Buscar solo palabras completas",
|
|
3659
|
+
"Use wildcards": "Usar comodines",
|
|
3660
|
+
"Match prefix": "Coincidir con el prefijo",
|
|
3661
|
+
"Match suffix": "Coincidir con el sufijo",
|
|
3662
|
+
"Ignore punctuation characters": "Ignorar signos de puntuaci\xF3n",
|
|
3663
|
+
"Ignore white-space characters": "Ignorar espacios en blanco",
|
|
3664
|
+
"Special characters": "Caracteres especiales",
|
|
3665
|
+
"Paragraph Mark": "Marca de p\xE1rrafo",
|
|
3666
|
+
"Tab Character": "Car\xE1cter de tabulaci\xF3n",
|
|
3667
|
+
"Any Character": "Cualquier car\xE1cter",
|
|
3668
|
+
"Any Digit": "Cualquier d\xEDgito",
|
|
3669
|
+
"Any Letter": "Cualquier letra",
|
|
3670
|
+
"Caret Character": "Car\xE1cter de intercalaci\xF3n",
|
|
3671
|
+
"Manual Line Break": "Salto de l\xEDnea manual",
|
|
3672
|
+
"Page Break": "Salto de p\xE1gina",
|
|
3673
|
+
"Optional Hyphen": "Guion condicional",
|
|
3674
|
+
"Nonbreaking Hyphen": "Guion no separable",
|
|
3675
|
+
"Nonbreaking Space": "Espacio no separable",
|
|
3676
|
+
"White Space": "Espacio en blanco",
|
|
3553
3677
|
"No matches": "Sin coincidencias",
|
|
3554
3678
|
"matches one": "coincidencia",
|
|
3555
3679
|
"matches many": "coincidencias",
|
|
@@ -3656,7 +3780,34 @@ var esRibbon = {
|
|
|
3656
3780
|
Finish: "Finalizar",
|
|
3657
3781
|
"Finish & Merge": "Finalizar y combinar",
|
|
3658
3782
|
Help: "Ayuda",
|
|
3659
|
-
"Not available in this editor": "No disponible en este editor"
|
|
3783
|
+
"Not available in this editor": "No disponible en este editor",
|
|
3784
|
+
Protect: "Proteger",
|
|
3785
|
+
"Restrict editing": "Restringir edici\xF3n",
|
|
3786
|
+
"Formatting restrictions": "Restricciones de formato",
|
|
3787
|
+
"Limit formatting to a selection of styles": "Limitar el formato a una selecci\xF3n de estilos",
|
|
3788
|
+
"Editing restrictions": "Restricciones de edici\xF3n",
|
|
3789
|
+
"Allow only this type of editing in the document": "Permitir solo este tipo de edici\xF3n en el documento",
|
|
3790
|
+
"No changes (Read only)": "Sin cambios (solo lectura)",
|
|
3791
|
+
"Filling in forms": "Rellenar formularios",
|
|
3792
|
+
"Exceptions (optional)": "Excepciones (opcional)",
|
|
3793
|
+
Everyone: "Todos",
|
|
3794
|
+
"Start enforcement": "Comenzar a aplicar",
|
|
3795
|
+
"Yes, start enforcing protection": "S\xED, aplicar la protecci\xF3n",
|
|
3796
|
+
"Enter new password (optional)": "Escriba la nueva contrase\xF1a (opcional)",
|
|
3797
|
+
"Reenter password to confirm": "Vuelva a escribir la contrase\xF1a para confirmarla",
|
|
3798
|
+
Password: "Contrase\xF1a",
|
|
3799
|
+
"Stop protection": "Suspender protecci\xF3n",
|
|
3800
|
+
"The document is protected": "El documento est\xE1 protegido",
|
|
3801
|
+
"The passwords do not match": "Las contrase\xF1as no coinciden",
|
|
3802
|
+
"Incorrect password": "Contrase\xF1a incorrecta",
|
|
3803
|
+
"This protection uses a password that cannot be checked here": "Esta protecci\xF3n usa una contrase\xF1a que no se puede comprobar aqu\xED",
|
|
3804
|
+
"Select text first": "Seleccione primero el texto",
|
|
3805
|
+
"This exception continues into another paragraph; change it in Word": "Esta excepci\xF3n contin\xFAa en otro p\xE1rrafo; c\xE1mbiela en Word",
|
|
3806
|
+
"Choose the type of editing to allow": "Elija el tipo de edici\xF3n que se permite",
|
|
3807
|
+
"Editing is restricted by document protection": "La edici\xF3n est\xE1 restringida por la protecci\xF3n del documento",
|
|
3808
|
+
"Highlight the regions I can edit": "Resaltar las regiones que puedo editar",
|
|
3809
|
+
"Find next region I can edit": "Buscar la siguiente regi\xF3n que puedo editar",
|
|
3810
|
+
"There are no regions you can edit": "No hay regiones que pueda editar"
|
|
3660
3811
|
};
|
|
3661
3812
|
|
|
3662
3813
|
// src/docx/locales/es.ts
|
|
@@ -3715,7 +3866,6 @@ var frApp = {
|
|
|
3715
3866
|
"Save As": "Enregistrer sous",
|
|
3716
3867
|
"Save a copy of this document to your device.": "Enregistrez une copie de ce document sur votre appareil.",
|
|
3717
3868
|
"Word Document (*.docx)": "Document Word (*.docx)",
|
|
3718
|
-
"Word 97-2003 Document (*.doc)": "Document Word 97-2003 (*.doc)",
|
|
3719
3869
|
"Paper size": "Taille du papier",
|
|
3720
3870
|
"Printing uses the browser print dialog. Page breaks come from Print Layout, which approximates Word.": "L\u2019impression utilise la bo\xEEte de dialogue du navigateur. Les sauts de page viennent de la mise en page Impression, qui approche Word.",
|
|
3721
3871
|
Export: "Exporter",
|
|
@@ -4198,6 +4348,7 @@ var frRibbon = {
|
|
|
4198
4348
|
"Numbered list": "Liste num\xE9rot\xE9e",
|
|
4199
4349
|
"Decrease list level": "R\xE9duire le niveau de liste",
|
|
4200
4350
|
"Increase list level": "Augmenter le niveau de liste",
|
|
4351
|
+
"Picture bullet...": "Puce image...",
|
|
4201
4352
|
"Remove list": "Supprimer la liste",
|
|
4202
4353
|
"Insert row above": "Ins\xE9rer une ligne au-dessus",
|
|
4203
4354
|
"Insert row below": "Ins\xE9rer une ligne au-dessous",
|
|
@@ -4254,6 +4405,29 @@ var frRibbon = {
|
|
|
4254
4405
|
"Close search": "Fermer la recherche",
|
|
4255
4406
|
"Search results": "R\xE9sultats de recherche",
|
|
4256
4407
|
"Enter text to search": "Saisissez le texte \xE0 rechercher",
|
|
4408
|
+
"Invalid search pattern": "Mod\xE8le de recherche non valide",
|
|
4409
|
+
"More >>": "Plus >>",
|
|
4410
|
+
"<< Less": "<< Moins",
|
|
4411
|
+
"Search options": "Options de recherche",
|
|
4412
|
+
"Find whole words only": "Rechercher les mots entiers uniquement",
|
|
4413
|
+
"Use wildcards": "Utiliser les caract\xE8res g\xE9n\xE9riques",
|
|
4414
|
+
"Match prefix": "Respecter le pr\xE9fixe",
|
|
4415
|
+
"Match suffix": "Respecter le suffixe",
|
|
4416
|
+
"Ignore punctuation characters": "Ignorer la ponctuation",
|
|
4417
|
+
"Ignore white-space characters": "Ignorer les espaces",
|
|
4418
|
+
"Special characters": "Caract\xE8res sp\xE9ciaux",
|
|
4419
|
+
"Paragraph Mark": "Marque de paragraphe",
|
|
4420
|
+
"Tab Character": "Caract\xE8re de tabulation",
|
|
4421
|
+
"Any Character": "N'importe quel caract\xE8re",
|
|
4422
|
+
"Any Digit": "N'importe quel chiffre",
|
|
4423
|
+
"Any Letter": "N'importe quelle lettre",
|
|
4424
|
+
"Caret Character": "Accent circonflexe",
|
|
4425
|
+
"Manual Line Break": "Saut de ligne manuel",
|
|
4426
|
+
"Page Break": "Saut de page",
|
|
4427
|
+
"Optional Hyphen": "Trait d\u2019union conditionnel",
|
|
4428
|
+
"Nonbreaking Hyphen": "Trait d\u2019union ins\xE9cable",
|
|
4429
|
+
"Nonbreaking Space": "Espace ins\xE9cable",
|
|
4430
|
+
"White Space": "Espace blanc",
|
|
4257
4431
|
"No matches": "Aucun r\xE9sultat",
|
|
4258
4432
|
"matches one": "r\xE9sultat",
|
|
4259
4433
|
"matches many": "r\xE9sultats",
|
|
@@ -4360,7 +4534,34 @@ var frRibbon = {
|
|
|
4360
4534
|
Finish: "Terminer",
|
|
4361
4535
|
"Finish & Merge": "Terminer et fusionner",
|
|
4362
4536
|
Help: "Aide",
|
|
4363
|
-
"Not available in this editor": "Indisponible dans cet \xE9diteur"
|
|
4537
|
+
"Not available in this editor": "Indisponible dans cet \xE9diteur",
|
|
4538
|
+
Protect: "Prot\xE9ger",
|
|
4539
|
+
"Restrict editing": "Restreindre la modification",
|
|
4540
|
+
"Formatting restrictions": "Restrictions de mise en forme",
|
|
4541
|
+
"Limit formatting to a selection of styles": "Limiter la mise en forme \xE0 une s\xE9lection de styles",
|
|
4542
|
+
"Editing restrictions": "Restrictions de modification",
|
|
4543
|
+
"Allow only this type of editing in the document": "Autoriser uniquement ce type de modification dans le document",
|
|
4544
|
+
"No changes (Read only)": "Aucune modification (lecture seule)",
|
|
4545
|
+
"Filling in forms": "Remplissage de formulaires",
|
|
4546
|
+
"Exceptions (optional)": "Exceptions (facultatif)",
|
|
4547
|
+
Everyone: "Tout le monde",
|
|
4548
|
+
"Start enforcement": "D\xE9marrer l\u2019application",
|
|
4549
|
+
"Yes, start enforcing protection": "Oui, appliquer la protection",
|
|
4550
|
+
"Enter new password (optional)": "Entrez un nouveau mot de passe (facultatif)",
|
|
4551
|
+
"Reenter password to confirm": "Entrez \xE0 nouveau le mot de passe pour confirmer",
|
|
4552
|
+
Password: "Mot de passe",
|
|
4553
|
+
"Stop protection": "D\xE9sactiver la protection",
|
|
4554
|
+
"The document is protected": "Le document est prot\xE9g\xE9",
|
|
4555
|
+
"The passwords do not match": "Les mots de passe ne correspondent pas",
|
|
4556
|
+
"Incorrect password": "Mot de passe incorrect",
|
|
4557
|
+
"This protection uses a password that cannot be checked here": "Cette protection utilise un mot de passe qui ne peut pas \xEAtre v\xE9rifi\xE9 ici",
|
|
4558
|
+
"Select text first": "S\xE9lectionnez d\u2019abord du texte",
|
|
4559
|
+
"This exception continues into another paragraph; change it in Word": "Cette exception se poursuit dans un autre paragraphe ; modifiez-la dans Word",
|
|
4560
|
+
"Choose the type of editing to allow": "Choisissez le type de modification autoris\xE9",
|
|
4561
|
+
"Editing is restricted by document protection": "La modification est restreinte par la protection du document",
|
|
4562
|
+
"Highlight the regions I can edit": "Mettre en \xE9vidence les zones que je peux modifier",
|
|
4563
|
+
"Find next region I can edit": "Rechercher la prochaine zone que je peux modifier",
|
|
4564
|
+
"There are no regions you can edit": "Aucune zone ne peut \xEAtre modifi\xE9e par vous"
|
|
4364
4565
|
};
|
|
4365
4566
|
|
|
4366
4567
|
// src/docx/locales/fr.ts
|
|
@@ -4419,7 +4620,6 @@ var zhCNApp = {
|
|
|
4419
4620
|
"Save As": "\u53E6\u5B58\u4E3A",
|
|
4420
4621
|
"Save a copy of this document to your device.": "\u5C06\u6B64\u6587\u6863\u7684\u526F\u672C\u4FDD\u5B58\u5230\u60A8\u7684\u8BBE\u5907\u3002",
|
|
4421
4622
|
"Word Document (*.docx)": "Word \u6587\u6863 (*.docx)",
|
|
4422
|
-
"Word 97-2003 Document (*.doc)": "Word 97-2003 \u6587\u6863 (*.doc)",
|
|
4423
4623
|
"Paper size": "\u7EB8\u5F20\u5927\u5C0F",
|
|
4424
4624
|
"Printing uses the browser print dialog. Page breaks come from Print Layout, which approximates Word.": "\u6253\u5370\u4F7F\u7528\u6D4F\u89C8\u5668\u7684\u6253\u5370\u5BF9\u8BDD\u6846\u3002\u5206\u9875\u6765\u81EA\u9875\u9762\u89C6\u56FE\uFF0C\u5B83\u53EA\u662F\u8FD1\u4F3C Word \u7684\u5206\u9875\u3002",
|
|
4425
4625
|
Export: "\u5BFC\u51FA",
|
|
@@ -4902,6 +5102,7 @@ var zhCNRibbon = {
|
|
|
4902
5102
|
"Numbered list": "\u7F16\u53F7",
|
|
4903
5103
|
"Decrease list level": "\u964D\u4F4E\u5217\u8868\u7EA7\u522B",
|
|
4904
5104
|
"Increase list level": "\u63D0\u9AD8\u5217\u8868\u7EA7\u522B",
|
|
5105
|
+
"Picture bullet...": "\u56FE\u7247\u9879\u76EE\u7B26\u53F7...",
|
|
4905
5106
|
"Remove list": "\u5220\u9664\u5217\u8868",
|
|
4906
5107
|
"Insert row above": "\u5728\u4E0A\u65B9\u63D2\u5165\u884C",
|
|
4907
5108
|
"Insert row below": "\u5728\u4E0B\u65B9\u63D2\u5165\u884C",
|
|
@@ -4958,6 +5159,29 @@ var zhCNRibbon = {
|
|
|
4958
5159
|
"Close search": "\u5173\u95ED\u641C\u7D22",
|
|
4959
5160
|
"Search results": "\u641C\u7D22\u7ED3\u679C",
|
|
4960
5161
|
"Enter text to search": "\u8BF7\u8F93\u5165\u8981\u641C\u7D22\u7684\u6587\u672C",
|
|
5162
|
+
"Invalid search pattern": "\u641C\u7D22\u6A21\u5F0F\u65E0\u6548",
|
|
5163
|
+
"More >>": "\u66F4\u591A >>",
|
|
5164
|
+
"<< Less": "<< \u6536\u8D77",
|
|
5165
|
+
"Search options": "\u641C\u7D22\u9009\u9879",
|
|
5166
|
+
"Find whole words only": "\u4EC5\u67E5\u627E\u5B8C\u6574\u5355\u8BCD",
|
|
5167
|
+
"Use wildcards": "\u4F7F\u7528\u901A\u914D\u7B26",
|
|
5168
|
+
"Match prefix": "\u5339\u914D\u524D\u7F00",
|
|
5169
|
+
"Match suffix": "\u5339\u914D\u540E\u7F00",
|
|
5170
|
+
"Ignore punctuation characters": "\u5FFD\u7565\u6807\u70B9\u7B26\u53F7",
|
|
5171
|
+
"Ignore white-space characters": "\u5FFD\u7565\u7A7A\u767D\u5B57\u7B26",
|
|
5172
|
+
"Special characters": "\u7279\u6B8A\u5B57\u7B26",
|
|
5173
|
+
"Paragraph Mark": "\u6BB5\u843D\u6807\u8BB0",
|
|
5174
|
+
"Tab Character": "\u5236\u8868\u7B26",
|
|
5175
|
+
"Any Character": "\u4EFB\u610F\u5B57\u7B26",
|
|
5176
|
+
"Any Digit": "\u4EFB\u610F\u6570\u5B57",
|
|
5177
|
+
"Any Letter": "\u4EFB\u610F\u5B57\u6BCD",
|
|
5178
|
+
"Caret Character": "\u63D2\u5165\u7B26",
|
|
5179
|
+
"Manual Line Break": "\u624B\u52A8\u6362\u884C\u7B26",
|
|
5180
|
+
"Page Break": "\u5206\u9875\u7B26",
|
|
5181
|
+
"Optional Hyphen": "\u53EF\u9009\u8FDE\u5B57\u7B26",
|
|
5182
|
+
"Nonbreaking Hyphen": "\u4E0D\u95F4\u65AD\u8FDE\u5B57\u7B26",
|
|
5183
|
+
"Nonbreaking Space": "\u4E0D\u95F4\u65AD\u7A7A\u683C",
|
|
5184
|
+
"White Space": "\u7A7A\u767D\u5B57\u7B26",
|
|
4961
5185
|
"No matches": "\u65E0\u5339\u914D\u9879",
|
|
4962
5186
|
"matches one": "\u4E2A\u5339\u914D\u9879",
|
|
4963
5187
|
"matches many": "\u4E2A\u5339\u914D\u9879",
|
|
@@ -5064,7 +5288,34 @@ var zhCNRibbon = {
|
|
|
5064
5288
|
Finish: "\u5B8C\u6210",
|
|
5065
5289
|
"Finish & Merge": "\u5B8C\u6210\u5E76\u5408\u5E76",
|
|
5066
5290
|
Help: "\u5E2E\u52A9",
|
|
5067
|
-
"Not available in this editor": "\u6B64\u7F16\u8F91\u5668\u5C1A\u4E0D\u652F\u6301"
|
|
5291
|
+
"Not available in this editor": "\u6B64\u7F16\u8F91\u5668\u5C1A\u4E0D\u652F\u6301",
|
|
5292
|
+
Protect: "\u4FDD\u62A4",
|
|
5293
|
+
"Restrict editing": "\u9650\u5236\u7F16\u8F91",
|
|
5294
|
+
"Formatting restrictions": "\u683C\u5F0F\u8BBE\u7F6E\u9650\u5236",
|
|
5295
|
+
"Limit formatting to a selection of styles": "\u9650\u5236\u5BF9\u9009\u5B9A\u7684\u6837\u5F0F\u8BBE\u7F6E\u683C\u5F0F",
|
|
5296
|
+
"Editing restrictions": "\u7F16\u8F91\u9650\u5236",
|
|
5297
|
+
"Allow only this type of editing in the document": "\u4EC5\u5141\u8BB8\u5728\u6587\u6863\u4E2D\u8FDB\u884C\u6B64\u7C7B\u578B\u7684\u7F16\u8F91",
|
|
5298
|
+
"No changes (Read only)": "\u4E0D\u5141\u8BB8\u4EFB\u4F55\u66F4\u6539(\u53EA\u8BFB)",
|
|
5299
|
+
"Filling in forms": "\u586B\u5199\u7A97\u4F53",
|
|
5300
|
+
"Exceptions (optional)": "\u4F8B\u5916\u9879(\u53EF\u9009)",
|
|
5301
|
+
Everyone: "\u6BCF\u4E2A\u4EBA",
|
|
5302
|
+
"Start enforcement": "\u542F\u52A8\u5F3A\u5236\u4FDD\u62A4",
|
|
5303
|
+
"Yes, start enforcing protection": "\u662F,\u542F\u52A8\u5F3A\u5236\u4FDD\u62A4",
|
|
5304
|
+
"Enter new password (optional)": "\u8F93\u5165\u65B0\u5BC6\u7801(\u53EF\u9009)",
|
|
5305
|
+
"Reenter password to confirm": "\u786E\u8BA4\u65B0\u5BC6\u7801",
|
|
5306
|
+
Password: "\u5BC6\u7801",
|
|
5307
|
+
"Stop protection": "\u505C\u6B62\u4FDD\u62A4",
|
|
5308
|
+
"The document is protected": "\u6587\u6863\u5DF2\u53D7\u4FDD\u62A4",
|
|
5309
|
+
"The passwords do not match": "\u4E24\u6B21\u8F93\u5165\u7684\u5BC6\u7801\u4E0D\u4E00\u81F4",
|
|
5310
|
+
"Incorrect password": "\u5BC6\u7801\u4E0D\u6B63\u786E",
|
|
5311
|
+
"This protection uses a password that cannot be checked here": "\u6B64\u4FDD\u62A4\u4F7F\u7528\u7684\u5BC6\u7801\u65E0\u6CD5\u5728\u6B64\u5904\u68C0\u67E5",
|
|
5312
|
+
"Select text first": "\u8BF7\u5148\u9009\u62E9\u6587\u672C",
|
|
5313
|
+
"This exception continues into another paragraph; change it in Word": "\u6B64\u4F8B\u5916\u9879\u5EF6\u7EED\u5230\u53E6\u4E00\u4E2A\u6BB5\u843D,\u8BF7\u5728 Word \u4E2D\u66F4\u6539",
|
|
5314
|
+
"Choose the type of editing to allow": "\u8BF7\u9009\u62E9\u5141\u8BB8\u7684\u7F16\u8F91\u7C7B\u578B",
|
|
5315
|
+
"Editing is restricted by document protection": "\u6587\u6863\u4FDD\u62A4\u9650\u5236\u4E86\u7F16\u8F91",
|
|
5316
|
+
"Highlight the regions I can edit": "\u7A81\u51FA\u663E\u793A\u6211\u53EF\u4EE5\u7F16\u8F91\u7684\u533A\u57DF",
|
|
5317
|
+
"Find next region I can edit": "\u67E5\u627E\u6211\u53EF\u4EE5\u7F16\u8F91\u7684\u4E0B\u4E00\u4E2A\u533A\u57DF",
|
|
5318
|
+
"There are no regions you can edit": "\u6CA1\u6709\u60A8\u53EF\u4EE5\u7F16\u8F91\u7684\u533A\u57DF"
|
|
5068
5319
|
};
|
|
5069
5320
|
|
|
5070
5321
|
// src/docx/locales/zh-CN.ts
|
|
@@ -5095,11 +5346,11 @@ var EDITOR_LOCALES = SUPPORTED_OFFICE_LOCALES;
|
|
|
5095
5346
|
function normalizeEditorLocale(value) {
|
|
5096
5347
|
return normalizeLocale(value, EDITOR_LOCALES, "en");
|
|
5097
5348
|
}
|
|
5098
|
-
function translate(locale,
|
|
5099
|
-
return strings[locale][
|
|
5349
|
+
function translate(locale, key3) {
|
|
5350
|
+
return strings[locale][key3] ?? strings.en[key3] ?? key3;
|
|
5100
5351
|
}
|
|
5101
|
-
function translateTemplate(locale,
|
|
5102
|
-
return interpolate(translate(locale,
|
|
5352
|
+
function translateTemplate(locale, key3, values2) {
|
|
5353
|
+
return interpolate(translate(locale, key3), values2);
|
|
5103
5354
|
}
|
|
5104
5355
|
function translateDynamic(locale, text) {
|
|
5105
5356
|
if (locale === "en") return text;
|
|
@@ -5230,14 +5481,14 @@ function parse(spec) {
|
|
|
5230
5481
|
let result = parsed.get(spec);
|
|
5231
5482
|
if (result) return result;
|
|
5232
5483
|
const parts = spec.split("+");
|
|
5233
|
-
const
|
|
5484
|
+
const key3 = (parts.pop() ?? "").toLowerCase();
|
|
5234
5485
|
const modifiers = new Set(parts.map((part) => part.toLowerCase()));
|
|
5235
5486
|
result = {
|
|
5236
5487
|
mod: modifiers.has("mod"),
|
|
5237
5488
|
shift: modifiers.has("shift"),
|
|
5238
5489
|
alt: modifiers.has("alt"),
|
|
5239
|
-
key:
|
|
5240
|
-
tap:
|
|
5490
|
+
key: key3,
|
|
5491
|
+
tap: key3 === "alt" && !modifiers.size
|
|
5241
5492
|
};
|
|
5242
5493
|
parsed.set(spec, result);
|
|
5243
5494
|
return result;
|
|
@@ -5591,6 +5842,7 @@ var paths = {
|
|
|
5591
5842
|
firstPage: "M6 3h9l3 3v15H6z M9 8h6 M9 12h6 M9 16h3",
|
|
5592
5843
|
oddEven: "M3 5h8v14H3z M13 5h8v14h-8z M6 9h2 M16 9h2",
|
|
5593
5844
|
track: "M4 20l4-1 11-11-3-3L5 16z M14 20h7",
|
|
5845
|
+
protect: "M7 11V8a5 5 0 0 1 10 0v3 M5 11h14v10H5z M12 15v2",
|
|
5594
5846
|
previous: "M6 14l6-6 6 6",
|
|
5595
5847
|
next: "M6 10l6 6 6-6",
|
|
5596
5848
|
accept: "M5 12.5l4.5 4.5L19 7",
|
|
@@ -6050,7 +6302,7 @@ var NS2 = "http://www.w3.org/2000/svg";
|
|
|
6050
6302
|
var inches = (twips7) => `${+(twips7 / 1440).toFixed(2)}"`;
|
|
6051
6303
|
function shape(name, attrs) {
|
|
6052
6304
|
const el = document.createElementNS(NS2, name);
|
|
6053
|
-
for (const [
|
|
6305
|
+
for (const [key3, value] of Object.entries(attrs)) el.setAttribute(key3, String(value));
|
|
6054
6306
|
return el;
|
|
6055
6307
|
}
|
|
6056
6308
|
function page(w, h, ...body) {
|
|
@@ -6301,17 +6553,18 @@ function underlineSplit() {
|
|
|
6301
6553
|
(value) => ({ type: "underline", value })
|
|
6302
6554
|
);
|
|
6303
6555
|
}
|
|
6304
|
-
function listSplit(
|
|
6305
|
-
const label2 =
|
|
6306
|
-
const icon2 =
|
|
6556
|
+
function listSplit(key3) {
|
|
6557
|
+
const label2 = key3 === "bullet" ? "Bulleted list" : "Numbered list";
|
|
6558
|
+
const icon2 = key3 === "bullet" ? "bullets" : "numbering";
|
|
6307
6559
|
return split(
|
|
6308
|
-
tool(label2, icon2, { type: "list", key:
|
|
6309
|
-
|
|
6560
|
+
tool(label2, icon2, { type: "list", key: key3 }),
|
|
6561
|
+
key3 === "bullet" ? "Bullets options" : "Numbering options",
|
|
6310
6562
|
[
|
|
6311
|
-
[
|
|
6563
|
+
[key3, label2],
|
|
6564
|
+
...key3 === "bullet" ? [["picture", "Picture bullet..."]] : [],
|
|
6312
6565
|
["remove", "Remove list"]
|
|
6313
6566
|
],
|
|
6314
|
-
(value) =>
|
|
6567
|
+
(value) => value === "picture" ? { type: "pictureBullet" } : { type: "list", key: value }
|
|
6315
6568
|
);
|
|
6316
6569
|
}
|
|
6317
6570
|
|
|
@@ -6810,19 +7063,19 @@ function showCommandTips(root, panel, onDone) {
|
|
|
6810
7063
|
}
|
|
6811
7064
|
|
|
6812
7065
|
// src/docx/ribbon-tab-api.ts
|
|
6813
|
-
function panelOf(ribbon,
|
|
6814
|
-
return ribbon.querySelector(`[data-ribbon-tab="${
|
|
7066
|
+
function panelOf(ribbon, key3) {
|
|
7067
|
+
return ribbon.querySelector(`[data-ribbon-tab="${key3}"]`);
|
|
6815
7068
|
}
|
|
6816
7069
|
function panelsOf(ribbon) {
|
|
6817
7070
|
return [...ribbon.children].filter(
|
|
6818
7071
|
(child) => child instanceof HTMLElement && !!child.dataset.ribbonTab
|
|
6819
7072
|
);
|
|
6820
7073
|
}
|
|
6821
|
-
function selectTab(ribbon,
|
|
6822
|
-
ribbon.selected =
|
|
7074
|
+
function selectTab(ribbon, key3) {
|
|
7075
|
+
ribbon.selected = key3;
|
|
6823
7076
|
}
|
|
6824
|
-
function setTabHidden(ribbon,
|
|
6825
|
-
ribbon.setTabHidden(
|
|
7077
|
+
function setTabHidden(ribbon, key3, reason, hidden) {
|
|
7078
|
+
ribbon.setTabHidden(key3, reason, hidden);
|
|
6826
7079
|
}
|
|
6827
7080
|
var isTabHidden = (panel) => panel.hasAttribute("data-tab-hidden");
|
|
6828
7081
|
function tabButtons(ribbon) {
|
|
@@ -6863,15 +7116,15 @@ function attachRibbonBehavior(root) {
|
|
|
6863
7116
|
panel: tab.dataset.tab
|
|
6864
7117
|
}))
|
|
6865
7118
|
];
|
|
6866
|
-
const badges = targets.flatMap(({ tab, key:
|
|
6867
|
-
if (!
|
|
7119
|
+
const badges = targets.flatMap(({ tab, key: key3, panel }) => {
|
|
7120
|
+
if (!key3) return [];
|
|
6868
7121
|
const badge = document.createElement("span");
|
|
6869
7122
|
badge.className = "dve-keytip";
|
|
6870
7123
|
badge.style.cssText = BADGE_STYLE;
|
|
6871
|
-
badge.textContent =
|
|
7124
|
+
badge.textContent = key3;
|
|
6872
7125
|
badge.setAttribute("aria-hidden", "true");
|
|
6873
7126
|
tab.append(badge);
|
|
6874
|
-
return [{ badge, key:
|
|
7127
|
+
return [{ badge, key: key3, tab, panel }];
|
|
6875
7128
|
});
|
|
6876
7129
|
const stop = () => {
|
|
6877
7130
|
for (const { badge } of badges) badge.remove();
|
|
@@ -6882,7 +7135,7 @@ function attachRibbonBehavior(root) {
|
|
|
6882
7135
|
};
|
|
6883
7136
|
const onKey = (event) => {
|
|
6884
7137
|
if (event.key === "Alt" || event.key === "Shift") return;
|
|
6885
|
-
const match = badges.find(({ key:
|
|
7138
|
+
const match = badges.find(({ key: key3 }) => key3 === event.key.toUpperCase());
|
|
6886
7139
|
stop();
|
|
6887
7140
|
if (!match || event.ctrlKey || event.metaKey) return;
|
|
6888
7141
|
event.preventDefault();
|
|
@@ -7108,6 +7361,8 @@ var schema = new Schema({
|
|
|
7108
7361
|
tabStops: { default: null },
|
|
7109
7362
|
/** Read-only bookmark names starting in this paragraph; not user-editable. */
|
|
7110
7363
|
bookmarks: { default: [] },
|
|
7364
|
+
/** Editable ranges (`w:permStart`/`w:permEnd`) in this paragraph; read-only. */
|
|
7365
|
+
permissions: { default: null },
|
|
7111
7366
|
/** Block-level content control (`w:sdt`) around this paragraph, as an object. */
|
|
7112
7367
|
contentControl: { default: null }
|
|
7113
7368
|
},
|
|
@@ -7265,16 +7520,16 @@ var schema = new Schema({
|
|
|
7265
7520
|
},
|
|
7266
7521
|
marks: markSpecs
|
|
7267
7522
|
});
|
|
7268
|
-
function languageMarkAttrs(mark,
|
|
7523
|
+
function languageMarkAttrs(mark, key3, value) {
|
|
7269
7524
|
const attrs = {
|
|
7270
7525
|
language: mark?.attrs.language ?? null,
|
|
7271
7526
|
eastAsiaLanguage: mark?.attrs.eastAsiaLanguage ?? null,
|
|
7272
7527
|
bidiLanguage: mark?.attrs.bidiLanguage ?? null
|
|
7273
7528
|
};
|
|
7274
|
-
attrs[
|
|
7529
|
+
attrs[key3] = value || null;
|
|
7275
7530
|
return attrs;
|
|
7276
7531
|
}
|
|
7277
|
-
function applyLanguage(view,
|
|
7532
|
+
function applyLanguage(view, key3, value) {
|
|
7278
7533
|
const tag = value.trim();
|
|
7279
7534
|
if (tag && !isValidLanguageTag(tag)) return;
|
|
7280
7535
|
const { state } = view;
|
|
@@ -7282,7 +7537,7 @@ function applyLanguage(view, key2, value) {
|
|
|
7282
7537
|
if (state.selection.empty) {
|
|
7283
7538
|
const marks2 = state.storedMarks || state.selection.$from.marks();
|
|
7284
7539
|
const existing = marks2.find((mark) => mark.type === type);
|
|
7285
|
-
const attrs = languageMarkAttrs(existing,
|
|
7540
|
+
const attrs = languageMarkAttrs(existing, key3, tag);
|
|
7286
7541
|
const next = Object.values(attrs).some(Boolean) ? type.create(attrs) : void 0;
|
|
7287
7542
|
view.dispatch(
|
|
7288
7543
|
state.tr.setStoredMarks([
|
|
@@ -7298,7 +7553,7 @@ function applyLanguage(view, key2, value) {
|
|
|
7298
7553
|
const start2 = Math.max(pos, state.selection.from);
|
|
7299
7554
|
const end2 = Math.min(pos + node.nodeSize, state.selection.to);
|
|
7300
7555
|
const existing = node.marks.find((mark) => mark.type === type);
|
|
7301
|
-
const attrs = languageMarkAttrs(existing,
|
|
7556
|
+
const attrs = languageMarkAttrs(existing, key3, tag);
|
|
7302
7557
|
const next = Object.values(attrs).some(Boolean) ? type.create(attrs) : void 0;
|
|
7303
7558
|
transaction = transaction.removeMark(start2, end2, type);
|
|
7304
7559
|
if (next) transaction = transaction.addMark(start2, end2, next);
|
|
@@ -7372,7 +7627,7 @@ var languageOptions = [
|
|
|
7372
7627
|
function emit2(control, detail2) {
|
|
7373
7628
|
emit(control, "ribbon-action", detail2);
|
|
7374
7629
|
}
|
|
7375
|
-
function languageControl(label2,
|
|
7630
|
+
function languageControl(label2, key3) {
|
|
7376
7631
|
const wrapper = document.createElement("label");
|
|
7377
7632
|
wrapper.className = "multilingual-language-control";
|
|
7378
7633
|
const visibleLabel = document.createElement("span");
|
|
@@ -7390,7 +7645,7 @@ function languageControl(label2, key2) {
|
|
|
7390
7645
|
const input = wrapper.querySelector("input");
|
|
7391
7646
|
input.value = "";
|
|
7392
7647
|
input.setCustomValidity("");
|
|
7393
|
-
emit2(wrapper, { type: "language", key:
|
|
7648
|
+
emit2(wrapper, { type: "language", key: key3, value: select2.value });
|
|
7394
7649
|
});
|
|
7395
7650
|
const custom = document.createElement("input");
|
|
7396
7651
|
custom.type = "text";
|
|
@@ -7409,7 +7664,7 @@ function languageControl(label2, key2) {
|
|
|
7409
7664
|
}
|
|
7410
7665
|
custom.setCustomValidity("");
|
|
7411
7666
|
select2.value = "";
|
|
7412
|
-
emit2(wrapper, { type: "language", key:
|
|
7667
|
+
emit2(wrapper, { type: "language", key: key3, value });
|
|
7413
7668
|
});
|
|
7414
7669
|
wrapper.append(visibleLabel, select2, custom);
|
|
7415
7670
|
return wrapper;
|
|
@@ -7510,10 +7765,10 @@ function syncMultilingualControls(toolbar, state) {
|
|
|
7510
7765
|
["eastAsiaLanguage", "East Asian language"],
|
|
7511
7766
|
["bidiLanguage", "Complex script language"]
|
|
7512
7767
|
];
|
|
7513
|
-
for (const [
|
|
7768
|
+
for (const [key3, label2] of languageKeys) {
|
|
7514
7769
|
const values2 = marks2.map((items) => {
|
|
7515
7770
|
const mark = items.find((item) => item.type === schema.marks.language);
|
|
7516
|
-
return mark?.attrs[
|
|
7771
|
+
return mark?.attrs[key3] ?? null;
|
|
7517
7772
|
});
|
|
7518
7773
|
const value = commonValue(values2);
|
|
7519
7774
|
setSelectValue(
|
|
@@ -7585,7 +7840,11 @@ function createReviewControls() {
|
|
|
7585
7840
|
tool("Next comment", "next", { type: "comments", key: "next" }, big),
|
|
7586
7841
|
tool("Comments", "comments", { type: "comments", key: "toggle" }, big)
|
|
7587
7842
|
);
|
|
7588
|
-
|
|
7843
|
+
const protect = group2(
|
|
7844
|
+
"Protect",
|
|
7845
|
+
tool("Restrict editing", "protect", { type: "formatDialog", kind: "restrictEditing" }, big)
|
|
7846
|
+
);
|
|
7847
|
+
return [tracking, changes, comments, protect];
|
|
7589
7848
|
}
|
|
7590
7849
|
|
|
7591
7850
|
// src/docx/insert-text-commands.ts
|
|
@@ -8761,7 +9020,7 @@ function smartArtFormatGallery(kind) {
|
|
|
8761
9020
|
}
|
|
8762
9021
|
function syncSmartArtFormatGalleries(root, disabled, colorsId, styleId) {
|
|
8763
9022
|
const locale = normalizeEditorLocale(root.dataset.editorLocale);
|
|
8764
|
-
const t = (
|
|
9023
|
+
const t = (key3) => translate(locale, key3);
|
|
8765
9024
|
for (const gallery of root.querySelectorAll("[data-smartart-format]")) {
|
|
8766
9025
|
const state = gallery.dataset.smartartFormat === "colors" ? smartArtColorsGalleryState(
|
|
8767
9026
|
{},
|
|
@@ -8782,7 +9041,7 @@ function syncSmartArtFormatGalleries(root, disabled, colorsId, styleId) {
|
|
|
8782
9041
|
|
|
8783
9042
|
// src/docx/smartart-design-ribbon.ts
|
|
8784
9043
|
var ADD_SHAPE = DIAGRAM_ADD_SHAPE_COMMANDS.map((c) => [c.key, c.label]);
|
|
8785
|
-
var label = (
|
|
9044
|
+
var label = (key3) => DIAGRAM_DESIGN_COMMANDS.find((command) => command.key === key3)?.label ?? key3;
|
|
8786
9045
|
function buildSmartArtDesignPanel(panel) {
|
|
8787
9046
|
panel.append(
|
|
8788
9047
|
group(
|
|
@@ -8938,13 +9197,13 @@ function createRibbon(locale = "en") {
|
|
|
8938
9197
|
"SmartArt Design",
|
|
8939
9198
|
"Chart Design"
|
|
8940
9199
|
]) {
|
|
8941
|
-
const
|
|
9200
|
+
const key3 = name === "Header & Footer" ? "header-footer" : name.toLowerCase().replace(/ /g, "-");
|
|
8942
9201
|
const panel = document.createElement("div");
|
|
8943
9202
|
panel.className = "ribbon-panel";
|
|
8944
|
-
panel.dataset.ribbonTab =
|
|
9203
|
+
panel.dataset.ribbonTab = key3;
|
|
8945
9204
|
panel.dataset.label = name;
|
|
8946
9205
|
panel.dataset.panel = name;
|
|
8947
|
-
panel.id = `dve-panel-${
|
|
9206
|
+
panel.id = `dve-panel-${key3}`;
|
|
8948
9207
|
panel.tabIndex = 0;
|
|
8949
9208
|
if (["Table", "Header & Footer", "Shape Format", "Chart Design", "SmartArt Design"].includes(name))
|
|
8950
9209
|
panel.dataset.contextual = "";
|
|
@@ -8958,8 +9217,8 @@ function createRibbon(locale = "en") {
|
|
|
8958
9217
|
buildSmartArtDesignPanel(panels.get("SmartArt Design"));
|
|
8959
9218
|
buildChartDesignPanel(panels.get("Chart Design"));
|
|
8960
9219
|
for (const panel of panels.values()) root.append(panel);
|
|
8961
|
-
for (const
|
|
8962
|
-
setTabHidden(root,
|
|
9220
|
+
for (const key3 of ["table", "header-footer", "shape-format", "chart-design", "smartart-design"])
|
|
9221
|
+
setTabHidden(root, key3, "contextual", true);
|
|
8963
9222
|
setComboValue(root.querySelector('[aria-label="Font family"]'), "Calibri");
|
|
8964
9223
|
setComboValue(root.querySelector('[aria-label="Font size"]'), "11");
|
|
8965
9224
|
root.querySelector('[aria-label="Zoom"]').value = "100";
|
|
@@ -9046,14 +9305,14 @@ function slotsOf(table) {
|
|
|
9046
9305
|
const cell = cells[next++];
|
|
9047
9306
|
if (!cell) break;
|
|
9048
9307
|
const span = Number(cell.attrs.colspan) || 1;
|
|
9049
|
-
const
|
|
9050
|
-
slots.push({ row: r, col, span, cell, offset: 0, key:
|
|
9308
|
+
const key3 = String(cell.attrs.sourceCellKey || "");
|
|
9309
|
+
slots.push({ row: r, col, span, cell, offset: 0, key: key3 });
|
|
9051
9310
|
const rowspan = Number(cell.attrs.rowspan) || 1;
|
|
9052
9311
|
const names = keysOf(cell);
|
|
9053
9312
|
for (let k = 1; k < rowspan; k++)
|
|
9054
9313
|
pending.set(r + k, [
|
|
9055
9314
|
...pending.get(r + k) ?? [],
|
|
9056
|
-
{ row: r + k, col, span, cell, offset: k, key: names[k - 1] ?? `${
|
|
9315
|
+
{ row: r + k, col, span, cell, offset: k, key: names[k - 1] ?? `${key3}~${k}` }
|
|
9057
9316
|
]);
|
|
9058
9317
|
col += span;
|
|
9059
9318
|
}
|
|
@@ -9132,7 +9391,7 @@ function paragraphNode(model, known) {
|
|
|
9132
9391
|
if (existing) return existing;
|
|
9133
9392
|
const attrs = { id: model.id };
|
|
9134
9393
|
const source = model;
|
|
9135
|
-
for (const
|
|
9394
|
+
for (const key3 of FORMAT_KEYS) if (source[key3] !== void 0) attrs[key3] = source[key3];
|
|
9136
9395
|
return schema.nodes.paragraph.create(attrs);
|
|
9137
9396
|
}
|
|
9138
9397
|
function nodeFromResult(old, result) {
|
|
@@ -9702,7 +9961,7 @@ function docToModel(doc, prior, previousDoc) {
|
|
|
9702
9961
|
if (!runs.length) runs.push({ text: "" });
|
|
9703
9962
|
const id = String(node.attrs.id || `p-edit-${++nextId}`);
|
|
9704
9963
|
const previous = previousParagraphs.get(id);
|
|
9705
|
-
if (previous && (previous.sourceParagraphPropertiesXml ?? null) === (node.attrs.sourceParagraphPropertiesXml ?? null) && (previous.restoredParagraphPropertiesXml ?? null) === (node.attrs.restoredParagraphPropertiesXml ?? null) && sameJson(previous.markRevision ?? null, node.attrs.markRevision ?? null) && sameJson(previous.formatRevision ?? null, node.attrs.formatRevision ?? null) && sameRuns(previous.runs, runs) && previous.align === (node.attrs.align ?? void 0) && previous.justification === (node.attrs.justification ?? void 0) && previous.outlineLevel === (node.attrs.outlineLevel ?? void 0) && previous.direction === (node.attrs.direction ?? void 0) && (previous.style || "") === (node.attrs.style || "") && previous.spacingBeforeTwips === (node.attrs.spacingBeforeTwips ?? void 0) && previous.spacingAfterTwips === (node.attrs.spacingAfterTwips ?? void 0) && previous.lineSpacingTwips === (node.attrs.lineSpacingTwips ?? void 0) && previous.lineSpacingRule === (node.attrs.lineSpacingRule ?? void 0) && previous.indentLeftTwips === (node.attrs.indentLeftTwips ?? void 0) && previous.indentRightTwips === (node.attrs.indentRightTwips ?? void 0) && previous.indentStartTwips === (node.attrs.indentStartTwips ?? void 0) && previous.indentEndTwips === (node.attrs.indentEndTwips ?? void 0) && previous.firstLineTwips === (node.attrs.firstLineTwips ?? void 0) && previous.hangingTwips === (node.attrs.hangingTwips ?? void 0) && (previous.numbering?.numId ?? null) === (node.attrs.numId ?? null) && (previous.numbering ? previous.numbering.level : null) === (node.attrs.ilvl ?? null) && (previous.pageBreakBefore ?? null) === node.attrs.pageBreakBefore && sameJson(previous.tabStops ?? null, node.attrs.tabStops ?? null) && PARAGRAPH_KEEP_KEYS.every((
|
|
9964
|
+
if (previous && (previous.sourceParagraphPropertiesXml ?? null) === (node.attrs.sourceParagraphPropertiesXml ?? null) && (previous.restoredParagraphPropertiesXml ?? null) === (node.attrs.restoredParagraphPropertiesXml ?? null) && sameJson(previous.markRevision ?? null, node.attrs.markRevision ?? null) && sameJson(previous.formatRevision ?? null, node.attrs.formatRevision ?? null) && sameRuns(previous.runs, runs) && previous.align === (node.attrs.align ?? void 0) && previous.justification === (node.attrs.justification ?? void 0) && previous.outlineLevel === (node.attrs.outlineLevel ?? void 0) && previous.direction === (node.attrs.direction ?? void 0) && (previous.style || "") === (node.attrs.style || "") && previous.spacingBeforeTwips === (node.attrs.spacingBeforeTwips ?? void 0) && previous.spacingAfterTwips === (node.attrs.spacingAfterTwips ?? void 0) && previous.lineSpacingTwips === (node.attrs.lineSpacingTwips ?? void 0) && previous.lineSpacingRule === (node.attrs.lineSpacingRule ?? void 0) && previous.indentLeftTwips === (node.attrs.indentLeftTwips ?? void 0) && previous.indentRightTwips === (node.attrs.indentRightTwips ?? void 0) && previous.indentStartTwips === (node.attrs.indentStartTwips ?? void 0) && previous.indentEndTwips === (node.attrs.indentEndTwips ?? void 0) && previous.firstLineTwips === (node.attrs.firstLineTwips ?? void 0) && previous.hangingTwips === (node.attrs.hangingTwips ?? void 0) && (previous.numbering?.numId ?? null) === (node.attrs.numId ?? null) && (previous.numbering ? previous.numbering.level : null) === (node.attrs.ilvl ?? null) && (previous.pageBreakBefore ?? null) === node.attrs.pageBreakBefore && sameJson(previous.tabStops ?? null, node.attrs.tabStops ?? null) && PARAGRAPH_KEEP_KEYS.every((key3) => (previous[key3] ?? null) === (node.attrs[key3] ?? null)) && sameJson(previous.dropCap ?? null, node.attrs.dropCap ?? null) && sameJson(previous.borders ?? null, node.attrs.borders ?? null) && (previous.shadingFill ?? null) === (node.attrs.shadingFill ?? null) && sameJson(previous.bookmarks ?? [], node.attrs.bookmarks ?? []) && sameJson(previous.permissions ?? null, node.attrs.permissions ?? null) && sameJson(previous.contentControl ?? null, node.attrs.contentControl ?? null))
|
|
9706
9965
|
return previous;
|
|
9707
9966
|
return paragraphFromAttrs(node.attrs, id, runs);
|
|
9708
9967
|
};
|
|
@@ -9820,25 +10079,25 @@ function createCanvasMeasurer() {
|
|
|
9820
10079
|
};
|
|
9821
10080
|
const fontString = (font) => `${font.italic ? "italic " : ""}${font.bold ? "bold " : ""}${font.sizePx}px ${cssFontStack(font.family)}`;
|
|
9822
10081
|
const metricsOf = (c, font) => {
|
|
9823
|
-
const
|
|
9824
|
-
const cached = metricCache.get(
|
|
10082
|
+
const key3 = fontString(font);
|
|
10083
|
+
const cached = metricCache.get(key3);
|
|
9825
10084
|
if (cached) return cached;
|
|
9826
|
-
c.font =
|
|
10085
|
+
c.font = key3;
|
|
9827
10086
|
const measured = c.measureText("Mg");
|
|
9828
10087
|
const metrics = {
|
|
9829
10088
|
ascent: measured.fontBoundingBoxAscent ?? font.sizePx * 0.95,
|
|
9830
10089
|
height: measured.fontBoundingBoxAscent !== void 0 && measured.fontBoundingBoxDescent !== void 0 ? measured.fontBoundingBoxAscent + measured.fontBoundingBoxDescent : font.sizePx * 1.22
|
|
9831
10090
|
};
|
|
9832
10091
|
if (metricCache.size >= 256) metricCache.delete(metricCache.keys().next().value);
|
|
9833
|
-
metricCache.set(
|
|
10092
|
+
metricCache.set(key3, metrics);
|
|
9834
10093
|
return metrics;
|
|
9835
10094
|
};
|
|
9836
10095
|
return {
|
|
9837
10096
|
widthOf(text, font) {
|
|
9838
10097
|
const c = ctx();
|
|
9839
10098
|
if (!c) return fallback.widthOf(text, font);
|
|
9840
|
-
const
|
|
9841
|
-
const cached = widthCache.get(
|
|
10099
|
+
const key3 = `${fontString(font)}\0${font.kerning ?? "auto"}\0${font.ligatures ?? "auto"}\0${font.smallCaps ?? false}\0${text}`;
|
|
10100
|
+
const cached = widthCache.get(key3);
|
|
9842
10101
|
if (cached !== void 0) return cached;
|
|
9843
10102
|
c.font = fontString(font);
|
|
9844
10103
|
c.fontKerning = font.kerning ?? "auto";
|
|
@@ -9860,7 +10119,7 @@ function createCanvasMeasurer() {
|
|
|
9860
10119
|
}
|
|
9861
10120
|
}
|
|
9862
10121
|
if (widthCache.size >= 2e4) widthCache.delete(widthCache.keys().next().value);
|
|
9863
|
-
widthCache.set(
|
|
10122
|
+
widthCache.set(key3, width);
|
|
9864
10123
|
return width;
|
|
9865
10124
|
},
|
|
9866
10125
|
ascentOf(font) {
|
|
@@ -10419,8 +10678,8 @@ function setDropCap(view, style, options) {
|
|
|
10419
10678
|
return true;
|
|
10420
10679
|
}
|
|
10421
10680
|
var toggleFormat = createToggleFormat(schema, styleModelOf);
|
|
10422
|
-
function applyFont(view,
|
|
10423
|
-
const patch =
|
|
10681
|
+
function applyFont(view, key3, value) {
|
|
10682
|
+
const patch = key3 === "family" ? { fontFamily: value } : key3 === "size" ? { fontSize: Number(value) } : { color: value };
|
|
10424
10683
|
applyRunFormattingPatch(patch)(view.state, view.dispatch, view);
|
|
10425
10684
|
}
|
|
10426
10685
|
function clearFormatting(view) {
|
|
@@ -10458,11 +10717,11 @@ function insertTable(view, idGenerator, size = {}) {
|
|
|
10458
10717
|
);
|
|
10459
10718
|
view.dispatch(closeHistory(view.state.tr.replaceSelectionWith(table)).scrollIntoView());
|
|
10460
10719
|
}
|
|
10461
|
-
function updateParagraphs(view,
|
|
10720
|
+
function updateParagraphs(view, key3, value) {
|
|
10462
10721
|
const { state } = view;
|
|
10463
|
-
if (
|
|
10722
|
+
if (key3 === "lineSpacing") {
|
|
10464
10723
|
if (value !== "inherit" && !parseLineSpacingValue(value)) return;
|
|
10465
|
-
} else if (
|
|
10724
|
+
} else if (key3 !== "indent" && value !== "inherit" && (!Number.isFinite(Number(value)) || Number(value) < 0))
|
|
10466
10725
|
return;
|
|
10467
10726
|
const positions = [];
|
|
10468
10727
|
state.doc.nodesBetween(state.selection.from, state.selection.to, (node, pos) => {
|
|
@@ -10474,7 +10733,7 @@ function updateParagraphs(view, key2, value) {
|
|
|
10474
10733
|
for (const pos of positions) {
|
|
10475
10734
|
const node = transaction.doc.nodeAt(pos);
|
|
10476
10735
|
if (!node) continue;
|
|
10477
|
-
if (
|
|
10736
|
+
if (key3 === "indent") {
|
|
10478
10737
|
const logical = node.attrs.indentStartTwips != null;
|
|
10479
10738
|
const attr = logical ? "indentStartTwips" : "indentLeftTwips";
|
|
10480
10739
|
const current2 = Number(node.attrs[attr] ?? 0);
|
|
@@ -10483,12 +10742,12 @@ function updateParagraphs(view, key2, value) {
|
|
|
10483
10742
|
...node.attrs,
|
|
10484
10743
|
[attr]: next
|
|
10485
10744
|
});
|
|
10486
|
-
} else if (
|
|
10745
|
+
} else if (key3 === "spacingAfter") {
|
|
10487
10746
|
transaction = transaction.setNodeMarkup(pos, void 0, {
|
|
10488
10747
|
...node.attrs,
|
|
10489
10748
|
spacingAfterTwips: value === "inherit" ? null : twipsAttr(Number(value)) ?? null
|
|
10490
10749
|
});
|
|
10491
|
-
} else if (
|
|
10750
|
+
} else if (key3 === "spacingBefore") {
|
|
10492
10751
|
transaction = transaction.setNodeMarkup(pos, void 0, {
|
|
10493
10752
|
...node.attrs,
|
|
10494
10753
|
spacingBeforeTwips: value === "inherit" ? null : twipsAttr(Number(value)) ?? null
|
|
@@ -11312,13 +11571,20 @@ function applyCustomList(view, model, levels) {
|
|
|
11312
11571
|
return created.numId;
|
|
11313
11572
|
});
|
|
11314
11573
|
}
|
|
11315
|
-
function
|
|
11316
|
-
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
|
|
11574
|
+
function applyPictureBulletList(view, model, picture) {
|
|
11575
|
+
toggleList(view, false, () => {
|
|
11576
|
+
const created = createPictureBulletList(model.numberingCatalog, picture);
|
|
11577
|
+
model.numberingCatalog = created.catalog;
|
|
11578
|
+
return created.numId;
|
|
11579
|
+
});
|
|
11580
|
+
}
|
|
11581
|
+
function runListAction(view, key3, model) {
|
|
11582
|
+
if (key3 === "remove") removeList(view);
|
|
11583
|
+
else if (key3 === "increaseLevel") changeListLevel(view, 1);
|
|
11584
|
+
else if (key3 === "decreaseLevel") changeListLevel(view, -1);
|
|
11585
|
+
else if (isHeadingListKind(key3)) {
|
|
11320
11586
|
toggleList(view, false, () => {
|
|
11321
|
-
const levels = headingListLevels(
|
|
11587
|
+
const levels = headingListLevels(key3).map(
|
|
11322
11588
|
(level) => model.paragraphStyles?.styles[level.paragraphStyleId] ? level : (({ paragraphStyleId: _removed, ...rest }) => rest)(level)
|
|
11323
11589
|
);
|
|
11324
11590
|
const created = createListDefinition(model.numberingCatalog, levels);
|
|
@@ -11327,14 +11593,14 @@ function runListAction(view, key2, model) {
|
|
|
11327
11593
|
if (linked) model.paragraphStyles = linked;
|
|
11328
11594
|
return created.numId;
|
|
11329
11595
|
});
|
|
11330
|
-
} else if (
|
|
11596
|
+
} else if (key3 === "multilevel" || key3 === "outline") {
|
|
11331
11597
|
toggleList(view, false, () => {
|
|
11332
|
-
const created = ensureListDefinition(model.numberingCatalog,
|
|
11598
|
+
const created = ensureListDefinition(model.numberingCatalog, key3);
|
|
11333
11599
|
model.numberingCatalog = created.catalog;
|
|
11334
11600
|
return created.numId;
|
|
11335
11601
|
});
|
|
11336
11602
|
} else {
|
|
11337
|
-
const kind =
|
|
11603
|
+
const kind = key3 === "bullet" ? "bullet" : "decimal";
|
|
11338
11604
|
const already = selectionIsListKind(view, kind, model.numberingCatalog);
|
|
11339
11605
|
toggleList(view, already, () => {
|
|
11340
11606
|
const created = ensureListDefinition(model.numberingCatalog, kind);
|
|
@@ -11523,7 +11789,7 @@ function applyCellBorderSettings(view, settings) {
|
|
|
11523
11789
|
if (!view.editable || !ctx) return false;
|
|
11524
11790
|
const rect = settings.scope === "table" ? wholeTable(ctx) : ctx.rect;
|
|
11525
11791
|
const edits = [];
|
|
11526
|
-
for (const [
|
|
11792
|
+
for (const [key3, preset] of [
|
|
11527
11793
|
["top", "top"],
|
|
11528
11794
|
["bottom", "bottom"],
|
|
11529
11795
|
["left", "left"],
|
|
@@ -11532,7 +11798,7 @@ function applyCellBorderSettings(view, settings) {
|
|
|
11532
11798
|
["insideV", "insideV"]
|
|
11533
11799
|
])
|
|
11534
11800
|
for (const edge of edgesOf(preset, rect))
|
|
11535
|
-
edits.push({ ...edge, pen: settings.sides[
|
|
11801
|
+
edits.push({ ...edge, pen: settings.sides[key3] ? settings.pen : null });
|
|
11536
11802
|
return applyEdits(
|
|
11537
11803
|
view,
|
|
11538
11804
|
ctx,
|
|
@@ -11546,9 +11812,9 @@ function readCellBorderSettings(state, scope) {
|
|
|
11546
11812
|
const rect = scope === "table" ? wholeTable(ctx) : ctx.rect;
|
|
11547
11813
|
const sides2 = {};
|
|
11548
11814
|
let pen;
|
|
11549
|
-
for (const
|
|
11550
|
-
const edges = edgesOf(
|
|
11551
|
-
sides2[
|
|
11815
|
+
for (const key3 of ["top", "bottom", "left", "right", "insideH", "insideV"]) {
|
|
11816
|
+
const edges = edgesOf(key3, rect);
|
|
11817
|
+
sides2[key3] = edges.length > 0 && edges.every((edge) => {
|
|
11552
11818
|
const side = current(ctx, state, edge.row, edge.column)[edge.side];
|
|
11553
11819
|
if (visible(side) && !pen)
|
|
11554
11820
|
pen = {
|
|
@@ -11609,8 +11875,8 @@ var editorBindings = {
|
|
|
11609
11875
|
};
|
|
11610
11876
|
function editorKeymap(showSearch) {
|
|
11611
11877
|
const shortcuts = Object.fromEntries(
|
|
11612
|
-
Object.entries({ ...baseKeymap, ...editorBindings }).map(([
|
|
11613
|
-
|
|
11878
|
+
Object.entries({ ...baseKeymap, ...editorBindings }).map(([key3, command]) => [
|
|
11879
|
+
key3,
|
|
11614
11880
|
editable(command)
|
|
11615
11881
|
])
|
|
11616
11882
|
);
|
|
@@ -11881,9 +12147,9 @@ function operate2(view, el) {
|
|
|
11881
12147
|
});
|
|
11882
12148
|
return true;
|
|
11883
12149
|
}
|
|
11884
|
-
function keyEdits(view,
|
|
12150
|
+
function keyEdits(view, key3) {
|
|
11885
12151
|
let tr;
|
|
11886
|
-
if (
|
|
12152
|
+
if (key3 === " ") tr = view.state.tr.insertText(" ");
|
|
11887
12153
|
else splitBlock(view.state, (split2) => tr = split2);
|
|
11888
12154
|
return Boolean(tr) && view.state.plugins.every(
|
|
11889
12155
|
(plugin) => plugin.spec.filterTransaction?.call(plugin, tr, view.state) ?? true
|
|
@@ -11929,7 +12195,23 @@ function formFieldViewPlugin(model) {
|
|
|
11929
12195
|
}
|
|
11930
12196
|
});
|
|
11931
12197
|
}
|
|
11932
|
-
var key = new PluginKey("
|
|
12198
|
+
var key = new PluginKey("docx-editable-regions");
|
|
12199
|
+
function editableRegionViewPlugin(protection, user, enabled = () => true) {
|
|
12200
|
+
return new Plugin({
|
|
12201
|
+
key,
|
|
12202
|
+
props: {
|
|
12203
|
+
decorations(state) {
|
|
12204
|
+
const restriction = editRestrictionOf(protection());
|
|
12205
|
+
if (!restriction || restriction === "trackedChanges" || !enabled()) return null;
|
|
12206
|
+
const decorations2 = editableRanges(state, user()).filter((range) => range.to > range.from).map(
|
|
12207
|
+
(range) => Decoration.inline(range.from, range.to, { class: "dve-editable-region" })
|
|
12208
|
+
);
|
|
12209
|
+
return decorations2.length ? DecorationSet.create(state.doc, decorations2) : null;
|
|
12210
|
+
}
|
|
12211
|
+
}
|
|
12212
|
+
});
|
|
12213
|
+
}
|
|
12214
|
+
var key2 = new PluginKey("dve-tab-stops");
|
|
11933
12215
|
var MAX_PASSES = 4;
|
|
11934
12216
|
var stopsOf = (paragraph2) => (paragraph2.attrs.tabStops ?? []).map((stop) => ({
|
|
11935
12217
|
posPx: stop.posTwips / 15,
|
|
@@ -12010,12 +12292,12 @@ function sameBoxes(set, boxes, state) {
|
|
|
12010
12292
|
}
|
|
12011
12293
|
function tabStopsPlugin() {
|
|
12012
12294
|
return new Plugin({
|
|
12013
|
-
key,
|
|
12295
|
+
key: key2,
|
|
12014
12296
|
state: {
|
|
12015
12297
|
init: () => DecorationSet.empty,
|
|
12016
|
-
apply: (tr, set) => tr.getMeta(
|
|
12298
|
+
apply: (tr, set) => tr.getMeta(key2) ?? set.map(tr.mapping, tr.doc)
|
|
12017
12299
|
},
|
|
12018
|
-
props: { decorations: (state) =>
|
|
12300
|
+
props: { decorations: (state) => key2.getState(state) },
|
|
12019
12301
|
view(view) {
|
|
12020
12302
|
let frame = 0;
|
|
12021
12303
|
let passes = 0;
|
|
@@ -12028,11 +12310,11 @@ function tabStopsPlugin() {
|
|
|
12028
12310
|
} catch {
|
|
12029
12311
|
return;
|
|
12030
12312
|
}
|
|
12031
|
-
const set =
|
|
12313
|
+
const set = key2.getState(view.state) ?? DecorationSet.empty;
|
|
12032
12314
|
if (sameBoxes(set, boxes, view.state)) return;
|
|
12033
12315
|
passes++;
|
|
12034
12316
|
view.dispatch(
|
|
12035
|
-
view.state.tr.setMeta(
|
|
12317
|
+
view.state.tr.setMeta(key2, decorations(view.state, boxes)).setMeta("addToHistory", false)
|
|
12036
12318
|
);
|
|
12037
12319
|
};
|
|
12038
12320
|
const schedule = () => {
|
|
@@ -12044,7 +12326,7 @@ function tabStopsPlugin() {
|
|
|
12044
12326
|
update(next, previous) {
|
|
12045
12327
|
const changed = next.state.doc !== previous.doc;
|
|
12046
12328
|
if (changed) passes = 0;
|
|
12047
|
-
if (changed ||
|
|
12329
|
+
if (changed || key2.getState(next.state) !== key2.getState(previous)) schedule();
|
|
12048
12330
|
},
|
|
12049
12331
|
destroy() {
|
|
12050
12332
|
if (frame) cancelAnimationFrame(frame);
|
|
@@ -12069,8 +12351,8 @@ function referenceFormatting(model, kind) {
|
|
|
12069
12351
|
};
|
|
12070
12352
|
}
|
|
12071
12353
|
function insertNote(view, model, kind) {
|
|
12072
|
-
const
|
|
12073
|
-
const id = nextNoteId(model[
|
|
12354
|
+
const key3 = kind === "footnote" ? "footnotes" : "endnotes";
|
|
12355
|
+
const id = nextNoteId(model[key3]);
|
|
12074
12356
|
const formatting = referenceFormatting(model, kind);
|
|
12075
12357
|
const textStyle = STYLES[kind].text;
|
|
12076
12358
|
const paragraph2 = {
|
|
@@ -12081,7 +12363,7 @@ function insertNote(view, model, kind) {
|
|
|
12081
12363
|
};
|
|
12082
12364
|
const next = {
|
|
12083
12365
|
...model,
|
|
12084
|
-
[
|
|
12366
|
+
[key3]: [...model[key3] ?? [], { id, blocks: [paragraph2] }]
|
|
12085
12367
|
};
|
|
12086
12368
|
const reference = schema.nodes.noteReference.create({
|
|
12087
12369
|
kind,
|
|
@@ -12118,7 +12400,7 @@ function noteNumberingPlugin() {
|
|
|
12118
12400
|
}
|
|
12119
12401
|
});
|
|
12120
12402
|
}
|
|
12121
|
-
function listMarkerDisplay(node, paragraph2, label2, model, measurer) {
|
|
12403
|
+
function listMarkerDisplay(node, paragraph2, label2, model, measurer, pictureUrl) {
|
|
12122
12404
|
if (!label2 || paragraph2.direction === "rtl")
|
|
12123
12405
|
return { css: "", attributes: { "data-list-marker": "" } };
|
|
12124
12406
|
const runs = [];
|
|
@@ -12140,7 +12422,10 @@ function listMarkerDisplay(node, paragraph2, label2, model, measurer) {
|
|
|
12140
12422
|
const text = displayListLabel(label2.text);
|
|
12141
12423
|
const color = own?.color ?? format.color ?? (format.colorTheme && model.theme ? resolveThemeColorReference(format.colorTheme, model.theme) : void 0);
|
|
12142
12424
|
const safeColor2 = color && /^#[0-9a-f]{6}$/i.test(color) ? color : "inherit";
|
|
12143
|
-
const
|
|
12425
|
+
const picture = label2.picture;
|
|
12426
|
+
const url = picture && pictureUrl?.(picture.partName, picture.contentType);
|
|
12427
|
+
const size = picture && url ? pictureBulletSizePt(picture, font.sizePx * 3 / 4) : void 0;
|
|
12428
|
+
const width = size ? size.widthPt * 4 / 3 : measurer.widthOf(text, font);
|
|
12144
12429
|
const indent = (paragraph2.indentStartTwips ?? paragraph2.indentLeftTwips ?? label2.indentLeftTwips ?? 0) / 15;
|
|
12145
12430
|
const ownFirst = paragraph2.hangingTwips !== void 0 || paragraph2.firstLineTwips !== void 0;
|
|
12146
12431
|
const hanging = ownFirst ? paragraph2.hangingTwips : label2.hangingTwips;
|
|
@@ -12160,8 +12445,11 @@ function listMarkerDisplay(node, paragraph2, label2, model, measurer) {
|
|
|
12160
12445
|
body = custom ? custom.posTwips / 15 : indent > end2 + 0.5 ? indent : (Math.floor(end2 / 48) + 1) * 48;
|
|
12161
12446
|
}
|
|
12162
12447
|
return {
|
|
12163
|
-
attributes: {
|
|
12164
|
-
|
|
12448
|
+
attributes: {
|
|
12449
|
+
"data-list-marker": text,
|
|
12450
|
+
...size ? { "data-list-marker-picture": "" } : {}
|
|
12451
|
+
},
|
|
12452
|
+
css: `${size && url ? `--dve-marker-image:url("${url.replace(/"/g, "%22")}");--dve-marker-pic-w:${size.widthPt * 4 / 3}px;--dve-marker-pic-h:${size.heightPt * 4 / 3}px;` : ""}position:relative;text-indent:${body - indent}px;--dve-marker-left:${anchor - width * factor - indent}px;--dve-marker-family:${cssFontStack(font.family)};--dve-marker-size:${font.sizePx}px;--dve-marker-weight:${font.bold ? "bold" : "normal"};--dve-marker-style:${font.italic ? "italic" : "normal"};--dve-marker-color:${safeColor2}`
|
|
12165
12453
|
};
|
|
12166
12454
|
}
|
|
12167
12455
|
|
|
@@ -12270,9 +12558,9 @@ function markSelectedTiles(root, selected, disabled) {
|
|
|
12270
12558
|
}
|
|
12271
12559
|
}
|
|
12272
12560
|
function syncStyleGallery(gallery, styles, selected, model, choose, disabled) {
|
|
12273
|
-
const
|
|
12274
|
-
if (gallery.dataset.key !==
|
|
12275
|
-
gallery.dataset.key =
|
|
12561
|
+
const key3 = JSON.stringify(styles);
|
|
12562
|
+
if (gallery.dataset.key !== key3) {
|
|
12563
|
+
gallery.dataset.key = key3;
|
|
12276
12564
|
gallery.replaceChildren(
|
|
12277
12565
|
...styles.map((style) => createStyleTile(style, model, "paragraph", choose))
|
|
12278
12566
|
);
|
|
@@ -12287,7 +12575,7 @@ function createStylesPane(onClose) {
|
|
|
12287
12575
|
element.className = "dve-styles-pane";
|
|
12288
12576
|
element.setAttribute("role", "complementary");
|
|
12289
12577
|
element.hidden = true;
|
|
12290
|
-
let
|
|
12578
|
+
let key3 = "";
|
|
12291
12579
|
let locale = "en";
|
|
12292
12580
|
const close3 = () => {
|
|
12293
12581
|
element.hidden = true;
|
|
@@ -12317,8 +12605,8 @@ function createStylesPane(onClose) {
|
|
|
12317
12605
|
data.selectedCharacter,
|
|
12318
12606
|
data.disabled
|
|
12319
12607
|
]);
|
|
12320
|
-
const listsChanged = signature !==
|
|
12321
|
-
|
|
12608
|
+
const listsChanged = signature !== key3;
|
|
12609
|
+
key3 = signature;
|
|
12322
12610
|
if (listsChanged) {
|
|
12323
12611
|
const header = document.createElement("div");
|
|
12324
12612
|
header.className = "dve-styles-pane-header";
|
|
@@ -12634,7 +12922,7 @@ function resetStylePicker(toolbar) {
|
|
|
12634
12922
|
}
|
|
12635
12923
|
|
|
12636
12924
|
// src/docx/paragraph-styles.ts
|
|
12637
|
-
function paragraphStylesPlugin(getModel, getMode = () => "all") {
|
|
12925
|
+
function paragraphStylesPlugin(getModel, getMode = () => "all", pictureUrl) {
|
|
12638
12926
|
let measurer = scaleMeasurer();
|
|
12639
12927
|
const cache = new DecorationCache();
|
|
12640
12928
|
const projections = new AttributeCache();
|
|
@@ -12687,6 +12975,7 @@ function paragraphStylesPlugin(getModel, getMode = () => "all") {
|
|
|
12687
12975
|
mode,
|
|
12688
12976
|
measurer,
|
|
12689
12977
|
JSON.stringify(label2),
|
|
12978
|
+
pictureUrl,
|
|
12690
12979
|
label2 ? node.firstChild : void 0
|
|
12691
12980
|
];
|
|
12692
12981
|
const rendered = attributes.resolve(node.attrs, dependencies, () => {
|
|
@@ -12699,7 +12988,8 @@ function paragraphStylesPlugin(getModel, getMode = () => "all") {
|
|
|
12699
12988
|
{ ...paragraph2, ...effective },
|
|
12700
12989
|
label2,
|
|
12701
12990
|
model,
|
|
12702
|
-
measurer
|
|
12991
|
+
measurer,
|
|
12992
|
+
pictureUrl
|
|
12703
12993
|
);
|
|
12704
12994
|
const list = label2 ? {
|
|
12705
12995
|
listIndentLeftTwips: label2.indentLeftTwips ?? null,
|
|
@@ -12834,6 +13124,15 @@ function bodyPlugins(host) {
|
|
|
12834
13124
|
contentControlPlugin(),
|
|
12835
13125
|
contentControlViewPlugin(),
|
|
12836
13126
|
formFieldGuardPlugin(() => host.model().protection),
|
|
13127
|
+
editRestrictionPlugin(
|
|
13128
|
+
() => host.model().protection,
|
|
13129
|
+
() => host.reviewAuthor()
|
|
13130
|
+
),
|
|
13131
|
+
editableRegionViewPlugin(
|
|
13132
|
+
() => host.model().protection,
|
|
13133
|
+
() => host.reviewAuthor(),
|
|
13134
|
+
() => host.highlightEditableRegions?.() ?? true
|
|
13135
|
+
),
|
|
12837
13136
|
formFieldViewPlugin(() => host.model()),
|
|
12838
13137
|
symbolFontPlugin(),
|
|
12839
13138
|
positionalTabInputPlugin(),
|
|
@@ -12849,11 +13148,12 @@ function bodyPlugins(host) {
|
|
|
12849
13148
|
),
|
|
12850
13149
|
paragraphStylesPlugin(
|
|
12851
13150
|
() => host.model(),
|
|
12852
|
-
() => host.reviewDisplayMode()
|
|
13151
|
+
() => host.reviewDisplayMode(),
|
|
13152
|
+
(partName, contentType) => host.pictureUrl?.(partName, contentType)
|
|
12853
13153
|
),
|
|
12854
13154
|
trackChangesPlugin(
|
|
12855
13155
|
() => host.reviewAuthor(),
|
|
12856
|
-
() => Boolean(host.model().trackChanges),
|
|
13156
|
+
() => Boolean(host.model().trackChanges) || forcesTrackChanges(host.model().protection),
|
|
12857
13157
|
host.revisionIds
|
|
12858
13158
|
),
|
|
12859
13159
|
reviewDisplayPlugin(() => host.reviewDisplayMode()),
|
|
@@ -13105,9 +13405,24 @@ function imageNodeView(cache, options = {}) {
|
|
|
13105
13405
|
if (node.attrs.chart) return chartNodeView(node, view, getPos, options);
|
|
13106
13406
|
const content = renderSpec(node);
|
|
13107
13407
|
if (content.tagName !== "IMG") return { dom: content, ignoreMutation: () => true };
|
|
13408
|
+
let painted;
|
|
13409
|
+
const fill = typeof node.attrs.pictureFill === "string" ? JSON.parse(node.attrs.pictureFill) : void 0;
|
|
13108
13410
|
const refresh = () => {
|
|
13109
13411
|
const src = node.attrs.svgPartName && cache.urlFor(String(node.attrs.svgPartName), "image/svg+xml") || cache.urlFor(String(node.attrs.partName), String(node.attrs.contentType));
|
|
13110
13412
|
if (src) content.setAttribute("src", src);
|
|
13413
|
+
if (src && pictureNeedsSvg(fill)) {
|
|
13414
|
+
const next = pictureSvg(
|
|
13415
|
+
content.ownerDocument,
|
|
13416
|
+
fill,
|
|
13417
|
+
src,
|
|
13418
|
+
Number(node.attrs.widthPx),
|
|
13419
|
+
Number(node.attrs.heightPx)
|
|
13420
|
+
);
|
|
13421
|
+
if (painted) painted.replaceWith(next);
|
|
13422
|
+
else content.after(next);
|
|
13423
|
+
painted = next;
|
|
13424
|
+
content.style.display = "none";
|
|
13425
|
+
}
|
|
13111
13426
|
content.classList.toggle("dve-image-missing", !src);
|
|
13112
13427
|
};
|
|
13113
13428
|
refresh();
|
|
@@ -13115,7 +13430,8 @@ function imageNodeView(cache, options = {}) {
|
|
|
13115
13430
|
const dom = document.createElement("span");
|
|
13116
13431
|
dom.className = ["dve-picture", placementClass(node.attrs.placement)].filter(Boolean).join(" ");
|
|
13117
13432
|
dom.append(content);
|
|
13118
|
-
|
|
13433
|
+
if (painted) dom.append(painted);
|
|
13434
|
+
dom.addEventListener("dblclick", () => {
|
|
13119
13435
|
const pos = getPos();
|
|
13120
13436
|
if (pos !== void 0 && view.editable) options.editPicture?.(pos);
|
|
13121
13437
|
});
|
|
@@ -13126,6 +13442,10 @@ function imageNodeView(cache, options = {}) {
|
|
|
13126
13442
|
preview: (width, height) => {
|
|
13127
13443
|
content.setAttribute("width", String(width));
|
|
13128
13444
|
content.setAttribute("height", String(height));
|
|
13445
|
+
if (painted) {
|
|
13446
|
+
painted.setAttribute("width", String(width));
|
|
13447
|
+
painted.setAttribute("height", String(height));
|
|
13448
|
+
}
|
|
13129
13449
|
}
|
|
13130
13450
|
});
|
|
13131
13451
|
dom.append(handle);
|
|
@@ -13266,7 +13586,9 @@ function renderDocument(core) {
|
|
|
13266
13586
|
doc: yjs?.doc ?? modelToDoc(core.model),
|
|
13267
13587
|
plugins: bodyPlugins({
|
|
13268
13588
|
model: () => core.model,
|
|
13589
|
+
pictureUrl: (partName, contentType) => core.imageMedia.urlFor(partName, contentType),
|
|
13269
13590
|
reviewAuthor: () => core.reviewAuthor,
|
|
13591
|
+
highlightEditableRegions: () => core.highlightEditableRegions,
|
|
13270
13592
|
reviewDisplayMode: () => core.reviewDisplayMode,
|
|
13271
13593
|
insertNote: (kind) => core.parts.insertNote(kind, canvas, paper),
|
|
13272
13594
|
// ProseMirror's Mod-f reaches here before the shortcut registry: honour `find: false`.
|
|
@@ -13622,7 +13944,7 @@ function setSelectedChartLegend(view, value) {
|
|
|
13622
13944
|
|
|
13623
13945
|
// src/docx/chart-sheet-labels.ts
|
|
13624
13946
|
function sheetLabels(locale) {
|
|
13625
|
-
const t = (
|
|
13947
|
+
const t = (key3) => translate(locale, `chart.sheet.${key3}`);
|
|
13626
13948
|
return {
|
|
13627
13949
|
heading: t("heading"),
|
|
13628
13950
|
addCategory: t("addCategory"),
|
|
@@ -13994,10 +14316,10 @@ function batchFontFormat(view, apply2) {
|
|
|
13994
14316
|
scroll ||= transaction.scrolledIntoView;
|
|
13995
14317
|
};
|
|
13996
14318
|
const draft = new Proxy(view, {
|
|
13997
|
-
get(target,
|
|
13998
|
-
if (
|
|
13999
|
-
if (
|
|
14000
|
-
return Reflect.get(target,
|
|
14319
|
+
get(target, key3) {
|
|
14320
|
+
if (key3 === "state") return state;
|
|
14321
|
+
if (key3 === "dispatch") return dispatch;
|
|
14322
|
+
return Reflect.get(target, key3, target);
|
|
14001
14323
|
}
|
|
14002
14324
|
});
|
|
14003
14325
|
apply2(draft);
|
|
@@ -14091,17 +14413,17 @@ function readFontFormat(state) {
|
|
|
14091
14413
|
}
|
|
14092
14414
|
return result;
|
|
14093
14415
|
}
|
|
14094
|
-
function shows(state,
|
|
14416
|
+
function shows(state, key3) {
|
|
14095
14417
|
const values2 = formatsOf(state).map(
|
|
14096
|
-
(format) =>
|
|
14418
|
+
(format) => key3 === "underline" ? format.underline !== "none" : format[key3]
|
|
14097
14419
|
);
|
|
14098
14420
|
if (values2.every(Boolean)) return true;
|
|
14099
14421
|
return values2.some(Boolean) ? null : false;
|
|
14100
14422
|
}
|
|
14101
|
-
function setToggle(view,
|
|
14423
|
+
function setToggle(view, key3, desired) {
|
|
14102
14424
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
14103
|
-
if (shows(view.state,
|
|
14104
|
-
toggleFormat(
|
|
14425
|
+
if (shows(view.state, key3) === desired) return;
|
|
14426
|
+
toggleFormat(key3)(view.state, view.dispatch, view);
|
|
14105
14427
|
}
|
|
14106
14428
|
}
|
|
14107
14429
|
function patchExtraProps(view, patch) {
|
|
@@ -14230,13 +14552,13 @@ function createFontAdvanced(mark) {
|
|
|
14230
14552
|
},
|
|
14231
14553
|
valid(dirty, reveal = () => {
|
|
14232
14554
|
}) {
|
|
14233
|
-
for (const [
|
|
14555
|
+
for (const [key3, input] of [
|
|
14234
14556
|
["scale", scale],
|
|
14235
14557
|
["spacing", spacingBy],
|
|
14236
14558
|
["position", positionBy],
|
|
14237
14559
|
["kerning", kerningBy]
|
|
14238
14560
|
])
|
|
14239
|
-
if (dirty.has(
|
|
14561
|
+
if (dirty.has(key3) && !input.checkValidity()) {
|
|
14240
14562
|
reveal();
|
|
14241
14563
|
input.reportValidity();
|
|
14242
14564
|
return false;
|
|
@@ -14438,8 +14760,8 @@ function createFontDialog(getView, getHistoryView = getView) {
|
|
|
14438
14760
|
if (dirty.has("underline")) changes.underline = underline.value;
|
|
14439
14761
|
if (dirty.has("underlineColor"))
|
|
14440
14762
|
changes.underlineColor = automatic.input.checked ? null : underlineColor.value;
|
|
14441
|
-
for (const
|
|
14442
|
-
if (dirty.has(
|
|
14763
|
+
for (const key3 of ["strike", "doubleStrike", "smallCaps", "caps", "hidden"])
|
|
14764
|
+
if (dirty.has(key3)) changes[key3] = effects[key3 === "hidden" ? "hidden" : key3].input.checked;
|
|
14443
14765
|
if (dirty.has("script"))
|
|
14444
14766
|
changes.script = effects.superscript.input.checked ? "superscript" : effects.subscript.input.checked ? "subscript" : "none";
|
|
14445
14767
|
Object.assign(changes, advanced.collect(dirty));
|
|
@@ -15130,9 +15452,9 @@ function createContentControlDialog(getView) {
|
|
|
15130
15452
|
const span = view && controlAtSelection(view.state);
|
|
15131
15453
|
if (!view?.editable || !span || !target) return hide();
|
|
15132
15454
|
const next = { ...span.control };
|
|
15133
|
-
const set = (
|
|
15134
|
-
if (value) next[
|
|
15135
|
-
else delete next[
|
|
15455
|
+
const set = (key3, value) => {
|
|
15456
|
+
if (value) next[key3] = value;
|
|
15457
|
+
else delete next[key3];
|
|
15136
15458
|
};
|
|
15137
15459
|
set("alias", title.value);
|
|
15138
15460
|
set("tag", tag.value);
|
|
@@ -16081,8 +16403,13 @@ function createCrossReferenceDialog(getView, getModel, pageOf) {
|
|
|
16081
16403
|
}
|
|
16082
16404
|
function inlinePicture(image, values2) {
|
|
16083
16405
|
const url = image.partName ? values2.pictureUrl?.(image.partName, image.contentType) : void 0;
|
|
16084
|
-
const element = document.createElement(
|
|
16085
|
-
|
|
16406
|
+
const element = document.createElement(
|
|
16407
|
+
url && !pictureNeedsSvg(image.pictureFill) ? "img" : "span"
|
|
16408
|
+
);
|
|
16409
|
+
if (url && image.pictureFill && pictureNeedsSvg(image.pictureFill)) {
|
|
16410
|
+
element.append(pictureSvg(document, image.pictureFill, url, image.widthPx, image.heightPx));
|
|
16411
|
+
element.setAttribute("aria-label", image.altText ?? "");
|
|
16412
|
+
} else if (url) {
|
|
16086
16413
|
element.src = url;
|
|
16087
16414
|
element.alt = image.altText ?? "";
|
|
16088
16415
|
} else element.className = "dve-print-picture-missing";
|
|
@@ -16150,8 +16477,12 @@ function floatingPictures(content, page2, anchorTopPx, values2) {
|
|
|
16150
16477
|
}).map((float) => {
|
|
16151
16478
|
const { xPx, yPx } = floatPosition(float, page2, column, { topPx: anchorTopPx, heightPx: 0 });
|
|
16152
16479
|
const url = values2.pictureUrl?.(float.partName, float.contentType);
|
|
16153
|
-
const element = document.createElement(
|
|
16154
|
-
|
|
16480
|
+
const element = document.createElement(
|
|
16481
|
+
url && !pictureNeedsSvg(float.pictureFill) ? "img" : "div"
|
|
16482
|
+
);
|
|
16483
|
+
if (url && float.pictureFill && pictureNeedsSvg(float.pictureFill))
|
|
16484
|
+
element.append(pictureSvg(document, float.pictureFill, url, float.widthPx, float.heightPx));
|
|
16485
|
+
else if (url) element.src = url;
|
|
16155
16486
|
else element.classList.add("dve-print-picture-missing");
|
|
16156
16487
|
element.classList.add("dve-print-picture", "dve-print-float");
|
|
16157
16488
|
if (float.behindText) element.classList.add("dve-print-float-behind");
|
|
@@ -16501,7 +16832,7 @@ var num = (value) => typeof value === "number" && Number.isFinite(value) ? value
|
|
|
16501
16832
|
function resolvedAttrs(attrs, model) {
|
|
16502
16833
|
const direct = Object.fromEntries(
|
|
16503
16834
|
Object.entries(attrs).filter(
|
|
16504
|
-
([
|
|
16835
|
+
([key3, value]) => value != null && (key3 !== "style" || value !== "")
|
|
16505
16836
|
)
|
|
16506
16837
|
);
|
|
16507
16838
|
const catalog = model?.paragraphStyles;
|
|
@@ -16605,7 +16936,7 @@ function attrChanges(node, changes) {
|
|
|
16605
16936
|
out.lineSpacingTwips = rule === "single" ? 240 : rule === "oneAndHalf" ? 360 : rule === "double" ? 480 : Math.max(24, twips(changes.lineAt ?? 1, 240));
|
|
16606
16937
|
}
|
|
16607
16938
|
}
|
|
16608
|
-
for (const
|
|
16939
|
+
for (const key3 of [
|
|
16609
16940
|
"contextualSpacing",
|
|
16610
16941
|
"widowControl",
|
|
16611
16942
|
"keepNext",
|
|
@@ -16613,7 +16944,7 @@ function attrChanges(node, changes) {
|
|
|
16613
16944
|
"pageBreakBefore",
|
|
16614
16945
|
"suppressLineNumbers"
|
|
16615
16946
|
])
|
|
16616
|
-
if (changes[
|
|
16947
|
+
if (changes[key3] !== void 0) out[key3] = changes[key3];
|
|
16617
16948
|
return out;
|
|
16618
16949
|
}
|
|
16619
16950
|
function applyParagraphFormat(view, changes) {
|
|
@@ -16743,8 +17074,8 @@ function createParagraphDialog(getView, getModel) {
|
|
|
16743
17074
|
out.lineAt = number2(lineAt);
|
|
16744
17075
|
}
|
|
16745
17076
|
for (const [field2, item] of toggles) if (dirty.has(field2)) out[field2] = item.input.checked;
|
|
16746
|
-
for (const
|
|
16747
|
-
if (out[
|
|
17077
|
+
for (const key3 of Object.keys(out))
|
|
17078
|
+
if (out[key3] === void 0) delete out[key3];
|
|
16748
17079
|
return out;
|
|
16749
17080
|
};
|
|
16750
17081
|
const close3 = () => {
|
|
@@ -17064,8 +17395,8 @@ function applyTableProperties(view, rowPatch, marginPatch, cellMarginPatch, cell
|
|
|
17064
17395
|
for (const row3 of context2.rows) {
|
|
17065
17396
|
const node = tr.doc.nodeAt(row3.pos);
|
|
17066
17397
|
const properties = { ...row3.properties, ...rowPatch };
|
|
17067
|
-
for (const
|
|
17068
|
-
if (properties[
|
|
17398
|
+
for (const key3 of Object.keys(properties))
|
|
17399
|
+
if (properties[key3] === void 0) delete properties[key3];
|
|
17069
17400
|
tr.setNodeMarkup(row3.pos, void 0, {
|
|
17070
17401
|
...node.attrs,
|
|
17071
17402
|
properties,
|
|
@@ -17148,7 +17479,7 @@ function createTablePropertiesDialog(viewOf) {
|
|
|
17148
17479
|
const validate = () => {
|
|
17149
17480
|
height.disabled = rule.disabled = !specified.input.checked;
|
|
17150
17481
|
const invalid = Object.entries(controls).some(
|
|
17151
|
-
([
|
|
17482
|
+
([key3, control]) => changed.has(key3) && control instanceof HTMLInputElement && control.type === "number" && (key3 !== "height" || specified.input.checked) && (control.value === "" || !Number.isFinite(Number(control.value)) || Number(control.value) < Number(control.min) || Number(control.value) > Number(control.max))
|
|
17152
17483
|
);
|
|
17153
17484
|
const invalidCell = !cellMargins.valid();
|
|
17154
17485
|
ok.disabled = invalid || invalidCell;
|
|
@@ -17156,13 +17487,13 @@ function createTablePropertiesDialog(viewOf) {
|
|
|
17156
17487
|
localizeElement(message, locale);
|
|
17157
17488
|
return !invalid && !invalidCell;
|
|
17158
17489
|
};
|
|
17159
|
-
for (const [
|
|
17490
|
+
for (const [key3, control] of Object.entries(controls)) {
|
|
17160
17491
|
control.addEventListener("input", () => {
|
|
17161
|
-
changed.add(
|
|
17492
|
+
changed.add(key3);
|
|
17162
17493
|
validate();
|
|
17163
17494
|
});
|
|
17164
17495
|
control.addEventListener("change", () => {
|
|
17165
|
-
changed.add(
|
|
17496
|
+
changed.add(key3);
|
|
17166
17497
|
validate();
|
|
17167
17498
|
});
|
|
17168
17499
|
}
|
|
@@ -18026,6 +18357,198 @@ function createReviewOptionsDialog(getView) {
|
|
|
18026
18357
|
}
|
|
18027
18358
|
};
|
|
18028
18359
|
}
|
|
18360
|
+
var TYPES = [
|
|
18361
|
+
["readOnly", "No changes (Read only)"],
|
|
18362
|
+
["trackedChanges", "Tracked changes"],
|
|
18363
|
+
["comments", "Comments"],
|
|
18364
|
+
["forms", "Filling in forms"]
|
|
18365
|
+
];
|
|
18366
|
+
var STYLE = `.dve-restrict-pane{flex:0 0 300px;min-width:0;max-width:40vw;display:flex;flex-direction:column;overflow:auto;background:var(--surface,#fff);border-left:1px solid var(--line,#ddd);font:13px/1.4 'Segoe UI',sans-serif;color:var(--ink,#222)}
|
|
18367
|
+
.dve-restrict-pane[hidden]{display:none}.dve-restrict-head{display:flex;justify-content:space-between;align-items:center;padding:12px}.dve-restrict-head button{border:0;background:none;color:inherit;font-size:20px;cursor:pointer}.dve-restrict-body{padding:0 12px 12px;display:flex;flex-direction:column;gap:8px}.dve-restrict-body fieldset{border:0;border-top:1px solid var(--line,#ddd);margin:0;padding:8px 0;display:flex;flex-direction:column;gap:6px}.dve-restrict-body legend{font-weight:600;padding:0 4px 0 0}.dve-restrict-body label{display:flex;flex-direction:column;gap:2px}.dve-restrict-body label.dve-dialog-check{flex-direction:row;align-items:center;gap:6px}.dve-restrict-body p{margin:0;color:var(--muted,#666)}.dve-restrict-actions{display:flex;gap:8px;flex-wrap:wrap}`;
|
|
18368
|
+
var password = () => {
|
|
18369
|
+
const input = textInput();
|
|
18370
|
+
input.type = "password";
|
|
18371
|
+
input.autocomplete = "new-password";
|
|
18372
|
+
return input;
|
|
18373
|
+
};
|
|
18374
|
+
function createRestrictEditingPane(host) {
|
|
18375
|
+
const element = document.createElement("aside");
|
|
18376
|
+
element.className = "dve-restrict-pane";
|
|
18377
|
+
element.setAttribute("aria-label", "Restrict editing");
|
|
18378
|
+
element.dataset.title = "Restrict editing";
|
|
18379
|
+
element.hidden = true;
|
|
18380
|
+
let locale = "en";
|
|
18381
|
+
const messages = [document.createElement("p"), document.createElement("p")];
|
|
18382
|
+
for (const message of messages) message.setAttribute("role", "alert");
|
|
18383
|
+
const say = (key3) => {
|
|
18384
|
+
for (const message of messages) message.textContent = key3 ? translate(locale, key3) : "";
|
|
18385
|
+
};
|
|
18386
|
+
const formatting = checkbox("Limit formatting to a selection of styles");
|
|
18387
|
+
const restrict = checkbox("Allow only this type of editing in the document");
|
|
18388
|
+
const type = selectOf(TYPES);
|
|
18389
|
+
type.setAttribute("aria-label", "Allow only this type of editing in the document");
|
|
18390
|
+
const everyone = checkbox("Everyone");
|
|
18391
|
+
const first = password();
|
|
18392
|
+
const again = password();
|
|
18393
|
+
const secret = password();
|
|
18394
|
+
const start2 = dialogButton("Yes, start enforcing protection", true);
|
|
18395
|
+
const stop = dialogButton("Stop protection", true);
|
|
18396
|
+
const highlights = [];
|
|
18397
|
+
const regionControls = () => {
|
|
18398
|
+
const highlight = checkbox("Highlight the regions I can edit");
|
|
18399
|
+
const find = dialogButton("Find next region I can edit");
|
|
18400
|
+
highlights.push(highlight.input);
|
|
18401
|
+
highlight.input.addEventListener("change", () => host.setHighlight(highlight.input.checked));
|
|
18402
|
+
find.addEventListener("click", () => {
|
|
18403
|
+
const view = host.view();
|
|
18404
|
+
const range = view && nextEditableRegion(view.state, host.user());
|
|
18405
|
+
if (!view || !range) return say("There are no regions you can edit");
|
|
18406
|
+
say("");
|
|
18407
|
+
view.dispatch(view.state.tr.setSelection(range).scrollIntoView());
|
|
18408
|
+
view.focus();
|
|
18409
|
+
});
|
|
18410
|
+
return [find, highlight.wrapper];
|
|
18411
|
+
};
|
|
18412
|
+
const enforcedView = [
|
|
18413
|
+
fieldset("Editing restrictions", messages[0]),
|
|
18414
|
+
fieldset("Exceptions (optional)", ...regionControls()),
|
|
18415
|
+
labelled("Password", secret),
|
|
18416
|
+
stop
|
|
18417
|
+
];
|
|
18418
|
+
const settingsView = [
|
|
18419
|
+
fieldset("Formatting restrictions", formatting.wrapper),
|
|
18420
|
+
fieldset("Editing restrictions", restrict.wrapper, type),
|
|
18421
|
+
fieldset("Exceptions (optional)", everyone.wrapper, ...regionControls()),
|
|
18422
|
+
fieldset(
|
|
18423
|
+
"Start enforcement",
|
|
18424
|
+
labelled("Enter new password (optional)", first),
|
|
18425
|
+
labelled("Reenter password to confirm", again),
|
|
18426
|
+
messages[1],
|
|
18427
|
+
start2
|
|
18428
|
+
)
|
|
18429
|
+
];
|
|
18430
|
+
const head = document.createElement("div");
|
|
18431
|
+
head.className = "dve-restrict-head";
|
|
18432
|
+
const title = document.createElement("strong");
|
|
18433
|
+
title.textContent = "Restrict editing";
|
|
18434
|
+
const closeButton = document.createElement("button");
|
|
18435
|
+
closeButton.type = "button";
|
|
18436
|
+
closeButton.textContent = "\xD7";
|
|
18437
|
+
closeButton.setAttribute("aria-label", "Close");
|
|
18438
|
+
const body = document.createElement("div");
|
|
18439
|
+
body.className = "dve-restrict-body";
|
|
18440
|
+
const style = document.createElement("style");
|
|
18441
|
+
style.textContent = STYLE;
|
|
18442
|
+
head.append(title, closeButton);
|
|
18443
|
+
const close3 = () => {
|
|
18444
|
+
element.hidden = true;
|
|
18445
|
+
element.replaceChildren();
|
|
18446
|
+
focusView(host.view());
|
|
18447
|
+
};
|
|
18448
|
+
const enforced = () => {
|
|
18449
|
+
const protection = host.protection();
|
|
18450
|
+
return Boolean(protection?.enforced && protection.edit !== "none");
|
|
18451
|
+
};
|
|
18452
|
+
const selectionIsEditable = () => {
|
|
18453
|
+
const view = host.view();
|
|
18454
|
+
if (!view) return false;
|
|
18455
|
+
const { from: from2, to } = view.state.selection;
|
|
18456
|
+
return from2 < to && (editRestrictionKey.getState(view.state) ?? []).some(
|
|
18457
|
+
(range) => range.group === "everyone" && range.from <= from2 && range.to >= to
|
|
18458
|
+
);
|
|
18459
|
+
};
|
|
18460
|
+
const render = () => {
|
|
18461
|
+
say("");
|
|
18462
|
+
const protection = host.protection();
|
|
18463
|
+
const current2 = enforced();
|
|
18464
|
+
body.replaceChildren(...current2 ? enforcedView : settingsView);
|
|
18465
|
+
for (const input of highlights) input.checked = host.highlight();
|
|
18466
|
+
if (current2) {
|
|
18467
|
+
secret.value = "";
|
|
18468
|
+
secret.parentElement.hidden = !protection?.password && !protection?.unverifiablePassword;
|
|
18469
|
+
say("The document is protected");
|
|
18470
|
+
} else {
|
|
18471
|
+
formatting.input.checked = Boolean(protection?.formatting);
|
|
18472
|
+
const edit = protection?.edit;
|
|
18473
|
+
restrict.input.checked = Boolean(edit && edit !== "none");
|
|
18474
|
+
type.value = edit && edit !== "none" ? edit : "readOnly";
|
|
18475
|
+
type.disabled = !restrict.input.checked;
|
|
18476
|
+
first.value = again.value = "";
|
|
18477
|
+
everyone.input.checked = selectionIsEditable();
|
|
18478
|
+
}
|
|
18479
|
+
localizeElement(element, locale);
|
|
18480
|
+
title.textContent = translate(locale, "Restrict editing");
|
|
18481
|
+
closeButton.setAttribute("aria-label", translate(locale, "Close"));
|
|
18482
|
+
};
|
|
18483
|
+
restrict.input.addEventListener("change", () => {
|
|
18484
|
+
type.disabled = !restrict.input.checked;
|
|
18485
|
+
});
|
|
18486
|
+
everyone.input.addEventListener("change", () => {
|
|
18487
|
+
const view = host.view();
|
|
18488
|
+
if (!view) return;
|
|
18489
|
+
const result = setEditableRegion(view.state, everyone.input.checked);
|
|
18490
|
+
if ("tr" in result) {
|
|
18491
|
+
view.dispatch(result.tr);
|
|
18492
|
+
say("");
|
|
18493
|
+
} else {
|
|
18494
|
+
everyone.input.checked = selectionIsEditable();
|
|
18495
|
+
say(
|
|
18496
|
+
result.error === "empty" ? "Select text first" : "This exception continues into another paragraph; change it in Word"
|
|
18497
|
+
);
|
|
18498
|
+
}
|
|
18499
|
+
});
|
|
18500
|
+
start2.addEventListener("click", () => {
|
|
18501
|
+
const edit = restrict.input.checked ? type.value : "none";
|
|
18502
|
+
if (edit === "none") return say("Choose the type of editing to allow");
|
|
18503
|
+
if (first.value !== again.value) return say("The passwords do not match");
|
|
18504
|
+
host.apply(
|
|
18505
|
+
enforceProtection(edit, {
|
|
18506
|
+
...first.value && { password: first.value },
|
|
18507
|
+
...formatting.input.checked && { formatting: true }
|
|
18508
|
+
})
|
|
18509
|
+
);
|
|
18510
|
+
const view = host.view();
|
|
18511
|
+
if (edit === "trackedChanges" && view && !view.state.doc.attrs.trackChanges)
|
|
18512
|
+
view.dispatch(view.state.tr.setDocAttribute("trackChanges", true));
|
|
18513
|
+
render();
|
|
18514
|
+
});
|
|
18515
|
+
stop.addEventListener("click", () => {
|
|
18516
|
+
const protection = host.protection();
|
|
18517
|
+
const verdict = verifyProtectionPassword(protection, secret.value);
|
|
18518
|
+
if (verdict === void 0)
|
|
18519
|
+
return say("This protection uses a password that cannot be checked here");
|
|
18520
|
+
if (!verdict) return say("Incorrect password");
|
|
18521
|
+
host.apply(
|
|
18522
|
+
protection && {
|
|
18523
|
+
edit: protection.edit,
|
|
18524
|
+
enforced: false,
|
|
18525
|
+
...protection.formatting && { formatting: true }
|
|
18526
|
+
}
|
|
18527
|
+
);
|
|
18528
|
+
render();
|
|
18529
|
+
});
|
|
18530
|
+
closeButton.addEventListener("click", close3);
|
|
18531
|
+
element.addEventListener("keydown", (event) => {
|
|
18532
|
+
if (event.key === "Escape") close3();
|
|
18533
|
+
});
|
|
18534
|
+
return {
|
|
18535
|
+
element,
|
|
18536
|
+
get isOpen() {
|
|
18537
|
+
return !element.hidden;
|
|
18538
|
+
},
|
|
18539
|
+
open() {
|
|
18540
|
+
element.replaceChildren(style, head, body);
|
|
18541
|
+
render();
|
|
18542
|
+
element.hidden = false;
|
|
18543
|
+
element.querySelector("input, select, button")?.focus();
|
|
18544
|
+
},
|
|
18545
|
+
close: close3,
|
|
18546
|
+
setLocale(value) {
|
|
18547
|
+
locale = value;
|
|
18548
|
+
if (!element.hidden) render();
|
|
18549
|
+
}
|
|
18550
|
+
};
|
|
18551
|
+
}
|
|
18029
18552
|
|
|
18030
18553
|
// src/docx/format-dialogs.ts
|
|
18031
18554
|
var FormatDialogs = class {
|
|
@@ -18106,11 +18629,23 @@ var FormatDialogs = class {
|
|
|
18106
18629
|
insertChart: createChartTypeDialog(charts, false),
|
|
18107
18630
|
changeChartType: createChartTypeDialog(charts, true),
|
|
18108
18631
|
chartData: createChartDataDialog(charts),
|
|
18632
|
+
restrictEditing: createRestrictEditingPane({
|
|
18633
|
+
view: () => host.reviewView ? host.reviewView() : host.view(),
|
|
18634
|
+
protection: () => host.restrictEditing?.protection(),
|
|
18635
|
+
apply: (protection) => host.restrictEditing?.apply(protection),
|
|
18636
|
+
user: () => host.restrictEditing?.user() ?? "Author",
|
|
18637
|
+
highlight: () => host.restrictEditing?.highlight() ?? true,
|
|
18638
|
+
setHighlight: (on2) => host.restrictEditing?.setHighlight(on2)
|
|
18639
|
+
}),
|
|
18109
18640
|
tracking: createReviewOptionsDialog(
|
|
18110
18641
|
() => host.reviewView ? host.reviewView() : host.view()
|
|
18111
18642
|
)
|
|
18112
18643
|
};
|
|
18113
18644
|
}
|
|
18645
|
+
/** The Restrict Editing pane docks beside the page; the shell mounts it, not the frame. */
|
|
18646
|
+
get restrictEditingPane() {
|
|
18647
|
+
return this.dialogs.restrictEditing.element;
|
|
18648
|
+
}
|
|
18114
18649
|
get elements() {
|
|
18115
18650
|
return Object.values(this.dialogs).map((dialog) => dialog.element);
|
|
18116
18651
|
}
|
|
@@ -18132,11 +18667,11 @@ var FormatDialogs = class {
|
|
|
18132
18667
|
};
|
|
18133
18668
|
function syncFormatControls(toolbar, state) {
|
|
18134
18669
|
const marked = /* @__PURE__ */ new Map();
|
|
18135
|
-
for (const
|
|
18136
|
-
marked.set(
|
|
18670
|
+
for (const key3 of ["bold", "italic", "underline", "strike", "verticalAlign"])
|
|
18671
|
+
marked.set(key3, /* @__PURE__ */ new Set());
|
|
18137
18672
|
const addMarks = (marks2) => {
|
|
18138
|
-
for (const
|
|
18139
|
-
marked.get(
|
|
18673
|
+
for (const key3 of ["bold", "italic", "underline", "strike"])
|
|
18674
|
+
marked.get(key3).add(marks2.some((mark) => mark.type.name === key3));
|
|
18140
18675
|
const align2 = marks2.find((mark) => mark.type.name === "verticalAlign");
|
|
18141
18676
|
marked.get("verticalAlign").add(Boolean(align2));
|
|
18142
18677
|
};
|
|
@@ -18156,8 +18691,8 @@ function syncFormatControls(toolbar, state) {
|
|
|
18156
18691
|
underline: "Underline",
|
|
18157
18692
|
strike: "Strikethrough"
|
|
18158
18693
|
};
|
|
18159
|
-
for (const [
|
|
18160
|
-
const values2 = marked.get(
|
|
18694
|
+
for (const [key3, label2] of Object.entries(labels3)) {
|
|
18695
|
+
const values2 = marked.get(key3);
|
|
18161
18696
|
findLocalizedControl(toolbar, label2)?.setAttribute(
|
|
18162
18697
|
"aria-pressed",
|
|
18163
18698
|
String(values2.size === 1 && values2.has(true))
|
|
@@ -18250,7 +18785,7 @@ var ALIGN_BUTTONS = [
|
|
|
18250
18785
|
function effectiveAlignment(attrs, model) {
|
|
18251
18786
|
const direct = Object.fromEntries(
|
|
18252
18787
|
Object.entries(attrs).filter(
|
|
18253
|
-
([
|
|
18788
|
+
([key3, value]) => value != null && (key3 !== "style" || value !== "")
|
|
18254
18789
|
)
|
|
18255
18790
|
);
|
|
18256
18791
|
const catalog = model.paragraphStyles;
|
|
@@ -18412,6 +18947,37 @@ function syncRuler(toolbar, view, model) {
|
|
|
18412
18947
|
const zoom = Number(paper?.style.getPropertyValue("--dve-zoom")) || 1;
|
|
18413
18948
|
updateRuler(ruler, rulerGeometry(view, model), zoom);
|
|
18414
18949
|
}
|
|
18950
|
+
var EDITING_PANELS = ["Home", "Insert", "Layout", "References", "Mailings", "Table"];
|
|
18951
|
+
var STAYS_ON = /* @__PURE__ */ new Set(["Copy", "Select all", "Find and replace", "Show paragraph marks"]);
|
|
18952
|
+
var REVIEW_LABELS = ["Track changes", "Accept", "Reject", "Accept all", "Reject all"];
|
|
18953
|
+
var REASON = "Editing is restricted by document protection";
|
|
18954
|
+
var TITLE = "data-protection-title";
|
|
18955
|
+
function syncProtectionControls(toolbar, protection, locale) {
|
|
18956
|
+
const restriction = editRestrictionOf(protection);
|
|
18957
|
+
const lock = (control) => {
|
|
18958
|
+
control.disabled = true;
|
|
18959
|
+
if (!control.hasAttribute(TITLE)) control.setAttribute(TITLE, control.title);
|
|
18960
|
+
control.title = translate(locale, REASON);
|
|
18961
|
+
};
|
|
18962
|
+
for (const control of toolbar.querySelectorAll(`[${TITLE}]`)) {
|
|
18963
|
+
control.title = control.getAttribute(TITLE) ?? "";
|
|
18964
|
+
control.removeAttribute(TITLE);
|
|
18965
|
+
}
|
|
18966
|
+
if (!restriction) return;
|
|
18967
|
+
if (restriction !== "trackedChanges")
|
|
18968
|
+
for (const panel of EDITING_PANELS)
|
|
18969
|
+
for (const control of toolbar.querySelectorAll(
|
|
18970
|
+
`.ribbon-panel[data-panel="${panel}"] button, .ribbon-panel[data-panel="${panel}"] select, .ribbon-panel[data-panel="${panel}"] input`
|
|
18971
|
+
)) {
|
|
18972
|
+
const label2 = control.dataset.localearialabel ?? control.getAttribute("aria-label") ?? "";
|
|
18973
|
+
if (!STAYS_ON.has(label2)) lock(control);
|
|
18974
|
+
}
|
|
18975
|
+
const reviewLabels = restriction === "readOnly" ? [...REVIEW_LABELS, "Add comment", "Delete comment"] : REVIEW_LABELS;
|
|
18976
|
+
for (const label2 of reviewLabels) {
|
|
18977
|
+
const control = findLocalizedControl(toolbar, label2);
|
|
18978
|
+
if (control) lock(control);
|
|
18979
|
+
}
|
|
18980
|
+
}
|
|
18415
18981
|
|
|
18416
18982
|
// src/docx/editor-controls.ts
|
|
18417
18983
|
function refreshEditorControls(toolbar, view, model, readOnly, collaboration, locale, language, printPageStatus, commentsOpen = false, canEditComments = !readOnly && !collaboration) {
|
|
@@ -18492,6 +19058,8 @@ function refreshEditorControls(toolbar, view, model, readOnly, collaboration, lo
|
|
|
18492
19058
|
const control = findLocalizedControl(toolbar, label2);
|
|
18493
19059
|
if (control) control.disabled = readOnly || !enabled;
|
|
18494
19060
|
}
|
|
19061
|
+
if (forcesTrackChanges(model.protection)) trackButton?.setAttribute("aria-pressed", "true");
|
|
19062
|
+
syncProtectionControls(toolbar, model.protection, locale);
|
|
18495
19063
|
}
|
|
18496
19064
|
const words = documentWordCount(state.doc, language || void 0);
|
|
18497
19065
|
const pageText = printPageStatus ? formatPageStatus(locale, printPageStatus.current, printPageStatus.total) : formatPageStatus(locale, 1, 1);
|
|
@@ -19523,7 +20091,11 @@ var PartsController = class {
|
|
|
19523
20091
|
reviewDisplayPlugin(this.reviewMode),
|
|
19524
20092
|
reviewRunMarksPlugin(this.reviewMode),
|
|
19525
20093
|
runStylesPlugin(() => this.host.model(), this.reviewMode),
|
|
19526
|
-
paragraphStylesPlugin(
|
|
20094
|
+
paragraphStylesPlugin(
|
|
20095
|
+
() => this.host.model(),
|
|
20096
|
+
this.reviewMode,
|
|
20097
|
+
(partName, contentType) => this.host.images().urlFor(partName, contentType)
|
|
20098
|
+
)
|
|
19527
20099
|
],
|
|
19528
20100
|
keepOpenWithin: () => this.host.keepOpenWithin(),
|
|
19529
20101
|
activate: (view) => {
|
|
@@ -19544,13 +20116,13 @@ var PartsController = class {
|
|
|
19544
20116
|
registerClose: (close3) => {
|
|
19545
20117
|
this.closeActive = close3;
|
|
19546
20118
|
},
|
|
19547
|
-
...header ? { history: (
|
|
20119
|
+
...header ? { history: (key3) => this.runHistory(key3) } : {}
|
|
19548
20120
|
};
|
|
19549
20121
|
}
|
|
19550
20122
|
/** Header/footer typing and insertion use the body history; notes retain their local stack. */
|
|
19551
|
-
runHistory(
|
|
20123
|
+
runHistory(key3) {
|
|
19552
20124
|
const view = this.host.view();
|
|
19553
|
-
return !!view?.editable && (
|
|
20125
|
+
return !!view?.editable && (key3 === "undo" ? undo : redo)(view.state, view.dispatch);
|
|
19554
20126
|
}
|
|
19555
20127
|
usesBodyHistory() {
|
|
19556
20128
|
return !!this.headerContext;
|
|
@@ -19647,10 +20219,10 @@ var PartsController = class {
|
|
|
19647
20219
|
if (!view?.editable || !this.host.canEditOutsideBody()) return;
|
|
19648
20220
|
const replace = (notes) => notes.map((note) => note.id === id ? { ...note, blocks: structuredClone(blocks) } : note);
|
|
19649
20221
|
const model = this.host.model();
|
|
19650
|
-
const
|
|
20222
|
+
const key3 = kind === "footnote" ? "footnotes" : "endnotes";
|
|
19651
20223
|
const next = {
|
|
19652
20224
|
...model,
|
|
19653
|
-
...model[
|
|
20225
|
+
...model[key3] && { [key3]: replace(model[key3]) }
|
|
19654
20226
|
};
|
|
19655
20227
|
view.dispatch(
|
|
19656
20228
|
view.state.tr.step(new NotePartsStep(notePartsJson(next))).setMeta(HEADER_FOOTER_INPUT, true)
|
|
@@ -19723,10 +20295,10 @@ function withWatermark(model, spec, newId) {
|
|
|
19723
20295
|
base = withBlankHeaderFooter(base, "headers", newId, 0, "default");
|
|
19724
20296
|
const updated = /* @__PURE__ */ new Map();
|
|
19725
20297
|
const change = (content) => {
|
|
19726
|
-
const
|
|
19727
|
-
if (!
|
|
19728
|
-
if (!updated.has(
|
|
19729
|
-
return { ...content, blocks: structuredClone(updated.get(
|
|
20298
|
+
const key3 = content.partName ?? "";
|
|
20299
|
+
if (!key3) return { ...content, blocks: withWatermarkRun(content.blocks, spec, newId) };
|
|
20300
|
+
if (!updated.has(key3)) updated.set(key3, withWatermarkRun(content.blocks, spec, newId));
|
|
20301
|
+
return { ...content, blocks: structuredClone(updated.get(key3)) };
|
|
19730
20302
|
};
|
|
19731
20303
|
return {
|
|
19732
20304
|
...base,
|
|
@@ -19742,8 +20314,8 @@ function withWatermark(model, spec, newId) {
|
|
|
19742
20314
|
};
|
|
19743
20315
|
}
|
|
19744
20316
|
var ALIGNMENTS = ["top", "center", "both", "bottom"];
|
|
19745
|
-
function pageSetupChange(model, index, section3,
|
|
19746
|
-
switch (
|
|
20317
|
+
function pageSetupChange(model, index, section3, key3, value) {
|
|
20318
|
+
switch (key3) {
|
|
19747
20319
|
case "margin":
|
|
19748
20320
|
return setMargins(model, index, value);
|
|
19749
20321
|
case "size":
|
|
@@ -19813,10 +20385,10 @@ function createStatusBar(handlers) {
|
|
|
19813
20385
|
const render = () => {
|
|
19814
20386
|
const t = locale();
|
|
19815
20387
|
const noteKey = model.notes === 1 ? "status.note" : "status.notes";
|
|
19816
|
-
const view = (mode,
|
|
20388
|
+
const view = (mode, key3) => ({
|
|
19817
20389
|
id: mode,
|
|
19818
20390
|
icon: mode === "draft" ? "webLayout" : "printLayout",
|
|
19819
|
-
label: translate(t,
|
|
20391
|
+
label: translate(t, key3),
|
|
19820
20392
|
pressed: model.mode === mode
|
|
19821
20393
|
});
|
|
19822
20394
|
element.state = {
|
|
@@ -19894,14 +20466,14 @@ var PageController = class {
|
|
|
19894
20466
|
userZoomed = false;
|
|
19895
20467
|
observed;
|
|
19896
20468
|
/** Page setup applies to the section holding the selection, as in Word, and is undoable. */
|
|
19897
|
-
changePageSetup(
|
|
20469
|
+
changePageSetup(key3, value) {
|
|
19898
20470
|
const view = this.host.view();
|
|
19899
20471
|
if (!view?.editable || !this.host.canEditOutsideBody()) return;
|
|
19900
20472
|
const model = this.host.model();
|
|
19901
20473
|
const index = currentSectionIndex(view, model);
|
|
19902
20474
|
const section3 = sectionsOf(model)[index];
|
|
19903
20475
|
if (!section3) return;
|
|
19904
|
-
const next = pageSetupChange(model, index, section3,
|
|
20476
|
+
const next = pageSetupChange(model, index, section3, key3, value);
|
|
19905
20477
|
this.dispatchSections(next);
|
|
19906
20478
|
}
|
|
19907
20479
|
/** Shows the selection's section settings in the Layout tab. */
|
|
@@ -20722,7 +21294,7 @@ function createSmartArtDialog(restoreFocus) {
|
|
|
20722
21294
|
element.append(picker, dialogActions(cancel, confirm2));
|
|
20723
21295
|
let locale = "en";
|
|
20724
21296
|
let onChoose;
|
|
20725
|
-
const t = (
|
|
21297
|
+
const t = (key3) => translate(locale, key3);
|
|
20726
21298
|
const fill = () => {
|
|
20727
21299
|
picker.labels = { categories: t("SmartArt categories"), layouts: t("SmartArt layouts") };
|
|
20728
21300
|
picker.categories = DIAGRAM_INSERT_CATEGORIES.map((category) => ({
|
|
@@ -20839,20 +21411,20 @@ var SmartArtController = class {
|
|
|
20839
21411
|
this.run(action.key);
|
|
20840
21412
|
return true;
|
|
20841
21413
|
}
|
|
20842
|
-
run(
|
|
21414
|
+
run(key3) {
|
|
20843
21415
|
const view = this.host.view();
|
|
20844
21416
|
if (!view || !selectedDiagram(view.state)) return;
|
|
20845
|
-
if (
|
|
21417
|
+
if (key3 === "textPane") {
|
|
20846
21418
|
this.text.setOpen(!this.text.open);
|
|
20847
21419
|
return;
|
|
20848
21420
|
}
|
|
20849
|
-
if (
|
|
21421
|
+
if (key3 === "changeLayout") {
|
|
20850
21422
|
this.dialog.open((preset) => void this.relayout(preset), void 0);
|
|
20851
21423
|
return;
|
|
20852
21424
|
}
|
|
20853
21425
|
this.refocus = true;
|
|
20854
21426
|
try {
|
|
20855
|
-
this.text.runCommand(
|
|
21427
|
+
this.text.runCommand(key3);
|
|
20856
21428
|
} finally {
|
|
20857
21429
|
this.refocus = false;
|
|
20858
21430
|
}
|
|
@@ -20938,7 +21510,7 @@ var SmartArtController = class {
|
|
|
20938
21510
|
setLocale(locale) {
|
|
20939
21511
|
this.locale = locale;
|
|
20940
21512
|
this.dialog.setLocale(locale);
|
|
20941
|
-
this.text.setLabels((
|
|
21513
|
+
this.text.setLabels((key3) => translate(locale, key3));
|
|
20942
21514
|
}
|
|
20943
21515
|
/** A new document: no current node, and the text pane closed. */
|
|
20944
21516
|
reset() {
|
|
@@ -20962,6 +21534,12 @@ var InsertController = class {
|
|
|
20962
21534
|
this.pictureInput.hidden = true;
|
|
20963
21535
|
this.pictureInput.className = "dve-picture-input";
|
|
20964
21536
|
this.pictureInput.addEventListener("change", () => void this.insertSelectedPicture());
|
|
21537
|
+
this.bulletInput = document.createElement("input");
|
|
21538
|
+
this.bulletInput.type = "file";
|
|
21539
|
+
this.bulletInput.accept = Object.keys(PICTURE_TYPES).join(",");
|
|
21540
|
+
this.bulletInput.hidden = true;
|
|
21541
|
+
this.bulletInput.className = "dve-picture-bullet-input";
|
|
21542
|
+
this.bulletInput.addEventListener("change", () => void this.applySelectedPictureBullet());
|
|
20965
21543
|
this.smartArt = new SmartArtController({
|
|
20966
21544
|
view: () => host.view(),
|
|
20967
21545
|
contentWidth: () => host.contentWidth(),
|
|
@@ -20977,6 +21555,8 @@ var InsertController = class {
|
|
|
20977
21555
|
linkDialog;
|
|
20978
21556
|
pictureDialog;
|
|
20979
21557
|
pictureInput;
|
|
21558
|
+
/** File chooser behind Bullets > Picture bullet. */
|
|
21559
|
+
bulletInput;
|
|
20980
21560
|
/** Bytes for pictures inserted since the document was loaded; passed to save. */
|
|
20981
21561
|
pendingMedia = /* @__PURE__ */ new Map();
|
|
20982
21562
|
/** The shape Insert > Shapes armed for the next drag on the page. */
|
|
@@ -20994,6 +21574,8 @@ var InsertController = class {
|
|
|
20994
21574
|
if (this.smartArt.handle(action)) return true;
|
|
20995
21575
|
if (action.type === "insertPicture") {
|
|
20996
21576
|
if (editable2) this.pictureInput.click();
|
|
21577
|
+
} else if (action.type === "pictureBullet") {
|
|
21578
|
+
if (editable2) this.bulletInput.click();
|
|
20997
21579
|
} else if (action.type === "insertContentControl") {
|
|
20998
21580
|
const tr = view?.editable && insertContentControl(view.state, action.value);
|
|
20999
21581
|
if (view && tr) view.dispatch(tr.scrollIntoView());
|
|
@@ -21077,13 +21659,13 @@ var InsertController = class {
|
|
|
21077
21659
|
];
|
|
21078
21660
|
}
|
|
21079
21661
|
runShapeAction(view, action) {
|
|
21080
|
-
const { key:
|
|
21081
|
-
if (
|
|
21082
|
-
else if (
|
|
21083
|
-
else if (
|
|
21084
|
-
else if (
|
|
21085
|
-
else if (
|
|
21086
|
-
else if (
|
|
21662
|
+
const { key: key3, value } = action;
|
|
21663
|
+
if (key3 === "fill") setShapeFill(view, String(value));
|
|
21664
|
+
else if (key3 === "outline") setShapeOutline(view, String(value));
|
|
21665
|
+
else if (key3 === "weight") setShapeWeight(view, Number(value));
|
|
21666
|
+
else if (key3 === "width") setShapeSize(view, Number(value) * 96, void 0);
|
|
21667
|
+
else if (key3 === "height") setShapeSize(view, void 0, Number(value) * 96);
|
|
21668
|
+
else if (key3 === "wrap") setShapeWrap(view, String(value));
|
|
21087
21669
|
}
|
|
21088
21670
|
handleClick(view, pos, event) {
|
|
21089
21671
|
return (event.ctrlKey || event.metaKey) && followLinkAt(view, pos);
|
|
@@ -21104,6 +21686,7 @@ var InsertController = class {
|
|
|
21104
21686
|
this.pictureDialog.setLocale(locale);
|
|
21105
21687
|
this.smartArt.setLocale(locale);
|
|
21106
21688
|
this.pictureInput.setAttribute("aria-label", translate(locale, "Insert picture"));
|
|
21689
|
+
this.bulletInput.setAttribute("aria-label", translate(locale, "Picture bullet..."));
|
|
21107
21690
|
}
|
|
21108
21691
|
/** Re-applies the hidden-text display state after the paper is rebuilt. */
|
|
21109
21692
|
syncPaper() {
|
|
@@ -21153,6 +21736,34 @@ var InsertController = class {
|
|
|
21153
21736
|
this.pictureInput.value = "";
|
|
21154
21737
|
if (file) await this.insertPictureFile(file);
|
|
21155
21738
|
}
|
|
21739
|
+
async applySelectedPictureBullet() {
|
|
21740
|
+
const file = this.bulletInput.files?.[0];
|
|
21741
|
+
this.bulletInput.value = "";
|
|
21742
|
+
if (file) await this.applyPictureBulletFile(file);
|
|
21743
|
+
}
|
|
21744
|
+
/** Stages `file` as a new picture bullet and starts a list that uses it. */
|
|
21745
|
+
async applyPictureBulletFile(file) {
|
|
21746
|
+
const view = this.host.view();
|
|
21747
|
+
if (!view?.editable) return false;
|
|
21748
|
+
try {
|
|
21749
|
+
const contentType = file.type.toLowerCase();
|
|
21750
|
+
if (!PICTURE_TYPES[contentType])
|
|
21751
|
+
throw new Error("Choose a PNG, JPEG, GIF or BMP picture for a picture bullet.");
|
|
21752
|
+
const bytes = await readBytes(file);
|
|
21753
|
+
if (this.host.view() !== view || !view.editable) return false;
|
|
21754
|
+
const partName = (this.host.newMediaPartName ?? newPicturePartName)(contentType);
|
|
21755
|
+
const part = { bytes, contentType };
|
|
21756
|
+
this.host.stageMedia?.(partName, part);
|
|
21757
|
+
this.pendingMedia.set(partName, part);
|
|
21758
|
+
applyPictureBulletList(view, this.host.model(), { partName, contentType });
|
|
21759
|
+
this.host.refresh?.();
|
|
21760
|
+
focusView(view);
|
|
21761
|
+
return true;
|
|
21762
|
+
} catch (cause) {
|
|
21763
|
+
this.host.reportError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
21764
|
+
return false;
|
|
21765
|
+
}
|
|
21766
|
+
}
|
|
21156
21767
|
/** Stages `file` and inserts it at the selection; false when it could not be inserted. */
|
|
21157
21768
|
async insertPictureFile(file) {
|
|
21158
21769
|
const view = this.host.view();
|
|
@@ -21385,6 +21996,16 @@ var EditorCore = class {
|
|
|
21385
21996
|
section: () => this.pages.currentSection(),
|
|
21386
21997
|
canEdit: () => !this.readOnly && !this.collab.active,
|
|
21387
21998
|
apply: (columns, footnoteColumns) => this.pages.applyColumns(columns, footnoteColumns)
|
|
21999
|
+
},
|
|
22000
|
+
restrictEditing: {
|
|
22001
|
+
protection: () => this.model.protection,
|
|
22002
|
+
apply: (protection) => this.applyProtection(protection),
|
|
22003
|
+
user: () => this.reviewAuthor,
|
|
22004
|
+
highlight: () => this.highlightEditableRegions,
|
|
22005
|
+
setHighlight: (on2) => {
|
|
22006
|
+
this.highlightEditableRegions = on2;
|
|
22007
|
+
this.view?.dispatch(this.view.state.tr.setMeta("docx-protection", true));
|
|
22008
|
+
}
|
|
21388
22009
|
}
|
|
21389
22010
|
});
|
|
21390
22011
|
this.imageMedia = new ImageMediaCache(
|
|
@@ -21399,7 +22020,7 @@ var EditorCore = class {
|
|
|
21399
22020
|
},
|
|
21400
22021
|
locale: () => this.locale,
|
|
21401
22022
|
// A document protected for forms lets only its body's fields change, as in Word.
|
|
21402
|
-
canEditOutsideBody: () => !this.readOnly && !this.collab.active && !
|
|
22023
|
+
canEditOutsideBody: () => !this.readOnly && !this.collab.active && !locksStories(this.model.protection),
|
|
21403
22024
|
edited: () => this.markEditedOutsideBody(),
|
|
21404
22025
|
reportError: (cause) => dispatchDocumentError(element, cause)
|
|
21405
22026
|
};
|
|
@@ -21520,6 +22141,18 @@ var EditorCore = class {
|
|
|
21520
22141
|
contentWidth() {
|
|
21521
22142
|
return this.model.page.width - this.model.page.marginLeft - this.model.page.marginRight;
|
|
21522
22143
|
}
|
|
22144
|
+
/** Review > Restrict Editing > Highlight the regions I can edit. */
|
|
22145
|
+
highlightEditableRegions = true;
|
|
22146
|
+
/** Starts or stops Review > Restrict Editing; saving writes it to settings.xml. */
|
|
22147
|
+
applyProtection(protection) {
|
|
22148
|
+
const { protection: _previous, ...rest } = this.model;
|
|
22149
|
+
this.model = protection ? { ...rest, protection } : rest;
|
|
22150
|
+
if (locksStories(protection) && this.parts.activeView())
|
|
22151
|
+
this.parts.closeHeaderFooter(this.shell.canvas, this.shell.paper);
|
|
22152
|
+
this.view?.dispatch(this.view.state.tr.setMeta("docx-protection", true));
|
|
22153
|
+
this.markEditedOutsideBody();
|
|
22154
|
+
this.refreshControls();
|
|
22155
|
+
}
|
|
21523
22156
|
canEditBody() {
|
|
21524
22157
|
return !this.readOnly && (!this.collab.yjs || this.collab.yjs.session.canWrite());
|
|
21525
22158
|
}
|
|
@@ -21688,7 +22321,7 @@ var ribbon_polish_default = "/* Ribbon polish: distinct pressed state and Word's
|
|
|
21688
22321
|
var ribbon_home_menus_default = ".ribbon-command-split {\n flex: none;\n height: 28px;\n}\n.ribbon-command-split .ribbon-menu.ribbon-menu-caret {\n width: 14px;\n height: 28px;\n}\n.ribbon-command-split-large {\n flex-direction: column;\n height: 74px;\n}\n.ribbon-group .ribbon-command-split-large .ribbon-large {\n height: 56px;\n min-height: 56px;\n}\n.ribbon-command-split-large .ribbon-menu.ribbon-menu-caret {\n width: 100%;\n height: 18px;\n}\n.ribbon-command-split[data-dve-hidden] {\n display: none;\n}\n";
|
|
21689
22322
|
|
|
21690
22323
|
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/docx/styles/document.css?raw
|
|
21691
|
-
var document_default = ".dve-revision-insert {\n color: var(--dve-revision-color, inherit);\n text-decoration: underline;\n text-decoration-color: var(--dve-revision-color, currentColor);\n}\n.dve-revision-delete {\n color: var(--dve-revision-color, inherit);\n text-decoration: line-through;\n text-decoration-color: var(--dve-revision-color, currentColor);\n}\n/* Moved text, like Word: green, double underline at the destination, double strike at the source. */\n.dve-revision-move {\n --dve-revision-color: #2e7d32;\n text-decoration-style: double;\n}\n.ProseMirror .dve-revision-hidden {\n /* Review visibility takes precedence over picture/equation node-view display rules. */\n display: none !important;\n}\n[data-review-display]:not([data-review-display='all']) .dve-revision-insert,\n[data-review-display]:not([data-review-display='all']) .dve-revision-delete {\n color: inherit;\n text-decoration: none;\n}\n[data-review-display]:not([data-review-display='all']) .dve-comment-range {\n background: transparent;\n}\n.dve-revision-format-markup {\n outline: 1px dotted currentColor;\n outline-offset: 2px;\n}\n.dve-comment-range {\n background: rgba(255, 212, 0, 0.28);\n}\n.dve-paper {\n box-sizing: border-box;\n position: relative;\n flex: none;\n margin: 0 auto;\n background: var(--dve-page-color, var(--office-paper, #fff));\n color: #202124;\n box-shadow:\n 0 1px 3px #20212430,\n 0 4px 12px #20212420;\n outline: none;\n /* Single spacing and no paragraph gap unless the document's styles set them, as in Word. */\n font:\n 11pt/1.2 Calibri,\n Carlito,\n Arial,\n sans-serif;\n zoom: var(--dve-zoom, 1);\n}\n.dve-paper p {\n min-height: 1.2em;\n margin: 0;\n white-space: pre-wrap;\n}\n.dve-paper p:last-child {\n margin-bottom: 0;\n}\n/* The caret marks focus in the document, as in Word; no ring around the editable area. */\n.dve-paper .ProseMirror:focus,\n.dve-paper .ProseMirror:focus-visible {\n outline: none;\n}\n.dve-paper:focus {\n box-shadow:\n 0 1px 3px #20212430,\n 0 4px 12px #20212420,\n 0 0 0 1px var(--blue);\n}\n/* Columns follow the table's grid and cell widths (equal when it has none), as Word lays them out;\n tables add no space around themselves. */\n.dve-paper table {\n width: 100%;\n table-layout: fixed;\n border-collapse: collapse;\n margin: 0;\n}\n.dve-paper td {\n min-width: 44px;\n border: var(--dve-cell-border, 1px dashed #c8c6c4);\n vertical-align: top;\n}\n.dve-paper td p {\n margin: 0;\n}\n.dve-paper p[data-list-label]::before {\n content: attr(data-list-label);\n white-space: pre;\n user-select: none;\n}\n.dve-paper p[data-list-marker]:not([data-list-marker=''])::before {\n content: attr(data-list-marker);\n position: absolute;\n left: var(--dve-marker-left);\n text-indent: 0;\n font-family: var(--dve-marker-family);\n font-size: var(--dve-marker-size);\n font-weight: var(--dve-marker-weight);\n font-style: var(--dve-marker-style);\n color: var(--dve-marker-color);\n}\n.multilingual-controls {\n flex: 1 1 100%;\n align-items: flex-start;\n gap: 9px 14px;\n}\n.multilingual-language-control {\n display: grid;\n grid-template-columns: minmax(145px, 180px);\n gap: 4px;\n color: var(--muted);\n font-size: 11px;\n}\n.multilingual-language-control select,\n.multilingual-language-control input {\n box-sizing: border-box;\n width: 180px;\n}\n.multilingual-language-control input {\n height: 26px;\n border: 1px solid var(--line);\n border-radius: 3px;\n background: var(--surface);\n padding: 0 7px;\n color: var(--ink);\n font: 11px var(--office-font, system-ui, sans-serif);\n}\n.multilingual-note {\n align-self: end;\n max-width: 240px;\n color: var(--muted);\n font-size: 11px;\n}\n@media (max-width: 650px) {\n .ribbon-panel {\n min-height: 96px;\n padding: 6px;\n gap: 4px;\n }\n .ribbon-group {\n padding-right: 7px;\n }\n .ribbon-panel[data-panel='Home'] .ribbon-group[data-label='Font'] {\n width: 340px;\n }\n .ribbon-panel[data-panel='Home'] .ribbon-group[data-label='Paragraph'] {\n width: 280px;\n }\n .ribbon-panel[data-panel='Home'] .ribbon-group[data-label='Editing'] {\n width: auto;\n }\n .ribbon-group button {\n min-width: 34px;\n min-height: 34px;\n }\n .ribbon-group select {\n max-width: min(150px, 42vw);\n }\n .dve-canvas {\n padding: 18px 8px 38px;\n align-items: flex-start;\n }\n .ribbon-group select.font-family-select {\n width: 120px;\n max-width: 38vw;\n }\n .ribbon-group select.font-size-select {\n width: 56px;\n }\n .ribbon-group select.spacing-select {\n width: min(128px, 36vw);\n }\n .ribbon-group select.line-spacing-select {\n width: min(112px, 32vw);\n }\n}\n.dve-break-marker {\n display: block;\n margin: 0.4em 0;\n padding: 2px 0;\n border-top: 1px dashed var(--muted);\n border-bottom: 1px dashed var(--muted);\n color: var(--muted);\n font-size: 10px;\n text-align: center;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n user-select: none;\n}\n.dve-note-reference {\n color: var(--blue);\n cursor: default;\n}\n.dve-header,\n.dve-footer {\n box-sizing: border-box;\n width: 816px;\n max-width: 100%;\n margin: 0 auto;\n padding: 10px clamp(16px, 5vw, 70px);\n background: var(--surface);\n color: var(--muted);\n font:\n 10pt/1.35 Calibri,\n Arial,\n sans-serif;\n}\n.dve-header {\n border-bottom: 1px dashed var(--line);\n}\n.dve-footer {\n border-top: 1px dashed var(--line);\n}\n.dve-header-footer-label {\n margin-bottom: 2px;\n color: var(--muted);\n font-size: 10px;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n}\n.dve-notes-container {\n box-sizing: border-box;\n width: 816px;\n max-width: 100%;\n margin: 12px auto 0;\n}\n.dve-notes {\n box-sizing: border-box;\n padding: 10px clamp(16px, 5vw, 70px);\n background: var(--surface);\n border-top: 1px solid var(--line);\n font:\n 10pt/1.35 Calibri,\n Arial,\n sans-serif;\n}\n.dve-notes-heading {\n margin: 0 0 6px;\n color: var(--ink);\n font-size: 12px;\n}\n.dve-note-list {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.dve-note-list li {\n display: flex;\n gap: 4px;\n align-items: baseline;\n margin-bottom: 4px;\n}\n.dve-note-marker {\n flex: none;\n color: var(--muted);\n}\n@media (prefers-reduced-motion: reduce) {\n * {\n scroll-behavior: auto !important;\n }\n}\n\n/* Print Layout: a read-only, paginated render kept beside the continuous\n editing surface (see print-layout.ts / print-layout-view.ts). */\n";
|
|
22324
|
+
var document_default = ".dve-revision-insert {\n color: var(--dve-revision-color, inherit);\n text-decoration: underline;\n text-decoration-color: var(--dve-revision-color, currentColor);\n}\n.dve-revision-delete {\n color: var(--dve-revision-color, inherit);\n text-decoration: line-through;\n text-decoration-color: var(--dve-revision-color, currentColor);\n}\n/* Moved text, like Word: green, double underline at the destination, double strike at the source. */\n.dve-revision-move {\n --dve-revision-color: #2e7d32;\n text-decoration-style: double;\n}\n.ProseMirror .dve-revision-hidden {\n /* Review visibility takes precedence over picture/equation node-view display rules. */\n display: none !important;\n}\n[data-review-display]:not([data-review-display='all']) .dve-revision-insert,\n[data-review-display]:not([data-review-display='all']) .dve-revision-delete {\n color: inherit;\n text-decoration: none;\n}\n[data-review-display]:not([data-review-display='all']) .dve-comment-range {\n background: transparent;\n}\n.dve-revision-format-markup {\n outline: 1px dotted currentColor;\n outline-offset: 2px;\n}\n.dve-comment-range {\n background: rgba(255, 212, 0, 0.28);\n}\n.dve-paper {\n box-sizing: border-box;\n position: relative;\n flex: none;\n margin: 0 auto;\n background: var(--dve-page-color, var(--office-paper, #fff));\n color: #202124;\n box-shadow:\n 0 1px 3px #20212430,\n 0 4px 12px #20212420;\n outline: none;\n /* Single spacing and no paragraph gap unless the document's styles set them, as in Word. */\n font:\n 11pt/1.2 Calibri,\n Carlito,\n Arial,\n sans-serif;\n zoom: var(--dve-zoom, 1);\n}\n.dve-paper p {\n min-height: 1.2em;\n margin: 0;\n white-space: pre-wrap;\n}\n.dve-paper p:last-child {\n margin-bottom: 0;\n}\n/* The caret marks focus in the document, as in Word; no ring around the editable area. */\n.dve-paper .ProseMirror:focus,\n.dve-paper .ProseMirror:focus-visible {\n outline: none;\n}\n.dve-paper:focus {\n box-shadow:\n 0 1px 3px #20212430,\n 0 4px 12px #20212420,\n 0 0 0 1px var(--blue);\n}\n/* Columns follow the table's grid and cell widths (equal when it has none), as Word lays them out;\n tables add no space around themselves. */\n.dve-paper table {\n width: 100%;\n table-layout: fixed;\n border-collapse: collapse;\n margin: 0;\n}\n.dve-paper td {\n min-width: 44px;\n border: var(--dve-cell-border, 1px dashed #c8c6c4);\n vertical-align: top;\n}\n.dve-paper td p {\n margin: 0;\n}\n.dve-paper p[data-list-label]::before {\n content: attr(data-list-label);\n white-space: pre;\n user-select: none;\n}\n.dve-paper p[data-list-marker]:not([data-list-marker=''])::before {\n content: attr(data-list-marker);\n position: absolute;\n left: var(--dve-marker-left);\n text-indent: 0;\n font-family: var(--dve-marker-family);\n font-size: var(--dve-marker-size);\n font-weight: var(--dve-marker-weight);\n font-style: var(--dve-marker-style);\n color: var(--dve-marker-color);\n}\n/* A picture bullet replaces the marker text with its image, sized by the list-marker display. */\n.dve-paper p[data-list-marker-picture]::before {\n content: '';\n display: block;\n width: var(--dve-marker-pic-w);\n height: var(--dve-marker-pic-h);\n background: var(--dve-marker-image) center / contain no-repeat;\n}\n.multilingual-controls {\n flex: 1 1 100%;\n align-items: flex-start;\n gap: 9px 14px;\n}\n.multilingual-language-control {\n display: grid;\n grid-template-columns: minmax(145px, 180px);\n gap: 4px;\n color: var(--muted);\n font-size: 11px;\n}\n.multilingual-language-control select,\n.multilingual-language-control input {\n box-sizing: border-box;\n width: 180px;\n}\n.multilingual-language-control input {\n height: 26px;\n border: 1px solid var(--line);\n border-radius: 3px;\n background: var(--surface);\n padding: 0 7px;\n color: var(--ink);\n font: 11px var(--office-font, system-ui, sans-serif);\n}\n.multilingual-note {\n align-self: end;\n max-width: 240px;\n color: var(--muted);\n font-size: 11px;\n}\n@media (max-width: 650px) {\n .ribbon-panel {\n min-height: 96px;\n padding: 6px;\n gap: 4px;\n }\n .ribbon-group {\n padding-right: 7px;\n }\n .ribbon-panel[data-panel='Home'] .ribbon-group[data-label='Font'] {\n width: 340px;\n }\n .ribbon-panel[data-panel='Home'] .ribbon-group[data-label='Paragraph'] {\n width: 280px;\n }\n .ribbon-panel[data-panel='Home'] .ribbon-group[data-label='Editing'] {\n width: auto;\n }\n .ribbon-group button {\n min-width: 34px;\n min-height: 34px;\n }\n .ribbon-group select {\n max-width: min(150px, 42vw);\n }\n .dve-canvas {\n padding: 18px 8px 38px;\n align-items: flex-start;\n }\n .ribbon-group select.font-family-select {\n width: 120px;\n max-width: 38vw;\n }\n .ribbon-group select.font-size-select {\n width: 56px;\n }\n .ribbon-group select.spacing-select {\n width: min(128px, 36vw);\n }\n .ribbon-group select.line-spacing-select {\n width: min(112px, 32vw);\n }\n}\n.dve-break-marker {\n display: block;\n margin: 0.4em 0;\n padding: 2px 0;\n border-top: 1px dashed var(--muted);\n border-bottom: 1px dashed var(--muted);\n color: var(--muted);\n font-size: 10px;\n text-align: center;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n user-select: none;\n}\n.dve-note-reference {\n color: var(--blue);\n cursor: default;\n}\n.dve-header,\n.dve-footer {\n box-sizing: border-box;\n width: 816px;\n max-width: 100%;\n margin: 0 auto;\n padding: 10px clamp(16px, 5vw, 70px);\n background: var(--surface);\n color: var(--muted);\n font:\n 10pt/1.35 Calibri,\n Arial,\n sans-serif;\n}\n.dve-header {\n border-bottom: 1px dashed var(--line);\n}\n.dve-footer {\n border-top: 1px dashed var(--line);\n}\n.dve-header-footer-label {\n margin-bottom: 2px;\n color: var(--muted);\n font-size: 10px;\n text-transform: uppercase;\n letter-spacing: 0.04em;\n}\n.dve-notes-container {\n box-sizing: border-box;\n width: 816px;\n max-width: 100%;\n margin: 12px auto 0;\n}\n.dve-notes {\n box-sizing: border-box;\n padding: 10px clamp(16px, 5vw, 70px);\n background: var(--surface);\n border-top: 1px solid var(--line);\n font:\n 10pt/1.35 Calibri,\n Arial,\n sans-serif;\n}\n.dve-notes-heading {\n margin: 0 0 6px;\n color: var(--ink);\n font-size: 12px;\n}\n.dve-note-list {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n.dve-note-list li {\n display: flex;\n gap: 4px;\n align-items: baseline;\n margin-bottom: 4px;\n}\n.dve-note-marker {\n flex: none;\n color: var(--muted);\n}\n@media (prefers-reduced-motion: reduce) {\n * {\n scroll-behavior: auto !important;\n }\n}\n\n/* Print Layout: a read-only, paginated render kept beside the continuous\n editing surface (see print-layout.ts / print-layout-view.ts). */\n";
|
|
21692
22325
|
|
|
21693
22326
|
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/docx/styles/underline.css?raw
|
|
21694
22327
|
var underline_default = `/* Styled runs paint their own underline. Do not superimpose the semantic mark's single line. */
|
|
@@ -21738,7 +22371,7 @@ var keyboard_menu_default = "/* Keyboard shortcut help. The context menu is the
|
|
|
21738
22371
|
var smartart_default = "/* SmartArt: a read-only display of the diagram's saved drawing */\n.dve-smartart {\n position: relative;\n max-width: 100%;\n box-sizing: border-box;\n vertical-align: bottom;\n line-height: normal;\n}\n.dve-smartart:not(.dve-float-left):not(.dve-float-right):not(.dve-float-block) {\n display: inline-block;\n}\n.dve-smartart:focus-visible {\n outline: 2px solid var(--word);\n outline-offset: 2px;\n}\n.dve-smartart-selected {\n outline: 2px solid var(--word);\n outline-offset: 1px;\n}\n.dve-smartart-drawing {\n display: block;\n width: 100%;\n height: 100%;\n}\n.dve-smartart-box {\n overflow: auto;\n border: 1px dashed var(--line);\n background: var(--canvas);\n color: var(--text, #1f1f1f);\n font-size: 12px;\n}\n.dve-smartart-placeholder {\n display: block;\n padding: 6px 8px;\n}\n.dve-smartart-heading {\n display: block;\n color: var(--muted);\n font-size: 11px;\n}\n.dve-smartart-placeholder ul,\n.dve-smartart-notes ul {\n margin: 4px 0 0;\n padding-left: 18px;\n}\n.dve-smartart-info {\n position: absolute;\n top: 2px;\n right: 2px;\n display: none;\n width: 20px;\n height: 20px;\n padding: 0;\n border: 1px solid var(--line);\n border-radius: 50%;\n background: var(--surface, #fff);\n color: var(--muted);\n font: italic 700 12px/1 serif;\n cursor: pointer;\n}\n.dve-smartart:hover .dve-smartart-info,\n.dve-smartart:focus-within .dve-smartart-info,\n.dve-smartart-selected .dve-smartart-info,\n.dve-smartart-info[aria-expanded='true'] {\n display: block;\n}\n.dve-smartart-notes {\n position: absolute;\n z-index: 3;\n top: 26px;\n right: 2px;\n width: max-content;\n max-width: min(320px, 90%);\n padding: 6px 8px;\n border: 1px solid var(--line);\n border-radius: var(--dve-radius, var(--office-radius, 4px));\n background: var(--surface, #fff);\n color: var(--text, #1f1f1f);\n font-size: 11px;\n text-align: left;\n box-shadow: 0 2px 8px rgb(0 0 0 / 0.18);\n}\n.dve-smartart-notes[hidden] {\n display: none;\n}\n/* The SmartArt text pane docks beside the page while a SmartArt is selected and the pane is open. */\n.dve-smartart-text-pane {\n flex: none;\n align-self: flex-start;\n width: 260px;\n max-width: 40%;\n margin: 12px 12px 0 0;\n}\n.dve-smartart-text-pane[hidden] {\n display: none;\n}\n.dve-smartart-dialog .dve-smartart-picker {\n display: grid;\n width: min(760px, 86vw);\n}\n";
|
|
21739
22372
|
|
|
21740
22373
|
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/docx/styles/content-controls.css?raw
|
|
21741
|
-
var content_controls_default = "/* Content controls (w:sdt): Word's hover and selected outline, title tab and grey placeholder. */\n.dve-sdt {\n position: relative;\n box-decoration-break: clone;\n -webkit-box-decoration-break: clone;\n}\n.dve-sdt[data-sdt-placeholder],\np[data-sdt-block] .dve-sdt[data-sdt-placeholder],\ntd[data-sdt-cell][data-sdt-placeholder] {\n color: #808080;\n}\n.dve-sdt:hover,\n.dve-sdt.dve-sdt-active,\np[data-sdt-block]:hover,\np[data-sdt-block].dve-sdt-active,\ntd[data-sdt-cell]:hover,\ntd[data-sdt-cell].dve-sdt-active {\n outline: 1px solid var(--dve-sdt-outline, #b6b6b6);\n outline-offset: 1px;\n}\n/* A control around a table cell outlines the cell inside its borders. */\ntd[data-sdt-cell] {\n position: relative;\n}\ntd[data-sdt-cell]:hover,\ntd[data-sdt-cell].dve-sdt-active {\n outline-offset: -2px;\n}\n.dve-sdt.dve-sdt-active,\np[data-sdt-block].dve-sdt-active,\ntd[data-sdt-cell].dve-sdt-active {\n outline-color: var(--dve-sdt-active, #4472c4);\n}\n/* The title tab sits above the control while it is hovered or holds the caret. */\n.dve-sdt[data-sdt-title]:hover::before,\n.dve-sdt[data-sdt-title].dve-sdt-active::before,\np[data-sdt-block][data-sdt-title]:hover::before,\np[data-sdt-block][data-sdt-title].dve-sdt-active::before,\ntd[data-sdt-cell][data-sdt-title]:hover::before,\ntd[data-sdt-cell][data-sdt-title].dve-sdt-active::before {\n content: attr(data-sdt-title);\n position: absolute;\n left: -1px;\n bottom: 100%;\n max-width: 22em;\n padding: 0 6px;\n overflow: hidden;\n background: var(--dve-sdt-active, #4472c4);\n color: #fff;\n font: 11px/16px var(--office-font, system-ui, sans-serif);\n text-overflow: ellipsis;\n white-space: nowrap;\n pointer-events: none;\n z-index: 2;\n}\np[data-sdt-block] {\n position: relative;\n}\np[data-sdt-block][data-sdt-title]:hover::before,\np[data-sdt-block][data-sdt-title].dve-sdt-active::before,\ntd[data-sdt-cell][data-sdt-title]:hover::before,\ntd[data-sdt-cell][data-sdt-title].dve-sdt-active::before {\n bottom: auto;\n top: -17px;\n}\n/* A drop-down, combo box or date picker shows its arrow at the end. */\n.dve-sdt[data-sdt-kind='dropDownList'].dve-sdt-active::after,\n.dve-sdt[data-sdt-kind='comboBox'].dve-sdt-active::after,\n.dve-sdt[data-sdt-kind='date'].dve-sdt-active::after,\n.dve-sdt[data-sdt-kind='dropDownList']:hover::after,\n.dve-sdt[data-sdt-kind='comboBox']:hover::after,\n.dve-sdt[data-sdt-kind='date']:hover::after {\n content: '\\25be';\n display: inline-block;\n width: 16px;\n margin-left: 4px;\n background: var(--dve-sdt-active, #4472c4);\n color: #fff;\n font-size: 11px;\n line-height: 16px;\n text-align: center;\n vertical-align: baseline;\n cursor: pointer;\n}\n.dve-sdt[data-sdt-kind='date']:hover::after,\n.dve-sdt[data-sdt-kind='date'].dve-sdt-active::after {\n content: '\\25bc';\n font-size: 8px;\n}\n.dve-sdt[data-sdt-kind='checkbox'],\ntd[data-sdt-cell][data-sdt-kind='checkbox'],\ntd[data-sdt-cell][data-sdt-kind='dropDownList'] {\n cursor: pointer;\n}\n/* A drop-down or date cell shows its arrow at the cell's top right corner. */\ntd[data-sdt-cell][data-sdt-kind='dropDownList']:is(:hover, .dve-sdt-active)::after,\ntd[data-sdt-cell][data-sdt-kind='comboBox']:is(:hover, .dve-sdt-active)::after,\ntd[data-sdt-cell][data-sdt-kind='date']:is(:hover, .dve-sdt-active)::after {\n content: '\\25be';\n position: absolute;\n top: 2px;\n right: 2px;\n width: 16px;\n background: var(--dve-sdt-active, #4472c4);\n color: #fff;\n font-size: 11px;\n line-height: 16px;\n text-align: center;\n pointer-events: none;\n}\n.dve-sdt[data-sdt-lock='sdtLocked']:hover,\n.dve-sdt[data-sdt-lock='sdtContentLocked']:hover {\n outline-style: solid;\n}\n\n/* The calendar and list popups of drop-down, combo box and date controls. */\n.ribbon-popover.sdt-calendar {\n display: grid;\n gap: 6px;\n width: 224px;\n padding: 8px;\n}\n.sdt-calendar-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n color: var(--ink);\n font: 600 13px var(--office-font, system-ui, sans-serif);\n}\n.sdt-calendar-head button,\n.sdt-calendar-foot button {\n min-width: 26px;\n height: 24px;\n border: 1px solid transparent;\n background: transparent;\n color: var(--ink);\n font: inherit;\n cursor: pointer;\n}\n.sdt-calendar-head button:hover,\n.sdt-calendar-foot button:hover {\n background: var(--accent-soft);\n}\n.sdt-calendar-grid {\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n gap: 1px;\n text-align: center;\n}\n.sdt-calendar-grid span,\n.sdt-calendar-grid button {\n height: 26px;\n border: 1px solid transparent;\n background: transparent;\n color: var(--ink);\n font: 12px var(--office-font, system-ui, sans-serif);\n line-height: 24px;\n}\n.sdt-calendar-grid span {\n color: var(--muted);\n}\n.sdt-calendar-grid button {\n cursor: pointer;\n}\n.sdt-calendar-grid button:hover,\n.sdt-calendar-grid button:focus-visible {\n background: var(--accent-soft);\n}\n.sdt-calendar-grid button.outside {\n color: var(--muted);\n}\n.sdt-calendar-grid button.today {\n border-color: var(--blue);\n}\n.sdt-calendar-grid button.selected {\n background: var(--blue);\n color: #fff;\n}\n.sdt-calendar-foot {\n display: flex;\n justify-content: center;\n}\n\n/* Insert > Equation dialog: the LaTeX source and the live preview. */\n.dve-equation-source {\n width: 100%;\n box-sizing: border-box;\n font:\n 13px/1.4 Consolas,\n 'Cascadia Mono',\n monospace;\n}\n.dve-equation-preview {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 64px;\n padding: 8px;\n overflow: auto;\n border: 1px solid var(--line);\n background: var(--surface);\n color: var(--ink);\n font-size: 20px;\n}\n\n/* Legacy form fields: Word shades a text field's result, and draws a check box or a drop-down's\n entry from the field's data on its (otherwise hidden) begin marker. */\n.ProseMirror:not([data-form-shading='off']) span[data-field='FORMTEXT'],\n.ProseMirror:not([data-form-shading='off']) .dve-form-field {\n background-color: var(--dve-form-field-shading, #d9d9d9);\n}\n.dve-field-marker.dve-form-field {\n font-size: inherit;\n cursor: default;\n}\n";
|
|
22374
|
+
var content_controls_default = "/* Content controls (w:sdt): Word's hover and selected outline, title tab and grey placeholder. */\n.dve-sdt {\n position: relative;\n box-decoration-break: clone;\n -webkit-box-decoration-break: clone;\n}\n.dve-sdt[data-sdt-placeholder],\np[data-sdt-block] .dve-sdt[data-sdt-placeholder],\ntd[data-sdt-cell][data-sdt-placeholder] {\n color: #808080;\n}\n.dve-sdt:hover,\n.dve-sdt.dve-sdt-active,\np[data-sdt-block]:hover,\np[data-sdt-block].dve-sdt-active,\ntd[data-sdt-cell]:hover,\ntd[data-sdt-cell].dve-sdt-active {\n outline: 1px solid var(--dve-sdt-outline, #b6b6b6);\n outline-offset: 1px;\n}\n/* A control around a table cell outlines the cell inside its borders. */\ntd[data-sdt-cell] {\n position: relative;\n}\ntd[data-sdt-cell]:hover,\ntd[data-sdt-cell].dve-sdt-active {\n outline-offset: -2px;\n}\n.dve-sdt.dve-sdt-active,\np[data-sdt-block].dve-sdt-active,\ntd[data-sdt-cell].dve-sdt-active {\n outline-color: var(--dve-sdt-active, #4472c4);\n}\n/* The title tab sits above the control while it is hovered or holds the caret. */\n.dve-sdt[data-sdt-title]:hover::before,\n.dve-sdt[data-sdt-title].dve-sdt-active::before,\np[data-sdt-block][data-sdt-title]:hover::before,\np[data-sdt-block][data-sdt-title].dve-sdt-active::before,\ntd[data-sdt-cell][data-sdt-title]:hover::before,\ntd[data-sdt-cell][data-sdt-title].dve-sdt-active::before {\n content: attr(data-sdt-title);\n position: absolute;\n left: -1px;\n bottom: 100%;\n max-width: 22em;\n padding: 0 6px;\n overflow: hidden;\n background: var(--dve-sdt-active, #4472c4);\n color: #fff;\n font: 11px/16px var(--office-font, system-ui, sans-serif);\n text-overflow: ellipsis;\n white-space: nowrap;\n pointer-events: none;\n z-index: 2;\n}\np[data-sdt-block] {\n position: relative;\n}\np[data-sdt-block][data-sdt-title]:hover::before,\np[data-sdt-block][data-sdt-title].dve-sdt-active::before,\ntd[data-sdt-cell][data-sdt-title]:hover::before,\ntd[data-sdt-cell][data-sdt-title].dve-sdt-active::before {\n bottom: auto;\n top: -17px;\n}\n/* A drop-down, combo box or date picker shows its arrow at the end. */\n.dve-sdt[data-sdt-kind='dropDownList'].dve-sdt-active::after,\n.dve-sdt[data-sdt-kind='comboBox'].dve-sdt-active::after,\n.dve-sdt[data-sdt-kind='date'].dve-sdt-active::after,\n.dve-sdt[data-sdt-kind='dropDownList']:hover::after,\n.dve-sdt[data-sdt-kind='comboBox']:hover::after,\n.dve-sdt[data-sdt-kind='date']:hover::after {\n content: '\\25be';\n display: inline-block;\n width: 16px;\n margin-left: 4px;\n background: var(--dve-sdt-active, #4472c4);\n color: #fff;\n font-size: 11px;\n line-height: 16px;\n text-align: center;\n vertical-align: baseline;\n cursor: pointer;\n}\n.dve-sdt[data-sdt-kind='date']:hover::after,\n.dve-sdt[data-sdt-kind='date'].dve-sdt-active::after {\n content: '\\25bc';\n font-size: 8px;\n}\n.dve-sdt[data-sdt-kind='checkbox'],\ntd[data-sdt-cell][data-sdt-kind='checkbox'],\ntd[data-sdt-cell][data-sdt-kind='dropDownList'] {\n cursor: pointer;\n}\n/* A drop-down or date cell shows its arrow at the cell's top right corner. */\ntd[data-sdt-cell][data-sdt-kind='dropDownList']:is(:hover, .dve-sdt-active)::after,\ntd[data-sdt-cell][data-sdt-kind='comboBox']:is(:hover, .dve-sdt-active)::after,\ntd[data-sdt-cell][data-sdt-kind='date']:is(:hover, .dve-sdt-active)::after {\n content: '\\25be';\n position: absolute;\n top: 2px;\n right: 2px;\n width: 16px;\n background: var(--dve-sdt-active, #4472c4);\n color: #fff;\n font-size: 11px;\n line-height: 16px;\n text-align: center;\n pointer-events: none;\n}\n.dve-sdt[data-sdt-lock='sdtLocked']:hover,\n.dve-sdt[data-sdt-lock='sdtContentLocked']:hover {\n outline-style: solid;\n}\n\n/* The calendar and list popups of drop-down, combo box and date controls. */\n.ribbon-popover.sdt-calendar {\n display: grid;\n gap: 6px;\n width: 224px;\n padding: 8px;\n}\n.sdt-calendar-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n color: var(--ink);\n font: 600 13px var(--office-font, system-ui, sans-serif);\n}\n.sdt-calendar-head button,\n.sdt-calendar-foot button {\n min-width: 26px;\n height: 24px;\n border: 1px solid transparent;\n background: transparent;\n color: var(--ink);\n font: inherit;\n cursor: pointer;\n}\n.sdt-calendar-head button:hover,\n.sdt-calendar-foot button:hover {\n background: var(--accent-soft);\n}\n.sdt-calendar-grid {\n display: grid;\n grid-template-columns: repeat(7, 1fr);\n gap: 1px;\n text-align: center;\n}\n.sdt-calendar-grid span,\n.sdt-calendar-grid button {\n height: 26px;\n border: 1px solid transparent;\n background: transparent;\n color: var(--ink);\n font: 12px var(--office-font, system-ui, sans-serif);\n line-height: 24px;\n}\n.sdt-calendar-grid span {\n color: var(--muted);\n}\n.sdt-calendar-grid button {\n cursor: pointer;\n}\n.sdt-calendar-grid button:hover,\n.sdt-calendar-grid button:focus-visible {\n background: var(--accent-soft);\n}\n.sdt-calendar-grid button.outside {\n color: var(--muted);\n}\n.sdt-calendar-grid button.today {\n border-color: var(--blue);\n}\n.sdt-calendar-grid button.selected {\n background: var(--blue);\n color: #fff;\n}\n.sdt-calendar-foot {\n display: flex;\n justify-content: center;\n}\n\n/* Insert > Equation dialog: the LaTeX source and the live preview. */\n.dve-equation-source {\n width: 100%;\n box-sizing: border-box;\n font:\n 13px/1.4 Consolas,\n 'Cascadia Mono',\n monospace;\n}\n.dve-equation-preview {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 64px;\n padding: 8px;\n overflow: auto;\n border: 1px solid var(--line);\n background: var(--surface);\n color: var(--ink);\n font-size: 20px;\n}\n\n/* Legacy form fields: Word shades a text field's result, and draws a check box or a drop-down's\n entry from the field's data on its (otherwise hidden) begin marker. */\n.ProseMirror:not([data-form-shading='off']) span[data-field='FORMTEXT'],\n.ProseMirror:not([data-form-shading='off']) .dve-form-field {\n background-color: var(--dve-form-field-shading, #d9d9d9);\n}\n.dve-field-marker.dve-form-field {\n font-size: inherit;\n cursor: default;\n}\n\n/* Restrict Editing: the regions the document lets the current user edit, highlighted as Word does. */\n.ProseMirror .dve-editable-region {\n background-color: var(--dve-editable-region, rgba(255, 213, 79, 0.35));\n box-shadow: inset 0 -1px 0 rgba(191, 144, 0, 0.55);\n}\n";
|
|
21742
22375
|
|
|
21743
22376
|
// raw-css:/home/runner/work/ooxml/ooxml/src/ui/src/docx/styles/shapes.css?raw
|
|
21744
22377
|
var shapes_default = "/* Drawing shapes on the editing surface, the draw tool and the Insert > Shapes gallery. */\n.ProseMirror p {\n position: relative;\n}\n.dve-shape {\n display: inline-block;\n position: relative;\n vertical-align: bottom;\n line-height: 0;\n}\n.dve-shape svg {\n display: block;\n}\n.dve-shape-floating {\n position: absolute;\n z-index: 2;\n}\n.dve-shape-floating.dve-shape-behind {\n z-index: 0;\n}\n.dve-shape-selected {\n outline: 2px solid var(--blue, #2b579a);\n outline-offset: 2px;\n}\n.dve-shape-handle {\n display: none;\n position: absolute;\n right: -6px;\n bottom: -6px;\n width: 9px;\n height: 9px;\n border: 1px solid var(--blue, #2b579a);\n background: #fff;\n cursor: nwse-resize;\n}\n.dve-shape-selected .dve-shape-handle {\n display: block;\n}\n.dve-drawing-shape,\n.dve-drawing-shape * {\n cursor: crosshair !important;\n}\n.dve-shape-rubber {\n position: fixed;\n z-index: 1000;\n border: 1px dashed var(--blue, #2b579a);\n background: rgba(68, 114, 196, 0.12);\n pointer-events: none;\n}\n\n.ribbon-popover.shape-picker {\n width: 244px;\n max-height: 420px;\n padding: 6px 8px 8px;\n overflow-y: auto;\n}\n.shape-picker h4 {\n margin: 6px 0 4px;\n color: var(--muted);\n font: 600 11px var(--office-font, system-ui, sans-serif);\n}\n.shape-picker-grid {\n display: grid;\n grid-template-columns: repeat(8, 26px);\n gap: 2px;\n}\n.shape-picker-grid button {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 26px;\n height: 26px;\n padding: 0;\n border: 1px solid transparent;\n background: transparent;\n cursor: pointer;\n}\n.shape-picker-grid button:hover,\n.shape-picker-grid button:focus-visible {\n border-color: var(--blue, #2b579a);\n background: var(--accent-soft);\n}\n";
|
|
@@ -21772,77 +22405,66 @@ var editorStyleText = [
|
|
|
21772
22405
|
content_controls_default,
|
|
21773
22406
|
shapes_default
|
|
21774
22407
|
].join("\n");
|
|
21775
|
-
function
|
|
21776
|
-
|
|
21777
|
-
|
|
21778
|
-
|
|
21779
|
-
const
|
|
21780
|
-
|
|
21781
|
-
|
|
21782
|
-
|
|
21783
|
-
|
|
21784
|
-
|
|
21785
|
-
|
|
21786
|
-
|
|
21787
|
-
|
|
21788
|
-
|
|
21789
|
-
|
|
21790
|
-
|
|
21791
|
-
|
|
21792
|
-
}
|
|
21793
|
-
|
|
21794
|
-
|
|
21795
|
-
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
|
|
21799
|
-
|
|
21800
|
-
|
|
22408
|
+
function findableText(doc) {
|
|
22409
|
+
let text = "";
|
|
22410
|
+
const from2 = [];
|
|
22411
|
+
const to = [];
|
|
22412
|
+
const add = (char, start2, end2) => {
|
|
22413
|
+
text += char;
|
|
22414
|
+
from2.push(start2);
|
|
22415
|
+
to.push(end2);
|
|
22416
|
+
};
|
|
22417
|
+
let previous = null;
|
|
22418
|
+
const inline = (parent, start2) => {
|
|
22419
|
+
parent.forEach((child, offset) => {
|
|
22420
|
+
const pos = start2 + offset;
|
|
22421
|
+
if (child.isText) {
|
|
22422
|
+
const value = child.text ?? "";
|
|
22423
|
+
for (let index = 0; index < value.length; index++)
|
|
22424
|
+
add(value.charAt(index), pos + index, pos + index + 1);
|
|
22425
|
+
} else if (child.type.name === "hardBreak") {
|
|
22426
|
+
add(FIND_LINE_BREAK, pos, pos + child.nodeSize);
|
|
22427
|
+
} else if (child.type.name === "pageBreak" && child.attrs.kind !== "column") {
|
|
22428
|
+
add(FIND_PAGE_BREAK, pos, pos + child.nodeSize);
|
|
22429
|
+
} else if (child.isLeaf) {
|
|
22430
|
+
add(FIND_OBJECT, pos, pos + child.nodeSize);
|
|
22431
|
+
} else {
|
|
22432
|
+
inline(child, pos + 1);
|
|
22433
|
+
}
|
|
22434
|
+
});
|
|
21801
22435
|
};
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21806
|
-
|
|
21807
|
-
|
|
21808
|
-
|
|
21809
|
-
|
|
21810
|
-
|
|
21811
|
-
|
|
21812
|
-
|
|
21813
|
-
|
|
21814
|
-
|
|
21815
|
-
|
|
21816
|
-
|
|
21817
|
-
|
|
21818
|
-
|
|
21819
|
-
|
|
21820
|
-
kept += text[index];
|
|
21821
|
-
offsets.push(index);
|
|
21822
|
-
}
|
|
21823
|
-
return { text: kept, offsets };
|
|
21824
|
-
}
|
|
21825
|
-
function collectMatches(doc, query, caseSensitive) {
|
|
21826
|
-
const literal = query.replaceAll(SOFT_HYPHEN, "");
|
|
21827
|
-
if (!literal) return [];
|
|
21828
|
-
const expression = new RegExp(escapedLiteral(literal), caseSensitive ? "gu" : "giu");
|
|
21829
|
-
const matches = [];
|
|
21830
|
-
doc.descendants((node, pos) => {
|
|
21831
|
-
if (node.type.name !== "paragraph") return;
|
|
21832
|
-
for (const segment of paragraphSegments(node, pos)) {
|
|
21833
|
-
const boundaries = graphemeBoundaries(segment.text);
|
|
21834
|
-
const { text, offsets } = withoutSoftHyphens(segment.text);
|
|
21835
|
-
expression.lastIndex = 0;
|
|
21836
|
-
for (const match of text.matchAll(expression)) {
|
|
21837
|
-
const start2 = offsets[match.index];
|
|
21838
|
-
const end2 = offsets[match.index + match[0].length - 1] + 1;
|
|
21839
|
-
if (boundaries.has(start2) && boundaries.has(end2))
|
|
21840
|
-
matches.push({ from: segment.from + start2, to: segment.from + end2 });
|
|
22436
|
+
const block = (parent, start2) => {
|
|
22437
|
+
parent.forEach((child, offset) => {
|
|
22438
|
+
const pos = start2 + offset;
|
|
22439
|
+
if (child.isTextblock) {
|
|
22440
|
+
const contentStart = pos + 1;
|
|
22441
|
+
if (previous)
|
|
22442
|
+
add(
|
|
22443
|
+
previous.parent === parent ? FIND_PARAGRAPH_MARK : FIND_OBJECT,
|
|
22444
|
+
previous.end,
|
|
22445
|
+
contentStart
|
|
22446
|
+
);
|
|
22447
|
+
inline(child, contentStart);
|
|
22448
|
+
previous = { parent, end: pos + child.nodeSize - 1 };
|
|
22449
|
+
} else if (child.isLeaf) {
|
|
22450
|
+
add(FIND_OBJECT, pos, pos + child.nodeSize);
|
|
22451
|
+
previous = null;
|
|
22452
|
+
} else {
|
|
22453
|
+
block(child, pos + 1);
|
|
21841
22454
|
}
|
|
21842
|
-
}
|
|
21843
|
-
|
|
21844
|
-
|
|
21845
|
-
return
|
|
22455
|
+
});
|
|
22456
|
+
};
|
|
22457
|
+
block(doc, 0);
|
|
22458
|
+
return { text, from: from2, to };
|
|
22459
|
+
}
|
|
22460
|
+
function findDocumentMatches(doc, query, options = {}) {
|
|
22461
|
+
const flat = findableText(doc);
|
|
22462
|
+
return findMatches(flat.text, query, options).map((match) => ({
|
|
22463
|
+
from: expectDefined(flat.from[match.start], "match start"),
|
|
22464
|
+
to: expectDefined(flat.to[match.end - 1], "match end"),
|
|
22465
|
+
text: match.text,
|
|
22466
|
+
groups: match.groups
|
|
22467
|
+
}));
|
|
21846
22468
|
}
|
|
21847
22469
|
function marksAt(doc, pos) {
|
|
21848
22470
|
const $pos = doc.resolve(pos);
|
|
@@ -21850,32 +22472,126 @@ function marksAt(doc, pos) {
|
|
|
21850
22472
|
if ($pos.nodeBefore?.isText) return $pos.nodeBefore.marks;
|
|
21851
22473
|
return $pos.marks();
|
|
21852
22474
|
}
|
|
22475
|
+
function replacementParagraphs(schema2, parts, marks2) {
|
|
22476
|
+
const paragraphs = [[]];
|
|
22477
|
+
let buffer = "";
|
|
22478
|
+
const flush = () => {
|
|
22479
|
+
if (!buffer) return;
|
|
22480
|
+
const content = paragraphs[paragraphs.length - 1];
|
|
22481
|
+
content?.push(schema2.text(buffer, insertedTextMarks(marks2, buffer)));
|
|
22482
|
+
buffer = "";
|
|
22483
|
+
};
|
|
22484
|
+
const inline = (node) => {
|
|
22485
|
+
flush();
|
|
22486
|
+
paragraphs[paragraphs.length - 1]?.push(node);
|
|
22487
|
+
};
|
|
22488
|
+
const text = (value) => {
|
|
22489
|
+
for (const char of value) {
|
|
22490
|
+
if (char === FIND_PARAGRAPH_MARK) {
|
|
22491
|
+
flush();
|
|
22492
|
+
paragraphs.push([]);
|
|
22493
|
+
} else if (char === FIND_LINE_BREAK) {
|
|
22494
|
+
inline(
|
|
22495
|
+
expectDefined(schema2.nodes.hardBreak, "hardBreak node type").create(null, null, marks2)
|
|
22496
|
+
);
|
|
22497
|
+
} else if (char === FIND_PAGE_BREAK) {
|
|
22498
|
+
inline(
|
|
22499
|
+
expectDefined(schema2.nodes.pageBreak, "pageBreak node type").create(
|
|
22500
|
+
{ kind: "page" },
|
|
22501
|
+
null,
|
|
22502
|
+
marks2
|
|
22503
|
+
)
|
|
22504
|
+
);
|
|
22505
|
+
} else if (char !== FIND_OBJECT) {
|
|
22506
|
+
buffer += char;
|
|
22507
|
+
}
|
|
22508
|
+
}
|
|
22509
|
+
};
|
|
22510
|
+
for (const part of parts) {
|
|
22511
|
+
if (part.kind === "text") text(part.text);
|
|
22512
|
+
else if (part.kind === "paragraph") {
|
|
22513
|
+
flush();
|
|
22514
|
+
paragraphs.push([]);
|
|
22515
|
+
} else if (part.kind === "lineBreak") text(FIND_LINE_BREAK);
|
|
22516
|
+
else if (part.kind === "pageBreak") text(FIND_PAGE_BREAK);
|
|
22517
|
+
else if (part.kind === "tab") text(" ");
|
|
22518
|
+
else if (part.kind === "optionalHyphen") text("\xAD");
|
|
22519
|
+
else if (part.kind === "nonBreakingHyphen") text("\u2011");
|
|
22520
|
+
else text("\xA0");
|
|
22521
|
+
}
|
|
22522
|
+
flush();
|
|
22523
|
+
return paragraphs;
|
|
22524
|
+
}
|
|
22525
|
+
function replaceTargets(state, targets) {
|
|
22526
|
+
const { schema: schema2 } = state;
|
|
22527
|
+
const ids = /* @__PURE__ */ new Set();
|
|
22528
|
+
state.doc.descendants((node) => {
|
|
22529
|
+
if (typeof node.attrs.id === "string" && node.attrs.id) ids.add(node.attrs.id);
|
|
22530
|
+
});
|
|
22531
|
+
let counter3 = 0;
|
|
22532
|
+
const nextId = () => {
|
|
22533
|
+
let id = "";
|
|
22534
|
+
do
|
|
22535
|
+
id = `dve-find-${++counter3}`;
|
|
22536
|
+
while (ids.has(id));
|
|
22537
|
+
ids.add(id);
|
|
22538
|
+
return id;
|
|
22539
|
+
};
|
|
22540
|
+
const paragraph2 = expectDefined(schema2.nodes.paragraph, "paragraph node type");
|
|
22541
|
+
let transaction = state.tr;
|
|
22542
|
+
for (const target of [...targets].sort((left, right) => right.from - left.from)) {
|
|
22543
|
+
const $from = state.doc.resolve(target.from);
|
|
22544
|
+
const attrs = $from.parent.attrs;
|
|
22545
|
+
const blocks = replacementParagraphs(schema2, target.parts, marksAt(state.doc, target.from));
|
|
22546
|
+
const nodes = blocks.map(
|
|
22547
|
+
(content, index) => paragraph2.create(index === 0 ? attrs : { ...attrs, id: nextId() }, content)
|
|
22548
|
+
);
|
|
22549
|
+
transaction = transaction.replace(
|
|
22550
|
+
target.from,
|
|
22551
|
+
target.to,
|
|
22552
|
+
new Slice(Fragment.from(nodes), 1, 1)
|
|
22553
|
+
);
|
|
22554
|
+
}
|
|
22555
|
+
return transaction;
|
|
22556
|
+
}
|
|
22557
|
+
|
|
22558
|
+
// src/docx/search-controller.ts
|
|
21853
22559
|
var SearchController = class {
|
|
21854
22560
|
constructor(getView) {
|
|
21855
22561
|
this.getView = getView;
|
|
21856
22562
|
}
|
|
21857
22563
|
getView;
|
|
21858
22564
|
query = "";
|
|
21859
|
-
|
|
22565
|
+
options = {};
|
|
21860
22566
|
matches = [];
|
|
21861
22567
|
activeIndex = -1;
|
|
22568
|
+
invalid = false;
|
|
21862
22569
|
get status() {
|
|
21863
22570
|
return {
|
|
21864
22571
|
query: this.query,
|
|
21865
22572
|
count: this.matches.length,
|
|
21866
22573
|
active: this.activeIndex < 0 ? 0 : this.activeIndex + 1,
|
|
21867
|
-
readOnly: !this.getView()?.editable
|
|
22574
|
+
readOnly: !this.getView()?.editable,
|
|
22575
|
+
invalid: this.invalid
|
|
21868
22576
|
};
|
|
21869
22577
|
}
|
|
21870
|
-
search(query,
|
|
22578
|
+
search(query, options = this.options) {
|
|
21871
22579
|
this.query = query;
|
|
21872
|
-
this.
|
|
21873
|
-
|
|
21874
|
-
this.activeIndex = this.indexAtSelection();
|
|
21875
|
-
return this.status;
|
|
22580
|
+
this.options = options;
|
|
22581
|
+
return this.refresh();
|
|
21876
22582
|
}
|
|
21877
22583
|
refresh() {
|
|
21878
|
-
|
|
22584
|
+
const view = this.getView();
|
|
22585
|
+
this.matches = [];
|
|
22586
|
+
this.invalid = false;
|
|
22587
|
+
if (view) {
|
|
22588
|
+
try {
|
|
22589
|
+
this.matches = findDocumentMatches(view.state.doc, this.query, this.options);
|
|
22590
|
+
} catch (error) {
|
|
22591
|
+
if (!(error instanceof FindPatternError)) throw error;
|
|
22592
|
+
this.invalid = true;
|
|
22593
|
+
}
|
|
22594
|
+
}
|
|
21879
22595
|
this.activeIndex = this.indexAtSelection();
|
|
21880
22596
|
return this.status;
|
|
21881
22597
|
}
|
|
@@ -21917,8 +22633,7 @@ var SearchController = class {
|
|
|
21917
22633
|
if (this.activeIndex < 0 && !this.findNext()) return false;
|
|
21918
22634
|
const match = this.matches[this.activeIndex];
|
|
21919
22635
|
if (!match) return false;
|
|
21920
|
-
this.replace(view, [match], replacement);
|
|
21921
|
-
return true;
|
|
22636
|
+
return this.replace(view, [match], replacement);
|
|
21922
22637
|
}
|
|
21923
22638
|
replaceAll(replacement) {
|
|
21924
22639
|
const view = this.getView();
|
|
@@ -21926,12 +22641,7 @@ var SearchController = class {
|
|
|
21926
22641
|
this.refresh();
|
|
21927
22642
|
if (!this.matches.length) return 0;
|
|
21928
22643
|
const targets = [...this.matches];
|
|
21929
|
-
this.replace(view, targets, replacement);
|
|
21930
|
-
return targets.length;
|
|
21931
|
-
}
|
|
21932
|
-
currentMatches() {
|
|
21933
|
-
const view = this.getView();
|
|
21934
|
-
return view ? collectMatches(view.state.doc, this.query, this.caseSensitive) : [];
|
|
22644
|
+
return this.replace(view, targets, replacement) ? targets.length : 0;
|
|
21935
22645
|
}
|
|
21936
22646
|
indexAtSelection() {
|
|
21937
22647
|
const selection = this.getView()?.state.selection;
|
|
@@ -21949,35 +22659,29 @@ var SearchController = class {
|
|
|
21949
22659
|
);
|
|
21950
22660
|
return match;
|
|
21951
22661
|
}
|
|
22662
|
+
/** Replaces the matches (in document order) in one undoable step; false if the replacement is invalid. */
|
|
21952
22663
|
replace(view, matches, replacement) {
|
|
21953
|
-
const
|
|
21954
|
-
let
|
|
21955
|
-
|
|
21956
|
-
|
|
21957
|
-
|
|
21958
|
-
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
22664
|
+
const wildcards = Boolean(this.options.wildcards);
|
|
22665
|
+
let targets;
|
|
22666
|
+
try {
|
|
22667
|
+
targets = matches.map((match) => ({
|
|
22668
|
+
from: match.from,
|
|
22669
|
+
to: match.to,
|
|
22670
|
+
parts: replacementParts(replacement, match, wildcards)
|
|
22671
|
+
}));
|
|
22672
|
+
} catch (error) {
|
|
22673
|
+
if (!(error instanceof FindPatternError)) throw error;
|
|
22674
|
+
this.invalid = true;
|
|
22675
|
+
return false;
|
|
22676
|
+
}
|
|
22677
|
+
const transaction = replaceTargets(view.state, targets);
|
|
22678
|
+
const cursor = transaction.mapping.map(expectDefined(matches[0], "first match").to, 1);
|
|
22679
|
+
const selection = TextSelection.near(transaction.doc.resolve(cursor));
|
|
22680
|
+
view.dispatch(closeHistory(transaction.setSelection(selection).scrollIntoView()));
|
|
21965
22681
|
this.refresh();
|
|
22682
|
+
return true;
|
|
21966
22683
|
}
|
|
21967
22684
|
};
|
|
21968
|
-
function replacementFragment(schema2, replacement, marks2) {
|
|
21969
|
-
if (!replacement) return Fragment.empty;
|
|
21970
|
-
const lines3 = replacement.split(/\r\n|\r|\n/);
|
|
21971
|
-
const content = [];
|
|
21972
|
-
lines3.forEach((line, index) => {
|
|
21973
|
-
if (line) content.push(schema2.text(line, insertedTextMarks(marks2, line)));
|
|
21974
|
-
if (index < lines3.length - 1)
|
|
21975
|
-
content.push(
|
|
21976
|
-
expectDefined(schema2.nodes.hardBreak, "hardBreak node type").create(null, null, marks2)
|
|
21977
|
-
);
|
|
21978
|
-
});
|
|
21979
|
-
return Fragment.fromArray(content);
|
|
21980
|
-
}
|
|
21981
22685
|
|
|
21982
22686
|
// src/docx/search-panel.ts
|
|
21983
22687
|
var styleText = `
|
|
@@ -21986,11 +22690,45 @@ var styleText = `
|
|
|
21986
22690
|
.dve-search-panel label{display:flex;flex-direction:column;gap:3px;color:var(--muted,#666)}
|
|
21987
22691
|
.dve-search-panel input[type=search],.dve-search-panel input[type=text]{box-sizing:border-box;width:clamp(130px,20vw,220px);height:29px;padding:4px 7px;border:1px solid var(--line,#ddd);border-radius:3px;background:var(--surface,#fff);color:var(--ink,#222);font:inherit}
|
|
21988
22692
|
.dve-search-panel .case{flex-direction:row;align-items:center;align-self:center;gap:5px;white-space:nowrap}
|
|
22693
|
+
.dve-search-panel .dve-search-options{display:flex;flex-basis:100%;flex-wrap:wrap;gap:6px 16px;padding-top:4px}
|
|
22694
|
+
.dve-search-panel .dve-search-options[hidden]{display:none}
|
|
22695
|
+
.dve-search-panel .dve-search-options label{flex-direction:row;align-items:center;gap:5px;white-space:nowrap}
|
|
22696
|
+
.dve-search-panel .dve-search-options label[aria-disabled=true]{opacity:.55}
|
|
22697
|
+
.dve-search-panel select{height:29px;padding:0 6px;border:1px solid var(--line,#ddd);border-radius:3px;background:var(--surface,#fff);color:var(--ink,#222);font:inherit}
|
|
21989
22698
|
.dve-search-panel button{height:29px;padding:0 9px;border:1px solid var(--line,#ddd);border-radius:3px;background:var(--surface,#fff);color:var(--ink,#222);font:inherit;cursor:pointer}
|
|
21990
22699
|
.dve-search-panel button:hover:not(:disabled){border-color:var(--blue,#1769aa)}
|
|
21991
22700
|
.dve-search-panel button:disabled{opacity:.55;cursor:default}
|
|
21992
22701
|
.dve-search-panel [role=status]{min-width:100px;color:var(--muted,#666)}
|
|
21993
22702
|
`;
|
|
22703
|
+
var SPECIAL_CODES = [
|
|
22704
|
+
["Paragraph Mark", "^p"],
|
|
22705
|
+
["Tab Character", "^t"],
|
|
22706
|
+
["Any Character", "^?"],
|
|
22707
|
+
["Any Digit", "^#"],
|
|
22708
|
+
["Any Letter", "^$"],
|
|
22709
|
+
["Caret Character", "^^"],
|
|
22710
|
+
["Manual Line Break", "^l"],
|
|
22711
|
+
["Page Break", "^m"],
|
|
22712
|
+
["Optional Hyphen", "^-"],
|
|
22713
|
+
["Nonbreaking Hyphen", "^~"],
|
|
22714
|
+
["Nonbreaking Space", "^s"],
|
|
22715
|
+
["White Space", "^w"]
|
|
22716
|
+
];
|
|
22717
|
+
var OPTION_LABELS = [
|
|
22718
|
+
["wholeWords", "Find whole words only"],
|
|
22719
|
+
["wildcards", "Use wildcards"],
|
|
22720
|
+
["matchPrefix", "Match prefix"],
|
|
22721
|
+
["matchSuffix", "Match suffix"],
|
|
22722
|
+
["ignorePunctuation", "Ignore punctuation characters"],
|
|
22723
|
+
["ignoreWhitespace", "Ignore white-space characters"]
|
|
22724
|
+
];
|
|
22725
|
+
var WILDCARD_DISABLED = /* @__PURE__ */ new Set([
|
|
22726
|
+
"wholeWords",
|
|
22727
|
+
"matchPrefix",
|
|
22728
|
+
"matchSuffix",
|
|
22729
|
+
"ignorePunctuation",
|
|
22730
|
+
"ignoreWhitespace"
|
|
22731
|
+
]);
|
|
21994
22732
|
function createSearchPanel(options, initialLocale = "en") {
|
|
21995
22733
|
let locale = normalizeEditorLocale(initialLocale);
|
|
21996
22734
|
const controller = new SearchController(options.getView);
|
|
@@ -22030,20 +22768,98 @@ function createSearchPanel(options, initialLocale = "en") {
|
|
|
22030
22768
|
const next = button3("Find next");
|
|
22031
22769
|
const replace = button3("Replace");
|
|
22032
22770
|
const replaceAll = button3("Replace all");
|
|
22771
|
+
const more = button3("More >>");
|
|
22772
|
+
more.setAttribute("aria-expanded", "false");
|
|
22033
22773
|
const close3 = button3("Close search");
|
|
22034
22774
|
const result = document.createElement("span");
|
|
22035
22775
|
result.setAttribute("role", "status");
|
|
22036
22776
|
result.setAttribute("aria-label", "Search results");
|
|
22037
22777
|
result.setAttribute("aria-live", "polite");
|
|
22778
|
+
const optionsSection = document.createElement("div");
|
|
22779
|
+
optionsSection.className = "dve-search-options";
|
|
22780
|
+
optionsSection.setAttribute("role", "group");
|
|
22781
|
+
optionsSection.setAttribute("aria-label", "Search options");
|
|
22782
|
+
optionsSection.hidden = true;
|
|
22783
|
+
const optionBoxes = /* @__PURE__ */ new Map();
|
|
22784
|
+
for (const [name, text] of OPTION_LABELS) {
|
|
22785
|
+
const label2 = document.createElement("label");
|
|
22786
|
+
const box2 = document.createElement("input");
|
|
22787
|
+
box2.type = "checkbox";
|
|
22788
|
+
box2.setAttribute("aria-label", text);
|
|
22789
|
+
label2.append(box2, document.createTextNode(text));
|
|
22790
|
+
optionsSection.append(label2);
|
|
22791
|
+
optionBoxes.set(name, { box: box2, label: label2 });
|
|
22792
|
+
}
|
|
22793
|
+
let lastField = findInput;
|
|
22794
|
+
const special = document.createElement("select");
|
|
22795
|
+
special.className = "dve-search-special";
|
|
22796
|
+
special.setAttribute("aria-label", "Special characters");
|
|
22797
|
+
const placeholder2 = document.createElement("option");
|
|
22798
|
+
placeholder2.value = "";
|
|
22799
|
+
placeholder2.textContent = "Special characters";
|
|
22800
|
+
special.append(placeholder2);
|
|
22801
|
+
for (const [label2, code] of SPECIAL_CODES) {
|
|
22802
|
+
const option = document.createElement("option");
|
|
22803
|
+
option.value = code;
|
|
22804
|
+
option.textContent = label2;
|
|
22805
|
+
special.append(option);
|
|
22806
|
+
}
|
|
22807
|
+
const insertCode = (code) => {
|
|
22808
|
+
const start2 = lastField.selectionStart ?? lastField.value.length;
|
|
22809
|
+
const end2 = lastField.selectionEnd ?? start2;
|
|
22810
|
+
lastField.value = lastField.value.slice(0, start2) + code + lastField.value.slice(end2);
|
|
22811
|
+
lastField.setSelectionRange(start2 + code.length, start2 + code.length);
|
|
22812
|
+
lastField.dispatchEvent(new Event("input", { bubbles: true }));
|
|
22813
|
+
lastField.focus();
|
|
22814
|
+
};
|
|
22815
|
+
special.addEventListener("change", () => {
|
|
22816
|
+
if (special.value) insertCode(special.value);
|
|
22817
|
+
special.value = "";
|
|
22818
|
+
});
|
|
22819
|
+
for (const field2 of [findInput, replaceInput])
|
|
22820
|
+
field2.addEventListener("focus", () => {
|
|
22821
|
+
lastField = field2;
|
|
22822
|
+
});
|
|
22823
|
+
const checked = (name) => optionBoxes.get(name)?.box.checked === true;
|
|
22824
|
+
const currentOptions = () => ({
|
|
22825
|
+
matchCase: caseInput.checked,
|
|
22826
|
+
wholeWords: checked("wholeWords"),
|
|
22827
|
+
wildcards: checked("wildcards"),
|
|
22828
|
+
matchPrefix: checked("matchPrefix"),
|
|
22829
|
+
matchSuffix: checked("matchSuffix"),
|
|
22830
|
+
ignorePunctuation: checked("ignorePunctuation"),
|
|
22831
|
+
ignoreWhitespace: checked("ignoreWhitespace")
|
|
22832
|
+
});
|
|
22833
|
+
const syncWildcards = () => {
|
|
22834
|
+
const wildcards = optionBoxes.get("wildcards")?.box.checked ?? false;
|
|
22835
|
+
for (const name of WILDCARD_DISABLED) {
|
|
22836
|
+
const entry = optionBoxes.get(name);
|
|
22837
|
+
if (!entry) continue;
|
|
22838
|
+
entry.box.disabled = wildcards;
|
|
22839
|
+
entry.label.setAttribute("aria-disabled", String(wildcards));
|
|
22840
|
+
}
|
|
22841
|
+
};
|
|
22038
22842
|
const renderStatus = (status) => {
|
|
22039
|
-
result.textContent = !status.query ? translate(locale, "Enter text to search") : !status.count ? translate(locale, "No matches") : status.active ? `${status.active} ${translate(locale, "of")} ${status.count} ${translate(locale, status.count === 1 ? "matches one" : "matches many")}` : `${status.count} ${translate(locale, status.count === 1 ? "matches one" : "matches many")}`;
|
|
22843
|
+
result.textContent = status.invalid ? translate(locale, "Invalid search pattern") : !status.query ? translate(locale, "Enter text to search") : !status.count ? translate(locale, "No matches") : status.active ? `${status.active} ${translate(locale, "of")} ${status.count} ${translate(locale, status.count === 1 ? "matches one" : "matches many")}` : `${status.count} ${translate(locale, status.count === 1 ? "matches one" : "matches many")}`;
|
|
22040
22844
|
replace.disabled = status.readOnly || !status.count;
|
|
22041
22845
|
replaceAll.disabled = status.readOnly || !status.count;
|
|
22042
22846
|
previous.disabled = next.disabled = !status.count;
|
|
22043
22847
|
};
|
|
22044
|
-
const refreshQuery = () => renderStatus(controller.search(findInput.value,
|
|
22848
|
+
const refreshQuery = () => renderStatus(controller.search(findInput.value, currentOptions()));
|
|
22045
22849
|
findInput.addEventListener("input", refreshQuery);
|
|
22046
22850
|
caseInput.addEventListener("change", refreshQuery);
|
|
22851
|
+
for (const [name] of OPTION_LABELS)
|
|
22852
|
+
optionBoxes.get(name)?.box.addEventListener("change", () => {
|
|
22853
|
+
syncWildcards();
|
|
22854
|
+
refreshQuery();
|
|
22855
|
+
});
|
|
22856
|
+
more.addEventListener("click", () => {
|
|
22857
|
+
const expanded = optionsSection.hidden;
|
|
22858
|
+
optionsSection.hidden = !expanded;
|
|
22859
|
+
more.setAttribute("aria-expanded", String(expanded));
|
|
22860
|
+
more.textContent = translate(locale, expanded ? "<< Less" : "More >>");
|
|
22861
|
+
more.setAttribute("aria-label", more.textContent);
|
|
22862
|
+
});
|
|
22047
22863
|
previous.addEventListener("click", () => {
|
|
22048
22864
|
controller.findPrevious();
|
|
22049
22865
|
renderStatus(controller.status);
|
|
@@ -22085,12 +22901,15 @@ function createSearchPanel(options, initialLocale = "en") {
|
|
|
22085
22901
|
findLabel,
|
|
22086
22902
|
replaceLabel,
|
|
22087
22903
|
caseLabel,
|
|
22904
|
+
special,
|
|
22088
22905
|
previous,
|
|
22089
22906
|
next,
|
|
22090
22907
|
replace,
|
|
22091
22908
|
replaceAll,
|
|
22909
|
+
more,
|
|
22092
22910
|
result,
|
|
22093
|
-
close3
|
|
22911
|
+
close3,
|
|
22912
|
+
optionsSection
|
|
22094
22913
|
);
|
|
22095
22914
|
localizeElement(panel, locale);
|
|
22096
22915
|
renderStatus(controller.status);
|
|
@@ -22107,12 +22926,13 @@ function createSearchPanel(options, initialLocale = "en") {
|
|
|
22107
22926
|
},
|
|
22108
22927
|
close: closePanel,
|
|
22109
22928
|
refresh() {
|
|
22110
|
-
controller.search(findInput.value,
|
|
22929
|
+
controller.search(findInput.value, currentOptions());
|
|
22111
22930
|
renderStatus(controller.status);
|
|
22112
22931
|
},
|
|
22113
22932
|
setLocale(value) {
|
|
22114
22933
|
locale = normalizeEditorLocale(value);
|
|
22115
22934
|
localizeElement(panel, locale);
|
|
22935
|
+
more.textContent = translate(locale, optionsSection.hidden ? "More >>" : "<< Less");
|
|
22116
22936
|
renderStatus(controller.status);
|
|
22117
22937
|
}
|
|
22118
22938
|
};
|
|
@@ -22129,8 +22949,8 @@ function measuredBorderWidth(css, fallback) {
|
|
|
22129
22949
|
cache = /* @__PURE__ */ new Map();
|
|
22130
22950
|
widths.set(document, cache);
|
|
22131
22951
|
}
|
|
22132
|
-
const
|
|
22133
|
-
const cached = cache.get(
|
|
22952
|
+
const key3 = `${view.devicePixelRatio}|${css}`;
|
|
22953
|
+
const cached = cache.get(key3);
|
|
22134
22954
|
if (cached !== void 0) return cached;
|
|
22135
22955
|
const probe = document.createElement("span");
|
|
22136
22956
|
probe.dataset.printBorderProbe = "true";
|
|
@@ -22151,7 +22971,7 @@ function measuredBorderWidth(css, fallback) {
|
|
|
22151
22971
|
try {
|
|
22152
22972
|
const actual = Number.parseFloat(view.getComputedStyle(probe).borderLeftWidth);
|
|
22153
22973
|
const width = Number.isFinite(actual) ? actual : fallback;
|
|
22154
|
-
cache.set(
|
|
22974
|
+
cache.set(key3, width);
|
|
22155
22975
|
return width;
|
|
22156
22976
|
} finally {
|
|
22157
22977
|
probe.remove();
|
|
@@ -22499,6 +23319,15 @@ function pictureElement(object, pictureUrl) {
|
|
|
22499
23319
|
return element2;
|
|
22500
23320
|
}
|
|
22501
23321
|
const url = object.partName ? pictureUrl?.(object.partName, object.contentType) : void 0;
|
|
23322
|
+
if (url && object.pictureFill && pictureNeedsSvg(object.pictureFill)) {
|
|
23323
|
+
const element2 = document.createElement("span");
|
|
23324
|
+
element2.className = "dve-print-picture";
|
|
23325
|
+
element2.style.position = "absolute";
|
|
23326
|
+
element2.style.width = `${object.widthPx}px`;
|
|
23327
|
+
element2.style.height = `${object.heightPx}px`;
|
|
23328
|
+
element2.append(pictureSvg(document, object.pictureFill, url, object.widthPx, object.heightPx));
|
|
23329
|
+
return element2;
|
|
23330
|
+
}
|
|
22502
23331
|
const element = document.createElement(url ? "img" : "div");
|
|
22503
23332
|
if (url) {
|
|
22504
23333
|
element.src = url;
|
|
@@ -24442,7 +25271,7 @@ function wordCommentThreads(comments) {
|
|
|
24442
25271
|
}));
|
|
24443
25272
|
}
|
|
24444
25273
|
function labels2(locale) {
|
|
24445
|
-
const t = (
|
|
25274
|
+
const t = (key3) => translate(locale, key3);
|
|
24446
25275
|
return {
|
|
24447
25276
|
heading: t("Comments"),
|
|
24448
25277
|
list: t("Comments"),
|
|
@@ -24625,8 +25454,10 @@ var ReviewController = class {
|
|
|
24625
25454
|
if (comment && commentThreadsFromDoc(view.state.doc) === void 0)
|
|
24626
25455
|
this.updateComments([...this.host.getModel().comments ?? [], comment]);
|
|
24627
25456
|
}
|
|
24628
|
-
handleReview(
|
|
24629
|
-
if (
|
|
25457
|
+
handleReview(key3) {
|
|
25458
|
+
if (forcesTrackChanges(this.host.getModel().protection) && ["trackChanges", "acceptOne", "rejectOne", "acceptAll", "rejectAll"].includes(key3))
|
|
25459
|
+
return;
|
|
25460
|
+
if (key3 === "trackChanges") {
|
|
24630
25461
|
const view2 = this.host.getView();
|
|
24631
25462
|
if (view2) toggleTrackChanges(view2.state, view2.dispatch, view2);
|
|
24632
25463
|
return;
|
|
@@ -24641,20 +25472,20 @@ var ReviewController = class {
|
|
|
24641
25472
|
previous: goToPreviousChange,
|
|
24642
25473
|
next: goToNextChange
|
|
24643
25474
|
};
|
|
24644
|
-
byKey[
|
|
25475
|
+
byKey[key3]?.(view);
|
|
24645
25476
|
}
|
|
24646
|
-
handleComments(
|
|
25477
|
+
handleComments(key3) {
|
|
24647
25478
|
const view = this.host.getView();
|
|
24648
|
-
if (
|
|
25479
|
+
if (key3 === "delete") {
|
|
24649
25480
|
const id = view && commentIdsAtSelection(view)[0];
|
|
24650
25481
|
if (id) this.deleteById(id);
|
|
24651
25482
|
return;
|
|
24652
25483
|
}
|
|
24653
|
-
if (
|
|
24654
|
-
if (view) goToComment(view,
|
|
25484
|
+
if (key3 === "previous" || key3 === "next") {
|
|
25485
|
+
if (view) goToComment(view, key3);
|
|
24655
25486
|
return;
|
|
24656
25487
|
}
|
|
24657
|
-
if (
|
|
25488
|
+
if (key3 === "toggle") {
|
|
24658
25489
|
if (this.commentsPanel.isOpen) this.commentsPanel.close();
|
|
24659
25490
|
else this.commentsPanel.open();
|
|
24660
25491
|
} else this.commentsPanel.open();
|
|
@@ -24787,11 +25618,11 @@ var PROPERTY_LABELS = [
|
|
|
24787
25618
|
function propertyFields(model, handlers, t) {
|
|
24788
25619
|
const list = document.createElement("div");
|
|
24789
25620
|
list.className = "dve-backstage-property-fields";
|
|
24790
|
-
for (const [
|
|
25621
|
+
for (const [key3, label2] of PROPERTY_LABELS) {
|
|
24791
25622
|
const input = document.createElement("input");
|
|
24792
25623
|
input.type = "text";
|
|
24793
|
-
input.value = model.properties?.[
|
|
24794
|
-
input.addEventListener("change", () => handlers.setProperty(
|
|
25624
|
+
input.value = model.properties?.[key3] ?? "";
|
|
25625
|
+
input.addEventListener("change", () => handlers.setProperty(key3, input.value));
|
|
24795
25626
|
list.append(labelled3(t(label2), input));
|
|
24796
25627
|
}
|
|
24797
25628
|
return list;
|
|
@@ -24893,7 +25724,7 @@ function renderSaveAs({ handlers, t, content }) {
|
|
|
24893
25724
|
const format = document.createElement("input");
|
|
24894
25725
|
format.type = "text";
|
|
24895
25726
|
format.readOnly = true;
|
|
24896
|
-
format.value =
|
|
25727
|
+
format.value = t("Word Document (*.docx)");
|
|
24897
25728
|
const save = () => {
|
|
24898
25729
|
if (!name.value.trim()) return;
|
|
24899
25730
|
handlers.close();
|
|
@@ -25037,7 +25868,7 @@ var BOOLEAN_KEYS = [
|
|
|
25037
25868
|
var KEYS = ["locale", "theme", "author", ...BOOLEAN_KEYS];
|
|
25038
25869
|
function wordCategories(context2, current2) {
|
|
25039
25870
|
const { t } = context2;
|
|
25040
|
-
const toggle = (
|
|
25871
|
+
const toggle = (key3, label2) => current2[key3] === void 0 ? [] : [{ kind: "toggle", key: key3, label: t(label2) }];
|
|
25041
25872
|
const display = [
|
|
25042
25873
|
{
|
|
25043
25874
|
id: "page",
|
|
@@ -25131,9 +25962,9 @@ function dialogValues(current2) {
|
|
|
25131
25962
|
theme: current2.theme === "light" || current2.theme === "dark" ? current2.theme : "auto",
|
|
25132
25963
|
author: current2.author
|
|
25133
25964
|
};
|
|
25134
|
-
for (const
|
|
25135
|
-
const value = current2[
|
|
25136
|
-
if (value !== void 0) values2[
|
|
25965
|
+
for (const key3 of BOOLEAN_KEYS) {
|
|
25966
|
+
const value = current2[key3];
|
|
25967
|
+
if (value !== void 0) values2[key3] = value;
|
|
25137
25968
|
}
|
|
25138
25969
|
return values2;
|
|
25139
25970
|
}
|
|
@@ -25156,16 +25987,16 @@ function createWordOptions(handlers, t) {
|
|
|
25156
25987
|
element.defaults = {
|
|
25157
25988
|
theme: "auto",
|
|
25158
25989
|
...Object.fromEntries(
|
|
25159
|
-
BOOLEAN_KEYS.filter((
|
|
25160
|
-
|
|
25161
|
-
|
|
25990
|
+
BOOLEAN_KEYS.filter((key3) => current2[key3] !== void 0).map((key3) => [
|
|
25991
|
+
key3,
|
|
25992
|
+
key3 === "spellCheck"
|
|
25162
25993
|
])
|
|
25163
25994
|
)
|
|
25164
25995
|
};
|
|
25165
25996
|
};
|
|
25166
25997
|
element.addEventListener("office-options-change", (event) => {
|
|
25167
25998
|
const { values: values2, changed } = event.detail;
|
|
25168
|
-
for (const
|
|
25999
|
+
for (const key3 of KEYS) if (changed.includes(key3)) handlers.setOption(key3, String(values2[key3]));
|
|
25169
26000
|
build2();
|
|
25170
26001
|
});
|
|
25171
26002
|
element.addEventListener("office-options-cancel", () => {
|
|
@@ -25347,6 +26178,9 @@ function withExtension(fileName, extension) {
|
|
|
25347
26178
|
const base = fileName.replace(/\.[^./\\]+$/, "") || "Document";
|
|
25348
26179
|
return `${base}.${extension}`;
|
|
25349
26180
|
}
|
|
26181
|
+
function docxFileName(fileName) {
|
|
26182
|
+
return /\.doc$/i.test(fileName) ? withExtension(fileName, "docx") : fileName;
|
|
26183
|
+
}
|
|
25350
26184
|
|
|
25351
26185
|
// src/docx/ribbon-actions.ts
|
|
25352
26186
|
function createRibbonActions(handlers) {
|
|
@@ -25516,7 +26350,7 @@ var EditorChrome = class {
|
|
|
25516
26350
|
this.host = host;
|
|
25517
26351
|
this.titleBar = createTitleBar({
|
|
25518
26352
|
fileCommand: (command) => void this.run(command),
|
|
25519
|
-
history: (
|
|
26353
|
+
history: (key3) => host.history(key3),
|
|
25520
26354
|
ribbon: () => host.ribbon()
|
|
25521
26355
|
});
|
|
25522
26356
|
this.ribbonActions = createRibbonActions({
|
|
@@ -25535,13 +26369,13 @@ var EditorChrome = class {
|
|
|
25535
26369
|
saveState: this.state
|
|
25536
26370
|
}),
|
|
25537
26371
|
options: () => host.options(),
|
|
25538
|
-
setOption: (
|
|
25539
|
-
setProperty: (
|
|
26372
|
+
setOption: (key3, value) => host.setOption(key3, value),
|
|
26373
|
+
setProperty: (key3, value) => {
|
|
25540
26374
|
const model = host.model();
|
|
25541
|
-
if ((model.properties?.[
|
|
26375
|
+
if ((model.properties?.[key3] ?? "") === value) return;
|
|
25542
26376
|
const next = { ...model.properties };
|
|
25543
|
-
if (value) next[
|
|
25544
|
-
else delete next[
|
|
26377
|
+
if (value) next[key3] = value;
|
|
26378
|
+
else delete next[key3];
|
|
25545
26379
|
if (Object.keys(next).length) model.properties = next;
|
|
25546
26380
|
else delete model.properties;
|
|
25547
26381
|
this.setSaveState("dirty");
|
|
@@ -25594,7 +26428,7 @@ var EditorChrome = class {
|
|
|
25594
26428
|
return this._fileName;
|
|
25595
26429
|
}
|
|
25596
26430
|
set fileName(value) {
|
|
25597
|
-
this._fileName = value || DEFAULT_FILE_NAME2;
|
|
26431
|
+
this._fileName = docxFileName(value) || DEFAULT_FILE_NAME2;
|
|
25598
26432
|
this.titleBar.setFileName(this._fileName);
|
|
25599
26433
|
}
|
|
25600
26434
|
get isDirty() {
|
|
@@ -25654,17 +26488,13 @@ var EditorChrome = class {
|
|
|
25654
26488
|
else if (command === "saveAs") {
|
|
25655
26489
|
const name = (fileName ?? "").trim();
|
|
25656
26490
|
if (!name) return;
|
|
25657
|
-
|
|
25658
|
-
this.fileName = withExtension(name, extension);
|
|
26491
|
+
this.fileName = withExtension(name, "docx");
|
|
25659
26492
|
if (this.host.customization().fileCommands.has("save"))
|
|
25660
26493
|
await this.saveDocument("saveAs", false);
|
|
25661
26494
|
else if (announceFileCommand(this.host.element, "save")) await this.saveDocument("saveAs");
|
|
25662
26495
|
} else if (command === "save") await this.saveDocument("save");
|
|
25663
26496
|
else if (command === "export")
|
|
25664
|
-
downloadBytes(
|
|
25665
|
-
await saveDocx(structuredClone(this.host.model())),
|
|
25666
|
-
withExtension(this._fileName, "docx")
|
|
25667
|
-
);
|
|
26497
|
+
downloadBytes(await this.host.save(), withExtension(this._fileName, "docx"));
|
|
25668
26498
|
} catch (cause) {
|
|
25669
26499
|
if (command === "save" || command === "saveAs") this.setSaveState("dirty");
|
|
25670
26500
|
this.host.reportError(cause instanceof Error ? cause : new Error(String(cause)));
|
|
@@ -26251,13 +27081,13 @@ function toggleFormatPainter(view, onChange) {
|
|
|
26251
27081
|
function withHeaderFooterDistance(model, index, kind, inches3) {
|
|
26252
27082
|
const sections = sectionsOf(model);
|
|
26253
27083
|
if (!Number.isFinite(inches3) || inches3 < 0 || inches3 > 22 || !sections[index]) return model;
|
|
26254
|
-
const
|
|
27084
|
+
const key3 = kind === "header" ? "headerDistanceTwips" : "footerDistanceTwips";
|
|
26255
27085
|
const distance = twips$1(Math.round(inches3 * 1440));
|
|
26256
|
-
if ((sections[index][
|
|
27086
|
+
if ((sections[index][key3] ?? 720) === distance) return model;
|
|
26257
27087
|
return {
|
|
26258
27088
|
...model,
|
|
26259
27089
|
sections: sections.map(
|
|
26260
|
-
(section3, i) => i === index ? { ...section3, [
|
|
27090
|
+
(section3, i) => i === index ? { ...section3, [key3]: distance } : section3
|
|
26261
27091
|
)
|
|
26262
27092
|
};
|
|
26263
27093
|
}
|
|
@@ -27054,11 +27884,11 @@ function computeMenuItems(state) {
|
|
|
27054
27884
|
]);
|
|
27055
27885
|
if (state.inTable)
|
|
27056
27886
|
groups.push(
|
|
27057
|
-
TABLE_ITEMS.map(([
|
|
27058
|
-
id: `table-${
|
|
27887
|
+
TABLE_ITEMS.map(([key3, label2]) => ({
|
|
27888
|
+
id: `table-${key3}`,
|
|
27059
27889
|
label: label2,
|
|
27060
|
-
command:
|
|
27061
|
-
disabled: state.readOnly || !state.canTable(
|
|
27890
|
+
command: key3 === "splitCell" ? { kind: "ribbon", action: { type: "formatDialog", kind: "splitCells" } } : { kind: "ribbon", action: { type: "tableEdit", key: key3 } },
|
|
27891
|
+
disabled: state.readOnly || !state.canTable(key3)
|
|
27062
27892
|
}))
|
|
27063
27893
|
);
|
|
27064
27894
|
return groups.flatMap(
|
|
@@ -27272,10 +28102,10 @@ function createShortcutHelp(onClose) {
|
|
|
27272
28102
|
closeButton.textContent = translate(locale, "shortcut.close");
|
|
27273
28103
|
table.replaceChildren();
|
|
27274
28104
|
const head = table.createTHead().insertRow();
|
|
27275
|
-
for (const
|
|
28105
|
+
for (const key3 of ["shortcut.columnAction", "shortcut.columnKeys"]) {
|
|
27276
28106
|
const cell = document.createElement("th");
|
|
27277
28107
|
cell.scope = "col";
|
|
27278
|
-
cell.textContent = translate(locale,
|
|
28108
|
+
cell.textContent = translate(locale, key3);
|
|
27279
28109
|
head.append(cell);
|
|
27280
28110
|
}
|
|
27281
28111
|
const body = table.createTBody();
|
|
@@ -27541,10 +28371,10 @@ function createChrome(core, api) {
|
|
|
27541
28371
|
if (state !== "saving") core.dirtyState.set(state === "dirty");
|
|
27542
28372
|
},
|
|
27543
28373
|
print: () => core.pages.print(),
|
|
27544
|
-
history: (
|
|
28374
|
+
history: (key3) => {
|
|
27545
28375
|
if (!core.view) return;
|
|
27546
|
-
if (core.parts.usesBodyHistory()) core.parts.runHistory(
|
|
27547
|
-
else runRibbonCommand(core.view, { type: "history", key:
|
|
28376
|
+
if (core.parts.usesBodyHistory()) core.parts.runHistory(key3);
|
|
28377
|
+
else runRibbonCommand(core.view, { type: "history", key: key3 }, core.collab.ids);
|
|
27548
28378
|
if (typeof document.execCommand === "function") core.targetView()?.focus();
|
|
27549
28379
|
},
|
|
27550
28380
|
toggleComments: () => shell.review?.handleComments("toggle"),
|
|
@@ -27560,17 +28390,17 @@ function createChrome(core, api) {
|
|
|
27560
28390
|
showMarks: shell.paper?.hasAttribute("data-show-marks") ?? false,
|
|
27561
28391
|
showThumbnails: core.viewOptions.showThumbnails
|
|
27562
28392
|
}),
|
|
27563
|
-
setOption: (
|
|
27564
|
-
if (
|
|
28393
|
+
setOption: (key3, value) => {
|
|
28394
|
+
if (key3 === "spellCheck") {
|
|
27565
28395
|
if (core.view) core.view.dom.spellcheck = value === "true";
|
|
27566
28396
|
core.refreshControls();
|
|
27567
|
-
} else if (
|
|
28397
|
+
} else if (key3 === "showThumbnails")
|
|
27568
28398
|
element.toggleAttribute("show-thumbnails", value === "true");
|
|
27569
|
-
else if (
|
|
27570
|
-
const current2 =
|
|
28399
|
+
else if (key3 === "showRuler" || key3 === "showMarks") {
|
|
28400
|
+
const current2 = key3 === "showRuler" ? Boolean(shell.canvas?.querySelector(".dve-ruler")) : shell.paper?.hasAttribute("data-show-marks") ?? false;
|
|
27571
28401
|
if (current2 !== (value === "true"))
|
|
27572
|
-
core.inserts.handle({ type:
|
|
27573
|
-
} else element.setAttribute(
|
|
28402
|
+
core.inserts.handle({ type: key3 === "showRuler" ? "ruler" : "showMarks" });
|
|
28403
|
+
} else element.setAttribute(key3 === "author" ? "review-author" : key3, value);
|
|
27574
28404
|
},
|
|
27575
28405
|
hiddenActions: () => host().hiddenActions,
|
|
27576
28406
|
setHiddenActions: (ids) => {
|
|
@@ -27699,7 +28529,8 @@ function buildShell(core, api) {
|
|
|
27699
28529
|
canvas,
|
|
27700
28530
|
core.inserts.smartArt.pane,
|
|
27701
28531
|
review.commentsPanel.element,
|
|
27702
|
-
shell.chartFormat.element
|
|
28532
|
+
shell.chartFormat.element,
|
|
28533
|
+
core.formatDialogs.restrictEditingPane
|
|
27703
28534
|
);
|
|
27704
28535
|
frame.append(toolbar, shell.searchPanel.element, body);
|
|
27705
28536
|
const chrome = createChrome(core, api);
|
|
@@ -27709,8 +28540,9 @@ function buildShell(core, api) {
|
|
|
27709
28540
|
core.inserts.linkDialog.element,
|
|
27710
28541
|
core.inserts.pictureDialog.element,
|
|
27711
28542
|
core.inserts.smartArt.dialog.element,
|
|
27712
|
-
...core.formatDialogs.elements,
|
|
27713
|
-
core.inserts.pictureInput
|
|
28543
|
+
...core.formatDialogs.elements.filter((el) => el !== core.formatDialogs.restrictEditingPane),
|
|
28544
|
+
core.inserts.pictureInput,
|
|
28545
|
+
core.inserts.bulletInput
|
|
27714
28546
|
);
|
|
27715
28547
|
if (core.pendingFileName) chrome.fileName = core.pendingFileName;
|
|
27716
28548
|
root.append(style, frame);
|
|
@@ -27792,7 +28624,7 @@ function findReplaceRequest(core) {
|
|
|
27792
28624
|
get canReplace() {
|
|
27793
28625
|
return core.canEditBody();
|
|
27794
28626
|
},
|
|
27795
|
-
search: (query,
|
|
28627
|
+
search: (query, options) => controller.search(query, options),
|
|
27796
28628
|
findNext: () => controller.findNext() !== null,
|
|
27797
28629
|
findPrevious: () => controller.findPrevious() !== null,
|
|
27798
28630
|
replaceOne: (replacement) => core.canEditBody() && controller.replaceOne(replacement),
|
|
@@ -27879,16 +28711,16 @@ function wordToolbarProps(core) {
|
|
|
27879
28711
|
const state = view?.state;
|
|
27880
28712
|
const canEdit = Boolean(view?.editable && core.canEditBody() && !core.loading);
|
|
27881
28713
|
const values2 = /* @__PURE__ */ new Map();
|
|
27882
|
-
const add = (
|
|
27883
|
-
if (!values2.has(
|
|
27884
|
-
values2.get(
|
|
28714
|
+
const add = (key3, value2) => {
|
|
28715
|
+
if (!values2.has(key3)) values2.set(key3, /* @__PURE__ */ new Set());
|
|
28716
|
+
values2.get(key3).add(value2);
|
|
27885
28717
|
};
|
|
27886
28718
|
if (state) {
|
|
27887
28719
|
const sample = (text, paragraph2) => {
|
|
27888
|
-
for (const
|
|
28720
|
+
for (const key3 of ["bold", "italic", "underline"])
|
|
27889
28721
|
add(
|
|
27890
|
-
|
|
27891
|
-
text.marks.some((mark) => mark.type.name ===
|
|
28722
|
+
key3,
|
|
28723
|
+
text.marks.some((mark) => mark.type.name === key3)
|
|
27892
28724
|
);
|
|
27893
28725
|
const font = effectiveFont(state, text, paragraph2);
|
|
27894
28726
|
add("fontFamily", font.family);
|
|
@@ -27905,8 +28737,8 @@ function wordToolbarProps(core) {
|
|
|
27905
28737
|
if (node.isText && parent) sample(node, parent);
|
|
27906
28738
|
});
|
|
27907
28739
|
}
|
|
27908
|
-
const value = (
|
|
27909
|
-
const set = values2.get(
|
|
28740
|
+
const value = (key3, fallback) => {
|
|
28741
|
+
const set = values2.get(key3);
|
|
27910
28742
|
return set?.size ? set.size === 1 ? [...set][0] : null : fallback;
|
|
27911
28743
|
};
|
|
27912
28744
|
const run = (action) => {
|
|
@@ -28200,8 +29032,10 @@ var DocxEditorApi = class extends HTMLElementBase {
|
|
|
28200
29032
|
...core.collab.yjs?.media.all() ?? []
|
|
28201
29033
|
]);
|
|
28202
29034
|
const media = pending.size ? pending : void 0;
|
|
28203
|
-
if (core.loaded)
|
|
28204
|
-
|
|
29035
|
+
if (core.loaded) {
|
|
29036
|
+
const options = { modified: modifiedStamp(core.reviewAuthor) };
|
|
29037
|
+
return core.loaded.saveDocx ? core.loaded.saveDocx(core.model, media, options) : core.loaded.save(core.model, media, options);
|
|
29038
|
+
}
|
|
28205
29039
|
return saveDocx(core.model, media);
|
|
28206
29040
|
}
|
|
28207
29041
|
/** The saved document as a Blob. Does not change `dirty`; call `markClean()` after persisting it. */
|
|
@@ -28211,7 +29045,10 @@ var DocxEditorApi = class extends HTMLElementBase {
|
|
|
28211
29045
|
/** Saves and starts a browser download, then marks the document clean. */
|
|
28212
29046
|
async download(fileName) {
|
|
28213
29047
|
const name = fileName || this.fileName;
|
|
28214
|
-
downloadBytes(
|
|
29048
|
+
downloadBytes(
|
|
29049
|
+
await this.saveBytes(),
|
|
29050
|
+
/\.[^./\\]+$/.test(name) ? docxFileName(name) : `${name}.docx`
|
|
29051
|
+
);
|
|
28215
29052
|
this.markClean();
|
|
28216
29053
|
}
|
|
28217
29054
|
};
|