@a3s-lab/office 0.37.4 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +10 -1
  2. package/dist/{0~4808.js → 0~5024.js} +150 -2
  3. package/dist/0~7240.js +26 -4
  4. package/dist/0~document-editor.js +455 -13
  5. package/dist/0~spreadsheet-editor.js +52 -36
  6. package/dist/0~work-docx-export.js +215 -18
  7. package/dist/0~work-docx-import.js +4 -2
  8. package/dist/0~work-office-diagnostics.js +57 -1
  9. package/dist/4174.js +313 -112
  10. package/dist/5416.js +56 -44
  11. package/dist/core.js +56 -10
  12. package/dist/internal/features/work/editors/document-font-dialog-model.d.ts +5 -4
  13. package/dist/internal/features/work/editors/document-font-dialog-opentype-model.d.ts +53 -0
  14. package/dist/internal/features/work/editors/document-font-dialog-script-font-model.d.ts +5 -0
  15. package/dist/internal/features/work/editors/spreadsheet-auto-filter-menu.d.ts +2 -2
  16. package/dist/internal/features/work/editors/spreadsheet-auto-filter.d.ts +3 -3
  17. package/dist/internal/features/work/editors/spreadsheet-date-time-command.d.ts +2 -1
  18. package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +2 -2
  19. package/dist/internal/features/work/editors/spreadsheet-filter-reconciliation.d.ts +3 -2
  20. package/dist/internal/features/work/work-document-equations.d.ts +4 -3
  21. package/dist/internal/features/work/work-document-format-changes.d.ts +2 -0
  22. package/dist/internal/features/work/work-document-opentype.d.ts +39 -0
  23. package/dist/internal/features/work/work-document-word-line-metrics.d.ts +1 -0
  24. package/dist/internal/features/work/work-docx-opentype-diagnostics.d.ts +3 -0
  25. package/dist/internal/features/work/work-docx-opentype-export.d.ts +19 -0
  26. package/dist/internal/features/work/work-docx-opentype-import.d.ts +8 -0
  27. package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +2 -0
  28. package/dist/internal/features/work/work-spreadsheet-dynamic-filter.d.ts +3 -2
  29. package/dist/internal/features/work/work-types.d.ts +3 -0
  30. package/dist/office-kernel.wasm +0 -0
  31. package/dist/styles.css +7 -3
  32. package/docs/latest/en/browser-editor-architecture.md +4 -2
  33. package/package.json +6 -1
@@ -16,7 +16,7 @@ import starter_kit from "@tiptap/starter-kit";
16
16
  import { BubbleMenu } from "@tiptap/react/menus";
17
17
  import { TableMap, isInTable, selectedRect } from "@tiptap/pm/tables";
18
18
  import { closeHistory } from "@tiptap/pm/history";
