@a3s-lab/office 0.43.0 → 0.45.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 +30 -1
- package/dist/0~1403.js +1 -1
- package/dist/0~2330.js +2 -2
- package/dist/0~3539.js +2 -2
- package/dist/0~3557.js +1 -1
- package/dist/{0~5024.js → 0~4042.js} +111 -3
- package/dist/0~4980.js +1 -1
- package/dist/0~7828.js +1 -1
- package/dist/{0~7048.js → 0~7831.js} +2 -547
- package/dist/0~document-editor.js +154 -5
- package/dist/{0~3635.js → 0~office-color-picker.js} +1 -12
- package/dist/0~pdf-viewer.js +22 -8
- package/dist/0~presentation-editor.js +4 -3
- package/dist/0~spreadsheet-editor.js +200 -3669
- package/dist/0~work-docx-export.js +11 -8
- package/dist/0~work-docx-import.js +11 -5
- package/dist/0~work-office-diagnostics.js +14 -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/3818.js +1 -1
- package/dist/4166.js +1 -1
- package/dist/4174.js +112 -4
- package/dist/4560.js +2 -2
- package/dist/{5416.js → 610.js} +4335 -410
- package/dist/{4121.js → 6968.js} +622 -13
- package/dist/7060.js +1 -1
- package/dist/{4650.js → 816.js} +12 -1
- package/dist/8715.js +1 -1
- package/dist/9333.js +17 -17
- package/dist/core.js +7 -5
- package/dist/index.js +2 -2
- package/dist/internal/features/work/editors/document-picture-properties-dialog-model.d.ts +4 -1
- package/dist/internal/features/work/editors/spreadsheet-data-validation-list.d.ts +44 -0
- package/dist/internal/features/work/editors/spreadsheet-data-validation.d.ts +2 -1
- package/dist/internal/features/work/editors/spreadsheet-editor-support.d.ts +1 -1
- package/dist/internal/features/work/work-document-image-layout.d.ts +14 -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-types.d.ts +4 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +51 -3
- package/docs/latest/en/browser-editor-architecture.md +7 -3
- package/package.json +1 -1
|
@@ -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, 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, StretchHorizontal, Strikethrough, Subscript, Superscript, Table2, TableCellsMerge, TableCellsSplit, TableProperties, Tags, 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,17 +16,18 @@ 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,
|
|
20
|
-
import { useOfficeTaskPaneEscape,
|
|
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, 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, 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
|
+
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";
|
|
23
|
-
import {
|
|
23
|
+
import { documentRunShadingDomAttributes, normalizeDocumentRunBorder, parseDocumentScriptFonts, officeFontFamilyLabel, parseDocumentRunShading, DOCUMENT_RUN_BORDER_STYLES, serializeDocumentRunBorder, documentScriptFontDirectFamily, serializeDocumentRunShading, patchDocumentScriptFonts, serializeDocumentScriptFonts, documentRunBorderIsVisible, cssDocumentFontFamily, isDocumentParagraphArtBorderStyle, visibleWorkDocumentOutlineItems, DEFAULT_DOCUMENT_TABLE_OF_CONTENTS_OPTIONS, createOfficeId as createWorkId, DEFAULT_DOCUMENT_INDEX_OPTIONS, normalizeOfficeFontFamily, normalizeDocumentLanguageTag, currentWorkDocumentOutlineItem, normalizeDocumentNoProof, parseDocumentRunBorder, DocumentParagraphIdentity, parseDocumentProofingLanguages, collectWorkDocumentOutline, documentScriptFontSlotFromHint, documentBorderPresentation, documentScriptFontFamilyForRendering, normalizeDocumentRunShading, normalizeDocumentScriptFontSlot, officeFontFamilies, documentScriptFontSegments, patchDocumentProofingLanguages, serializeDocumentProofingLanguages, documentFontNameFromCssFamily } from "./6968.js";
|
|
24
24
|
import { normalizeDocumentHref, DOCUMENT_LINK_VALIDATION_MESSAGE } from "./0~work-document-links.js";
|
|
25
|
-
import { OfficeColorPicker
|
|
25
|
+
import { OfficeColorPicker } from "./0~office-color-picker.js";
|
|
26
26
|
import { OfficeTableInsertPopover, readOfficeFileAsDataUrl } from "./0~9445.js";
|
|
27
27
|
import { mergeOfficeTiptapExtensions, documentHasRefreshableFields, documentCurrentPage, documentAgentMenuItems, documentPageCount, createWorkDocumentSelectionSnapshot, documentPlainTextAsHtml, createWorkDocumentSelectionAction, documentCustomSelectionMenuItems } from "./0~5050.js";
|
|
28
28
|
import { WorkEditorLoadingState, documentLayoutFontKey, useOfficeCollaborationLocationNavigator, OFFICE_DOCUMENT_LAYOUT_HEBREW_FONT_ID, useOfficeEditorInitialFocus, OFFICE_DOCUMENT_LAYOUT_FONT_ID, OFFICE_DOCUMENT_LAYOUT_ARABIC_FONT_ID, OFFICE_DOCUMENT_LAYOUT_LATIN_FONT_ID } from "./432.js";
|
|
29
29
|
import { useOfficeDraft, InlineNotice } from "./0~345.js";
|
|
30
|
+
import { isOfficeShortcutBlocked } from "./816.js";
|
|
30
31
|
import { showToast } from "./6489.js";
|
|
31
32
|
import { ControlledEditorComposition } from "./0~controlled-editor-composition.js";
|
|
32
33
|
import { documentPageColor, normalizeDocumentPageColor } from "./0~work-document-page-color.js";
|
|
@@ -12688,6 +12689,9 @@ function createDocumentPicturePropertiesDraft(source) {
|
|
|
12688
12689
|
cropRight: formatNumber(source.properties.crop?.right ?? 0),
|
|
12689
12690
|
cropBottom: formatNumber(source.properties.crop?.bottom ?? 0),
|
|
12690
12691
|
cropLeft: formatNumber(source.properties.crop?.left ?? 0),
|
|
12692
|
+
rotation: (source.properties.transform ?? defaultDocumentImageTransform()).rotation,
|
|
12693
|
+
flipHorizontal: Boolean(source.properties.transform?.flipHorizontal),
|
|
12694
|
+
flipVertical: Boolean(source.properties.transform?.flipVertical),
|
|
12691
12695
|
relativeHeight: String(layer.relativeHeight),
|
|
12692
12696
|
behindDocument: layer.behindDocument,
|
|
12693
12697
|
allowOverlap: layer.allowOverlap,
|
|
@@ -12766,6 +12770,14 @@ function documentPicturePropertyChanges(initial, current) {
|
|
|
12766
12770
|
};
|
|
12767
12771
|
changes.crop = Object.values(crop).some((edge)=>edge > 0) ? crop : null;
|
|
12768
12772
|
}
|
|
12773
|
+
if (initial.rotation !== current.rotation || initial.flipHorizontal !== current.flipHorizontal || initial.flipVertical !== current.flipVertical) {
|
|
12774
|
+
const transform = normalizeDocumentImageTransform({
|
|
12775
|
+
rotation: current.rotation,
|
|
12776
|
+
flipHorizontal: current.flipHorizontal,
|
|
12777
|
+
flipVertical: current.flipVertical
|
|
12778
|
+
});
|
|
12779
|
+
changes.transform = 0 !== transform.rotation || transform.flipHorizontal || transform.flipVertical ? transform : null;
|
|
12780
|
+
}
|
|
12769
12781
|
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({
|
|
12770
12782
|
relativeHeight: current.relativeHeight,
|
|
12771
12783
|
behindDocument: current.behindDocument,
|
|
@@ -12925,6 +12937,24 @@ const verticalReferenceOptions = [
|
|
|
12925
12937
|
label: '页面'
|
|
12926
12938
|
}
|
|
12927
12939
|
];
|
|
12940
|
+
const rotationOptions = [
|
|
12941
|
+
{
|
|
12942
|
+
value: '0',
|
|
12943
|
+
label: '0°(原始)'
|
|
12944
|
+
},
|
|
12945
|
+
{
|
|
12946
|
+
value: '90',
|
|
12947
|
+
label: '90°'
|
|
12948
|
+
},
|
|
12949
|
+
{
|
|
12950
|
+
value: '180',
|
|
12951
|
+
label: '180°'
|
|
12952
|
+
},
|
|
12953
|
+
{
|
|
12954
|
+
value: '270',
|
|
12955
|
+
label: '270°'
|
|
12956
|
+
}
|
|
12957
|
+
];
|
|
12928
12958
|
function DocumentPicturePropertiesControl({ editor }) {
|
|
12929
12959
|
const [source, setSource] = useState(null);
|
|
12930
12960
|
const triggerRef = useRef(null);
|
|
@@ -13028,6 +13058,10 @@ function DocumentPicturePropertiesDialog({ editor, source, restoreFocusTarget, o
|
|
|
13028
13058
|
errors: errors,
|
|
13029
13059
|
onDraftChange: setDraft
|
|
13030
13060
|
}),
|
|
13061
|
+
/*#__PURE__*/ jsx(PictureTransformSection, {
|
|
13062
|
+
draft: draft,
|
|
13063
|
+
onDraftChange: setDraft
|
|
13064
|
+
}),
|
|
13031
13065
|
/*#__PURE__*/ jsxs("label", {
|
|
13032
13066
|
className: "work-document-picture-properties-alt-text",
|
|
13033
13067
|
htmlFor: alternativeTextId,
|
|
@@ -13417,6 +13451,60 @@ function PictureCropSection({ draft, errors, onDraftChange }) {
|
|
|
13417
13451
|
]
|
|
13418
13452
|
});
|
|
13419
13453
|
}
|
|
13454
|
+
function PictureTransformSection({ draft, onDraftChange }) {
|
|
13455
|
+
return /*#__PURE__*/ jsxs("fieldset", {
|
|
13456
|
+
className: "work-document-picture-properties-section transform",
|
|
13457
|
+
children: [
|
|
13458
|
+
/*#__PURE__*/ jsx("legend", {
|
|
13459
|
+
children: "变换"
|
|
13460
|
+
}),
|
|
13461
|
+
/*#__PURE__*/ jsxs("div", {
|
|
13462
|
+
className: "work-document-picture-properties-transform-row",
|
|
13463
|
+
children: [
|
|
13464
|
+
/*#__PURE__*/ jsx("span", {
|
|
13465
|
+
children: "旋转"
|
|
13466
|
+
}),
|
|
13467
|
+
/*#__PURE__*/ jsx(OfficeSelect, {
|
|
13468
|
+
ariaLabel: "图片旋转角度",
|
|
13469
|
+
value: String(draft.rotation),
|
|
13470
|
+
options: rotationOptions,
|
|
13471
|
+
onValueChange: (value)=>onDraftChange((current)=>({
|
|
13472
|
+
...current,
|
|
13473
|
+
rotation: Number(value)
|
|
13474
|
+
}))
|
|
13475
|
+
})
|
|
13476
|
+
]
|
|
13477
|
+
}),
|
|
13478
|
+
/*#__PURE__*/ jsxs("div", {
|
|
13479
|
+
className: "work-document-picture-properties-transform-options",
|
|
13480
|
+
children: [
|
|
13481
|
+
/*#__PURE__*/ jsx(OfficeCheckbox, {
|
|
13482
|
+
ariaLabel: "水平翻转图片",
|
|
13483
|
+
checked: draft.flipHorizontal,
|
|
13484
|
+
onCheckedChange: (flipHorizontal)=>onDraftChange((current)=>({
|
|
13485
|
+
...current,
|
|
13486
|
+
flipHorizontal
|
|
13487
|
+
})),
|
|
13488
|
+
children: "水平翻转"
|
|
13489
|
+
}),
|
|
13490
|
+
/*#__PURE__*/ jsx(OfficeCheckbox, {
|
|
13491
|
+
ariaLabel: "垂直翻转图片",
|
|
13492
|
+
checked: draft.flipVertical,
|
|
13493
|
+
onCheckedChange: (flipVertical)=>onDraftChange((current)=>({
|
|
13494
|
+
...current,
|
|
13495
|
+
flipVertical
|
|
13496
|
+
})),
|
|
13497
|
+
children: "垂直翻转"
|
|
13498
|
+
})
|
|
13499
|
+
]
|
|
13500
|
+
}),
|
|
13501
|
+
/*#__PURE__*/ jsx("small", {
|
|
13502
|
+
className: "work-document-picture-properties-transform-help",
|
|
13503
|
+
children: "旋转以 90\xb0 为单位;每次确认作为一次可撤销操作保存。"
|
|
13504
|
+
})
|
|
13505
|
+
]
|
|
13506
|
+
});
|
|
13507
|
+
}
|
|
13420
13508
|
function PictureNumberRow({ label, ariaLabel, value, unit, min, max, step, disabled = false, invalid, onValueChange }) {
|
|
13421
13509
|
return /*#__PURE__*/ jsxs("div", {
|
|
13422
13510
|
className: "work-document-picture-properties-number-row",
|
|
@@ -13480,6 +13568,7 @@ const imageWrapDistanceOptions = [
|
|
|
13480
13568
|
];
|
|
13481
13569
|
function DocumentPictureRibbon({ editor }) {
|
|
13482
13570
|
const image = documentImageLayoutOptions(editor);
|
|
13571
|
+
const transform = documentImageProperties(editor).transform ?? defaultDocumentImageTransform();
|
|
13483
13572
|
const imageSelected = editor.isActive('image');
|
|
13484
13573
|
const wrapDistanceValue = String(image.wrapDistance);
|
|
13485
13574
|
const updateLayout = (layout)=>editor.commands.setDocumentImageLayoutOptions({
|
|
@@ -13488,6 +13577,15 @@ function DocumentPictureRibbon({ editor }) {
|
|
|
13488
13577
|
const updateAlignment = (alignment)=>editor.commands.setDocumentImageLayoutOptions({
|
|
13489
13578
|
alignment
|
|
13490
13579
|
});
|
|
13580
|
+
const updateTransform = (next)=>{
|
|
13581
|
+
const current = documentImageProperties(editor).transform ?? defaultDocumentImageTransform();
|
|
13582
|
+
return editor.commands.setDocumentImageProperties({
|
|
13583
|
+
transform: {
|
|
13584
|
+
...current,
|
|
13585
|
+
...next(current)
|
|
13586
|
+
}
|
|
13587
|
+
});
|
|
13588
|
+
};
|
|
13491
13589
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
13492
13590
|
children: [
|
|
13493
13591
|
/*#__PURE__*/ jsxs(WorkOfficeRibbonGroup, {
|
|
@@ -13581,6 +13679,53 @@ function DocumentPictureRibbon({ editor }) {
|
|
|
13581
13679
|
})
|
|
13582
13680
|
]
|
|
13583
13681
|
}),
|
|
13682
|
+
/*#__PURE__*/ jsxs(WorkOfficeRibbonGroup, {
|
|
13683
|
+
label: "变换",
|
|
13684
|
+
children: [
|
|
13685
|
+
/*#__PURE__*/ jsx(PictureButton, {
|
|
13686
|
+
label: "向左旋转",
|
|
13687
|
+
disabled: !imageSelected,
|
|
13688
|
+
onClick: ()=>updateTransform((current)=>({
|
|
13689
|
+
rotation: rotateImage(current.rotation, -90)
|
|
13690
|
+
})),
|
|
13691
|
+
children: /*#__PURE__*/ jsx(RotateCcw, {
|
|
13692
|
+
size: 18
|
|
13693
|
+
})
|
|
13694
|
+
}),
|
|
13695
|
+
/*#__PURE__*/ jsx(PictureButton, {
|
|
13696
|
+
label: "向右旋转",
|
|
13697
|
+
disabled: !imageSelected,
|
|
13698
|
+
onClick: ()=>updateTransform((current)=>({
|
|
13699
|
+
rotation: rotateImage(current.rotation, 90)
|
|
13700
|
+
})),
|
|
13701
|
+
children: /*#__PURE__*/ jsx(RotateCw, {
|
|
13702
|
+
size: 18
|
|
13703
|
+
})
|
|
13704
|
+
}),
|
|
13705
|
+
/*#__PURE__*/ jsx(PictureButton, {
|
|
13706
|
+
label: "水平翻转",
|
|
13707
|
+
active: transform.flipHorizontal,
|
|
13708
|
+
disabled: !imageSelected,
|
|
13709
|
+
onClick: ()=>updateTransform((current)=>({
|
|
13710
|
+
flipHorizontal: !current.flipHorizontal
|
|
13711
|
+
})),
|
|
13712
|
+
children: /*#__PURE__*/ jsx(FlipHorizontal2, {
|
|
13713
|
+
size: 18
|
|
13714
|
+
})
|
|
13715
|
+
}),
|
|
13716
|
+
/*#__PURE__*/ jsx(PictureButton, {
|
|
13717
|
+
label: "垂直翻转",
|
|
13718
|
+
active: transform.flipVertical,
|
|
13719
|
+
disabled: !imageSelected,
|
|
13720
|
+
onClick: ()=>updateTransform((current)=>({
|
|
13721
|
+
flipVertical: !current.flipVertical
|
|
13722
|
+
})),
|
|
13723
|
+
children: /*#__PURE__*/ jsx(FlipVertical2, {
|
|
13724
|
+
size: 18
|
|
13725
|
+
})
|
|
13726
|
+
})
|
|
13727
|
+
]
|
|
13728
|
+
}),
|
|
13584
13729
|
/*#__PURE__*/ jsx(WorkOfficeRibbonGroup, {
|
|
13585
13730
|
label: "与文字距离",
|
|
13586
13731
|
children: /*#__PURE__*/ jsx(OfficeSelect, {
|
|
@@ -13612,6 +13757,10 @@ function DocumentPictureRibbon({ editor }) {
|
|
|
13612
13757
|
]
|
|
13613
13758
|
});
|
|
13614
13759
|
}
|
|
13760
|
+
function rotateImage(rotation, delta) {
|
|
13761
|
+
const next = (rotation + delta + 360) % 360;
|
|
13762
|
+
return next;
|
|
13763
|
+
}
|
|
13615
13764
|
function imageWrapDistanceOptionsForValue(value) {
|
|
13616
13765
|
if (imageWrapDistanceOptions.some((option)=>option.value === value)) return imageWrapDistanceOptions;
|
|
13617
13766
|
return [
|
|
@@ -312,15 +312,4 @@ function swatchForeground(color) {
|
|
|
312
312
|
const blue = Number.parseInt(color.slice(5, 7), 16);
|
|
313
313
|
return 0.299 * red + 0.587 * green + 0.114 * blue > 176 ? '#111827' : '#ffffff';
|
|
314
314
|
}
|
|
315
|
-
|
|
316
|
-
const OFFICE_SHORTCUT_IGNORE_SELECTOR = '[data-office-shortcuts="ignore"]';
|
|
317
|
-
function isOfficeCompositionKeyboardEvent(event) {
|
|
318
|
-
return event.isComposing || 'Process' === event.key || 229 === event.keyCode;
|
|
319
|
-
}
|
|
320
|
-
function isOfficeShortcutBlocked(target) {
|
|
321
|
-
if ("u" < typeof document) return false;
|
|
322
|
-
if (target instanceof Element && (target.closest(MODAL_DIALOG_SELECTOR) || target.closest(OFFICE_SHORTCUT_IGNORE_SELECTOR))) return true;
|
|
323
|
-
if (document.activeElement instanceof Element && (document.activeElement.closest(MODAL_DIALOG_SELECTOR) || document.activeElement.closest(OFFICE_SHORTCUT_IGNORE_SELECTOR))) return true;
|
|
324
|
-
return null !== document.querySelector(MODAL_DIALOG_SELECTOR);
|
|
325
|
-
}
|
|
326
|
-
export { OfficeColorPicker, isOfficeCompositionKeyboardEvent, isOfficeShortcutBlocked };
|
|
315
|
+
export { OfficeColorPicker };
|
package/dist/0~pdf-viewer.js
CHANGED
|
@@ -6,9 +6,10 @@ import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useSta
|
|
|
6
6
|
import { PdfErrorCode } from "@embedpdf/models";
|
|
7
7
|
import { readOfficePdfCollaborationSource as readWorkOfficePdfCollaborationSource, createOfficePdfCollaborationBinding as createWorkOfficePdfCollaborationBinding, assertPdfCollaborationSource as assertWorkOfficePdfCollaborationSource } from "./3818.js";
|
|
8
8
|
import { createOfficeEditorExtension, useOfficeEditorRuntime, useOfficeEditorKeyboardShortcuts } from "./0~3557.js";
|
|
9
|
-
import { isOfficeShortcutBlocked
|
|
9
|
+
import { isOfficeShortcutBlocked } from "./816.js";
|
|
10
10
|
import { officePresenceColorStyle, moveOfficeMenuFocus, useOfficeEditorWheelZoom, useOfficeRemoteParticipants, WorkOfficeCollaborationParticipants, Dialog, OfficePresenceAvatar, useOfficePublishPresenceLocation, button_Button, icon_button_IconButton, office_text_field_OfficeTextField, Popover, useDialogFocusScope, office_text_field_OfficeFileInput } from "./0~8136.js";
|
|
11
11
|
import { StateView, useOfficeCollaborationLocationNavigator, PDF_EVIDENCE_COORDINATE_BASIS } from "./432.js";
|
|
12
|
+
import { OfficeColorPicker } from "./0~office-color-picker.js";
|
|
12
13
|
var pdf_viewer_namespaceObject = {};
|
|
13
14
|
__webpack_require__.r(pdf_viewer_namespaceObject);
|
|
14
15
|
__webpack_require__.d(pdf_viewer_namespaceObject, {
|
|
@@ -2982,6 +2983,7 @@ const initialPdfViewerControllerState = {
|
|
|
2982
2983
|
};
|
|
2983
2984
|
function usePdfViewerController(registry, historyOverride) {
|
|
2984
2985
|
const capabilitiesRef = useRef(null);
|
|
2986
|
+
const stateRegistryRef = useRef(null);
|
|
2985
2987
|
const pendingPageRef = useRef({
|
|
2986
2988
|
page: null,
|
|
2987
2989
|
retryTimer: null
|
|
@@ -2993,6 +2995,7 @@ function usePdfViewerController(registry, historyOverride) {
|
|
|
2993
2995
|
let disposed = false;
|
|
2994
2996
|
const unsubscribe = [];
|
|
2995
2997
|
capabilitiesRef.current = null;
|
|
2998
|
+
stateRegistryRef.current = null;
|
|
2996
2999
|
clearPendingPdfPageNavigation(pendingPageRef);
|
|
2997
3000
|
setState(initialPdfViewerControllerState);
|
|
2998
3001
|
if (!registry) return;
|
|
@@ -3000,6 +3003,7 @@ function usePdfViewerController(registry, historyOverride) {
|
|
|
3000
3003
|
if (disposed) return;
|
|
3001
3004
|
const capabilities = readCapabilities(registry);
|
|
3002
3005
|
capabilitiesRef.current = capabilities;
|
|
3006
|
+
stateRegistryRef.current = registry;
|
|
3003
3007
|
const sync = ()=>{
|
|
3004
3008
|
if (!disposed) setState(readControllerState(capabilities));
|
|
3005
3009
|
};
|
|
@@ -3029,6 +3033,7 @@ function usePdfViewerController(registry, historyOverride) {
|
|
|
3029
3033
|
sync();
|
|
3030
3034
|
}).catch((error)=>{
|
|
3031
3035
|
if (disposed) return;
|
|
3036
|
+
stateRegistryRef.current = registry;
|
|
3032
3037
|
setState({
|
|
3033
3038
|
...initialPdfViewerControllerState,
|
|
3034
3039
|
error: errorMessage(error)
|
|
@@ -3037,6 +3042,7 @@ function usePdfViewerController(registry, historyOverride) {
|
|
|
3037
3042
|
return ()=>{
|
|
3038
3043
|
disposed = true;
|
|
3039
3044
|
capabilitiesRef.current = null;
|
|
3045
|
+
stateRegistryRef.current = null;
|
|
3040
3046
|
clearPendingPdfPageNavigation(pendingPageRef);
|
|
3041
3047
|
for (const stop of unsubscribe)stop();
|
|
3042
3048
|
};
|
|
@@ -3155,17 +3161,18 @@ function usePdfViewerController(registry, historyOverride) {
|
|
|
3155
3161
|
type: 'application/pdf'
|
|
3156
3162
|
});
|
|
3157
3163
|
}, []);
|
|
3164
|
+
const boundState = stateRegistryRef.current === registry ? state : initialPdfViewerControllerState;
|
|
3158
3165
|
const projectedState = useMemo(()=>historyOverride ? {
|
|
3159
|
-
...
|
|
3166
|
+
...boundState,
|
|
3160
3167
|
canRedo: historyOverride.canRedo,
|
|
3161
3168
|
canUndo: historyOverride.canUndo,
|
|
3162
3169
|
features: {
|
|
3163
|
-
...
|
|
3170
|
+
...boundState.features,
|
|
3164
3171
|
history: true
|
|
3165
3172
|
}
|
|
3166
|
-
} :
|
|
3167
|
-
|
|
3168
|
-
|
|
3173
|
+
} : boundState, [
|
|
3174
|
+
boundState,
|
|
3175
|
+
historyOverride
|
|
3169
3176
|
]);
|
|
3170
3177
|
return useMemo(()=>({
|
|
3171
3178
|
state: projectedState,
|
|
@@ -3671,6 +3678,7 @@ function PdfViewer({ collaboration, evidenceOverlay, fileName = 'document.pdf',
|
|
|
3671
3678
|
const [saveState, setSaveState] = useState('idle');
|
|
3672
3679
|
const [retryCount, setRetryCount] = useState(0);
|
|
3673
3680
|
const [registry, setRegistry] = useState(null);
|
|
3681
|
+
const activeSourceUrlRef = useRef(null);
|
|
3674
3682
|
const [, refreshCollaborationHistory] = useState(0);
|
|
3675
3683
|
const [hostSourceGeneration, setHostSourceGeneration] = useState(0);
|
|
3676
3684
|
const [pageOrganizerOpen, setPageOrganizerOpen] = useState(false);
|
|
@@ -3735,7 +3743,7 @@ function PdfViewer({ collaboration, evidenceOverlay, fileName = 'document.pdf',
|
|
|
3735
3743
|
pageOrganization
|
|
3736
3744
|
]);
|
|
3737
3745
|
const annotation = usePdfAnnotationController(registry);
|
|
3738
|
-
const viewerReady = viewerController.state.ready && viewerController.state.documentOpen;
|
|
3746
|
+
const viewerReady = Boolean(registry) && viewerController.state.ready && viewerController.state.documentOpen;
|
|
3739
3747
|
const mobilePageNavigationModal = usePdfMobilePageNavigationModal();
|
|
3740
3748
|
const mobilePageNavigationModalOpen = mobilePageNavigationOpen && mobilePageNavigationModal;
|
|
3741
3749
|
const collaborationRef = useRef(collaboration);
|
|
@@ -3792,6 +3800,12 @@ function PdfViewer({ collaboration, evidenceOverlay, fileName = 'document.pdf',
|
|
|
3792
3800
|
}, [
|
|
3793
3801
|
sourceBlob
|
|
3794
3802
|
]);
|
|
3803
|
+
activeSourceUrlRef.current = sourceUrl;
|
|
3804
|
+
const handleViewerReady = useCallback((nextRegistry)=>{
|
|
3805
|
+
if (activeSourceUrlRef.current === sourceUrl) setRegistry(nextRegistry);
|
|
3806
|
+
}, [
|
|
3807
|
+
sourceUrl
|
|
3808
|
+
]);
|
|
3795
3809
|
useEffect(()=>{
|
|
3796
3810
|
if (controller.state.error) setLoadError(controller.state.error);
|
|
3797
3811
|
}, [
|
|
@@ -4090,7 +4104,7 @@ function PdfViewer({ collaboration, evidenceOverlay, fileName = 'document.pdf',
|
|
|
4090
4104
|
'history'
|
|
4091
4105
|
]
|
|
4092
4106
|
},
|
|
4093
|
-
onReady:
|
|
4107
|
+
onReady: handleViewerReady
|
|
4094
4108
|
}, sourceUrl),
|
|
4095
4109
|
viewerReady && viewerController.state.currentPage > 0 && /*#__PURE__*/ jsx(PdfCollaborationPresenceLayer, {
|
|
4096
4110
|
pageIndex: viewerController.state.currentPage - 1
|
|
@@ -11,17 +11,18 @@ 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 { officeFontFamilies, normalizeOfficeFontFamily, createOfficeId as createWorkId, officeFontFamilyLabel } from "./6968.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";
|
|
18
18
|
import { officePresenceColorStyle, office_text_field_OfficeTextArea, stepOfficeZoom, useOfficeEditorWheelZoom, useOfficeRemoteParticipants, button_Button, useOfficePublishPresenceLocation, CommittedOfficeTextArea, CommittedOfficeTextField, office_text_field_OfficeTextField, useDialogFocusScope, icon_button_IconButton, office_text_field_OfficeFileInput } from "./0~8136.js";
|
|
19
|
-
import { useOfficeTaskPaneEscape,
|
|
19
|
+
import { useOfficeTaskPaneEscape, OfficeCheckbox, CommittedOfficeNumberField, useOfficeTaskPaneModal, useOfficeDialog, createOfficeKernelClient, CollectionState, OfficeNumberField, handleOfficeTaskPaneKeyDown } from "./0~7831.js";
|
|
20
20
|
import { WorkspaceContextMenu, isWorkspaceContextMenuKeyboardEvent, WorkOfficeZoomControls, WorkOfficeStatusBar, WorkOfficeRibbon, workspaceContextMenuPosition, OfficeSelect, WorkOfficeRibbonGroup, WorkOfficePreviewBar, WorkOfficeRibbonButton } from "./0~9073.js";
|
|
21
21
|
import { presentationAgentProposalTargets, SpreadsheetChartSeriesStyleEditor, applyPresentationAgentProposalChanges, normalizeOptionalOfficeNumber, SpreadsheetErrorBarEditor, useOfficeHistory, presentationNotesProposalTarget, presentationAgentSelection, SpreadsheetTrendlineEditor, presentationAgentMenuItems } from "./0~3539.js";
|
|
22
22
|
import { readOfficePresentationCollaboration as readWorkOfficePresentationCollaboration, workSlideAnimationIndex, workSlideAnimationForElement, remapWorkSlideAnimations, createOfficePresentationCollaborationBinding as createWorkOfficePresentationCollaborationBinding, workSlideAnimationEffectMatchesClass, workSlideAnimationCues, workSlideAnimationSequenceIssue, initialWorkSlideAnimationCueIndex, normalizeWorkSlideAnimation, workSlideAnimationClass, removeWorkSlideAnimationsForElements, createWorkSlideAnimation } from "./4560.js";
|
|
23
23
|
import { createOfficeEditorExtension, useOfficeEditorRuntime, useOfficeEditorKeyboardShortcuts } from "./0~3557.js";
|
|
24
|
-
import { isOfficeShortcutBlocked,
|
|
24
|
+
import { isOfficeShortcutBlocked, isOfficeCompositionKeyboardEvent } from "./816.js";
|
|
25
|
+
import { OfficeColorPicker } from "./0~office-color-picker.js";
|
|
25
26
|
import { slideTransitionDurationMilliseconds, createWorkSlideTransition, workSlideTransitionsEqual } from "./0~work-presentation-transition.js";
|
|
26
27
|
import { ControlledEditorComposition } from "./0~controlled-editor-composition.js";
|
|
27
28
|
import { normalizeDocumentHref, DOCUMENT_LINK_VALIDATION_MESSAGE } from "./0~work-document-links.js";
|