@a3s-lab/office 0.47.0 → 0.48.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.
@@ -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, 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";
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, TextSelect, 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, 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, documentCharacterPositionPoints, documentBulletListStyle, 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";
19
+ import { createWorkDocumentExtensions, 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, documentCharacterPositionPoints, documentBulletListStyle, DOCUMENT_CONTENT_CONTROL_DEFAULTS, 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, normalizeDocumentContentControlProperties, DOCUMENT_TABLE_STYLE_OPTIONS, updateDocumentColumnWidth, updateDocumentPaperSizePreset, documentPageMetrics, documentStrikeStyle, DocumentHighlight, createDocumentBibliography, DocumentSubscript, normalizeDocumentOpenTypeLigatures, selectedDocumentIndexEntry, updateDocumentPageChromeVariant, updateDocumentMirrorMargins, DOCUMENT_TEXT_BOX_DEFAULTS, activeDocumentTableStyle, measureDocumentLayoutBlocksIncrementally, documentWordLineHeightFactor, normalizeDocumentLegacyTextEffect, documentContentControlProperties } 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";
@@ -7411,6 +7411,15 @@ const documentCommandCatalog = {
7411
7411
  group: 'text'
7412
7412
  }
7413
7413
  },
7414
+ insertContentControl: {
7415
+ id: 'insert.contentControl',
7416
+ label: '插入内容控件',
7417
+ location: {
7418
+ area: 'ribbon',
7419
+ tab: 'insert',
7420
+ group: 'text'
7421
+ }
7422
+ },
7414
7423
  hyperlink: {
7415
7424
  id: 'insert.hyperlink',
7416
7425
  label: '添加链接',
@@ -16116,7 +16125,7 @@ function headingLevelForShortcut(code, key) {
16116
16125
  if ('3' === value) return 3;
16117
16126
  return null;
16118
16127
  }
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 }) {
16128
+ 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, onInsertContentControl, 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 }) {
16120
16129
  const [activeTab, setActiveTab] = useState(reviewOnly ? 'review' : 'home');
16121
16130
  const [fontDialogRequest, setFontDialogRequest] = useState(null);
16122
16131
  const [proofingDialogRequest, setProofingDialogRequest] = useState(null);
@@ -16532,6 +16541,14 @@ function DocumentToolbar({ editor, defaultRibbonCollapsed = false, reviewOnly =
16532
16541
  size: 19
16533
16542
  })
16534
16543
  }),
16544
+ /*#__PURE__*/ jsx(document_toolbar_ToolbarButton, {
16545
+ label: "插入内容控件",
16546
+ displayLabel: true,
16547
+ onClick: ()=>onInsertContentControl?.(),
16548
+ children: /*#__PURE__*/ jsx(TextSelect, {
16549
+ size: 19
16550
+ })
16551
+ }),
16535
16552
  /*#__PURE__*/ jsx(DocumentFieldSelect, {
16536
16553
  onInsertField: onInsertField
16537
16554
  })
@@ -18313,6 +18330,216 @@ function invalidComparisonResult() {
18313
18330
  ]
18314
18331
  };
18315
18332
  }