19
- import { documentTableSizing, transferChangedDocumentTextStatistics, documentPageBordersVisible, documentUnderlineStyle, DOCUMENT_PAGE_BORDER_EDGES, documentTableRowOptions, normalizeDocumentColumns, clampDocumentMargin, materializeLazyDocumentEditorRoot, documentKerningThresholdPoints, selectedDocumentIndexOptions, nextDocumentTabAlignment, DOCUMENT_BOOKMARK_DUPLICATE_MESSAGE, normalizedTabPosition, documentCitationCount, resolveDocumentPageBorders, documentLazyHtmlChunkFragment, DocumentFontFamily, normalizeDocumentHiddenText, documentLegacyTextEffectsConflict, DOCUMENT_CHUNK_VISIBLE_IDS_META, selectedDocumentIndexDraft, MAX_DOCUMENT_IMAGE_RELATIVE_HEIGHT, retainAnchoredDocumentComments, DocumentTableRowIdentity, work_document_page_margins_twipsToMillimeters, DEFAULT_DOCUMENT_TABLE_CELL_FORMAT, resolveWorkDocumentEditorInput, documentCharacterPositionPoints, documentBulletListStyle, collectDocumentTextLayoutParagraphs, readOfficeDocumentCollaboration as readWorkOfficeDocumentCollaboration, normalizeDocumentCharacterScalePercent, DOCUMENT_PARAGRAPH_FORMAT_ATTRIBUTES, documentOrderedListState, normalizeDocumentPageChrome, documentTextStatistics, documentPageMarginsForLayout, invalidateDocumentLazyHtmlProjection, documentTableCellFormat, normalizeDocumentPageGeometry, normalizeDocumentImageLayer, documentImageProperties, isValidDocumentCitationTag, sanitizeDocumentPageChromeHtml, pageTwipsToMillimeters, normalizeDocumentPageBorders, importWorkDocumentFile, DocumentParagraphFormatting, documentModelHasTrustedInitialIntegrityFeatures, normalizeDocumentHtml, documentInitialSectionLayout, activeDocumentSection, documentParagraphDirection, documentParagraphPagination, isDocumentCharacterFormatMark, documentModelUsesWindowing, documentPageChromeLegacyFields, documentChunkMountedIds, collectDocumentCommentAnchors, documentTextCaseKeyboardShortcuts, DocumentTextStyle, canChangeDocumentIndent, documentCharacterSpacingPoints, documentKerningIsEffective, DocumentSuperscript, documentSectionById, activeDocumentBookmark, DocumentEquation, documentLazyHtmlProjectionFingerprint, documentLazyHtmlProjection, normalizeDocumentParagraphIndent, updateDocumentGutterPosition, DocumentStrike, mountWorkLiveDocumentCapture, registerDocumentPageSurfaceGeometry, documentHiddenTextKeyboardShortcut, documentHasIndex, syncDocumentContentFromHtml, documentLegacyTextEffectsCss, editorDocumentCaptionTargets, resolveDocumentPageChrome, documentImageLayoutOptions, MAX_DOCUMENT_NUMBERING_START, resolveDocumentPageSize, editorDocumentBookmarkReferenceTargets, serializeWorkDocumentNode, DOCUMENT_CHUNK_PAGINATION_META, documentModelForContent, createOfficeDocumentCollaborationBinding as createWorkOfficeDocumentCollaborationBinding, documentLegacyTextEffectsFromTextStyleAttributes, normalizeDocumentEmphasisMark, selectedDocumentChunkId, documentCommentViews, documentParagraphSpacing, normalizeDocumentTabStops, patchDocumentLazyHtmlProjection, normalizeDocumentTextCase, documentUnderlineColor, documentBookmarkNameExists, collectDocumentChanges, DocumentImage, selectedDocumentTableOfContentsOptions, resolveDocumentPageMargins, updateDocumentPageMarginMode, serializeDocumentParagraphFormatting, canSetDocumentTableRowRepeatHeader, normalizeDocumentCharacterSpacingTwips, DocumentCharacterFormatting, millimetersToPixels as work_document_layout_millimetersToPixels, DOCUMENT_PARAGRAPH_CHANGE_ATTRIBUTES, serializeDocumentCharacterFormatting, DOCUMENT_CHUNK_HYDRATION_META, documentTabLeaderLabel, createSchemaDerivedWorkDocumentModel, updateDocumentCustomPageMillimeters, DocumentUnderline, documentCommentDraftRange, documentParagraphTabStops, documentTableHorizontalAlignment, documentUnderlineKeyboardShortcuts, documentParagraphIndent, DocumentScriptFontFormatting, canInsertDocumentComment, resolveAllDocumentChanges, documentHasTableOfContents, documentTextLayoutBatches, normalizeDocumentImageWrapSide, updateDocumentPageOrientation, documentCitationStyleDetails, validateDocumentBookmarkName, setCustomDocumentColumns, updateDocumentPageMarginMillimeters, documentCitationStyle, normalizeDocumentCharacterPositionHalfPoints, documentTransactionsOnlyHydrateChunks, normalizeDocumentKerningThresholdHalfPoints, forgetSourceBlob as forgetWorkSourceBlob, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, DOCUMENT_TABLE_STYLE_OPTIONS, updateDocumentColumnWidth, updateDocumentPaperSizePreset, documentPageMetrics, documentStrikeStyle, DocumentHighlight, createDocumentBibliography, DocumentSubscript, selectedDocumentIndexEntry, updateDocumentPageChromeVariant, updateDocumentMirrorMargins, activeDocumentTableStyle, measureDocumentLayoutBlocksIncrementally, documentWordLineHeightFactor, normalizeDocumentLegacyTextEffect, createWorkDocumentExtensions } from "./4174.js";
19
+ import { documentTableSizing, transferChangedDocumentTextStatistics, documentPageBordersVisible, documentUnderlineStyle, DOCUMENT_PAGE_BORDER_EDGES, documentTableRowOptions, normalizeDocumentColumns, clampDocumentMargin, materializeLazyDocumentEditorRoot, documentKerningThresholdPoints, selectedDocumentIndexOptions, nextDocumentTabAlignment, DOCUMENT_BOOKMARK_DUPLICATE_MESSAGE, normalizedTabPosition, documentCitationCount, resolveDocumentPageBorders, documentLazyHtmlChunkFragment, DocumentFontFamily, normalizeDocumentHiddenText, documentLegacyTextEffectsConflict, DOCUMENT_CHUNK_VISIBLE_IDS_META, selectedDocumentIndexDraft, MAX_DOCUMENT_IMAGE_RELATIVE_HEIGHT, retainAnchoredDocumentComments, DocumentTableRowIdentity, work_document_page_margins_twipsToMillimeters, DEFAULT_DOCUMENT_TABLE_CELL_FORMAT, resolveWorkDocumentEditorInput, documentOpenTypeCssProperties, documentBulletListStyle, documentCharacterPositionPoints, collectDocumentTextLayoutParagraphs, readOfficeDocumentCollaboration as readWorkOfficeDocumentCollaboration, normalizeDocumentCharacterScalePercent, DOCUMENT_PARAGRAPH_FORMAT_ATTRIBUTES, documentOrderedListState, normalizeDocumentPageChrome, documentTextStatistics, documentPageMarginsForLayout, invalidateDocumentLazyHtmlProjection, documentTableCellFormat, normalizeDocumentPageGeometry, normalizeDocumentImageLayer, documentImageProperties, isValidDocumentCitationTag, sanitizeDocumentPageChromeHtml, pageTwipsToMillimeters, normalizeDocumentPageBorders, importWorkDocumentFile, DocumentParagraphFormatting, documentModelHasTrustedInitialIntegrityFeatures, normalizeDocumentHtml, documentInitialSectionLayout, activeDocumentSection, documentParagraphDirection, documentParagraphPagination, normalizeDocumentOpenTypeFeatures, isDocumentCharacterFormatMark, documentModelUsesWindowing, documentPageChromeLegacyFields, documentChunkMountedIds, collectDocumentCommentAnchors, documentTextCaseKeyboardShortcuts, DocumentTextStyle, canChangeDocumentIndent, patchDocumentOpenTypeFeatures, normalizeDocumentOpenTypeNumberForm, parseDocumentOpenTypeFeatures, documentCharacterSpacingPoints, documentKerningIsEffective, DocumentSuperscript, documentSectionById, activeDocumentBookmark, DocumentEquation, documentLazyHtmlProjectionFingerprint, documentLazyHtmlProjection, normalizeDocumentParagraphIndent, updateDocumentGutterPosition, DocumentStrike, mountWorkLiveDocumentCapture, registerDocumentPageSurfaceGeometry, documentHiddenTextKeyboardShortcut, documentHasIndex, syncDocumentContentFromHtml, documentLegacyTextEffectsCss, editorDocumentCaptionTargets, resolveDocumentPageChrome, documentImageLayoutOptions, MAX_DOCUMENT_NUMBERING_START, resolveDocumentPageSize, normalizeDocumentOpenTypeNumberSpacing, editorDocumentBookmarkReferenceTargets, serializeWorkDocumentNode, DOCUMENT_CHUNK_PAGINATION_META, documentModelForContent, createOfficeDocumentCollaborationBinding as createWorkOfficeDocumentCollaborationBinding, documentLegacyTextEffectsFromTextStyleAttributes, normalizeDocumentEmphasisMark, selectedDocumentChunkId, documentCommentViews, documentParagraphSpacing, normalizeDocumentTabStops, patchDocumentLazyHtmlProjection, normalizeDocumentTextCase, documentUnderlineColor, documentBookmarkNameExists, collectDocumentChanges, DocumentImage, selectedDocumentTableOfContentsOptions, resolveDocumentPageMargins, updateDocumentPageMarginMode, serializeDocumentParagraphFormatting, canSetDocumentTableRowRepeatHeader, isDocumentOpenTypeFeaturePatch, normalizeDocumentCharacterSpacingTwips, DocumentCharacterFormatting, millimetersToPixels as work_document_layout_millimetersToPixels, DOCUMENT_PARAGRAPH_CHANGE_ATTRIBUTES, serializeDocumentCharacterFormatting, DOCUMENT_CHUNK_HYDRATION_META, documentTabLeaderLabel, createSchemaDerivedWorkDocumentModel, updateDocumentCustomPageMillimeters, DocumentUnderline, documentCommentDraftRange, documentParagraphTabStops, documentTableHorizontalAlignment, documentUnderlineKeyboardShortcuts, documentParagraphIndent, DocumentScriptFontFormatting, canInsertDocumentComment, resolveAllDocumentChanges, serializeDocumentOpenTypeFeatures, documentHasTableOfContents, documentTextLayoutBatches, normalizeDocumentImageWrapSide, updateDocumentPageOrientation, documentCitationStyleDetails, validateDocumentBookmarkName, setCustomDocumentColumns, updateDocumentPageMarginMillimeters, normalizeDocumentCharacterPositionHalfPoints, documentCitationStyle, documentTransactionsOnlyHydrateChunks, normalizeDocumentKerningThresholdHalfPoints, forgetSourceBlob as forgetWorkSourceBlob, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, DOCUMENT_TABLE_STYLE_OPTIONS, updateDocumentColumnWidth, updateDocumentPaperSizePreset, documentPageMetrics, documentStrikeStyle, DocumentHighlight, createDocumentBibliography, DocumentSubscript, normalizeDocumentOpenTypeLigatures, selectedDocumentIndexEntry, updateDocumentPageChromeVariant, updateDocumentMirrorMargins, activeDocumentTableStyle, measureDocumentLayoutBlocksIncrementally, documentWordLineHeightFactor, normalizeDocumentLegacyTextEffect, createWorkDocumentExtensions } from "./4174.js";
20
20
  import { useOfficeTaskPaneEscape, normalizeOfficeFontFamily, OfficeCheckbox, useOfficeDialog, useOfficeTaskPaneModal, CommittedOfficeNumberField, officeFontFamilyLabel, officeFontFamilies, CollectionState, createOfficeKernelClient, OfficeNumberField } from "./0~7048.js";
