@a3s-lab/office 0.44.0 → 0.46.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 +24 -0
- package/dist/{0~2330.js → 0~2133.js} +325 -19
- package/dist/{0~5024.js → 0~4042.js} +110 -2
- package/dist/0~document-editor.js +562 -9
- package/dist/0~work-docx-export.js +206 -8
- package/dist/0~work-docx-import.js +22 -7
- package/dist/0~work-office-diagnostics.js +19 -3
- package/dist/4174.js +508 -3
- package/dist/internal/features/work/editors/document-command-catalog.d.ts +15 -1
- package/dist/internal/features/work/editors/document-picture-properties-dialog-model.d.ts +4 -1
- package/dist/internal/features/work/editors/document-text-box-ribbon.d.ts +4 -0
- package/dist/internal/features/work/editors/document-toolbar.d.ts +2 -1
- package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +1 -0
- package/dist/internal/features/work/work-document-image-layout.d.ts +14 -0
- package/dist/internal/features/work/work-document-text-box.d.ts +64 -0
- package/dist/internal/features/work/work-docx-export-image.d.ts +2 -1
- package/dist/internal/features/work/work-docx-image-layout-import.d.ts +2 -1
- package/dist/internal/features/work/work-docx-image-transform.d.ts +17 -0
- package/dist/internal/features/work/work-docx-import.d.ts +3 -1
- package/dist/internal/features/work/work-docx-text-box-export.d.ts +25 -0
- package/dist/internal/features/work/work-docx-text-box-import.d.ts +26 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +101 -2
- package/docs/latest/en/browser-editor-architecture.md +7 -3
- package/package.json +6 -3
|
@@ -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, FileCheck2, FileDiff, FilePlus2, FileStack, FileText, FileUp, GitCompareArrows, Globe2, Grid2X2, Hash, Highlighter, Image, IndentDecrease, IndentIncrease, Italic, Languages, Link2, List, ListChecks, ListOrdered, ListTree, 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, Tags, 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, FileCheck2, FileDiff, FilePlus2, FileStack, FileText, FileUp, FlipHorizontal2, FlipVertical2, GitCompareArrows, Globe2, Grid2X2, Hash, Highlighter, Image, IndentDecrease, IndentIncrease, Italic, Languages, Link2, List, ListChecks, ListOrdered, ListTree, MessageSquarePlus, MessageSquareReply, MessagesSquare, Move, MoveVertical, Paintbrush, Palette, PanelBottom, PanelBottomOpen, PanelLeftOpen, PanelTop, PanelTopOpen, Pilcrow, PilcrowLeft, PilcrowRight, Plus, Quote, Redo2, RefreshCw, Replace, ReplaceAll, RotateCcw, RotateCw, Rows3, Ruler, Scan, Search, Settings2, Square, SquareDashedMousePointer, StretchHorizontal, Strikethrough, Subscript, Superscript, Table2, TableCellsMerge, TableCellsSplit, TableProperties, Tags, TextCursorInput, TextWrap, Trash2, TriangleAlert, Type, Underline, Undo2, Unlink, Unlink2, X, XCircle, ZoomIn, ZoomOut } from "lucide-react";
|
|
10
10
|
import { Fragment as model_Fragment, 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";
|
|
@@ -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, documentOpenTypeCssProperties, documentBulletListStyle, documentCharacterPositionPoints, collectDocumentTextLayoutParagraphs, readOfficeDocumentCollaboration as readWorkOfficeDocumentCollaboration, normalizeDocumentCharacterScalePercent, DOCUMENT_PARAGRAPH_FORMAT_ATTRIBUTES, documentOrderedListState, normalizeDocumentPageChrome, documentTextStatistics, documentPageMarginsForLayout, invalidateDocumentLazyHtmlProjection, documentTableCellFormat,
|
|
19
|
+
import { documentTableSizing, transferChangedDocumentTextStatistics, documentPageBordersVisible, documentUnderlineStyle, DOCUMENT_PAGE_BORDER_EDGES, documentTableRowOptions, normalizeDocumentColumns, clampDocumentMargin, materializeLazyDocumentEditorRoot, documentKerningThresholdPoints, selectedDocumentIndexOptions, nextDocumentTabAlignment, DOCUMENT_BOOKMARK_DUPLICATE_MESSAGE, normalizedTabPosition, documentTextBoxProperties, 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, defaultDocumentImageTransform, documentOpenTypeCssProperties, documentBulletListStyle, documentCharacterPositionPoints, collectDocumentTextLayoutParagraphs, readOfficeDocumentCollaboration as readWorkOfficeDocumentCollaboration, normalizeDocumentCharacterScalePercent, DOCUMENT_PARAGRAPH_FORMAT_ATTRIBUTES, documentOrderedListState, normalizeDocumentPageChrome, documentTextStatistics, documentPageMarginsForLayout, invalidateDocumentLazyHtmlProjection, documentTableCellFormat, normalizeDocumentImageTransform, normalizeDocumentPageGeometry, documentImageProperties, normalizeDocumentImageLayer, 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, DOCUMENT_TEXT_BOX_LIMITS, 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, DOCUMENT_TEXT_BOX_DEFAULTS, activeDocumentTableStyle, measureDocumentLayoutBlocksIncrementally, documentWordLineHeightFactor, normalizeDocumentLegacyTextEffect, createWorkDocumentExtensions } from "./4174.js";
|
|
20
20
|
import { useOfficeTaskPaneEscape, OfficeCheckbox, useOfficeDialog, useOfficeTaskPaneModal, CommittedOfficeNumberField, createOfficeKernelClient, CollectionState, OfficeNumberField } from "./0~7831.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";
|
|
@@ -6843,6 +6843,11 @@ const documentPictureRibbonTab = {
|
|
|
6843
6843
|
label: '图片',
|
|
6844
6844
|
contextual: true
|
|
6845
6845
|
};
|
|
6846
|
+
const documentTextBoxRibbonTab = {
|
|
6847
|
+
id: 'textBox',
|
|
6848
|
+
label: '文本框',
|
|
6849
|
+
contextual: true
|
|
6850
|
+
};
|
|
6846
6851
|
const documentTableRibbonTabs = [
|
|
6847
6852
|
{
|
|
6848
6853
|
id: 'tableDesign',
|
|
@@ -7397,6 +7402,15 @@ const documentCommandCatalog = {
|
|
|
7397
7402
|
]
|
|
7398
7403
|
}
|
|
7399
7404
|
},
|
|
7405
|
+
insertTextBox: {
|
|
7406
|
+
id: 'insert.textBox',
|
|
7407
|
+
label: '插入文本框',
|
|
7408
|
+
location: {
|
|
7409
|
+
area: 'ribbon',
|
|
7410
|
+
tab: 'insert',
|
|
7411
|
+
group: 'text'
|
|
7412
|
+
}
|
|
7413
|
+
},
|
|
7400
7414
|
hyperlink: {
|
|
7401
7415
|
id: 'insert.hyperlink',
|
|
7402
7416
|
label: '添加链接',
|
|
@@ -12689,6 +12703,9 @@ function createDocumentPicturePropertiesDraft(source) {
|
|
|
12689
12703
|
cropRight: formatNumber(source.properties.crop?.right ?? 0),
|
|
12690
12704
|
cropBottom: formatNumber(source.properties.crop?.bottom ?? 0),
|
|
12691
12705
|
cropLeft: formatNumber(source.properties.crop?.left ?? 0),
|
|
12706
|
+
rotation: (source.properties.transform ?? defaultDocumentImageTransform()).rotation,
|
|
12707
|
+
flipHorizontal: Boolean(source.properties.transform?.flipHorizontal),
|
|
12708
|
+
flipVertical: Boolean(source.properties.transform?.flipVertical),
|
|
12692
12709
|
relativeHeight: String(layer.relativeHeight),
|
|
12693
12710
|
behindDocument: layer.behindDocument,
|
|
12694
12711
|
allowOverlap: layer.allowOverlap,
|
|
@@ -12767,6 +12784,14 @@ function documentPicturePropertyChanges(initial, current) {
|
|
|
12767
12784
|
};
|
|
12768
12785
|
changes.crop = Object.values(crop).some((edge)=>edge > 0) ? crop : null;
|
|
12769
12786
|
}
|
|
12787
|
+
if (initial.rotation !== current.rotation || initial.flipHorizontal !== current.flipHorizontal || initial.flipVertical !== current.flipVertical) {
|
|
12788
|
+
const transform = normalizeDocumentImageTransform({
|
|
12789
|
+
rotation: current.rotation,
|
|
12790
|
+
flipHorizontal: current.flipHorizontal,
|
|
12791
|
+
flipVertical: current.flipVertical
|
|
12792
|
+
});
|
|
12793
|
+
changes.transform = 0 !== transform.rotation || transform.flipHorizontal || transform.flipVertical ? transform : null;
|
|
12794
|
+
}
|
|
12770
12795
|
if (!sameDraftNumber(initial.relativeHeight, current.relativeHeight) || initial.behindDocument !== current.behindDocument || initial.allowOverlap !== current.allowOverlap || initial.layoutInCell !== current.layoutInCell || initial.lockAnchor !== current.lockAnchor) changes.layer = normalizeDocumentImageLayer({
|
|
12771
12796
|
relativeHeight: current.relativeHeight,
|
|
12772
12797
|
behindDocument: current.behindDocument,
|
|
@@ -12926,6 +12951,24 @@ const verticalReferenceOptions = [
|
|
|
12926
12951
|
label: '页面'
|
|
12927
12952
|
}
|
|
12928
12953
|
];
|
|
12954
|
+
const rotationOptions = [
|
|
12955
|
+
{
|
|
12956
|
+
value: '0',
|
|
12957
|
+
label: '0°(原始)'
|
|
12958
|
+
},
|
|
12959
|
+
{
|
|
12960
|
+
value: '90',
|
|
12961
|
+
label: '90°'
|
|
12962
|
+
},
|
|
12963
|
+
{
|
|
12964
|
+
value: '180',
|
|
12965
|
+
label: '180°'
|
|
12966
|
+
},
|
|
12967
|
+
{
|
|
12968
|
+
value: '270',
|
|
12969
|
+
label: '270°'
|
|
12970
|
+
}
|
|
12971
|
+
];
|
|
12929
12972
|
function DocumentPicturePropertiesControl({ editor }) {
|
|
12930
12973
|
const [source, setSource] = useState(null);
|
|
12931
12974
|
const triggerRef = useRef(null);
|
|
@@ -13029,6 +13072,10 @@ function DocumentPicturePropertiesDialog({ editor, source, restoreFocusTarget, o
|
|
|
13029
13072
|
errors: errors,
|
|
13030
13073
|
onDraftChange: setDraft
|
|
13031
13074
|
}),
|
|
13075
|
+
/*#__PURE__*/ jsx(PictureTransformSection, {
|
|
13076
|
+
draft: draft,
|
|
13077
|
+
onDraftChange: setDraft
|
|
13078
|
+
}),
|
|
13032
13079
|
/*#__PURE__*/ jsxs("label", {
|
|
13033
13080
|
className: "work-document-picture-properties-alt-text",
|
|
13034
13081
|
htmlFor: alternativeTextId,
|
|
@@ -13418,6 +13465,60 @@ function PictureCropSection({ draft, errors, onDraftChange }) {
|
|
|
13418
13465
|
]
|
|
13419
13466
|
});
|
|
13420
13467
|
}
|
|
13468
|
+
function PictureTransformSection({ draft, onDraftChange }) {
|
|
13469
|
+
return /*#__PURE__*/ jsxs("fieldset", {
|
|
13470
|
+
className: "work-document-picture-properties-section transform",
|
|
13471
|
+
children: [
|
|
13472
|
+
/*#__PURE__*/ jsx("legend", {
|
|
13473
|
+
children: "变换"
|
|
13474
|
+
}),
|
|
13475
|
+
/*#__PURE__*/ jsxs("div", {
|
|
13476
|
+
className: "work-document-picture-properties-transform-row",
|
|
13477
|
+
children: [
|
|
13478
|
+
/*#__PURE__*/ jsx("span", {
|
|
13479
|
+
children: "旋转"
|
|
13480
|
+
}),
|
|
13481
|
+
/*#__PURE__*/ jsx(OfficeSelect, {
|
|
13482
|
+
ariaLabel: "图片旋转角度",
|
|
13483
|
+
value: String(draft.rotation),
|
|
13484
|
+
options: rotationOptions,
|
|
13485
|
+
onValueChange: (value)=>onDraftChange((current)=>({
|
|
13486
|
+
...current,
|
|
13487
|
+
rotation: Number(value)
|
|
13488
|
+
}))
|
|
13489
|
+
})
|
|
13490
|
+
]
|
|
13491
|
+
}),
|
|
13492
|
+
/*#__PURE__*/ jsxs("div", {
|
|
13493
|
+
className: "work-document-picture-properties-transform-options",
|
|
13494
|
+
children: [
|
|
13495
|
+
/*#__PURE__*/ jsx(OfficeCheckbox, {
|
|
13496
|
+
ariaLabel: "水平翻转图片",
|
|
13497
|
+
checked: draft.flipHorizontal,
|
|
13498
|
+
onCheckedChange: (flipHorizontal)=>onDraftChange((current)=>({
|
|
13499
|
+
...current,
|
|
13500
|
+
flipHorizontal
|
|
13501
|
+
})),
|
|
13502
|
+
children: "水平翻转"
|
|
13503
|
+
}),
|
|
13504
|
+
/*#__PURE__*/ jsx(OfficeCheckbox, {
|
|
13505
|
+
ariaLabel: "垂直翻转图片",
|
|
13506
|
+
checked: draft.flipVertical,
|
|
13507
|
+
onCheckedChange: (flipVertical)=>onDraftChange((current)=>({
|
|
13508
|
+
...current,
|
|
13509
|
+
flipVertical
|
|
13510
|
+
})),
|
|
13511
|
+
children: "垂直翻转"
|
|
13512
|
+
})
|
|
13513
|
+
]
|
|
13514
|
+
}),
|
|
13515
|
+
/*#__PURE__*/ jsx("small", {
|
|
13516
|
+
className: "work-document-picture-properties-transform-help",
|
|
13517
|
+
children: "旋转以 90\xb0 为单位;每次确认作为一次可撤销操作保存。"
|
|
13518
|
+
})
|
|
13519
|
+
]
|
|
13520
|
+
});
|
|
13521
|
+
}
|
|
13421
13522
|
function PictureNumberRow({ label, ariaLabel, value, unit, min, max, step, disabled = false, invalid, onValueChange }) {
|
|
13422
13523
|
return /*#__PURE__*/ jsxs("div", {
|
|
13423
13524
|
className: "work-document-picture-properties-number-row",
|
|
@@ -13481,6 +13582,7 @@ const imageWrapDistanceOptions = [
|
|
|
13481
13582
|
];
|
|
13482
13583
|
function DocumentPictureRibbon({ editor }) {
|
|
13483
13584
|
const image = documentImageLayoutOptions(editor);
|
|
13585
|
+
const transform = documentImageProperties(editor).transform ?? defaultDocumentImageTransform();
|
|
13484
13586
|
const imageSelected = editor.isActive('image');
|
|
13485
13587
|
const wrapDistanceValue = String(image.wrapDistance);
|
|
13486
13588
|
const updateLayout = (layout)=>editor.commands.setDocumentImageLayoutOptions({
|
|
@@ -13489,6 +13591,15 @@ function DocumentPictureRibbon({ editor }) {
|
|
|
13489
13591
|
const updateAlignment = (alignment)=>editor.commands.setDocumentImageLayoutOptions({
|
|
13490
13592
|
alignment
|
|
13491
13593
|
});
|
|
13594
|
+
const updateTransform = (next)=>{
|
|
13595
|
+
const current = documentImageProperties(editor).transform ?? defaultDocumentImageTransform();
|
|
13596
|
+
return editor.commands.setDocumentImageProperties({
|
|
13597
|
+
transform: {
|
|
13598
|
+
...current,
|
|
13599
|
+
...next(current)
|
|
13600
|
+
}
|
|
13601
|
+
});
|
|
13602
|
+
};
|
|
13492
13603
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
13493
13604
|
children: [
|
|
13494
13605
|
/*#__PURE__*/ jsxs(WorkOfficeRibbonGroup, {
|
|
@@ -13582,6 +13693,53 @@ function DocumentPictureRibbon({ editor }) {
|
|
|
13582
13693
|
})
|
|
13583
13694
|
]
|
|
13584
13695
|
}),
|
|
13696
|
+
/*#__PURE__*/ jsxs(WorkOfficeRibbonGroup, {
|
|
13697
|
+
label: "变换",
|
|
13698
|
+
children: [
|
|
13699
|
+
/*#__PURE__*/ jsx(PictureButton, {
|
|
13700
|
+
label: "向左旋转",
|
|
13701
|
+
disabled: !imageSelected,
|
|
13702
|
+
onClick: ()=>updateTransform((current)=>({
|
|
13703
|
+
rotation: rotateImage(current.rotation, -90)
|
|
13704
|
+
})),
|
|
13705
|
+
children: /*#__PURE__*/ jsx(RotateCcw, {
|
|
13706
|
+
size: 18
|
|
13707
|
+
})
|
|
13708
|
+
}),
|
|
13709
|
+
/*#__PURE__*/ jsx(PictureButton, {
|
|
13710
|
+
label: "向右旋转",
|
|
13711
|
+
disabled: !imageSelected,
|
|
13712
|
+
onClick: ()=>updateTransform((current)=>({
|
|
13713
|
+
rotation: rotateImage(current.rotation, 90)
|
|
13714
|
+
})),
|
|
13715
|
+
children: /*#__PURE__*/ jsx(RotateCw, {
|
|
13716
|
+
size: 18
|
|
13717
|
+
})
|
|
13718
|
+
}),
|
|
13719
|
+
/*#__PURE__*/ jsx(PictureButton, {
|
|
13720
|
+
label: "水平翻转",
|
|
13721
|
+
active: transform.flipHorizontal,
|
|
13722
|
+
disabled: !imageSelected,
|
|
13723
|
+
onClick: ()=>updateTransform((current)=>({
|
|
13724
|
+
flipHorizontal: !current.flipHorizontal
|
|
13725
|
+
})),
|
|
13726
|
+
children: /*#__PURE__*/ jsx(FlipHorizontal2, {
|
|
13727
|
+
size: 18
|
|
13728
|
+
})
|
|
13729
|
+
}),
|
|
13730
|
+
/*#__PURE__*/ jsx(PictureButton, {
|
|
13731
|
+
label: "垂直翻转",
|
|
13732
|
+
active: transform.flipVertical,
|
|
13733
|
+
disabled: !imageSelected,
|
|
13734
|
+
onClick: ()=>updateTransform((current)=>({
|
|
13735
|
+
flipVertical: !current.flipVertical
|
|
13736
|
+
})),
|
|
13737
|
+
children: /*#__PURE__*/ jsx(FlipVertical2, {
|
|
13738
|
+
size: 18
|
|
13739
|
+
})
|
|
13740
|
+
})
|
|
13741
|
+
]
|
|
13742
|
+
}),
|
|
13585
13743
|
/*#__PURE__*/ jsx(WorkOfficeRibbonGroup, {
|
|
13586
13744
|
label: "与文字距离",
|
|
13587
13745
|
children: /*#__PURE__*/ jsx(OfficeSelect, {
|
|
@@ -13613,6 +13771,10 @@ function DocumentPictureRibbon({ editor }) {
|
|
|
13613
13771
|
]
|
|
13614
13772
|
});
|
|
13615
13773
|
}
|
|
13774
|
+
function rotateImage(rotation, delta) {
|
|
13775
|
+
const next = (rotation + delta + 360) % 360;
|
|
13776
|
+
return next;
|
|
13777
|
+
}
|
|
13616
13778
|
function imageWrapDistanceOptionsForValue(value) {
|
|
13617
13779
|
if (imageWrapDistanceOptions.some((option)=>option.value === value)) return imageWrapDistanceOptions;
|
|
13618
13780
|
return [
|
|
@@ -15468,6 +15630,370 @@ function RibbonButton({ label, visibleLabel, active = false, disabled = false, o
|
|
|
15468
15630
|
});
|
|
15469
15631
|
}
|
|
15470
15632
|
const document_table_ribbon_RibbonGroup = WorkOfficeRibbonGroup;
|
|
15633
|
+
const document_text_box_ribbon_layoutOptions = [
|
|
15634
|
+
{
|
|
15635
|
+
value: 'inline',
|
|
15636
|
+
label: '嵌入文字',
|
|
15637
|
+
icon: Rows3
|
|
15638
|
+
},
|
|
15639
|
+
{
|
|
15640
|
+
value: 'floating',
|
|
15641
|
+
label: '浮于文字上方',
|
|
15642
|
+
icon: SquareDashedMousePointer
|
|
15643
|
+
}
|
|
15644
|
+
];
|
|
15645
|
+
const document_text_box_ribbon_horizontalReferenceOptions = [
|
|
15646
|
+
{
|
|
15647
|
+
value: 'column',
|
|
15648
|
+
label: '栏'
|
|
15649
|
+
},
|
|
15650
|
+
{
|
|
15651
|
+
value: 'margin',
|
|
15652
|
+
label: '页边距'
|
|
15653
|
+
},
|
|
15654
|
+
{
|
|
15655
|
+
value: 'page',
|
|
15656
|
+
label: '页面'
|
|
15657
|
+
}
|
|
15658
|
+
];
|
|
15659
|
+
const document_text_box_ribbon_verticalReferenceOptions = [
|
|
15660
|
+
{
|
|
15661
|
+
value: 'paragraph',
|
|
15662
|
+
label: '段落'
|
|
15663
|
+
},
|
|
15664
|
+
{
|
|
15665
|
+
value: 'margin',
|
|
15666
|
+
label: '页边距'
|
|
15667
|
+
},
|
|
15668
|
+
{
|
|
15669
|
+
value: 'page',
|
|
15670
|
+
label: '页面'
|
|
15671
|
+
}
|
|
15672
|
+
];
|
|
15673
|
+
const verticalAlignOptions = [
|
|
15674
|
+
{
|
|
15675
|
+
value: 'top',
|
|
15676
|
+
label: '顶端',
|
|
15677
|
+
icon: AlignVerticalJustifyStart
|
|
15678
|
+
},
|
|
15679
|
+
{
|
|
15680
|
+
value: 'center',
|
|
15681
|
+
label: '居中',
|
|
15682
|
+
icon: AlignVerticalJustifyCenter
|
|
15683
|
+
},
|
|
15684
|
+
{
|
|
15685
|
+
value: 'bottom',
|
|
15686
|
+
label: '底端',
|
|
15687
|
+
icon: AlignVerticalJustifyEnd
|
|
15688
|
+
}
|
|
15689
|
+
];
|
|
15690
|
+
const borderWidthOptions = [
|
|
15691
|
+
{
|
|
15692
|
+
value: '0',
|
|
15693
|
+
label: '无边框'
|
|
15694
|
+
},
|
|
15695
|
+
{
|
|
15696
|
+
value: '0.35',
|
|
15697
|
+
label: '细(0.35 mm)'
|
|
15698
|
+
},
|
|
15699
|
+
{
|
|
15700
|
+
value: '0.7',
|
|
15701
|
+
label: '中(0.7 mm)'
|
|
15702
|
+
},
|
|
15703
|
+
{
|
|
15704
|
+
value: '1.4',
|
|
15705
|
+
label: '粗(1.4 mm)'
|
|
15706
|
+
}
|
|
15707
|
+
];
|
|
15708
|
+
function DocumentTextBoxRibbon({ editor }) {
|
|
15709
|
+
const properties = documentTextBoxProperties(editor);
|
|
15710
|
+
const selected = editor.isActive('documentTextBox');
|
|
15711
|
+
const update = (value)=>{
|
|
15712
|
+
if (!selected) return;
|
|
15713
|
+
editor.commands.setDocumentTextBoxProperties(value, {
|
|
15714
|
+
restoreFocus: false
|
|
15715
|
+
});
|
|
15716
|
+
};
|
|
15717
|
+
const updateLayout = (layout)=>{
|
|
15718
|
+
update({
|
|
15719
|
+
layout,
|
|
15720
|
+
...'floating' === layout ? {
|
|
15721
|
+
horizontalOffset: properties.horizontalOffset ?? 0,
|
|
15722
|
+
verticalOffset: properties.verticalOffset ?? 0
|
|
15723
|
+
} : {}
|
|
15724
|
+
});
|
|
15725
|
+
};
|
|
15726
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
15727
|
+
children: [
|
|
15728
|
+
/*#__PURE__*/ jsx(WorkOfficeRibbonGroup, {
|
|
15729
|
+
label: "布局",
|
|
15730
|
+
priority: "high",
|
|
15731
|
+
children: document_text_box_ribbon_layoutOptions.map((option)=>{
|
|
15732
|
+
const Icon = option.icon;
|
|
15733
|
+
return /*#__PURE__*/ jsx(TextBoxButton, {
|
|
15734
|
+
label: option.label,
|
|
15735
|
+
active: selected && properties.layout === option.value,
|
|
15736
|
+
disabled: !selected,
|
|
15737
|
+
onClick: ()=>updateLayout(option.value),
|
|
15738
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
15739
|
+
size: 18
|
|
15740
|
+
})
|
|
15741
|
+
}, option.value);
|
|
15742
|
+
})
|
|
15743
|
+
}),
|
|
15744
|
+
/*#__PURE__*/ jsxs(WorkOfficeRibbonGroup, {
|
|
15745
|
+
label: "大小",
|
|
15746
|
+
children: [
|
|
15747
|
+
/*#__PURE__*/ jsxs("div", {
|
|
15748
|
+
className: "work-office-field work-document-text-box-size-field",
|
|
15749
|
+
children: [
|
|
15750
|
+
/*#__PURE__*/ jsx("span", {
|
|
15751
|
+
children: "宽度(毫米)"
|
|
15752
|
+
}),
|
|
15753
|
+
/*#__PURE__*/ jsx(CommittedOfficeNumberField, {
|
|
15754
|
+
ariaLabel: "文本框宽度(毫米)",
|
|
15755
|
+
value: properties.width,
|
|
15756
|
+
min: DOCUMENT_TEXT_BOX_LIMITS.width.min,
|
|
15757
|
+
max: DOCUMENT_TEXT_BOX_LIMITS.width.max,
|
|
15758
|
+
step: 0.1,
|
|
15759
|
+
disabled: !selected,
|
|
15760
|
+
normalizeValue: (value)=>normalizeTextBoxNumber(value, DOCUMENT_TEXT_BOX_LIMITS.width.min, DOCUMENT_TEXT_BOX_LIMITS.width.max),
|
|
15761
|
+
onValueCommit: (width)=>update({
|
|
15762
|
+
width
|
|
15763
|
+
})
|
|
15764
|
+
})
|
|
15765
|
+
]
|
|
15766
|
+
}),
|
|
15767
|
+
/*#__PURE__*/ jsxs("div", {
|
|
15768
|
+
className: "work-office-field work-document-text-box-size-field",
|
|
15769
|
+
children: [
|
|
15770
|
+
/*#__PURE__*/ jsx("span", {
|
|
15771
|
+
children: "高度(毫米)"
|
|
15772
|
+
}),
|
|
15773
|
+
/*#__PURE__*/ jsx(CommittedOfficeNumberField, {
|
|
15774
|
+
ariaLabel: "文本框高度(毫米)",
|
|
15775
|
+
value: properties.height,
|
|
15776
|
+
min: DOCUMENT_TEXT_BOX_LIMITS.height.min,
|
|
15777
|
+
max: DOCUMENT_TEXT_BOX_LIMITS.height.max,
|
|
15778
|
+
step: 0.1,
|
|
15779
|
+
disabled: !selected,
|
|
15780
|
+
normalizeValue: (value)=>normalizeTextBoxNumber(value, DOCUMENT_TEXT_BOX_LIMITS.height.min, DOCUMENT_TEXT_BOX_LIMITS.height.max),
|
|
15781
|
+
onValueCommit: (height)=>update({
|
|
15782
|
+
height
|
|
15783
|
+
})
|
|
15784
|
+
})
|
|
15785
|
+
]
|
|
15786
|
+
})
|
|
15787
|
+
]
|
|
15788
|
+
}),
|
|
15789
|
+
/*#__PURE__*/ jsxs(WorkOfficeRibbonGroup, {
|
|
15790
|
+
label: "位置",
|
|
15791
|
+
children: [
|
|
15792
|
+
/*#__PURE__*/ jsxs("div", {
|
|
15793
|
+
className: "work-office-field work-document-text-box-position-field",
|
|
15794
|
+
children: [
|
|
15795
|
+
/*#__PURE__*/ jsx("span", {
|
|
15796
|
+
children: "水平相对于"
|
|
15797
|
+
}),
|
|
15798
|
+
/*#__PURE__*/ jsx(OfficeSelect, {
|
|
15799
|
+
ariaLabel: "文本框水平相对于",
|
|
15800
|
+
value: properties.horizontalReference,
|
|
15801
|
+
options: document_text_box_ribbon_horizontalReferenceOptions,
|
|
15802
|
+
disabled: !selected || 'floating' !== properties.layout,
|
|
15803
|
+
onValueChange: (horizontalReference)=>update({
|
|
15804
|
+
horizontalReference
|
|
15805
|
+
})
|
|
15806
|
+
})
|
|
15807
|
+
]
|
|
15808
|
+
}),
|
|
15809
|
+
/*#__PURE__*/ jsxs("div", {
|
|
15810
|
+
className: "work-office-field work-document-text-box-position-field",
|
|
15811
|
+
children: [
|
|
15812
|
+
/*#__PURE__*/ jsx("span", {
|
|
15813
|
+
children: "垂直相对于"
|
|
15814
|
+
}),
|
|
15815
|
+
/*#__PURE__*/ jsx(OfficeSelect, {
|
|
15816
|
+
ariaLabel: "文本框垂直相对于",
|
|
15817
|
+
value: properties.verticalReference,
|
|
15818
|
+
options: document_text_box_ribbon_verticalReferenceOptions,
|
|
15819
|
+
disabled: !selected || 'floating' !== properties.layout,
|
|
15820
|
+
onValueChange: (verticalReference)=>update({
|
|
15821
|
+
verticalReference
|
|
15822
|
+
})
|
|
15823
|
+
})
|
|
15824
|
+
]
|
|
15825
|
+
}),
|
|
15826
|
+
/*#__PURE__*/ jsxs("div", {
|
|
15827
|
+
className: "work-office-field work-document-text-box-offset-field",
|
|
15828
|
+
children: [
|
|
15829
|
+
/*#__PURE__*/ jsx("span", {
|
|
15830
|
+
children: "水平偏移(毫米)"
|
|
15831
|
+
}),
|
|
15832
|
+
/*#__PURE__*/ jsx(CommittedOfficeNumberField, {
|
|
15833
|
+
ariaLabel: "文本框水平偏移(毫米)",
|
|
15834
|
+
value: properties.horizontalOffset ?? 0,
|
|
15835
|
+
min: DOCUMENT_TEXT_BOX_LIMITS.offset.min,
|
|
15836
|
+
max: DOCUMENT_TEXT_BOX_LIMITS.offset.max,
|
|
15837
|
+
step: 0.1,
|
|
15838
|
+
disabled: !selected || 'floating' !== properties.layout,
|
|
15839
|
+
normalizeValue: (value)=>normalizeTextBoxNumber(value, DOCUMENT_TEXT_BOX_LIMITS.offset.min, DOCUMENT_TEXT_BOX_LIMITS.offset.max),
|
|
15840
|
+
onValueCommit: (horizontalOffset)=>update({
|
|
15841
|
+
horizontalOffset
|
|
15842
|
+
})
|
|
15843
|
+
})
|
|
15844
|
+
]
|
|
15845
|
+
}),
|
|
15846
|
+
/*#__PURE__*/ jsxs("div", {
|
|
15847
|
+
className: "work-office-field work-document-text-box-offset-field",
|
|
15848
|
+
children: [
|
|
15849
|
+
/*#__PURE__*/ jsx("span", {
|
|
15850
|
+
children: "垂直偏移(毫米)"
|
|
15851
|
+
}),
|
|
15852
|
+
/*#__PURE__*/ jsx(CommittedOfficeNumberField, {
|
|
15853
|
+
ariaLabel: "文本框垂直偏移(毫米)",
|
|
15854
|
+
value: properties.verticalOffset ?? 0,
|
|
15855
|
+
min: DOCUMENT_TEXT_BOX_LIMITS.offset.min,
|
|
15856
|
+
max: DOCUMENT_TEXT_BOX_LIMITS.offset.max,
|
|
15857
|
+
step: 0.1,
|
|
15858
|
+
disabled: !selected || 'floating' !== properties.layout,
|
|
15859
|
+
normalizeValue: (value)=>normalizeTextBoxNumber(value, DOCUMENT_TEXT_BOX_LIMITS.offset.min, DOCUMENT_TEXT_BOX_LIMITS.offset.max),
|
|
15860
|
+
onValueCommit: (verticalOffset)=>update({
|
|
15861
|
+
verticalOffset
|
|
15862
|
+
})
|
|
15863
|
+
})
|
|
15864
|
+
]
|
|
15865
|
+
})
|
|
15866
|
+
]
|
|
15867
|
+
}),
|
|
15868
|
+
/*#__PURE__*/ jsx(WorkOfficeRibbonGroup, {
|
|
15869
|
+
label: "文本对齐",
|
|
15870
|
+
children: verticalAlignOptions.map((option)=>{
|
|
15871
|
+
const Icon = option.icon;
|
|
15872
|
+
return /*#__PURE__*/ jsx(TextBoxButton, {
|
|
15873
|
+
label: option.label,
|
|
15874
|
+
active: selected && properties.verticalAlign === option.value,
|
|
15875
|
+
disabled: !selected,
|
|
15876
|
+
onClick: ()=>update({
|
|
15877
|
+
verticalAlign: option.value
|
|
15878
|
+
}),
|
|
15879
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
15880
|
+
size: 18
|
|
15881
|
+
})
|
|
15882
|
+
}, option.value);
|
|
15883
|
+
})
|
|
15884
|
+
}),
|
|
15885
|
+
/*#__PURE__*/ jsxs(WorkOfficeRibbonGroup, {
|
|
15886
|
+
label: "填充和轮廓",
|
|
15887
|
+
children: [
|
|
15888
|
+
/*#__PURE__*/ jsx(OfficeColorPicker, {
|
|
15889
|
+
ariaLabel: "文本框填充颜色",
|
|
15890
|
+
triggerLabel: "填充",
|
|
15891
|
+
value: properties.fill,
|
|
15892
|
+
disabled: !selected,
|
|
15893
|
+
resetAction: {
|
|
15894
|
+
kind: 'automatic',
|
|
15895
|
+
label: '无填充',
|
|
15896
|
+
onSelect: ()=>update({
|
|
15897
|
+
fill: 'transparent'
|
|
15898
|
+
})
|
|
15899
|
+
},
|
|
15900
|
+
onValueChange: (fill)=>update({
|
|
15901
|
+
fill
|
|
15902
|
+
})
|
|
15903
|
+
}),
|
|
15904
|
+
/*#__PURE__*/ jsx(OfficeColorPicker, {
|
|
15905
|
+
ariaLabel: "文本框边框颜色",
|
|
15906
|
+
triggerLabel: "边框",
|
|
15907
|
+
value: 'none' === properties.borderColor ? '#ffffff' : properties.borderColor,
|
|
15908
|
+
disabled: !selected,
|
|
15909
|
+
resetAction: {
|
|
15910
|
+
kind: 'none',
|
|
15911
|
+
label: '无轮廓',
|
|
15912
|
+
onSelect: ()=>update({
|
|
15913
|
+
borderColor: 'none',
|
|
15914
|
+
borderWidth: 0
|
|
15915
|
+
})
|
|
15916
|
+
},
|
|
15917
|
+
onValueChange: (borderColor)=>update({
|
|
15918
|
+
borderColor
|
|
15919
|
+
})
|
|
15920
|
+
}),
|
|
15921
|
+
/*#__PURE__*/ jsx(OfficeSelect, {
|
|
15922
|
+
ariaLabel: "文本框边框粗细",
|
|
15923
|
+
value: String(properties.borderWidth),
|
|
15924
|
+
options: borderWidthOptionsForValue(String(properties.borderWidth)),
|
|
15925
|
+
disabled: !selected,
|
|
15926
|
+
onValueChange: (value)=>update({
|
|
15927
|
+
borderWidth: Number(value),
|
|
15928
|
+
...'0' === value ? {
|
|
15929
|
+
borderColor: 'none'
|
|
15930
|
+
} : {}
|
|
15931
|
+
})
|
|
15932
|
+
})
|
|
15933
|
+
]
|
|
15934
|
+
}),
|
|
15935
|
+
/*#__PURE__*/ jsxs(WorkOfficeRibbonGroup, {
|
|
15936
|
+
label: "文本框",
|
|
15937
|
+
children: [
|
|
15938
|
+
/*#__PURE__*/ jsx(TextBoxButton, {
|
|
15939
|
+
label: "删除文本框",
|
|
15940
|
+
disabled: !selected,
|
|
15941
|
+
onClick: ()=>editor.commands.deleteDocumentTextBox(),
|
|
15942
|
+
children: /*#__PURE__*/ jsx(Trash2, {
|
|
15943
|
+
size: 18
|
|
15944
|
+
})
|
|
15945
|
+
}),
|
|
15946
|
+
/*#__PURE__*/ jsx(TextBoxButton, {
|
|
15947
|
+
label: "恢复默认样式",
|
|
15948
|
+
disabled: !selected,
|
|
15949
|
+
onClick: ()=>update({
|
|
15950
|
+
width: DOCUMENT_TEXT_BOX_DEFAULTS.width,
|
|
15951
|
+
height: DOCUMENT_TEXT_BOX_DEFAULTS.height,
|
|
15952
|
+
layout: DOCUMENT_TEXT_BOX_DEFAULTS.layout,
|
|
15953
|
+
horizontalOffset: DOCUMENT_TEXT_BOX_DEFAULTS.horizontalOffset,
|
|
15954
|
+
verticalOffset: DOCUMENT_TEXT_BOX_DEFAULTS.verticalOffset,
|
|
15955
|
+
horizontalReference: DOCUMENT_TEXT_BOX_DEFAULTS.horizontalReference,
|
|
15956
|
+
verticalReference: DOCUMENT_TEXT_BOX_DEFAULTS.verticalReference,
|
|
15957
|
+
fill: DOCUMENT_TEXT_BOX_DEFAULTS.fill,
|
|
15958
|
+
borderColor: DOCUMENT_TEXT_BOX_DEFAULTS.borderColor,
|
|
15959
|
+
borderWidth: DOCUMENT_TEXT_BOX_DEFAULTS.borderWidth,
|
|
15960
|
+
padding: DOCUMENT_TEXT_BOX_DEFAULTS.padding,
|
|
15961
|
+
verticalAlign: DOCUMENT_TEXT_BOX_DEFAULTS.verticalAlign
|
|
15962
|
+
}),
|
|
15963
|
+
children: /*#__PURE__*/ jsx(Move, {
|
|
15964
|
+
size: 18
|
|
15965
|
+
})
|
|
15966
|
+
})
|
|
15967
|
+
]
|
|
15968
|
+
})
|
|
15969
|
+
]
|
|
15970
|
+
});
|
|
15971
|
+
}
|
|
15972
|
+
function TextBoxButton({ label, active = false, disabled = false, onClick, children }) {
|
|
15973
|
+
return /*#__PURE__*/ jsx(WorkOfficeRibbonButton, {
|
|
15974
|
+
label: label,
|
|
15975
|
+
displayLabel: true,
|
|
15976
|
+
active: active,
|
|
15977
|
+
disabled: disabled,
|
|
15978
|
+
onClick: onClick,
|
|
15979
|
+
children: children
|
|
15980
|
+
});
|
|
15981
|
+
}
|
|
15982
|
+
function normalizeTextBoxNumber(value, min, max) {
|
|
15983
|
+
const number = Number(value);
|
|
15984
|
+
if (!Number.isFinite(number) || number < min || number > max) return null;
|
|
15985
|
+
return Number(number.toFixed(2));
|
|
15986
|
+
}
|
|
15987
|
+
function borderWidthOptionsForValue(value) {
|
|
15988
|
+
if (borderWidthOptions.some((option)=>option.value === value)) return borderWidthOptions;
|
|
15989
|
+
return [
|
|
15990
|
+
...borderWidthOptions,
|
|
15991
|
+
{
|
|
15992
|
+
value,
|
|
15993
|
+
label: `${value} 毫米`
|
|
15994
|
+
}
|
|
15995
|
+
];
|
|
15996
|
+
}
|
|
15471
15997
|
function runDocumentWpsShortcut(editor, event, callbacks) {
|
|
15472
15998
|
if (editor.isDestroyed) return false;
|
|
15473
15999
|
const key = event.key.toLowerCase();
|
|
@@ -15590,13 +16116,14 @@ function headingLevelForShortcut(code, key) {
|
|
|
15590
16116
|
if ('3' === value) return 3;
|
|
15591
16117
|
return null;
|
|
15592
16118
|
}
|
|
15593
|
-
function DocumentToolbar({ editor, defaultRibbonCollapsed = false, reviewOnly = false, suggestionOnly = false, history, layoutOpen, layout, layoutFonts = [], navigationOpen, pageColor, showPageNumbers, showHiddenText, showRulers, spellcheckEnabled, viewMode, zoom, pageChromeEditor, pageChromeEditingPart, pageChromeShowPageNumber, onRequestImage, onPageChromeEditingPartChange, onClosePageChrome, onTogglePageChromePageNumber, onToggleLayout, onLayoutChange, onOpenLayout, onToggleNavigation, onTogglePageNumbers, onToggleHiddenText, onToggleRulers, onPageColorChange, onToggleSpellcheck, onViewModeChange, onZoomChange, onZoomFit, onInsertSection, onInsertNote, onInsertCaption, onInsertCrossReference, onOpenTableOfContents, onOpenIndexEntry, onOpenIndex, citationsOpen, citationSourceCount, onToggleCitations, onInsertField, onRefreshFields, onRefreshIndex, onRefreshTableOfContents, canInsertComment, onInsertComment, commentsOpen, commentCount, onToggleComments, trackChanges, changesOpen, changeCount, findReplaceMode, fileActions, onRibbonTabChange, onToggleTrackChanges, onToggleChanges, onOpenComparison, onDecideChange, onOpenWordCount, onOpenFindReplace }) {
|
|
16119
|
+
function DocumentToolbar({ editor, defaultRibbonCollapsed = false, reviewOnly = false, suggestionOnly = false, history, layoutOpen, layout, layoutFonts = [], navigationOpen, pageColor, showPageNumbers, showHiddenText, showRulers, spellcheckEnabled, viewMode, zoom, pageChromeEditor, pageChromeEditingPart, pageChromeShowPageNumber, onRequestImage, onInsertTextBox, onPageChromeEditingPartChange, onClosePageChrome, onTogglePageChromePageNumber, onToggleLayout, onLayoutChange, onOpenLayout, onToggleNavigation, onTogglePageNumbers, onToggleHiddenText, onToggleRulers, onPageColorChange, onToggleSpellcheck, onViewModeChange, onZoomChange, onZoomFit, onInsertSection, onInsertNote, onInsertCaption, onInsertCrossReference, onOpenTableOfContents, onOpenIndexEntry, onOpenIndex, citationsOpen, citationSourceCount, onToggleCitations, onInsertField, onRefreshFields, onRefreshIndex, onRefreshTableOfContents, canInsertComment, onInsertComment, commentsOpen, commentCount, onToggleComments, trackChanges, changesOpen, changeCount, findReplaceMode, fileActions, onRibbonTabChange, onToggleTrackChanges, onToggleChanges, onOpenComparison, onDecideChange, onOpenWordCount, onOpenFindReplace }) {
|
|
15594
16120
|
const [activeTab, setActiveTab] = useState(reviewOnly ? 'review' : 'home');
|
|
15595
16121
|
const [fontDialogRequest, setFontDialogRequest] = useState(null);
|
|
15596
16122
|
const [proofingDialogRequest, setProofingDialogRequest] = useState(null);
|
|
15597
16123
|
const officeDialog = useOfficeDialog();
|
|
15598
16124
|
const prompt = officeDialog.prompt;
|
|
15599
16125
|
const imageSelected = editor.isActive('image');
|
|
16126
|
+
const textBoxSelected = editor.isActive('documentTextBox');
|
|
15600
16127
|
const tableSelected = editor.isActive('table');
|
|
15601
16128
|
const activeBookmark = activeDocumentBookmark(editor);
|
|
15602
16129
|
const hasRefreshableFields = documentHasRefreshableFields(editor);
|
|
@@ -15638,6 +16165,9 @@ function DocumentToolbar({ editor, defaultRibbonCollapsed = false, reviewOnly =
|
|
|
15638
16165
|
const ribbonTabs = reviewOnly ? documentRibbonTabs.filter(({ id })=>'review' === id || 'view' === id) : pageChromeEditor ? [
|
|
15639
16166
|
...documentRibbonTabs,
|
|
15640
16167
|
documentPageChromeRibbonTab
|
|
16168
|
+
] : textBoxSelected ? [
|
|
16169
|
+
...documentRibbonTabs,
|
|
16170
|
+
documentTextBoxRibbonTab
|
|
15641
16171
|
] : imageSelected ? [
|
|
15642
16172
|
...documentRibbonTabs,
|
|
15643
16173
|
documentPictureRibbonTab
|
|
@@ -15692,15 +16222,17 @@ function DocumentToolbar({ editor, defaultRibbonCollapsed = false, reviewOnly =
|
|
|
15692
16222
|
setActiveTab((current)=>{
|
|
15693
16223
|
if (reviewOnly) return 'view' === current ? 'view' : 'review';
|
|
15694
16224
|
if (pageChromeEditor) return 'pageChrome';
|
|
16225
|
+
if (textBoxSelected) return 'textBox';
|
|
15695
16226
|
if (imageSelected) return 'picture';
|
|
15696
16227
|
if (tableSelected) return 'tableDesign' === current || 'tableLayout' === current ? current : 'tableDesign';
|
|
15697
|
-
return 'picture' === current || 'tableDesign' === current || 'tableLayout' === current || 'pageChrome' === current ? 'home' : current;
|
|
16228
|
+
return 'picture' === current || 'textBox' === current || 'tableDesign' === current || 'tableLayout' === current || 'pageChrome' === current ? 'home' : current;
|
|
15698
16229
|
});
|
|
15699
16230
|
}, [
|
|
15700
16231
|
imageSelected,
|
|
15701
16232
|
pageChromeEditor,
|
|
15702
16233
|
reviewOnly,
|
|
15703
|
-
tableSelected
|
|
16234
|
+
tableSelected,
|
|
16235
|
+
textBoxSelected
|
|
15704
16236
|
]);
|
|
15705
16237
|
useEffect(()=>{
|
|
15706
16238
|
let editorDom = null;
|
|
@@ -15988,12 +16520,22 @@ function DocumentToolbar({ editor, defaultRibbonCollapsed = false, reviewOnly =
|
|
|
15988
16520
|
})
|
|
15989
16521
|
]
|
|
15990
16522
|
}),
|
|
15991
|
-
/*#__PURE__*/
|
|
16523
|
+
/*#__PURE__*/ jsxs(document_toolbar_RibbonGroup, {
|
|
15992
16524
|
label: "文本",
|
|
15993
16525
|
priority: "low",
|
|
15994
|
-
children:
|
|
15995
|
-
|
|
15996
|
-
|
|
16526
|
+
children: [
|
|
16527
|
+
/*#__PURE__*/ jsx(document_toolbar_ToolbarButton, {
|
|
16528
|
+
label: "插入文本框",
|
|
16529
|
+
displayLabel: true,
|
|
16530
|
+
onClick: ()=>onInsertTextBox?.(),
|
|
16531
|
+
children: /*#__PURE__*/ jsx(TextCursorInput, {
|
|
16532
|
+
size: 19
|
|
16533
|
+
})
|
|
16534
|
+
}),
|
|
16535
|
+
/*#__PURE__*/ jsx(DocumentFieldSelect, {
|
|
16536
|
+
onInsertField: onInsertField
|
|
16537
|
+
})
|
|
16538
|
+
]
|
|
15997
16539
|
})
|
|
15998
16540
|
]
|
|
15999
16541
|
}),
|
|
@@ -16305,6 +16847,9 @@ function DocumentToolbar({ editor, defaultRibbonCollapsed = false, reviewOnly =
|
|
|
16305
16847
|
onOpenFontDialog: ()=>openFontDialog(pageChromeEditor),
|
|
16306
16848
|
onOpenProofingDialog: ()=>openProofingDialog(pageChromeEditor),
|
|
16307
16849
|
onClose: onClosePageChrome
|
|
16850
|
+
}) : null,
|
|
16851
|
+
textBox: textBoxSelected ? /*#__PURE__*/ jsx(DocumentTextBoxRibbon, {
|
|
16852
|
+
editor: editor
|
|
16308
16853
|
}) : null
|
|
16309
16854
|
}
|
|
16310
16855
|
}),
|
|
@@ -18295,6 +18840,12 @@ function useDocumentInsertCommands({ contentRef, editor, resolveFieldContext })
|
|
|
18295
18840
|
const insertNote = useCallback((kind)=>editor?.chain().focus().insertDocumentNote(kind).run() ?? false, [
|
|
18296
18841
|
editor
|
|
18297
18842
|
]);
|
|
18843
|
+
const insertTextBox = useCallback(()=>{
|
|
18844
|
+
if (!editor || editor.isDestroyed) return false;
|
|
18845
|
+
return editor.chain().focus().insertDocumentTextBox().run();
|
|
18846
|
+
}, [
|
|
18847
|
+
editor
|
|
18848
|
+
]);
|
|
18298
18849
|
const insertCaption = useCallback((kind)=>{
|
|
18299
18850
|
if (!editor) return;
|
|
18300
18851
|
rememberInvoker();
|
|
@@ -18622,6 +19173,7 @@ function useDocumentInsertCommands({ contentRef, editor, resolveFieldContext })
|
|
|
18622
19173
|
insertField,
|
|
18623
19174
|
insertImage,
|
|
18624
19175
|
insertNote,
|
|
19176
|
+
insertTextBox,
|
|
18625
19177
|
openIndexEntry,
|
|
18626
19178
|
openIndex,
|
|
18627
19179
|
openTableOfContents,
|
|
@@ -20827,6 +21379,7 @@ function DocumentEditorSurface({ artifactId, autoFocus = true, collaboration, co
|
|
|
20827
21379
|
pageChromeEditingPart: pageChromeEditing?.part ?? null,
|
|
20828
21380
|
pageChromeShowPageNumber: visibleChrome.showPageNumber,
|
|
20829
21381
|
onRequestImage: ()=>imageInputRef.current?.click(),
|
|
21382
|
+
onInsertTextBox: documentInsert.insertTextBox,
|
|
20830
21383
|
onPageChromeEditingPartChange: editPageChrome,
|
|
20831
21384
|
onClosePageChrome: closePageChrome,
|
|
20832
21385
|
onTogglePageChromePageNumber: toggleVisiblePageNumber,
|