18333
+ const typeOptions = [
18334
+ {
18335
+ value: 'text',
18336
+ label: '纯文本'
18337
+ },
18338
+ {
18339
+ value: 'richText',
18340
+ label: '富文本'
18341
+ }
18342
+ ];
18343
+ const lockOptions = [
18344
+ {
18345
+ value: 'unlocked',
18346
+ label: '可编辑'
18347
+ },
18348
+ {
18349
+ value: 'contentLocked',
18350
+ label: '锁定内容'
18351
+ },
18352
+ {
18353
+ value: 'sdtLocked',
18354
+ label: '锁定控件'
18355
+ },
18356
+ {
18357
+ value: 'sdtContentLocked',
18358
+ label: '锁定控件和内容'
18359
+ }
18360
+ ];
18361
+ const appearanceOptions = [
18362
+ {
18363
+ value: 'boundingBox',
18364
+ label: '边框'
18365
+ },
18366
+ {
18367
+ value: 'tags',
18368
+ label: '标签'
18369
+ },
18370
+ {
18371
+ value: 'hidden',
18372
+ label: '隐藏边框'
18373
+ }
18374
+ ];
18375
+ function DocumentContentControlDialog({ editing, properties, restoreFocusTarget, onCancel, onChange, onSubmit }) {
18376
+ const update = (patch)=>onChange({
18377
+ ...properties,
18378
+ ...patch
18379
+ });
18380
+ const aliasId = 'document-content-control-alias';
18381
+ const tagId = 'document-content-control-tag';
18382
+ return /*#__PURE__*/ jsxs(Dialog, {
18383
+ title: editing ? '编辑内容控件' : '插入内容控件',
18384
+ description: "仅支持可编辑的内联纯文本或富文本控件;绑定、下拉、日期和重复区域不会被伪装成普通文本。",
18385
+ className: "work-document-content-control-dialog",
18386
+ restoreFocusTarget: restoreFocusTarget,
18387
+ onClose: onCancel,
18388
+ footer: /*#__PURE__*/ jsxs(Fragment, {
18389
+ children: [
18390
+ /*#__PURE__*/ jsx(button_Button, {
18391
+ tone: "quiet",
18392
+ onClick: onCancel,
18393
+ children: "取消"
18394
+ }),
18395
+ /*#__PURE__*/ jsx(button_Button, {
18396
+ tone: "primary",
18397
+ onClick: onSubmit,
18398
+ children: editing ? '应用' : '插入控件'
18399
+ })
18400
+ ]
18401
+ }),
18402
+ children: [
18403
+ /*#__PURE__*/ jsxs("div", {
18404
+ className: "work-document-content-control-dialog-fields",
18405
+ children: [
18406
+ /*#__PURE__*/ jsxs("label", {
18407
+ htmlFor: aliasId,
18408
+ children: [
18409
+ /*#__PURE__*/ jsx("span", {
18410
+ children: "显示名称"
18411
+ }),
18412
+ /*#__PURE__*/ jsx(office_text_field_OfficeTextField, {
18413
+ id: aliasId,
18414
+ "data-autofocus": true,
18415
+ "aria-label": "内容控件显示名称",
18416
+ value: properties.alias,
18417
+ maxLength: 255,
18418
+ placeholder: "例如:客户名称",
18419
+ onChange: (event)=>update({
18420
+ alias: event.target.value
18421
+ }),
18422
+ onKeyDown: (event)=>{
18423
+ if ('Enter' !== event.key || event.nativeEvent.isComposing) return;
18424
+ event.preventDefault();
18425
+ onSubmit();
18426
+ }
18427
+ })
18428
+ ]
18429
+ }),
18430
+ /*#__PURE__*/ jsxs("label", {
18431
+ htmlFor: tagId,
18432
+ children: [
18433
+ /*#__PURE__*/ jsx("span", {
18434
+ children: "程序标签"
18435
+ }),
18436
+ /*#__PURE__*/ jsx(office_text_field_OfficeTextField, {
18437
+ id: tagId,
18438
+ "aria-label": "内容控件程序标签",
18439
+ value: properties.tag,
18440
+ maxLength: 255,
18441
+ placeholder: "可选,供文档自动化识别",
18442
+ onChange: (event)=>update({
18443
+ tag: event.target.value
18444
+ })
18445
+ })
18446
+ ]
18447
+ })
18448
+ ]
18449
+ }),
18450
+ /*#__PURE__*/ jsxs("div", {
18451
+ className: "work-document-content-control-dialog-selects",
18452
+ children: [
18453
+ /*#__PURE__*/ jsxs("div", {
18454
+ className: "work-document-content-control-dialog-field",
18455
+ children: [
18456
+ /*#__PURE__*/ jsx("span", {
18457
+ children: "控件类型"
18458
+ }),
18459
+ /*#__PURE__*/ jsx(OfficeSelect, {
18460
+ ariaLabel: "内容控件类型",
18461
+ value: properties.type,
18462
+ options: typeOptions,
18463
+ onValueChange: (type)=>update({
18464
+ type
18465
+ })
18466
+ })
18467
+ ]
18468
+ }),
18469
+ /*#__PURE__*/ jsxs("div", {
18470
+ className: "work-document-content-control-dialog-field",
18471
+ children: [
18472
+ /*#__PURE__*/ jsx("span", {
18473
+ children: "锁定方式"
18474
+ }),
18475
+ /*#__PURE__*/ jsx(OfficeSelect, {
18476
+ ariaLabel: "内容控件锁定方式",
18477
+ value: properties.lock,
18478
+ options: lockOptions,
18479
+ onValueChange: (lock)=>update({
18480
+ lock
18481
+ })
18482
+ })
18483
+ ]
18484
+ }),
18485
+ /*#__PURE__*/ jsxs("div", {
18486
+ className: "work-document-content-control-dialog-field",
18487
+ children: [
18488
+ /*#__PURE__*/ jsx("span", {
18489
+ children: "外观"
18490
+ }),
18491
+ /*#__PURE__*/ jsx(OfficeSelect, {
18492
+ ariaLabel: "内容控件外观",
18493
+ value: properties.appearance,
18494
+ options: appearanceOptions,
18495
+ onValueChange: (appearance)=>update({
18496
+ appearance
18497
+ })
18498
+ })
18499
+ ]
18500
+ })
18501
+ ]
18502
+ }),
18503
+ /*#__PURE__*/ jsxs("div", {
18504
+ className: "work-document-content-control-dialog-options",
18505
+ children: [
18506
+ /*#__PURE__*/ jsx(OfficeCheckbox, {
18507
+ ariaLabel: "允许多行文字",
18508
+ checked: properties.multiLine,
18509
+ onCheckedChange: (multiLine)=>update({
18510
+ multiLine
18511
+ }),
18512
+ children: "允许多行文字"
18513
+ }),
18514
+ /*#__PURE__*/ jsxs("label", {
18515
+ className: "work-document-content-control-color",
18516
+ children: [
18517
+ /*#__PURE__*/ jsx("span", {
18518
+ children: "控件颜色"
18519
+ }),
18520
+ /*#__PURE__*/ jsx("input", {
18521
+ type: "color",
18522
+ "aria-label": "内容控件颜色",
18523
+ value: properties.color ?? '#2f6fed',
18524
+ onChange: (event)=>update({
18525
+ color: event.target.value
18526
+ })
18527
+ }),
18528
+ /*#__PURE__*/ jsx("button", {
18529
+ type: "button",
18530
+ className: "work-document-content-control-color-reset",
18531
+ onClick: ()=>update({
18532
+ color: null
18533
+ }),
18534
+ children: "使用主题色"
18535
+ })
18536
+ ]
18537
+ })
18538
+ ]
18539
+ })
18540
+ ]
18541
+ });
18542
+ }
18316
18543
  function DocumentIndexDialog({ editing, options, restoreFocusTarget, onCancel, onOptionsChange, onSubmit }) {
18317
18544
  const update = (patch)=>onOptionsChange({
18318
18545
  ...options,
@@ -18854,6 +19081,19 @@ function useDocumentInsertCommands({ contentRef, editor, resolveFieldContext })
18854
19081
  }, [
18855
19082
  editor
18856
19083
  ]);
19084
+ const openContentControl = useCallback(()=>{
19085
+ if (!editor || editor.isDestroyed) return;
19086
+ rememberInvoker();
19087
+ const active = editor.isActive('documentContentControl');
19088
+ setInsertDialog({
19089
+ kind: 'contentControl',
19090
+ editing: active,
19091
+ properties: active ? documentContentControlProperties(editor) : normalizeDocumentContentControlProperties(DOCUMENT_CONTENT_CONTROL_DEFAULTS)
19092
+ });
19093
+ }, [
19094
+ editor,
19095
+ rememberInvoker
19096
+ ]);
18857
19097
  const insertCaption = useCallback((kind)=>{
18858
19098
  if (!editor) return;
18859
19099
  rememberInvoker();
@@ -19024,6 +19264,13 @@ function useDocumentInsertCommands({ contentRef, editor, resolveFieldContext })
19024
19264
  invokerRef.current = editor.view.dom;
19025
19265
  setInsertDialog(null);
19026
19266
  };
19267
+ const submitContentControl = ()=>{
19268
+ if (!editor || insertDialog?.kind !== 'contentControl') return;
19269
+ const applied = insertDialog.editing ? editor.chain().focus().setDocumentContentControlProperties(insertDialog.properties).run() : editor.chain().focus().insertDocumentContentControl(insertDialog.properties).run();
19270
+ if (!applied) return;
19271
+ invokerRef.current = editor.view.dom;
19272
+ setInsertDialog(null);
19273
+ };
19027
19274
  const moveReferenceSelection = (event, currentIndex)=>{
19028
19275
  if (insertDialog?.kind !== 'crossReference') return;
19029
19276
  let nextIndex = currentIndex;
@@ -19193,6 +19440,17 @@ function useDocumentInsertCommands({ contentRef, editor, resolveFieldContext })
19193
19440
  options
19194
19441
  }),
19195
19442
  onSubmit: submitIndex
19443
+ }),
19444
+ insertDialog?.kind === 'contentControl' && /*#__PURE__*/ jsx(DocumentContentControlDialog, {
19445
+ editing: insertDialog.editing,
19446
+ properties: insertDialog.properties,
19447
+ restoreFocusTarget: ()=>invokerRef.current,
19448
+ onCancel: ()=>setInsertDialog(null),
19449
+ onChange: (properties)=>setInsertDialog({
19450
+ ...insertDialog,
19451
+ properties
19452
+ }),
19453
+ onSubmit: submitContentControl
19196
19454
  })
19197
19455
  ]
19198
19456
  });
@@ -19204,6 +19462,7 @@ function useDocumentInsertCommands({ contentRef, editor, resolveFieldContext })
19204
19462
  insertImage,
19205
19463
  insertNote,
19206
19464
  insertTextBox,
19465
+ openContentControl,
19207
19466
  openIndexEntry,
19208
19467
  openIndex,
19209
19468
  openTableOfContents,
@@ -21410,6 +21669,7 @@ function DocumentEditorSurface({ artifactId, autoFocus = true, collaboration, co
21410
21669
  pageChromeShowPageNumber: visibleChrome.showPageNumber,
21411
21670
  onRequestImage: ()=>imageInputRef.current?.click(),
21412
21671
  onInsertTextBox: documentInsert.insertTextBox,
21672
+ onInsertContentControl: documentInsert.openContentControl,
21413
21673
  onPageChromeEditingPartChange: editPageChrome,
21414
21674
  onClosePageChrome: closePageChrome,
21415
21675
  onTogglePageChromePageNumber: toggleVisiblePageNumber,