21
21
  import { moveOfficeMenuFocus, office_text_field_OfficeTextArea, Popover, officeOverlayPortalRoot, Dialog, button_Button, useOfficePublishPresenceLocation, OfficeTiptapPresenceLayer, icon_button_IconButton, office_text_field_OfficeTextField, useDialogFocusScope, useOfficeEditorWheelZoom, office_text_field_OfficeFileInput } from "./0~8136.js";
22
22
  import { WorkOfficePreviewBar, isWorkspaceContextMenuKeyboardEvent, Tabs, WorkOfficeZoomControls, WorkOfficeStatusBar, WorkOfficeRibbon, workspaceContextMenuPosition, OfficeSelect, WorkspaceContextMenu, WorkOfficeRibbonGroup, WorkOfficeRibbonButton } from "./0~9073.js";
@@ -9614,8 +9614,10 @@ function addDocumentScriptFontValues(latin, eastAsia, complexScript, attributes)
9614
9614
  addFontValue(eastAsia, documentScriptFontDirectFamily(fonts, 'eastAsia'));
9615
9615
  addFontValue(complexScript, documentScriptFontDirectFamily(fonts, 'complexScript'));
9616
9616
  }
9617
- function applyDocumentScriptFontPatch(editor, selection, scalarPatch, scriptFontPatch) {
9618
- if (!validScriptFontPatch(scriptFontPatch)) return false;
9617
+ function applyDocumentTextStylePatch(editor, selection, scalarPatch, scriptFontPatch, openTypePatch) {
9618
+ const hasScriptFontPatch = Object.keys(scriptFontPatch).length > 0;
9619
+ const hasOpenTypePatch = Object.keys(openTypePatch).length > 0;
9620
+ if (hasScriptFontPatch && !validScriptFontPatch(scriptFontPatch) || hasOpenTypePatch && !isDocumentOpenTypeFeaturePatch(openTypePatch)) return false;
9619
9621
  const { state } = editor;
9620
9622
  const textStyle = state.schema.marks.textStyle;
9621
9623
  if (!textStyle) return false;
@@ -9628,7 +9630,7 @@ function applyDocumentScriptFontPatch(editor, selection, scalarPatch, scriptFont
9628
9630
  if (selection.from === selection.to) {
9629
9631
  const marks = transaction.selection.$from.marks();
9630
9632
  const current = marks.find((mark)=>mark.type === textStyle);
9631
- const attributes = patchedTextStyleAttributes(current, scalarPatch, scriptFontPatch, normalizeDocumentScriptFontSlot(current?.attrs.scriptFontSlot) ?? documentScriptFontSlotFromHint(parseDocumentScriptFonts(current?.attrs.scriptFonts)?.hint));
9633
+ const attributes = patchedTextStyleAttributes(current, scalarPatch, scriptFontPatch, openTypePatch, normalizeDocumentScriptFontSlot(current?.attrs.scriptFontSlot) ?? documentScriptFontSlotFromHint(parseDocumentScriptFonts(current?.attrs.scriptFonts)?.hint));
9632
9634
  const retained = marks.filter((mark)=>mark.type !== textStyle);
9633
9635
  if (document_font_dialog_script_font_model_textStyleAttributesHaveValue(attributes)) retained.push(textStyle.create(attributes));
9634
9636
  transaction.setStoredMarks(retained);
@@ -9644,6 +9646,12 @@ function applyDocumentScriptFontPatch(editor, selection, scalarPatch, scriptFont
9644
9646
  const to = Math.min(selection.to, position + node.nodeSize);
9645
9647
  if (to <= from) return;
9646
9648
  const current = node.marks.find((mark)=>mark.type === textStyle);
9649
+ if (!hasScriptFontPatch) return void updates.push({
9650
+ from,
9651
+ to,
9652
+ current,
9653
+ attributes: patchedTextStyleAttributes(current, scalarPatch, scriptFontPatch, openTypePatch)
9654
+ });
9647
9655
  const currentFonts = parseDocumentScriptFonts(current?.attrs.scriptFonts);
9648
9656
  const nextFonts = patchDocumentScriptFonts(currentFonts, scriptFontPatch, current?.attrs.fontFamily);
9649
9657
  const text = node.text.slice(from - position, to - position);
@@ -9652,7 +9660,7 @@ function applyDocumentScriptFontPatch(editor, selection, scalarPatch, scriptFont
9652
9660
  from: from + segment.from,
9653
9661
  to: from + segment.to,
9654
9662
  current,
9655
- attributes: patchedTextStyleAttributes(current, scalarPatch, scriptFontPatch, segment.slot, currentFonts, nextFonts)
9663
+ attributes: patchedTextStyleAttributes(current, scalarPatch, scriptFontPatch, openTypePatch, segment.slot, currentFonts, nextFonts)
9656
9664
  });
9657
9665
  });
9658
9666
  for (const update of updates){
@@ -9664,11 +9672,17 @@ function applyDocumentScriptFontPatch(editor, selection, scalarPatch, scriptFont
9664
9672
  editor.view.focus();
9665
9673
  return true;
9666
9674
  }
9667
- function patchedTextStyleAttributes(current, scalarPatch, scriptFontPatch, slot, currentFonts = parseDocumentScriptFonts(current?.attrs.scriptFonts), nextFonts = patchDocumentScriptFonts(currentFonts, scriptFontPatch, current?.attrs.fontFamily)) {
9675
+ function patchedTextStyleAttributes(current, scalarPatch, scriptFontPatch, openTypePatch, slot, currentFonts = parseDocumentScriptFonts(current?.attrs.scriptFonts), nextFonts = patchDocumentScriptFonts(currentFonts, scriptFontPatch, current?.attrs.fontFamily)) {
9668
9676
  const attributes = {
9669
9677
  ...current?.attrs ?? {},
9670
9678
  ...scalarPatch
9671
9679
  };
9680
+ if (Object.keys(openTypePatch).length) {
9681
+ const features = patchDocumentOpenTypeFeatures(parseDocumentOpenTypeFeatures(current?.attrs.openTypeFeatures), openTypePatch);
9682
+ attributes.openTypeFeatures = serializeDocumentOpenTypeFeatures(features);
9683
+ }
9684
+ if (!Object.keys(scriptFontPatch).length) return attributes;
9685
+ if (!slot) return attributes;
9672
9686
  const serialized = serializeDocumentScriptFonts(nextFonts);
9673
9687
  if (!nextFonts || !serialized) {
9674
9688
  attributes.scriptFonts = null;
@@ -9696,6 +9710,135 @@ function addFontValue(values, value) {
9696
9710
  const normalized = value?.trim() || null;
9697
9711
  values.set(normalized?.toLocaleLowerCase() ?? 'inherited', normalized);
9698
9712
  }
9713
+ function createDocumentFontDialogOpenTypeValueMaps() {
9714
+ return {
9715
+ ligatures: new Map(),
9716
+ numberForm: new Map(),
9717
+ numberSpacing: new Map(),
9718
+ stylisticSets: new Map(),
9719
+ contextualAlternates: new Map()
9720
+ };
9721
+ }
9722
+ function addDocumentFontDialogOpenTypeValues(values, serialized) {
9723
+ const features = parseDocumentOpenTypeFeatures(serialized);
9724
+ addValue(values.ligatures, features?.ligatures ?? null);
9725
+ addValue(values.numberForm, features?.numberForm ?? null);
9726
+ addValue(values.numberSpacing, features?.numberSpacing ?? null);
9727
+ const stylisticSets = features?.stylisticSets ?? null;
9728
+ values.stylisticSets.set(null === stylisticSets ? 'inherited' : JSON.stringify(stylisticSets), stylisticSets);
9729
+ addValue(values.contextualAlternates, features?.contextualAlternates ?? null);
9730
+ }
9731
+ function selectedDocumentFontDialogOpenTypeSource(values) {
9732
+ return {
9733
+ openTypeLigatures: document_font_dialog_opentype_model_selectedValue(values.ligatures),
9734
+ openTypeNumberForm: document_font_dialog_opentype_model_selectedValue(values.numberForm),
9735
+ openTypeNumberSpacing: document_font_dialog_opentype_model_selectedValue(values.numberSpacing),
9736
+ openTypeStylisticSets: document_font_dialog_opentype_model_selectedValue(values.stylisticSets),
9737
+ openTypeContextualAlternates: document_font_dialog_opentype_model_selectedValue(values.contextualAlternates)
9738
+ };
9739
+ }
9740
+ function createDocumentFontDialogOpenTypeDraft(source) {
9741
+ return {
9742
+ openTypeLigatures: source.openTypeLigatures.mixed ? 'mixed' : source.openTypeLigatures.value ?? 'inherit',
9743
+ openTypeNumberForm: source.openTypeNumberForm.mixed ? 'mixed' : source.openTypeNumberForm.value ?? 'inherit',
9744
+ openTypeNumberSpacing: source.openTypeNumberSpacing.mixed ? 'mixed' : source.openTypeNumberSpacing.value ?? 'inherit',
9745
+ openTypeStylisticSets: stylisticSetsMode(source.openTypeStylisticSets),
9746
+ openTypeContextualAlternates: source.openTypeContextualAlternates.mixed ? 'mixed' : null === source.openTypeContextualAlternates.value ? 'inherit' : source.openTypeContextualAlternates.value ? 'enabled' : 'disabled'
9747
+ };
9748
+ }
9749
+ function appendDocumentFontDialogOpenTypePatch(patch, source, draft, touched) {
9750
+ if (touched.openTypeLigatures && 'mixed' !== draft.openTypeLigatures) {
9751
+ const value = 'inherit' === draft.openTypeLigatures ? null : normalizeDocumentOpenTypeLigatures(draft.openTypeLigatures);
9752
+ appendScalarPatch(patch, 'openTypeLigatures', source.openTypeLigatures, value);
9753
+ }
9754
+ if (touched.openTypeNumberForm && 'mixed' !== draft.openTypeNumberForm) {
9755
+ const value = 'inherit' === draft.openTypeNumberForm ? null : normalizeDocumentOpenTypeNumberForm(draft.openTypeNumberForm);
9756
+ appendScalarPatch(patch, 'openTypeNumberForm', source.openTypeNumberForm, value);
9757
+ }
9758
+ if (touched.openTypeNumberSpacing && 'mixed' !== draft.openTypeNumberSpacing) {
9759
+ const value = 'inherit' === draft.openTypeNumberSpacing ? null : normalizeDocumentOpenTypeNumberSpacing(draft.openTypeNumberSpacing);
9760
+ appendScalarPatch(patch, 'openTypeNumberSpacing', source.openTypeNumberSpacing, value);
9761
+ }
9762
+ if (touched.openTypeStylisticSets && 'mixed' !== draft.openTypeStylisticSets && 'multiple' !== draft.openTypeStylisticSets) {
9763
+ const value = stylisticSetsFromMode(draft.openTypeStylisticSets);
9764
+ if (source.openTypeStylisticSets.mixed || !sameStylisticSets(source.openTypeStylisticSets.value, value)) patch.openTypeStylisticSets = value;
9765
+ }
9766
+ if (touched.openTypeContextualAlternates && 'mixed' !== draft.openTypeContextualAlternates) {
9767
+ const value = 'inherit' === draft.openTypeContextualAlternates ? null : 'enabled' === draft.openTypeContextualAlternates;
9768
+ appendScalarPatch(patch, 'openTypeContextualAlternates', source.openTypeContextualAlternates, value);
9769
+ }
9770
+ }
9771
+ function documentFontDialogOpenTypeFeaturePatch(patch) {
9772
+ return {
9773
+ ...void 0 !== patch.openTypeLigatures ? {
9774
+ ligatures: patch.openTypeLigatures
9775
+ } : {},
9776
+ ...void 0 !== patch.openTypeNumberForm ? {
9777
+ numberForm: patch.openTypeNumberForm
9778
+ } : {},
9779
+ ...void 0 !== patch.openTypeNumberSpacing ? {
9780
+ numberSpacing: patch.openTypeNumberSpacing
9781
+ } : {},
9782
+ ...void 0 !== patch.openTypeStylisticSets ? {
9783
+ stylisticSets: patch.openTypeStylisticSets
9784
+ } : {},
9785
+ ...void 0 !== patch.openTypeContextualAlternates ? {
9786
+ contextualAlternates: patch.openTypeContextualAlternates
9787
+ } : {}
9788
+ };
9789
+ }
9790
+ function documentFontDialogOpenTypePreviewFeatures(source, draft) {
9791
+ const features = {};
9792
+ const ligatures = draftValue(draft.openTypeLigatures, source.openTypeLigatures);
9793
+ const numberForm = draftValue(draft.openTypeNumberForm, source.openTypeNumberForm);
9794
+ const numberSpacing = draftValue(draft.openTypeNumberSpacing, source.openTypeNumberSpacing);
9795
+ const stylisticSets = 'mixed' === draft.openTypeStylisticSets || 'multiple' === draft.openTypeStylisticSets ? source.openTypeStylisticSets.value : stylisticSetsFromMode(draft.openTypeStylisticSets);
9796
+ const contextualAlternates = 'mixed' === draft.openTypeContextualAlternates ? source.openTypeContextualAlternates.value : 'inherit' === draft.openTypeContextualAlternates ? null : 'enabled' === draft.openTypeContextualAlternates;
9797
+ if (null !== ligatures) features.ligatures = ligatures;
9798
+ if (null !== numberForm) features.numberForm = numberForm;
9799
+ if (null !== numberSpacing) features.numberSpacing = numberSpacing;
9800
+ if (null !== stylisticSets) features.stylisticSets = [
9801
+ ...stylisticSets
9802
+ ];
9803
+ if (null !== contextualAlternates) features.contextualAlternates = contextualAlternates;
9804
+ return normalizeDocumentOpenTypeFeatures(features);
9805
+ }
9806
+ function stylisticSetsMode(source) {
9807
+ if (source.mixed) return 'mixed';
9808
+ if (null === source.value) return 'inherit';
9809
+ if (!source.value.length) return 'none';
9810
+ return 1 === source.value.length ? `set-${source.value[0]}` : 'multiple';
9811
+ }
9812
+ function stylisticSetsFromMode(mode) {
9813
+ if ('inherit' === mode) return null;
9814
+ if ('none' === mode) return [];
9815
+ const id = Number(mode.slice(4));
9816
+ return Number.isSafeInteger(id) && id >= 1 && id <= 20 ? [
9817
+ id
9818
+ ] : null;
9819
+ }
9820
+ function sameStylisticSets(left, right) {
9821
+ return JSON.stringify(left) === JSON.stringify(right);
9822
+ }
9823
+ function appendScalarPatch(patch, key, source, value) {
9824
+ if (source.mixed || source.value !== value) Object.assign(patch, {
9825
+ [key]: value
9826
+ });
9827
+ }
9828
+ function draftValue(value, source) {
9829
+ if ('mixed' === value) return source.value;
9830
+ return 'inherit' === value ? null : value;
9831
+ }
9832
+ function addValue(values, value) {
9833
+ values.set(null === value ? 'inherited' : String(value), value);
9834
+ }
9835
+ function document_font_dialog_opentype_model_selectedValue(values) {
9836
+ const mixed = values.size > 1;
9837
+ return {
9838
+ mixed,
9839
+ value: mixed ? null : values.values().next().value ?? null
9840
+ };
9841
+ }
9699
9842
  function addDocumentFontDialogRunBorderValue(values, source) {
9700
9843
  const border = parseDocumentRunBorder(source);
9701
9844
  const serialized = serializeDocumentRunBorder(border);
@@ -9877,6 +10020,7 @@ function documentFontDialogSource(editor) {
9877
10020
  const latinFontValues = new Map();
9878
10021
  const eastAsiaFontValues = new Map();
9879
10022
  const complexScriptFontValues = new Map();
10023
+ const openTypeValues = createDocumentFontDialogOpenTypeValueMaps();
9880
10024
  const addValues = (attributes)=>{
9881
10025
  addScaleValue(scaleValues, attributes.characterScalePercent);
9882
10026
  addPositionValue(positionValues, attributes.characterPositionHalfPoints);
@@ -9891,6 +10035,7 @@ function documentFontDialogSource(editor) {
9891
10035
  addDocumentFontDialogRunBorderValue(runBorderValues, attributes.runBorder);
9892
10036
  addDocumentFontDialogRunShadingValue(runShadingValues, attributes.runShading);
9893
10037
  addDocumentScriptFontValues(latinFontValues, eastAsiaFontValues, complexScriptFontValues, attributes);
10038
+ addDocumentFontDialogOpenTypeValues(openTypeValues, attributes.openTypeFeatures);
9894
10039
  };
9895
10040
  if (selection.empty) addValues(editor.getAttributes('textStyle'));
9896
10041
  else doc.nodesBetween(selection.from, selection.to, (node, position)=>{
@@ -9914,6 +10059,7 @@ function documentFontDialogSource(editor) {
9914
10059
  const latinFont = document_font_dialog_model_selectedValue(latinFontValues);
9915
10060
  const eastAsiaFont = document_font_dialog_model_selectedValue(eastAsiaFontValues);
9916
10061
  const complexScriptFont = document_font_dialog_model_selectedValue(complexScriptFontValues);
10062
+ const openType = selectedDocumentFontDialogOpenTypeSource(openTypeValues);
9917
10063
  const textStyle = editor.getAttributes('textStyle');
9918
10064
  const selectedText = selection.empty ? '' : doc.textBetween(selection.from, selection.to, ' ', ' ').replace(/\s+/g, ' ').trim();
9919
10065
  return {
@@ -9932,6 +10078,7 @@ function documentFontDialogSource(editor) {
9932
10078
  latinFont,
9933
10079
  eastAsiaFont,
9934
10080
  complexScriptFont,
10081
+ ...openType,
9935
10082
  fontFamily: 'string' == typeof textStyle.fontFamily && textStyle.fontFamily.trim() ? textStyle.fontFamily : null,
9936
10083
  fontSize: 'string' == typeof textStyle.fontSize && textStyle.fontSize.trim() ? textStyle.fontSize : null,
9937
10084
  previewText: selectedText.slice(0, 72) || 'A3S Office 字符格式',
@@ -9964,7 +10111,8 @@ function createDocumentFontDialogDraft(source) {
9964
10111
  ...createDocumentFontDialogRunShadingDraft(source.runShading),
9965
10112
  latinFont: documentFontFamilyDraftValue(source.latinFont),
9966
10113
  eastAsiaFont: documentFontFamilyDraftValue(source.eastAsiaFont),
9967
- complexScriptFont: documentFontFamilyDraftValue(source.complexScriptFont)
10114
+ complexScriptFont: documentFontFamilyDraftValue(source.complexScriptFont),
10115
+ ...createDocumentFontDialogOpenTypeDraft(source)
9968
10116
  };
9969
10117
  }
9970
10118
  function documentFontDialogDraftError(draft) {
@@ -10014,6 +10162,7 @@ function documentFontDialogPatch(source, draft, touched) {
10014
10162
  appendDocumentFontDialogScriptFontPatch(patch, 'latinFont', source.latinFont, draft.latinFont, touched.latinFont);
10015
10163
  appendDocumentFontDialogScriptFontPatch(patch, 'eastAsiaFont', source.eastAsiaFont, draft.eastAsiaFont, touched.eastAsiaFont);
10016
10164
  appendDocumentFontDialogScriptFontPatch(patch, 'complexScriptFont', source.complexScriptFont, draft.complexScriptFont, touched.complexScriptFont);
10165
+ appendDocumentFontDialogOpenTypePatch(patch, source, draft, touched);
10017
10166
  return patch;
10018
10167
  }
10019
10168
  function applyDocumentFontDialogPatch(editor, selection, patch) {
@@ -10042,6 +10191,8 @@ function applyDocumentFontDialogPatch(editor, selection, patch) {
10042
10191
  } : {}
10043
10192
  };
10044
10193
  const hasScriptFonts = Object.keys(scriptFontPatch).length > 0;
10194
+ const openTypePatch = documentFontDialogOpenTypeFeaturePatch(patch);
10195
+ const hasOpenType = Object.keys(openTypePatch).length > 0;
10045
10196
  const scale = hasScale ? normalizeDocumentCharacterScalePercent(patch.characterScalePercent) : null;
10046
10197
  const position = hasPosition ? normalizeDocumentCharacterPositionHalfPoints(patch.characterPositionHalfPoints) : null;
10047
10198
  const spacing = hasSpacing ? normalizeDocumentCharacterSpacingTwips(patch.characterSpacingTwips) : null;
@@ -10050,7 +10201,7 @@ function applyDocumentFontDialogPatch(editor, selection, patch) {
10050
10201
  const runBorder = hasRunBorder && null !== patch.runBorder ? normalizeDocumentRunBorder(patch.runBorder) : null;
10051
10202
  const runShading = hasRunShading && null !== patch.runShading ? normalizeDocumentRunShading(patch.runShading) : null;
10052
10203
  const maximum = editor.state.doc.content.size;
10053
- if (editor.isDestroyed || !hasScale && !hasPosition && !hasSpacing && !hasKerning && !hasEmphasis && !hasHiddenText && !hasLegacyTextEffects && !hasRunBorder && !hasRunShading && !hasScriptFonts || hasScale && null === scale || hasPosition && null === position || hasSpacing && null === spacing || hasKerning && null !== patch.kerningThresholdHalfPoints && null === kerningThreshold || hasEmphasis && null !== patch.emphasisMark && null === emphasisMark || hasRunBorder && null !== patch.runBorder && null === runBorder || hasRunShading && null !== patch.runShading && null === runShading || hasHiddenText && 'boolean' != typeof patch.hiddenText || hasLegacyTextOutline && null === normalizeDocumentLegacyTextEffect(patch.legacyTextOutline) || hasLegacyTextShadow && null === normalizeDocumentLegacyTextEffect(patch.legacyTextShadow) || hasLegacyTextEmboss && null === normalizeDocumentLegacyTextEffect(patch.legacyTextEmboss) || hasLegacyTextImprint && null === normalizeDocumentLegacyTextEffect(patch.legacyTextImprint) || !Number.isSafeInteger(selection.from) || !Number.isSafeInteger(selection.to) || selection.from < 0 || selection.to < selection.from || selection.to > maximum || hasLegacyTextEffects && !documentFontDialogLegacyTextEffectsAreSafe(editor, selection, patch)) return false;
10204
+ if (editor.isDestroyed || !hasScale && !hasPosition && !hasSpacing && !hasKerning && !hasEmphasis && !hasHiddenText && !hasLegacyTextEffects && !hasRunBorder && !hasRunShading && !hasScriptFonts && !hasOpenType || hasScale && null === scale || hasPosition && null === position || hasSpacing && null === spacing || hasKerning && null !== patch.kerningThresholdHalfPoints && null === kerningThreshold || hasEmphasis && null !== patch.emphasisMark && null === emphasisMark || hasRunBorder && null !== patch.runBorder && null === runBorder || hasRunShading && null !== patch.runShading && null === runShading || hasHiddenText && 'boolean' != typeof patch.hiddenText || hasLegacyTextOutline && null === normalizeDocumentLegacyTextEffect(patch.legacyTextOutline) || hasLegacyTextShadow && null === normalizeDocumentLegacyTextEffect(patch.legacyTextShadow) || hasLegacyTextEmboss && null === normalizeDocumentLegacyTextEffect(patch.legacyTextEmboss) || hasLegacyTextImprint && null === normalizeDocumentLegacyTextEffect(patch.legacyTextImprint) || !Number.isSafeInteger(selection.from) || !Number.isSafeInteger(selection.to) || selection.from < 0 || selection.to < selection.from || selection.to > maximum || hasLegacyTextEffects && !documentFontDialogLegacyTextEffectsAreSafe(editor, selection, patch)) return false;
10054
10205
  const attributes = {};
10055
10206
  if (null !== scale) attributes.characterScalePercent = scale;
10056
10207
  if (null !== position) attributes.characterPositionHalfPoints = position;
@@ -10064,7 +10215,7 @@ function applyDocumentFontDialogPatch(editor, selection, patch) {
10064
10215
  if (hasLegacyTextImprint) attributes.legacyTextImprint = patch.legacyTextImprint ?? false;
10065
10216
  if (hasRunBorder) attributes.runBorder = null === patch.runBorder ? null : serializeDocumentRunBorder(runBorder) ?? null;
10066
10217
  if (hasRunShading) attributes.runShading = null === patch.runShading ? null : serializeDocumentRunShading(runShading) ?? null;
10067
- if (hasScriptFonts) return applyDocumentScriptFontPatch(editor, selection, attributes, scriptFontPatch);
10218
+ if (hasScriptFonts || hasOpenType) return applyDocumentTextStylePatch(editor, selection, attributes, scriptFontPatch, openTypePatch);
10068
10219
  return editor.chain().setTextSelection(selection).setMark('textStyle', attributes).removeEmptyTextStyle().focus().scrollIntoView().run();
10069
10220
  }
10070
10221
  function addScaleValue(values, value) {
@@ -10763,6 +10914,172 @@ const emphasisMarkModes = [
10763
10914
  label: '下方圆点'
10764
10915
  }
10765
10916
  ];
10917
+ const openTypeLigatureModes = [
10918
+ {
10919
+ value: 'mixed',
10920
+ label: '混合(保持不变)',
10921
+ disabled: true
10922
+ },
10923
+ {
10924
+ value: 'inherit',
10925
+ label: '跟随样式'
10926
+ },
10927
+ {
10928
+ value: 'none',
10929
+ label: '无'
10930
+ },
10931
+ {
10932
+ value: 'standard',
10933
+ label: '标准'
10934
+ },
10935
+ {
10936
+ value: 'contextual',
10937
+ label: '上下文'
10938
+ },
10939
+ {
10940
+ value: 'historical',
10941
+ label: '历史'
10942
+ },
10943
+ {
10944
+ value: 'discretional',
10945
+ label: '任意'
10946
+ },
10947
+ {
10948
+ value: 'standardContextual',
10949
+ label: '标准和上下文'
10950
+ },
10951
+ {
10952
+ value: 'standardHistorical',
10953
+ label: '标准和历史'
10954
+ },
10955
+ {
10956
+ value: 'contextualHistorical',
10957
+ label: '上下文和历史'
10958
+ },
10959
+ {
10960
+ value: 'standardDiscretional',
10961
+ label: '标准和任意'
10962
+ },
10963
+ {
10964
+ value: 'contextualDiscretional',
10965
+ label: '上下文和任意'
10966
+ },
10967
+ {
10968
+ value: 'historicalDiscretional',
10969
+ label: '历史和任意'
10970
+ },
10971
+ {
10972
+ value: 'standardContextualHistorical',
10973
+ label: '标准、上下文和历史'
10974
+ },
10975
+ {
10976
+ value: 'standardContextualDiscretional',
10977
+ label: '标准、上下文和任意'
10978
+ },
10979
+ {
10980
+ value: 'standardHistoricalDiscretional',
10981
+ label: '标准、历史和任意'
10982
+ },
10983
+ {
10984
+ value: 'contextualHistoricalDiscretional',
10985
+ label: '上下文、历史和任意'
10986
+ },
10987
+ {
10988
+ value: 'all',
10989
+ label: '全部'
10990
+ }
10991
+ ];
10992
+ const openTypeNumberFormModes = [
10993
+ {
10994
+ value: 'mixed',
10995
+ label: '混合(保持不变)',
10996
+ disabled: true
10997
+ },
10998
+ {
10999
+ value: 'inherit',
11000
+ label: '跟随样式'
11001
+ },
11002
+ {
11003
+ value: 'default',
11004
+ label: '默认'
11005
+ },
11006
+ {
11007
+ value: 'lining',
11008
+ label: '等高数字'
11009
+ },
11010
+ {
11011
+ value: 'oldStyle',
11012
+ label: '旧式数字'
11013
+ }
11014
+ ];
11015
+ const openTypeNumberSpacingModes = [
11016
+ {
11017
+ value: 'mixed',
11018
+ label: '混合(保持不变)',
11019
+ disabled: true
11020
+ },
11021
+ {
11022
+ value: 'inherit',
11023
+ label: '跟随样式'
11024
+ },
11025
+ {
11026
+ value: 'default',
11027
+ label: '默认'
11028
+ },
11029
+ {
11030
+ value: 'proportional',
11031
+ label: '比例宽度'
11032
+ },
11033
+ {
11034
+ value: 'tabular',
11035
+ label: '等宽'
11036
+ }
11037
+ ];
11038
+ const openTypeStylisticSetModes = [
11039
+ {
11040
+ value: 'mixed',
11041
+ label: '混合(保持不变)',
11042
+ disabled: true
11043
+ },
11044
+ {
11045
+ value: 'multiple',
11046
+ label: '多个样式集(保持不变)',
11047
+ disabled: true
11048
+ },
11049
+ {
11050
+ value: 'inherit',
11051
+ label: '跟随样式'
11052
+ },
11053
+ {
11054
+ value: 'none',
11055
+ label: '无'
11056
+ },
11057
+ ...Array.from({
11058
+ length: 20
11059
+ }, (_, index)=>({
11060
+ value: `set-${index + 1}`,
11061
+ label: `样式集 ${index + 1}`
11062
+ }))
11063
+ ];
11064
+ const openTypeContextualAlternatesModes = [
11065
+ {
11066
+ value: 'mixed',
11067
+ label: '混合(保持不变)',
11068
+ disabled: true
11069
+ },
11070
+ {
11071
+ value: 'inherit',
11072
+ label: '跟随样式'
11073
+ },
11074
+ {
11075
+ value: 'enabled',
11076
+ label: '启用'
11077
+ },
11078
+ {
11079
+ value: 'disabled',
11080
+ label: '禁用'
11081
+ }
11082
+ ];
10766
11083
  function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onApply, onClose }) {
10767
11084
  const [draft, setDraft] = useState(()=>createDocumentFontDialogDraft(source));
10768
11085
  const [characterScaleTouched, setCharacterScaleTouched] = useState(false);
@@ -10780,6 +11097,11 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
10780
11097
  const [latinFontTouched, setLatinFontTouched] = useState(false);
10781
11098
  const [eastAsiaFontTouched, setEastAsiaFontTouched] = useState(false);
10782
11099
  const [complexScriptFontTouched, setComplexScriptFontTouched] = useState(false);
11100
+ const [openTypeLigaturesTouched, setOpenTypeLigaturesTouched] = useState(false);
11101
+ const [openTypeNumberFormTouched, setOpenTypeNumberFormTouched] = useState(false);
11102
+ const [openTypeNumberSpacingTouched, setOpenTypeNumberSpacingTouched] = useState(false);
11103
+ const [openTypeStylisticSetsTouched, setOpenTypeStylisticSetsTouched] = useState(false);
11104
+ const [openTypeContextualAlternatesTouched, setOpenTypeContextualAlternatesTouched] = useState(false);
10783
11105
  const formId = useId();
10784
11106
  const error = documentFontDialogDraftError(draft);
10785
11107
  const patch = documentFontDialogPatch(source, draft, {
@@ -10797,7 +11119,12 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
10797
11119
  runBorder: runBorderTouched,
10798
11120
  runShading: runShadingTouched,
10799
11121
  kerning: kerningTouched,
10800
- latinFont: latinFontTouched
11122
+ latinFont: latinFontTouched,
11123
+ openTypeLigatures: openTypeLigaturesTouched,
11124
+ openTypeNumberForm: openTypeNumberFormTouched,
11125
+ openTypeNumberSpacing: openTypeNumberSpacingTouched,
11126
+ openTypeStylisticSets: openTypeStylisticSetsTouched,
11127
+ openTypeContextualAlternates: openTypeContextualAlternatesTouched
10801
11128
  });
10802
11129
  const hasChanges = Object.keys(patch).length > 0;
10803
11130
  const previewScale = previewCharacterScale(draft);
@@ -10813,6 +11140,7 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
10813
11140
  });
10814
11141
  const previewRunBorder = documentFontDialogRunBorderPreviewStyle(source.runBorder, draft);
10815
11142
  const previewRunShading = documentFontDialogRunShadingPreviewStyle(source.runShading, draft);
11143
+ const previewOpenType = documentOpenTypeCssProperties(documentFontDialogOpenTypePreviewFeatures(source, draft));
10816
11144
  const submit = (event)=>{
10817
11145
  event?.preventDefault();
10818
11146
  if (!hasChanges || error) return;
@@ -11272,6 +11600,119 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
11272
11600
  })),
11273
11601
  onTouched: ()=>setRunShadingTouched(true)
11274
11602
  }),
11603
+ /*#__PURE__*/ jsxs("fieldset", {
11604
+ className: "work-document-font-dialog-opentype",
11605
+ children: [
11606
+ /*#__PURE__*/ jsx("legend", {
11607
+ children: "OpenType 排版"
11608
+ }),
11609
+ /*#__PURE__*/ jsxs("div", {
11610
+ className: "work-document-font-dialog-field",
11611
+ children: [
11612
+ /*#__PURE__*/ jsx("span", {
11613
+ children: "连字"
11614
+ }),
11615
+ /*#__PURE__*/ jsx(OfficeSelect, {
11616
+ ariaLabel: "OpenType 连字",
11617
+ value: draft.openTypeLigatures,
11618
+ options: openTypeLigatureModes,
11619
+ onValueChange: (openTypeLigatures)=>{
11620
+ setDraft((current)=>({
11621
+ ...current,
11622
+ openTypeLigatures
11623
+ }));
11624
+ setOpenTypeLigaturesTouched(true);
11625
+ }
11626
+ })
11627
+ ]
11628
+ }),
11629
+ /*#__PURE__*/ jsxs("div", {
11630
+ className: "work-document-font-dialog-field",
11631
+ children: [
11632
+ /*#__PURE__*/ jsx("span", {
11633
+ children: "数字字形"
11634
+ }),
11635
+ /*#__PURE__*/ jsx(OfficeSelect, {
11636
+ ariaLabel: "OpenType 数字字形",
11637
+ value: draft.openTypeNumberForm,
11638
+ options: openTypeNumberFormModes,
11639
+ onValueChange: (openTypeNumberForm)=>{
11640
+ setDraft((current)=>({
11641
+ ...current,
11642
+ openTypeNumberForm
11643
+ }));
11644
+ setOpenTypeNumberFormTouched(true);
11645
+ }
11646
+ })
11647
+ ]
11648
+ }),
11649
+ /*#__PURE__*/ jsxs("div", {
11650
+ className: "work-document-font-dialog-field",
11651
+ children: [
11652
+ /*#__PURE__*/ jsx("span", {
11653
+ children: "数字间距"
11654
+ }),
11655
+ /*#__PURE__*/ jsx(OfficeSelect, {
11656
+ ariaLabel: "OpenType 数字间距",
11657
+ value: draft.openTypeNumberSpacing,
11658
+ options: openTypeNumberSpacingModes,
11659
+ onValueChange: (openTypeNumberSpacing)=>{
11660
+ setDraft((current)=>({
11661
+ ...current,
11662
+ openTypeNumberSpacing
11663
+ }));
11664
+ setOpenTypeNumberSpacingTouched(true);
11665
+ }
11666
+ })
11667
+ ]
11668
+ }),
11669
+ /*#__PURE__*/ jsxs("div", {
11670
+ className: "work-document-font-dialog-field",
11671
+ children: [
11672
+ /*#__PURE__*/ jsx("span", {
11673
+ children: "样式集"
11674
+ }),
11675
+ /*#__PURE__*/ jsx(OfficeSelect, {
11676
+ ariaLabel: "OpenType 样式集",
11677
+ value: draft.openTypeStylisticSets,
11678
+ options: openTypeStylisticSetModes,
11679
+ onValueChange: (openTypeStylisticSets)=>{
11680
+ setDraft((current)=>({
11681
+ ...current,
11682
+ openTypeStylisticSets
11683
+ }));
11684
+ setOpenTypeStylisticSetsTouched(true);
11685
+ }
11686
+ })
11687
+ ]
11688
+ }),
11689
+ /*#__PURE__*/ jsxs("div", {
11690
+ className: "work-document-font-dialog-field",
11691
+ children: [
11692
+ /*#__PURE__*/ jsx("span", {
11693
+ children: "上下文替代"
11694
+ }),
11695
+ /*#__PURE__*/ jsx(OfficeSelect, {
11696
+ ariaLabel: "OpenType 上下文替代",
11697
+ value: draft.openTypeContextualAlternates,
11698
+ options: openTypeContextualAlternatesModes,
11699
+ onValueChange: (openTypeContextualAlternates)=>{
11700
+ setDraft((current)=>({
11701
+ ...current,
11702
+ openTypeContextualAlternates
11703
+ }));
11704
+ setOpenTypeContextualAlternatesTouched(true);
11705
+ }
11706
+ })
11707
+ ]
11708
+ }),
11709
+ (source.openTypeLigatures.mixed && !openTypeLigaturesTouched || source.openTypeNumberForm.mixed && !openTypeNumberFormTouched || source.openTypeNumberSpacing.mixed && !openTypeNumberSpacingTouched || source.openTypeStylisticSets.mixed && !openTypeStylisticSetsTouched || source.openTypeContextualAlternates.mixed && !openTypeContextualAlternatesTouched) && /*#__PURE__*/ jsx("p", {
11710
+ className: "work-document-font-dialog-mixed",
11711
+ role: "status",
11712
+ children: "当前选区包含不同的 OpenType 排版设置。仅修改所选项目,其他原生设置保持不变。"
11713
+ })
11714
+ ]
11715
+ }),
11275
11716
  source.characterScale.mixed && !characterScaleTouched && /*#__PURE__*/ jsx("p", {
11276
11717
  className: "work-document-font-dialog-mixed",
11277
11718
  role: "status",
@@ -11307,7 +11748,7 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
11307
11748
  role: "status",
11308
11749
  children: "当前选区包含不同的空心、阴影、阳文或阴文设置。勾选或取消对应选项后才会统一修改。"
11309
11750
  }),
11310
- (characterScaleTouched || characterSpacingTouched || characterPositionTouched || kerningTouched || emphasisTouched || hiddenTextTouched || legacyTextOutlineTouched || legacyTextShadowTouched || legacyTextEmbossTouched || legacyTextImprintTouched || runBorderTouched || runShadingTouched) && error && /*#__PURE__*/ jsx("p", {
11751
+ (characterScaleTouched || characterSpacingTouched || characterPositionTouched || kerningTouched || emphasisTouched || hiddenTextTouched || legacyTextOutlineTouched || legacyTextShadowTouched || legacyTextEmbossTouched || legacyTextImprintTouched || runBorderTouched || runShadingTouched || openTypeLigaturesTouched || openTypeNumberFormTouched || openTypeNumberSpacingTouched || openTypeStylisticSetsTouched || openTypeContextualAlternatesTouched) && error && /*#__PURE__*/ jsx("p", {
11311
11752
  className: "work-document-font-dialog-error",
11312
11753
  role: "alert",
11313
11754
  children: error
@@ -11327,7 +11768,8 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
11327
11768
  fontSize: source.fontSize ?? void 0,
11328
11769
  fontStretch: `${previewScale}%`,
11329
11770
  fontKerning: previewKerning,
11330
- letterSpacing: `${previewSpacing}pt`
11771
+ letterSpacing: `${previewSpacing}pt`,
11772
+ ...previewOpenType
11331
11773
  },
11332
11774
  children: /*#__PURE__*/ jsx("span", {
11333
11775
  style: {
@@ -11413,7 +11855,7 @@ function previewScriptFontFamily(value, fallback) {
11413
11855
  return 'mixed' === value || 'inherit' === value ? fallback ?? void 0 : value;
11414
11856
  }
11415
11857
  function fontDialogDescription(source) {
11416
- return source.selectedCharacters ? `分别设置当前选中内容的拉丁、东亚和复杂文字字体,以及原生字符缩放、间距、字距调整阈值、位置、着重号、隐藏文字、空心、阴影、阳文和阴文(${source.selectedCharacters} 个字符)。` : '分别设置当前位置后续输入文字的拉丁、东亚和复杂文字字体,以及原生字符缩放、间距、字距调整阈值、位置、着重号、隐藏文字、空心、阴影、阳文和阴文。';
11858
+ return source.selectedCharacters ? `分别设置当前选中内容的拉丁、东亚和复杂文字字体,以及原生字符缩放、间距、字距调整阈值、位置、文字效果和 OpenType 排版(${source.selectedCharacters} 个字符)。` : '分别设置当前位置后续输入文字的拉丁、东亚和复杂文字字体,以及原生字符缩放、间距、字距调整阈值、位置、文字效果和 OpenType 排版。';
11417
11859
  }
11418
11860
  function DocumentPageChromeRibbon({ editor, editingPart, showPageNumber, onEditingPartChange, onTogglePageNumber, onOpenFontDialog, onOpenProofingDialog, onClose }) {
11419
11861
  const imageInputRef = useRef(null);