@a3s-lab/office 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -1
- package/dist/0~1403.js +1 -1
- package/dist/0~4980.js +1 -1
- package/dist/0~5093.js +64 -5
- package/dist/0~7043.js +241 -241
- package/dist/0~7048.js +1 -1
- package/dist/0~7614.js +1 -1
- package/dist/0~document-editor.js +433 -10
- package/dist/0~presentation-editor.js +1 -1
- package/dist/0~spreadsheet-editor.js +1 -2
- package/dist/0~work-docx-export.js +141 -3
- package/dist/0~work-docx-import.js +5 -3
- package/dist/0~work-office-diagnostics.js +46 -3
- package/dist/0~work-pptx-export.js +1 -1
- package/dist/0~work-pptx-import.js +1 -1
- package/dist/0~work-presentation-charts.js +1 -1
- package/dist/1544.js +1 -1
- package/dist/4104.js +2 -2
- package/dist/4121.js +1510 -0
- package/dist/6282.js +59 -684
- package/dist/8715.js +1 -1
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/features/work/editors/document-command-catalog.d.ts +9 -0
- package/dist/internal/features/work/editors/document-font-dialog-model.d.ts +5 -2
- package/dist/internal/features/work/editors/document-font-dialog-run-border-model.d.ts +24 -0
- package/dist/internal/features/work/editors/document-font-dialog-run-border-section.d.ts +10 -0
- package/dist/internal/features/work/work-document-character-formatting.d.ts +4 -0
- package/dist/internal/features/work/work-document-format-changes.d.ts +1 -0
- package/dist/internal/features/work/work-document-run-border.d.ts +11 -0
- package/dist/internal/features/work/work-document-word-line-metrics.d.ts +1 -0
- package/dist/internal/features/work/work-docx-run-border-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-run-border-export.d.ts +17 -0
- package/dist/internal/features/work/work-docx-run-border.d.ts +20 -0
- package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +2 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +31 -0
- package/docs/latest/en/browser-editor-architecture.md +22 -0
- package/package.json +4 -1
- package/dist/5184.js +0 -662
- package/dist/9424.js +0 -16
|
@@ -6,7 +6,7 @@ import { Fragment as external_react_Fragment, forwardRef, useCallback, useEffect
|
|
|
6
6
|
import { Extension, createNodeFromContent } from "@tiptap/core";
|
|
7
7
|
import { NodeSelection, Plugin, PluginKey, TextSelection } from "@tiptap/pm/state";
|
|
8
8
|
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
9
|
-
import { AArrowDown, AArrowUp, ALargeSmall, AlignCenter, AlignJustify, AlignLeft, AlignRight, AlignVerticalJustifyCenter, AlignVerticalJustifyEnd, AlignVerticalJustifyStart, ArrowDown, ArrowUp, BetweenHorizontalEnd, BetweenHorizontalStart, BetweenVerticalEnd, BetweenVerticalStart, Bold, BookMarked, BookOpen, Bookmark, CaseUpper, Check, CheckCheck, CheckCircle2, ChevronDown, ChevronRight, ChevronUp, ClipboardCopy, ClipboardPaste, Cloud, Columns3, Eraser, Eye, FileDiff, FilePlus2, FileText, Globe2, Grid2X2, Hash, Highlighter, Image, IndentDecrease, IndentIncrease, Italic, Link2, List, ListChecks, ListOrdered, MessageSquarePlus, MessageSquareReply, MessagesSquare, MoveVertical, Paintbrush, Palette, PanelBottom, PanelBottomOpen, PanelLeftOpen, PanelTop, PanelTopOpen, Pilcrow, PilcrowLeft, PilcrowRight, Plus, Quote, Redo2, RefreshCw, Replace, ReplaceAll, RotateCcw, Rows3, Ruler, Scan, Search, Settings2, StretchHorizontal, Strikethrough, Subscript, Superscript, Table2, TableCellsMerge, TableCellsSplit, TableProperties, TextWrap, Trash2, TriangleAlert, Type, Underline, Undo2, Unlink, Unlink2, X, XCircle, ZoomIn, ZoomOut } from "lucide-react";
|
|
9
|
+
import { AArrowDown, AArrowUp, ALargeSmall, AlignCenter, AlignJustify, AlignLeft, AlignRight, AlignVerticalJustifyCenter, AlignVerticalJustifyEnd, AlignVerticalJustifyStart, ArrowDown, ArrowUp, BetweenHorizontalEnd, BetweenHorizontalStart, BetweenVerticalEnd, BetweenVerticalStart, Bold, BookMarked, BookOpen, Bookmark, CaseUpper, Check, CheckCheck, CheckCircle2, ChevronDown, ChevronRight, ChevronUp, ClipboardCopy, ClipboardPaste, Cloud, Columns3, Eraser, Eye, FileDiff, FilePlus2, FileText, Globe2, Grid2X2, Hash, Highlighter, Image, IndentDecrease, IndentIncrease, Italic, Link2, List, ListChecks, ListOrdered, MessageSquarePlus, MessageSquareReply, MessagesSquare, MoveVertical, Paintbrush, Palette, PanelBottom, PanelBottomOpen, PanelLeftOpen, PanelTop, PanelTopOpen, Pilcrow, PilcrowLeft, PilcrowRight, Plus, Quote, Redo2, RefreshCw, Replace, ReplaceAll, RotateCcw, Rows3, Ruler, Scan, Search, Settings2, Square, StretchHorizontal, Strikethrough, Subscript, Superscript, Table2, TableCellsMerge, TableCellsSplit, TableProperties, TextWrap, Trash2, TriangleAlert, Type, Underline, Undo2, Unlink, Unlink2, X, XCircle, ZoomIn, ZoomOut } from "lucide-react";
|
|
10
10
|
import { Node as model_Node } from "@tiptap/pm/model";
|
|
11
11
|
import extension_color from "@tiptap/extension-color";
|
|
12
12
|
import { TableKit } from "@tiptap/extension-table";
|
|
@@ -15,11 +15,11 @@ import font_size from "@tiptap/extension-text-style/font-size";
|
|
|
15
15
|
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
|
-
import { documentTableSizing, transferChangedDocumentTextStatistics, documentPageBordersVisible, documentUnderlineStyle, DOCUMENT_PAGE_BORDER_EDGES, documentScriptFontDirectFamily, normalizeDocumentColumns, clampDocumentMargin, materializeLazyDocumentEditorRoot, patchDocumentScriptFonts, documentKerningThresholdPoints, nextDocumentTabAlignment, documentTableRowOptions, normalizedTabPosition, DOCUMENT_BOOKMARK_DUPLICATE_MESSAGE, documentCitationCount,
|
|
18
|
+
import { documentTableSizing, transferChangedDocumentTextStatistics, documentPageBordersVisible, documentUnderlineStyle, DOCUMENT_PAGE_BORDER_EDGES, documentScriptFontDirectFamily, normalizeDocumentColumns, clampDocumentMargin, materializeLazyDocumentEditorRoot, patchDocumentScriptFonts, documentKerningThresholdPoints, nextDocumentTabAlignment, documentTableRowOptions, normalizedTabPosition, DOCUMENT_BOOKMARK_DUPLICATE_MESSAGE, documentCitationCount, resolveDocumentPageBorders, documentLazyHtmlChunkFragment, DocumentFontFamily, normalizeDocumentHiddenText, documentLegacyTextEffectsConflict, DOCUMENT_CHUNK_VISIBLE_IDS_META, 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, documentOrderedListState, normalizeDocumentPageChrome, documentTextStatistics, documentPageMarginsForLayout, invalidateDocumentLazyHtmlProjection, documentTableCellFormat, normalizeDocumentPageGeometry, normalizeDocumentImageLayer, documentImageProperties, isValidDocumentCitationTag, sanitizeDocumentPageChromeHtml, pageTwipsToMillimeters, normalizeDocumentPageBorders, parseDocumentScriptFonts, DocumentParagraphFormatting, activeDocumentSection, normalizeDocumentHtml, documentInitialSectionLayout, documentModelHasTrustedInitialIntegrityFeatures, documentParagraphDirection, documentParagraphPagination, documentModelUsesWindowing, documentPageChromeLegacyFields, documentChunkMountedIds, collectDocumentCommentAnchors, documentTextCaseKeyboardShortcuts, DocumentTextStyle, canChangeDocumentIndent, cssDocumentFontFamily, documentCharacterSpacingPoints, documentKerningIsEffective, DocumentSuperscript, documentSectionById, activeDocumentBookmark, DocumentEquation, documentLazyHtmlProjectionFingerprint, documentLazyHtmlProjection, normalizeDocumentParagraphIndent, updateDocumentGutterPosition, DocumentStrike, mountWorkLiveDocumentCapture, registerDocumentPageSurfaceGeometry, documentHiddenTextKeyboardShortcut, syncDocumentContentFromHtml, documentLegacyTextEffectsCss, documentScriptFontSlotFromHint, editorDocumentCaptionTargets, resolveDocumentPageChrome, documentScriptFontFamilyForRendering, documentImageLayoutOptions, MAX_DOCUMENT_NUMBERING_START, resolveDocumentPageSize, editorDocumentBookmarkReferenceTargets, serializeWorkDocumentNode, DOCUMENT_CHUNK_PAGINATION_META, createOfficeDocumentCollaborationBinding as createWorkOfficeDocumentCollaborationBinding, documentModelForContent, documentLegacyTextEffectsFromTextStyleAttributes, normalizeDocumentEmphasisMark, selectedDocumentChunkId, documentCommentViews, documentParagraphSpacing, normalizeDocumentTabStops, patchDocumentLazyHtmlProjection, normalizeDocumentTextCase, serializeDocumentScriptFonts, documentUnderlineColor, documentBookmarkNameExists, collectDocumentChanges, DocumentImage, resolveDocumentPageMargins, updateDocumentPageMarginMode, canSetDocumentTableRowRepeatHeader, normalizeDocumentCharacterSpacingTwips, DocumentCharacterFormatting, millimetersToPixels as work_document_layout_millimetersToPixels, DOCUMENT_CHUNK_HYDRATION_META, documentTabLeaderLabel, createSchemaDerivedWorkDocumentModel, updateDocumentCustomPageMillimeters, DocumentUnderline, documentCommentDraftRange, documentParagraphTabStops, documentScriptFontSegments, documentUnderlineKeyboardShortcuts, documentParagraphIndent, documentFontNameFromCssFamily, DocumentScriptFontFormatting, canInsertDocumentComment, documentTableHorizontalAlignment, documentTextLayoutBatches, normalizeDocumentImageWrapSide, updateDocumentPageOrientation, documentCitationStyleDetails, validateDocumentBookmarkName, setCustomDocumentColumns, updateDocumentPageMarginMillimeters, documentCitationStyle, normalizeDocumentCharacterPositionHalfPoints, documentTransactionsOnlyHydrateChunks, normalizeDocumentKerningThresholdHalfPoints, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, DOCUMENT_TABLE_STYLE_OPTIONS, updateDocumentColumnWidth, updateDocumentPaperSizePreset, documentPageMetrics, documentStrikeStyle, createDocumentBibliography, DocumentSubscript, DocumentParagraphIdentity, updateDocumentPageChromeVariant, updateDocumentMirrorMargins, activeDocumentTableStyle, normalizeDocumentScriptFontSlot, measureDocumentLayoutBlocksIncrementally, documentWordLineHeightFactor, normalizeDocumentLegacyTextEffect, createWorkDocumentExtensions } from "./6282.js";
|
|
19
19
|
import { useOfficeTaskPaneEscape, normalizeOfficeFontFamily, OfficeCheckbox, useOfficeDialog, useOfficeTaskPaneModal, CommittedOfficeNumberField, officeFontFamilyLabel, officeFontFamilies, CollectionState, createOfficeKernelClient, OfficeNumberField } from "./0~7048.js";
|
|
20
20
|
import { moveOfficeMenuFocus, office_text_field_OfficeTextArea, Popover, officeOverlayPortalRoot, button_Button, useOfficePublishPresenceLocation, OfficeTiptapPresenceLayer, icon_button_IconButton, office_text_field_OfficeTextField, useDialogFocusScope, useOfficeEditorWheelZoom, office_text_field_OfficeFileInput } from "./0~6090.js";
|
|
21
21
|
import { WorkOfficePreviewBar, isWorkspaceContextMenuKeyboardEvent, Tabs, WorkOfficeZoomControls, WorkOfficeStatusBar, Dialog, WorkOfficeRibbon, workspaceContextMenuPosition, OfficeSelect, WorkspaceContextMenu, WorkOfficeRibbonGroup, WorkOfficeRibbonButton } from "./0~4595.js";
|
|
22
|
-
import { createOfficeId as createWorkId } from "./
|
|
22
|
+
import { documentBorderPresentation, normalizeDocumentRunBorder, parseDocumentRunBorder, DOCUMENT_RUN_BORDER_STYLES, isDocumentParagraphArtBorderStyle, serializeDocumentRunBorder, createOfficeId as createWorkId, documentRunBorderIsVisible } from "./4121.js";
|
|
23
23
|
import { normalizeDocumentHref, DOCUMENT_LINK_VALIDATION_MESSAGE } from "./0~work-document-links.js";
|
|
24
24
|
import { OfficeColorPicker, isOfficeShortcutBlocked } from "./0~3635.js";
|
|
25
25
|
import { OfficeTableInsertPopover, readOfficeFileAsDataUrl } from "./0~9445.js";
|
|
@@ -7222,6 +7222,15 @@ const documentCommandCatalog = {
|
|
|
7222
7222
|
]
|
|
7223
7223
|
}
|
|
7224
7224
|
},
|
|
7225
|
+
runBorder: {
|
|
7226
|
+
id: 'font.runBorder',
|
|
7227
|
+
label: '字符边框',
|
|
7228
|
+
location: {
|
|
7229
|
+
area: 'ribbon',
|
|
7230
|
+
tab: 'home',
|
|
7231
|
+
group: 'font'
|
|
7232
|
+
}
|
|
7233
|
+
},
|
|
7225
7234
|
clearFormatting: {
|
|
7226
7235
|
id: 'font.clearFormatting',
|
|
7227
7236
|
label: '清除格式',
|
|
@@ -8949,6 +8958,14 @@ function DocumentHomeRibbon({ editor, findReplaceMode, layoutFonts = [], onFindT
|
|
|
8949
8958
|
size: 16
|
|
8950
8959
|
})
|
|
8951
8960
|
}),
|
|
8961
|
+
/*#__PURE__*/ jsx(ToolbarButton, {
|
|
8962
|
+
label: "字符边框",
|
|
8963
|
+
active: documentRunBorderIsVisible(parseDocumentRunBorder(editor.getAttributes('textStyle').runBorder)),
|
|
8964
|
+
onClick: ()=>editor.commands.toggleDocumentRunBorder(),
|
|
8965
|
+
children: /*#__PURE__*/ jsx(Square, {
|
|
8966
|
+
size: 16
|
|
8967
|
+
})
|
|
8968
|
+
}),
|
|
8952
8969
|
/*#__PURE__*/ jsx(ToolbarButton, {
|
|
8953
8970
|
label: "清除格式",
|
|
8954
8971
|
onClick: ()=>editor.commands.clearDocumentFormatting(),
|
|
@@ -9243,6 +9260,89 @@ function addFontValue(values, value) {
|
|
|
9243
9260
|
const normalized = value?.trim() || null;
|
|
9244
9261
|
values.set(normalized?.toLocaleLowerCase() ?? 'inherited', normalized);
|
|
9245
9262
|
}
|
|
9263
|
+
function addDocumentFontDialogRunBorderValue(values, source) {
|
|
9264
|
+
const border = parseDocumentRunBorder(source);
|
|
9265
|
+
const serialized = serializeDocumentRunBorder(border);
|
|
9266
|
+
values.set(serialized ?? 'inherited', border);
|
|
9267
|
+
}
|
|
9268
|
+
function selectedDocumentFontDialogRunBorderValue(values) {
|
|
9269
|
+
return 1 === values.size ? {
|
|
9270
|
+
mixed: false,
|
|
9271
|
+
value: values.values().next().value ?? null
|
|
9272
|
+
} : {
|
|
9273
|
+
mixed: true,
|
|
9274
|
+
value: null
|
|
9275
|
+
};
|
|
9276
|
+
}
|
|
9277
|
+
function createDocumentFontDialogRunBorderDraft(source) {
|
|
9278
|
+
const border = source.value;
|
|
9279
|
+
const visible = border && 'nil' !== border.style && 'none' !== border.style;
|
|
9280
|
+
return {
|
|
9281
|
+
runBorderMode: source.mixed ? 'mixed' : border ? visible ? 'value' : 'none' : 'inherit',
|
|
9282
|
+
runBorderStyle: visible ? border.style : 'single',
|
|
9283
|
+
runBorderColor: border?.color?.value ?? 'auto',
|
|
9284
|
+
runBorderWidthPoints: formatPoints((border?.size ?? 4) / 8),
|
|
9285
|
+
runBorderSpacingPoints: String(border?.space ?? 1),
|
|
9286
|
+
runBorderShadow: border?.shadow ?? false,
|
|
9287
|
+
runBorderFrame: border?.frame ?? false
|
|
9288
|
+
};
|
|
9289
|
+
}
|
|
9290
|
+
function documentFontDialogRunBorderDraftError(draft) {
|
|
9291
|
+
if ('value' !== draft.runBorderMode) return null;
|
|
9292
|
+
if (!DOCUMENT_RUN_BORDER_STYLES.includes(draft.runBorderStyle) || 'nil' === draft.runBorderStyle || 'none' === draft.runBorderStyle) return '请选择有效的字符边框线型。';
|
|
9293
|
+
if ('auto' !== draft.runBorderColor && !/^#[0-9a-f]{6}$/i.test(draft.runBorderColor)) return '请选择有效的字符边框颜色。';
|
|
9294
|
+
if (null === runBorderSizeFromDraft(draft)) return '请输入 0.25 至 12 磅、以 0.125 磅递增的字符边框宽度。';
|
|
9295
|
+
if (null === runBorderSpaceFromDraft(draft)) return '请输入 0 至 31 磅的整数字符边框间距。';
|
|
9296
|
+
return null;
|
|
9297
|
+
}
|
|
9298
|
+
function documentFontDialogRunBorderPatch(source, draft, touched) {
|
|
9299
|
+
if (!touched || 'mixed' === draft.runBorderMode) return {};
|
|
9300
|
+
if ('inherit' === draft.runBorderMode) return source.mixed || source.value ? {
|
|
9301
|
+
runBorder: null
|
|
9302
|
+
} : {};
|
|
9303
|
+
const border = 'none' === draft.runBorderMode ? {
|
|
9304
|
+
style: 'nil'
|
|
9305
|
+
} : documentFontDialogRunBorderFromDraft(source, draft);
|
|
9306
|
+
if (!border) return {};
|
|
9307
|
+
return serializeDocumentRunBorder(source.value) === serializeDocumentRunBorder(border) ? {} : {
|
|
9308
|
+
runBorder: border
|
|
9309
|
+
};
|
|
9310
|
+
}
|
|
9311
|
+
function documentFontDialogRunBorderFromDraft(source, draft) {
|
|
9312
|
+
if ('none' === draft.runBorderMode) return {
|
|
9313
|
+
style: 'nil'
|
|
9314
|
+
};
|
|
9315
|
+
if ('value' !== draft.runBorderMode) return source.value;
|
|
9316
|
+
const size = runBorderSizeFromDraft(draft);
|
|
9317
|
+
const space = runBorderSpaceFromDraft(draft);
|
|
9318
|
+
if (null === size || null === space) return null;
|
|
9319
|
+
const sourceColor = source.value?.color;
|
|
9320
|
+
return normalizeDocumentRunBorder({
|
|
9321
|
+
style: draft.runBorderStyle,
|
|
9322
|
+
color: {
|
|
9323
|
+
value: draft.runBorderColor,
|
|
9324
|
+
...sourceColor?.theme && sourceColor.value === draft.runBorderColor ? {
|
|
9325
|
+
theme: sourceColor.theme
|
|
9326
|
+
} : {}
|
|
9327
|
+
},
|
|
9328
|
+
size,
|
|
9329
|
+
space,
|
|
9330
|
+
shadow: draft.runBorderShadow,
|
|
9331
|
+
frame: draft.runBorderFrame
|
|
9332
|
+
});
|
|
9333
|
+
}
|
|
9334
|
+
function runBorderSizeFromDraft(draft) {
|
|
9335
|
+
const points = Number(draft.runBorderWidthPoints);
|
|
9336
|
+
const size = Math.round(8 * points);
|
|
9337
|
+
return Number.isFinite(points) && size >= 2 && size <= 96 && 8 * points === size ? size : null;
|
|
9338
|
+
}
|
|
9339
|
+
function runBorderSpaceFromDraft(draft) {
|
|
9340
|
+
const space = Number(draft.runBorderSpacingPoints);
|
|
9341
|
+
return Number.isSafeInteger(space) && space >= 0 && space <= 31 ? space : null;
|
|
9342
|
+
}
|
|
9343
|
+
function formatPoints(value) {
|
|
9344
|
+
return Number(value.toFixed(3)).toString();
|
|
9345
|
+
}
|
|
9246
9346
|
function documentFontDialogSource(editor) {
|
|
9247
9347
|
const { doc, selection } = editor.state;
|
|
9248
9348
|
const scaleValues = new Map();
|
|
@@ -9255,6 +9355,7 @@ function documentFontDialogSource(editor) {
|
|
|
9255
9355
|
const legacyTextShadowValues = new Map();
|
|
9256
9356
|
const legacyTextEmbossValues = new Map();
|
|
9257
9357
|
const legacyTextImprintValues = new Map();
|
|
9358
|
+
const runBorderValues = new Map();
|
|
9258
9359
|
const latinFontValues = new Map();
|
|
9259
9360
|
const eastAsiaFontValues = new Map();
|
|
9260
9361
|
const complexScriptFontValues = new Map();
|
|
@@ -9269,6 +9370,7 @@ function documentFontDialogSource(editor) {
|
|
|
9269
9370
|
addLegacyTextEffectValue(legacyTextShadowValues, attributes.legacyTextShadow);
|
|
9270
9371
|
addLegacyTextEffectValue(legacyTextEmbossValues, attributes.legacyTextEmboss);
|
|
9271
9372
|
addLegacyTextEffectValue(legacyTextImprintValues, attributes.legacyTextImprint);
|
|
9373
|
+
addDocumentFontDialogRunBorderValue(runBorderValues, attributes.runBorder);
|
|
9272
9374
|
addDocumentScriptFontValues(latinFontValues, eastAsiaFontValues, complexScriptFontValues, attributes);
|
|
9273
9375
|
};
|
|
9274
9376
|
if (selection.empty) addValues(editor.getAttributes('textStyle'));
|
|
@@ -9277,7 +9379,7 @@ function documentFontDialogSource(editor) {
|
|
|
9277
9379
|
const textStyle = node.marks.find((mark)=>'textStyle' === mark.type.name);
|
|
9278
9380
|
addValues(textStyle?.attrs ?? {});
|
|
9279
9381
|
});
|
|
9280
|
-
if (!scaleValues.size || !spacingValues.size || !positionValues.size || !kerningValues.size || !emphasisValues.size || !hiddenTextValues.size || !legacyTextOutlineValues.size || !legacyTextShadowValues.size || !legacyTextEmbossValues.size || !legacyTextImprintValues.size || !latinFontValues.size || !eastAsiaFontValues.size || !complexScriptFontValues.size) addValues(editor.getAttributes('textStyle'));
|
|
9382
|
+
if (!scaleValues.size || !spacingValues.size || !positionValues.size || !kerningValues.size || !emphasisValues.size || !hiddenTextValues.size || !legacyTextOutlineValues.size || !legacyTextShadowValues.size || !legacyTextEmbossValues.size || !legacyTextImprintValues.size || !runBorderValues.size || !latinFontValues.size || !eastAsiaFontValues.size || !complexScriptFontValues.size) addValues(editor.getAttributes('textStyle'));
|
|
9281
9383
|
const characterScale = selectedValue(scaleValues);
|
|
9282
9384
|
const characterPosition = selectedValue(positionValues);
|
|
9283
9385
|
const characterSpacing = selectedValue(spacingValues);
|
|
@@ -9288,6 +9390,7 @@ function documentFontDialogSource(editor) {
|
|
|
9288
9390
|
const legacyTextShadow = selectedValue(legacyTextShadowValues);
|
|
9289
9391
|
const legacyTextEmboss = selectedValue(legacyTextEmbossValues);
|
|
9290
9392
|
const legacyTextImprint = selectedValue(legacyTextImprintValues);
|
|
9393
|
+
const runBorder = selectedDocumentFontDialogRunBorderValue(runBorderValues);
|
|
9291
9394
|
const latinFont = selectedValue(latinFontValues);
|
|
9292
9395
|
const eastAsiaFont = selectedValue(eastAsiaFontValues);
|
|
9293
9396
|
const complexScriptFont = selectedValue(complexScriptFontValues);
|
|
@@ -9304,6 +9407,7 @@ function documentFontDialogSource(editor) {
|
|
|
9304
9407
|
legacyTextShadow,
|
|
9305
9408
|
legacyTextEmboss,
|
|
9306
9409
|
legacyTextImprint,
|
|
9410
|
+
runBorder,
|
|
9307
9411
|
latinFont,
|
|
9308
9412
|
eastAsiaFont,
|
|
9309
9413
|
complexScriptFont,
|
|
@@ -9324,23 +9428,26 @@ function createDocumentFontDialogDraft(source) {
|
|
|
9324
9428
|
characterScaleMode: source.characterScale.mixed ? 'mixed' : 'value',
|
|
9325
9429
|
characterScalePercent: source.characterScale.mixed ? '' : String(scale ?? 100),
|
|
9326
9430
|
characterPositionMode: source.characterPosition.mixed ? 'mixed' : null !== position && position < 0 ? 'lowered' : null !== position && position > 0 ? 'raised' : 'normal',
|
|
9327
|
-
characterPositionPoints:
|
|
9431
|
+
characterPositionPoints: document_font_dialog_model_formatPoints(positionPoints || 1),
|
|
9328
9432
|
characterSpacingMode: source.characterSpacing.mixed ? 'mixed' : null !== spacing && spacing < 0 ? 'condensed' : null !== spacing && spacing > 0 ? 'expanded' : 'normal',
|
|
9329
|
-
characterSpacingPoints:
|
|
9433
|
+
characterSpacingPoints: document_font_dialog_model_formatPoints(spacingPoints || 1),
|
|
9330
9434
|
kerningEnabled: !source.kerningThreshold.mixed && null !== kerningThreshold,
|
|
9331
|
-
kerningThresholdPoints:
|
|
9435
|
+
kerningThresholdPoints: document_font_dialog_model_formatPoints(documentKerningThresholdPoints(kerningThreshold) ?? 12),
|
|
9332
9436
|
emphasisMark: source.emphasisMark.mixed ? 'mixed' : source.emphasisMark.value ?? 'inherit',
|
|
9333
9437
|
hiddenText: source.hiddenText.value ?? false,
|
|
9334
9438
|
legacyTextOutline: source.legacyTextOutline.value ?? false,
|
|
9335
9439
|
legacyTextShadow: source.legacyTextShadow.value ?? false,
|
|
9336
9440
|
legacyTextEmboss: source.legacyTextEmboss.value ?? false,
|
|
9337
9441
|
legacyTextImprint: source.legacyTextImprint.value ?? false,
|
|
9442
|
+
...createDocumentFontDialogRunBorderDraft(source.runBorder),
|
|
9338
9443
|
latinFont: documentFontFamilyDraftValue(source.latinFont),
|
|
9339
9444
|
eastAsiaFont: documentFontFamilyDraftValue(source.eastAsiaFont),
|
|
9340
9445
|
complexScriptFont: documentFontFamilyDraftValue(source.complexScriptFont)
|
|
9341
9446
|
};
|
|
9342
9447
|
}
|
|
9343
9448
|
function documentFontDialogDraftError(draft) {
|
|
9449
|
+
const runBorderError = documentFontDialogRunBorderDraftError(draft);
|
|
9450
|
+
if (runBorderError) return runBorderError;
|
|
9344
9451
|
if ('mixed' !== draft.characterScaleMode && null === characterScalePercentFromDraft(draft)) return "请输入 1 至 600 的整数缩放比例。";
|
|
9345
9452
|
if ('mixed' !== draft.characterSpacingMode && 'normal' !== draft.characterSpacingMode && null === characterSpacingTwipsFromDraft(draft)) return "请输入 0.05 至 1584 磅的间距。";
|
|
9346
9453
|
if ('mixed' !== draft.characterPositionMode && 'normal' !== draft.characterPositionMode && null === characterPositionHalfPointsFromDraft(draft)) return "请输入 0.5 至 1584 磅、以 0.5 磅递增的位置值。";
|
|
@@ -9375,6 +9482,7 @@ function documentFontDialogPatch(source, draft, touched) {
|
|
|
9375
9482
|
}
|
|
9376
9483
|
if (touched.hiddenText && (source.hiddenText.mixed || source.hiddenText.value !== draft.hiddenText)) patch.hiddenText = draft.hiddenText;
|
|
9377
9484
|
appendLegacyTextEffectPatch(patch, 'legacyTextOutline', source.legacyTextOutline, draft.legacyTextOutline, touched.legacyTextOutline);
|
|
9485
|
+
Object.assign(patch, documentFontDialogRunBorderPatch(source.runBorder, draft, touched.runBorder));
|
|
9378
9486
|
appendLegacyTextEffectPatch(patch, 'legacyTextShadow', source.legacyTextShadow, draft.legacyTextShadow, touched.legacyTextShadow);
|
|
9379
9487
|
appendLegacyTextEffectPatch(patch, 'legacyTextEmboss', source.legacyTextEmboss, draft.legacyTextEmboss, touched.legacyTextEmboss);
|
|
9380
9488
|
appendLegacyTextEffectPatch(patch, 'legacyTextImprint', source.legacyTextImprint, draft.legacyTextImprint, touched.legacyTextImprint);
|
|
@@ -9394,6 +9502,7 @@ function applyDocumentFontDialogPatch(editor, selection, patch) {
|
|
|
9394
9502
|
const hasLegacyTextShadow = void 0 !== patch.legacyTextShadow;
|
|
9395
9503
|
const hasLegacyTextEmboss = void 0 !== patch.legacyTextEmboss;
|
|
9396
9504
|
const hasLegacyTextImprint = void 0 !== patch.legacyTextImprint;
|
|
9505
|
+
const hasRunBorder = void 0 !== patch.runBorder;
|
|
9397
9506
|
const hasLegacyTextEffects = hasLegacyTextOutline || hasLegacyTextShadow || hasLegacyTextEmboss || hasLegacyTextImprint;
|
|
9398
9507
|
const scriptFontPatch = {
|
|
9399
9508
|
...void 0 !== patch.latinFont ? {
|
|
@@ -9412,8 +9521,9 @@ function applyDocumentFontDialogPatch(editor, selection, patch) {
|
|
|
9412
9521
|
const spacing = hasSpacing ? normalizeDocumentCharacterSpacingTwips(patch.characterSpacingTwips) : null;
|
|
9413
9522
|
const kerningThreshold = hasKerning && null !== patch.kerningThresholdHalfPoints ? normalizeDocumentKerningThresholdHalfPoints(patch.kerningThresholdHalfPoints) : null;
|
|
9414
9523
|
const emphasisMark = hasEmphasis && null !== patch.emphasisMark ? normalizeDocumentEmphasisMark(patch.emphasisMark) : null;
|
|
9524
|
+
const runBorder = hasRunBorder && null !== patch.runBorder ? normalizeDocumentRunBorder(patch.runBorder) : null;
|
|
9415
9525
|
const maximum = editor.state.doc.content.size;
|
|
9416
|
-
if (editor.isDestroyed || !hasScale && !hasPosition && !hasSpacing && !hasKerning && !hasEmphasis && !hasHiddenText && !hasLegacyTextEffects && !hasScriptFonts || hasScale && null === scale || hasPosition && null === position || hasSpacing && null === spacing || hasKerning && null !== patch.kerningThresholdHalfPoints && null === kerningThreshold || hasEmphasis && null !== patch.emphasisMark && null === emphasisMark || 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;
|
|
9526
|
+
if (editor.isDestroyed || !hasScale && !hasPosition && !hasSpacing && !hasKerning && !hasEmphasis && !hasHiddenText && !hasLegacyTextEffects && !hasRunBorder && !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 || 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;
|
|
9417
9527
|
const attributes = {};
|
|
9418
9528
|
if (null !== scale) attributes.characterScalePercent = scale;
|
|
9419
9529
|
if (null !== position) attributes.characterPositionHalfPoints = position;
|
|
@@ -9425,6 +9535,7 @@ function applyDocumentFontDialogPatch(editor, selection, patch) {
|
|
|
9425
9535
|
if (hasLegacyTextShadow) attributes.legacyTextShadow = patch.legacyTextShadow ?? false;
|
|
9426
9536
|
if (hasLegacyTextEmboss) attributes.legacyTextEmboss = patch.legacyTextEmboss ?? false;
|
|
9427
9537
|
if (hasLegacyTextImprint) attributes.legacyTextImprint = patch.legacyTextImprint ?? false;
|
|
9538
|
+
if (hasRunBorder) attributes.runBorder = null === patch.runBorder ? null : serializeDocumentRunBorder(runBorder) ?? null;
|
|
9428
9539
|
if (hasScriptFonts) return applyDocumentScriptFontPatch(editor, selection, attributes, scriptFontPatch);
|
|
9429
9540
|
return editor.chain().setTextSelection(selection).setMark('textStyle', attributes).removeEmptyTextStyle().focus().scrollIntoView().run();
|
|
9430
9541
|
}
|
|
@@ -9529,9 +9640,307 @@ function selectedValue(values) {
|
|
|
9529
9640
|
value: mixed ? null : values.values().next().value ?? null
|
|
9530
9641
|
};
|
|
9531
9642
|
}
|
|
9532
|
-
function
|
|
9643
|
+
function document_font_dialog_model_formatPoints(value) {
|
|
9533
9644
|
return String(Number(value.toFixed(2)));
|
|
9534
9645
|
}
|
|
9646
|
+
const runBorderModes = [
|
|
9647
|
+
{
|
|
9648
|
+
value: 'mixed',
|
|
9649
|
+
label: '混合(保持不变)',
|
|
9650
|
+
disabled: true
|
|
9651
|
+
},
|
|
9652
|
+
{
|
|
9653
|
+
value: 'inherit',
|
|
9654
|
+
label: '跟随样式'
|
|
9655
|
+
},
|
|
9656
|
+
{
|
|
9657
|
+
value: 'none',
|
|
9658
|
+
label: '无(显式重置)'
|
|
9659
|
+
},
|
|
9660
|
+
{
|
|
9661
|
+
value: 'value',
|
|
9662
|
+
label: '边框'
|
|
9663
|
+
}
|
|
9664
|
+
];
|
|
9665
|
+
const runBorderStyles = [
|
|
9666
|
+
{
|
|
9667
|
+
value: 'single',
|
|
9668
|
+
label: '单实线'
|
|
9669
|
+
},
|
|
9670
|
+
{
|
|
9671
|
+
value: 'thick',
|
|
9672
|
+
label: '粗实线'
|
|
9673
|
+
},
|
|
9674
|
+
{
|
|
9675
|
+
value: 'double',
|
|
9676
|
+
label: '双线'
|
|
9677
|
+
},
|
|
9678
|
+
{
|
|
9679
|
+
value: 'dotted',
|
|
9680
|
+
label: '点线'
|
|
9681
|
+
},
|
|
9682
|
+
{
|
|
9683
|
+
value: 'dashed',
|
|
9684
|
+
label: '虚线'
|
|
9685
|
+
},
|
|
9686
|
+
{
|
|
9687
|
+
value: 'dotDash',
|
|
9688
|
+
label: '点划线'
|
|
9689
|
+
},
|
|
9690
|
+
{
|
|
9691
|
+
value: 'dotDotDash',
|
|
9692
|
+
label: '双点划线'
|
|
9693
|
+
},
|
|
9694
|
+
{
|
|
9695
|
+
value: 'triple',
|
|
9696
|
+
label: '三线'
|
|
9697
|
+
},
|
|
9698
|
+
{
|
|
9699
|
+
value: 'thinThickSmallGap',
|
|
9700
|
+
label: '细粗线(小间距)'
|
|
9701
|
+
},
|
|
9702
|
+
{
|
|
9703
|
+
value: 'thickThinSmallGap',
|
|
9704
|
+
label: '粗细线(小间距)'
|
|
9705
|
+
},
|
|
9706
|
+
{
|
|
9707
|
+
value: 'thinThickThinSmallGap',
|
|
9708
|
+
label: '细粗细线(小间距)'
|
|
9709
|
+
},
|
|
9710
|
+
{
|
|
9711
|
+
value: 'thinThickMediumGap',
|
|
9712
|
+
label: '细粗线(中间距)'
|
|
9713
|
+
},
|
|
9714
|
+
{
|
|
9715
|
+
value: 'thickThinMediumGap',
|
|
9716
|
+
label: '粗细线(中间距)'
|
|
9717
|
+
},
|
|
9718
|
+
{
|
|
9719
|
+
value: 'thinThickThinMediumGap',
|
|
9720
|
+
label: '细粗细线(中间距)'
|
|
9721
|
+
},
|
|
9722
|
+
{
|
|
9723
|
+
value: 'thinThickLargeGap',
|
|
9724
|
+
label: '细粗线(大间距)'
|
|
9725
|
+
},
|
|
9726
|
+
{
|
|
9727
|
+
value: 'thickThinLargeGap',
|
|
9728
|
+
label: '粗细线(大间距)'
|
|
9729
|
+
},
|
|
9730
|
+
{
|
|
9731
|
+
value: 'thinThickThinLargeGap',
|
|
9732
|
+
label: '细粗细线(大间距)'
|
|
9733
|
+
},
|
|
9734
|
+
{
|
|
9735
|
+
value: 'wave',
|
|
9736
|
+
label: '波浪线'
|
|
9737
|
+
},
|
|
9738
|
+
{
|
|
9739
|
+
value: 'doubleWave',
|
|
9740
|
+
label: '双波浪线'
|
|
9741
|
+
},
|
|
9742
|
+
{
|
|
9743
|
+
value: 'dashSmallGap',
|
|
9744
|
+
label: '短划线'
|
|
9745
|
+
},
|
|
9746
|
+
{
|
|
9747
|
+
value: 'dashDotStroked',
|
|
9748
|
+
label: '粗点划线'
|
|
9749
|
+
},
|
|
9750
|
+
{
|
|
9751
|
+
value: 'threeDEmboss',
|
|
9752
|
+
label: '三维浮雕'
|
|
9753
|
+
},
|
|
9754
|
+
{
|
|
9755
|
+
value: 'threeDEngrave',
|
|
9756
|
+
label: '三维凹刻'
|
|
9757
|
+
},
|
|
9758
|
+
{
|
|
9759
|
+
value: 'outset',
|
|
9760
|
+
label: '外凸'
|
|
9761
|
+
},
|
|
9762
|
+
{
|
|
9763
|
+
value: 'inset',
|
|
9764
|
+
label: '内凹'
|
|
9765
|
+
}
|
|
9766
|
+
];
|
|
9767
|
+
function DocumentFontDialogRunBorderSection({ source, draft, touched, onDraftChange, onTouched }) {
|
|
9768
|
+
const enabled = 'value' === draft.runBorderMode;
|
|
9769
|
+
const update = (patch)=>{
|
|
9770
|
+
onDraftChange(patch);
|
|
9771
|
+
onTouched();
|
|
9772
|
+
};
|
|
9773
|
+
return /*#__PURE__*/ jsxs("fieldset", {
|
|
9774
|
+
className: "work-document-font-dialog-run-border",
|
|
9775
|
+
"aria-label": "字符边框设置",
|
|
9776
|
+
children: [
|
|
9777
|
+
/*#__PURE__*/ jsx("legend", {
|
|
9778
|
+
children: "字符边框"
|
|
9779
|
+
}),
|
|
9780
|
+
/*#__PURE__*/ jsxs("div", {
|
|
9781
|
+
className: "work-document-font-dialog-field",
|
|
9782
|
+
children: [
|
|
9783
|
+
/*#__PURE__*/ jsx("span", {
|
|
9784
|
+
children: "应用方式"
|
|
9785
|
+
}),
|
|
9786
|
+
/*#__PURE__*/ jsx(OfficeSelect, {
|
|
9787
|
+
ariaLabel: "字符边框",
|
|
9788
|
+
value: draft.runBorderMode,
|
|
9789
|
+
options: runBorderModes,
|
|
9790
|
+
onValueChange: (runBorderMode)=>update({
|
|
9791
|
+
runBorderMode
|
|
9792
|
+
})
|
|
9793
|
+
})
|
|
9794
|
+
]
|
|
9795
|
+
}),
|
|
9796
|
+
/*#__PURE__*/ jsxs("div", {
|
|
9797
|
+
className: "work-document-font-dialog-field",
|
|
9798
|
+
children: [
|
|
9799
|
+
/*#__PURE__*/ jsx("span", {
|
|
9800
|
+
children: "线型"
|
|
9801
|
+
}),
|
|
9802
|
+
/*#__PURE__*/ jsx(OfficeSelect, {
|
|
9803
|
+
ariaLabel: "字符边框线型",
|
|
9804
|
+
value: draft.runBorderStyle,
|
|
9805
|
+
options: runBorderStyles,
|
|
9806
|
+
disabled: !enabled,
|
|
9807
|
+
onValueChange: (runBorderStyle)=>update({
|
|
9808
|
+
runBorderMode: 'value',
|
|
9809
|
+
runBorderStyle
|
|
9810
|
+
})
|
|
9811
|
+
})
|
|
9812
|
+
]
|
|
9813
|
+
}),
|
|
9814
|
+
/*#__PURE__*/ jsxs("div", {
|
|
9815
|
+
className: "work-document-font-dialog-field",
|
|
9816
|
+
children: [
|
|
9817
|
+
/*#__PURE__*/ jsx("span", {
|
|
9818
|
+
children: "颜色"
|
|
9819
|
+
}),
|
|
9820
|
+
/*#__PURE__*/ jsx(OfficeColorPicker, {
|
|
9821
|
+
ariaLabel: "字符边框颜色",
|
|
9822
|
+
value: 'auto' === draft.runBorderColor ? '#000000' : draft.runBorderColor,
|
|
9823
|
+
disabled: !enabled,
|
|
9824
|
+
resetAction: {
|
|
9825
|
+
kind: 'automatic',
|
|
9826
|
+
label: '自动颜色',
|
|
9827
|
+
onSelect: ()=>update({
|
|
9828
|
+
runBorderMode: 'value',
|
|
9829
|
+
runBorderColor: 'auto'
|
|
9830
|
+
})
|
|
9831
|
+
},
|
|
9832
|
+
onValueChange: (runBorderColor)=>update({
|
|
9833
|
+
runBorderMode: 'value',
|
|
9834
|
+
runBorderColor: runBorderColor
|
|
9835
|
+
})
|
|
9836
|
+
})
|
|
9837
|
+
]
|
|
9838
|
+
}),
|
|
9839
|
+
/*#__PURE__*/ jsxs("div", {
|
|
9840
|
+
className: "work-document-font-dialog-field",
|
|
9841
|
+
children: [
|
|
9842
|
+
/*#__PURE__*/ jsx("span", {
|
|
9843
|
+
children: "宽度"
|
|
9844
|
+
}),
|
|
9845
|
+
/*#__PURE__*/ jsxs("span", {
|
|
9846
|
+
className: "work-document-font-dialog-measure",
|
|
9847
|
+
children: [
|
|
9848
|
+
/*#__PURE__*/ jsx(OfficeNumberField, {
|
|
9849
|
+
ariaLabel: "字符边框宽度(磅)",
|
|
9850
|
+
value: draft.runBorderWidthPoints,
|
|
9851
|
+
min: 0.25,
|
|
9852
|
+
max: 12,
|
|
9853
|
+
step: 0.125,
|
|
9854
|
+
disabled: !enabled,
|
|
9855
|
+
onValueChange: (runBorderWidthPoints)=>update({
|
|
9856
|
+
runBorderMode: 'value',
|
|
9857
|
+
runBorderWidthPoints
|
|
9858
|
+
})
|
|
9859
|
+
}),
|
|
9860
|
+
/*#__PURE__*/ jsx("span", {
|
|
9861
|
+
"aria-hidden": "true",
|
|
9862
|
+
children: "磅"
|
|
9863
|
+
})
|
|
9864
|
+
]
|
|
9865
|
+
})
|
|
9866
|
+
]
|
|
9867
|
+
}),
|
|
9868
|
+
/*#__PURE__*/ jsxs("div", {
|
|
9869
|
+
className: "work-document-font-dialog-field",
|
|
9870
|
+
children: [
|
|
9871
|
+
/*#__PURE__*/ jsx("span", {
|
|
9872
|
+
children: "文字间距"
|
|
9873
|
+
}),
|
|
9874
|
+
/*#__PURE__*/ jsxs("span", {
|
|
9875
|
+
className: "work-document-font-dialog-measure",
|
|
9876
|
+
children: [
|
|
9877
|
+
/*#__PURE__*/ jsx(OfficeNumberField, {
|
|
9878
|
+
ariaLabel: "字符边框间距(磅)",
|
|
9879
|
+
value: draft.runBorderSpacingPoints,
|
|
9880
|
+
min: 0,
|
|
9881
|
+
max: 31,
|
|
9882
|
+
step: 1,
|
|
9883
|
+
disabled: !enabled,
|
|
9884
|
+
onValueChange: (runBorderSpacingPoints)=>update({
|
|
9885
|
+
runBorderMode: 'value',
|
|
9886
|
+
runBorderSpacingPoints
|
|
9887
|
+
})
|
|
9888
|
+
}),
|
|
9889
|
+
/*#__PURE__*/ jsx("span", {
|
|
9890
|
+
"aria-hidden": "true",
|
|
9891
|
+
children: "磅"
|
|
9892
|
+
})
|
|
9893
|
+
]
|
|
9894
|
+
})
|
|
9895
|
+
]
|
|
9896
|
+
}),
|
|
9897
|
+
/*#__PURE__*/ jsxs("div", {
|
|
9898
|
+
className: "work-document-font-dialog-run-border-effects",
|
|
9899
|
+
children: [
|
|
9900
|
+
/*#__PURE__*/ jsx(OfficeCheckbox, {
|
|
9901
|
+
ariaLabel: "字符边框阴影",
|
|
9902
|
+
checked: draft.runBorderShadow,
|
|
9903
|
+
disabled: !enabled,
|
|
9904
|
+
onCheckedChange: (runBorderShadow)=>update({
|
|
9905
|
+
runBorderMode: 'value',
|
|
9906
|
+
runBorderShadow
|
|
9907
|
+
}),
|
|
9908
|
+
children: "阴影"
|
|
9909
|
+
}),
|
|
9910
|
+
/*#__PURE__*/ jsx(OfficeCheckbox, {
|
|
9911
|
+
ariaLabel: "字符边框框架",
|
|
9912
|
+
checked: draft.runBorderFrame,
|
|
9913
|
+
disabled: !enabled,
|
|
9914
|
+
onCheckedChange: (runBorderFrame)=>update({
|
|
9915
|
+
runBorderMode: 'value',
|
|
9916
|
+
runBorderFrame
|
|
9917
|
+
}),
|
|
9918
|
+
children: "框架"
|
|
9919
|
+
})
|
|
9920
|
+
]
|
|
9921
|
+
}),
|
|
9922
|
+
source.mixed && !touched ? /*#__PURE__*/ jsx("p", {
|
|
9923
|
+
className: "work-document-font-dialog-mixed",
|
|
9924
|
+
role: "status",
|
|
9925
|
+
children: "当前选区包含不同的字符边框。选择一种应用方式后才会统一修改。"
|
|
9926
|
+
}) : null
|
|
9927
|
+
]
|
|
9928
|
+
});
|
|
9929
|
+
}
|
|
9930
|
+
function documentFontDialogRunBorderPreviewStyle(source, draft) {
|
|
9931
|
+
const border = documentFontDialogRunBorderFromDraft(source, draft);
|
|
9932
|
+
if (!border) return {};
|
|
9933
|
+
const presentation = documentBorderPresentation(border);
|
|
9934
|
+
return {
|
|
9935
|
+
border: `${presentation.width}px ${presentation.style} ${presentation.color}`,
|
|
9936
|
+
padding: `${(border.space ?? 0) * (96 / 72)}px`,
|
|
9937
|
+
boxDecorationBreak: 'clone',
|
|
9938
|
+
WebkitBoxDecorationBreak: 'clone',
|
|
9939
|
+
...border.shadow && presentation.width > 0 ? {
|
|
9940
|
+
boxShadow: `2px 2px 0 ${presentation.color}`
|
|
9941
|
+
} : {}
|
|
9942
|
+
};
|
|
9943
|
+
}
|
|
9535
9944
|
const characterSpacingModes = [
|
|
9536
9945
|
{
|
|
9537
9946
|
value: 'mixed',
|
|
@@ -9613,6 +10022,7 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
9613
10022
|
const [legacyTextShadowTouched, setLegacyTextShadowTouched] = useState(false);
|
|
9614
10023
|
const [legacyTextEmbossTouched, setLegacyTextEmbossTouched] = useState(false);
|
|
9615
10024
|
const [legacyTextImprintTouched, setLegacyTextImprintTouched] = useState(false);
|
|
10025
|
+
const [runBorderTouched, setRunBorderTouched] = useState(false);
|
|
9616
10026
|
const [latinFontTouched, setLatinFontTouched] = useState(false);
|
|
9617
10027
|
const [eastAsiaFontTouched, setEastAsiaFontTouched] = useState(false);
|
|
9618
10028
|
const [complexScriptFontTouched, setComplexScriptFontTouched] = useState(false);
|
|
@@ -9630,6 +10040,7 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
9630
10040
|
legacyTextShadow: legacyTextShadowTouched,
|
|
9631
10041
|
legacyTextEmboss: legacyTextEmbossTouched,
|
|
9632
10042
|
legacyTextImprint: legacyTextImprintTouched,
|
|
10043
|
+
runBorder: runBorderTouched,
|
|
9633
10044
|
kerning: kerningTouched,
|
|
9634
10045
|
latinFont: latinFontTouched
|
|
9635
10046
|
});
|
|
@@ -9645,6 +10056,7 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
9645
10056
|
emboss: draft.legacyTextEmboss,
|
|
9646
10057
|
imprint: draft.legacyTextImprint
|
|
9647
10058
|
});
|
|
10059
|
+
const previewRunBorder = documentFontDialogRunBorderPreviewStyle(source.runBorder, draft);
|
|
9648
10060
|
const submit = (event)=>{
|
|
9649
10061
|
event?.preventDefault();
|
|
9650
10062
|
if (!hasChanges || error) return;
|
|
@@ -10084,6 +10496,16 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
10084
10496
|
})
|
|
10085
10497
|
]
|
|
10086
10498
|
}),
|
|
10499
|
+
/*#__PURE__*/ jsx(DocumentFontDialogRunBorderSection, {
|
|
10500
|
+
source: source.runBorder,
|
|
10501
|
+
draft: draft,
|
|
10502
|
+
touched: runBorderTouched,
|
|
10503
|
+
onDraftChange: (runBorderDraft)=>setDraft((current)=>({
|
|
10504
|
+
...current,
|
|
10505
|
+
...runBorderDraft
|
|
10506
|
+
})),
|
|
10507
|
+
onTouched: ()=>setRunBorderTouched(true)
|
|
10508
|
+
}),
|
|
10087
10509
|
source.characterScale.mixed && !characterScaleTouched && /*#__PURE__*/ jsx("p", {
|
|
10088
10510
|
className: "work-document-font-dialog-mixed",
|
|
10089
10511
|
role: "status",
|
|
@@ -10119,7 +10541,7 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
10119
10541
|
role: "status",
|
|
10120
10542
|
children: "当前选区包含不同的空心、阴影、阳文或阴文设置。勾选或取消对应选项后才会统一修改。"
|
|
10121
10543
|
}),
|
|
10122
|
-
(characterScaleTouched || characterSpacingTouched || characterPositionTouched || kerningTouched || emphasisTouched || hiddenTextTouched || legacyTextOutlineTouched || legacyTextShadowTouched || legacyTextEmbossTouched || legacyTextImprintTouched) && error && /*#__PURE__*/ jsx("p", {
|
|
10544
|
+
(characterScaleTouched || characterSpacingTouched || characterPositionTouched || kerningTouched || emphasisTouched || hiddenTextTouched || legacyTextOutlineTouched || legacyTextShadowTouched || legacyTextEmbossTouched || legacyTextImprintTouched || runBorderTouched) && error && /*#__PURE__*/ jsx("p", {
|
|
10123
10545
|
className: "work-document-font-dialog-error",
|
|
10124
10546
|
role: "alert",
|
|
10125
10547
|
children: error
|
|
@@ -10146,6 +10568,7 @@ function DocumentFontDialog({ source, layoutFonts = [], restoreFocusTarget, onAp
|
|
|
10146
10568
|
verticalAlign: `${previewPosition}pt`,
|
|
10147
10569
|
...previewEmphasis,
|
|
10148
10570
|
...previewLegacyTextEffects,
|
|
10571
|
+
...previewRunBorder,
|
|
10149
10572
|
...draft.hiddenText ? {
|
|
10150
10573
|
textDecorationColor: 'currentColor',
|
|
10151
10574
|
textDecorationLine: 'underline',
|
|
@@ -11,7 +11,7 @@ import extension_underline from "@tiptap/extension-underline";
|
|
|
11
11
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
12
12
|
import starter_kit from "@tiptap/starter-kit";
|
|
13
13
|
import { canUngroupPresentationElements, withPresentationDesign, withPresentationDesignMetadata, groupPresentationElements, expandPresentationGroupSelection, ungroupPresentationElements, presentationSlideViewFromDesign, canGroupPresentationElements, presentationSlideView, applyPresentationLayout, presentationSelectionUnits, remapPresentationGroupPaths } from "./0~1403.js";
|
|
14
|
-
import { createOfficeId as createWorkId } from "./
|
|
14
|
+
import { createOfficeId as createWorkId } from "./4121.js";
|
|
15
15
|
import { OfficeTableInsertPopover, readOfficeFileAsDataUrl } from "./0~9445.js";
|
|
16
16
|
import { normalizePresentationChartLegendPosition, presentationChartDataLabelPositions, presentationChartDataLabelText, normalizePresentationBubbleSizeRepresents, parsePresentationChartCategories, presentationChartXValues, withPresentationChartLayout, presentationChartTypeLabel, presentationChartAxes, withPresentationChartSeriesAnalysis, presentationChartUsesNumericXAxis, presentationChartSupportsSeriesMarkers, presentationChartBubbleSizes, createPresentationChartElement, parsePresentationChartValueDraft, normalizePresentationChartDataLabelPosition, presentationChartSupportsAxisTitles, withPresentationChartDataLabels, withPresentationChartType, createPresentationChartSeries, presentationChartErrorBarCount, normalizePresentationScatterStyle, withPresentationChartSeriesStyle, normalizePresentationBubbleScale, presentationChartDataLabelPositionLabel, presentationChartShowsLegend, presentationChartTrendlineCount, presentationChartHasDataLabels, normalizeDoughnutHoleSize, withPresentationChartAxes } from "./0~work-presentation-charts.js";
|
|
17
17
|
import { spreadsheetChartSeriesLayout, workSpreadsheetChartSupportsGrouping, normalizeWorkSpreadsheetChartSmoothLines, workSpreadsheetChartAxisIsValueAxis, fitSpreadsheetTrendline, spreadsheetChartSeriesLegendColor, normalizeWorkSpreadsheetChartSeriesStyle, spreadsheetChartCategoryVisualIndex, errorBarSourceValues, normalizeWorkSpreadsheetErrorBars, workSpreadsheetChartSupportsTrendlines, normalizeWorkSpreadsheetChartLegendOverlay, normalizeWorkSpreadsheetChartGapWidth, spreadsheetChartCategoryLabelVisible, spreadsheetChartAxisLabelLayout, workSpreadsheetChartSupportsSmoothLines, workSpreadsheetChartGroupingIsStacked, normalizeWorkSpreadsheetChartGrouping, workSpreadsheetChartSupportsBarSpacing, workSpreadsheetChartSupportsErrorBars, spreadsheetChartSeriesLineStyle, workSpreadsheetChartAxisDefaultLabelPosition, workSpreadsheetChartSupportsSeriesAnalysis, workSpreadsheetChartAxisIsCategoryAxis, spreadsheetErrorBarAmounts, spreadsheetChartAxisValueRatio, spreadsheetChartAxisScale, normalizeWorkSpreadsheetChartOverlap, spreadsheetChartBarGeometry, workSpreadsheetChartAxisShowsMajorGridlinesByDefault, spreadsheetChartAxisGridlinesVisible, normalizeWorkSpreadsheetTrendline, roundChartNumber, formatSpreadsheetChartAxisNumber, spreadsheetChartSeriesFillStyle } from "./8715.js";
|