@a3s-lab/office 0.47.0 → 0.48.1

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.
@@ -547,6 +547,15 @@ export declare const documentCommandCatalog: {
547
547
  readonly group: "text";
548
548
  };
549
549
  };
550
+ readonly insertContentControl: {
551
+ readonly id: "insert.contentControl";
552
+ readonly label: "插入内容控件";
553
+ readonly location: {
554
+ readonly area: "ribbon";
555
+ readonly tab: "insert";
556
+ readonly group: "text";
557
+ };
558
+ };
550
559
  readonly hyperlink: {
551
560
  readonly id: "insert.hyperlink";
552
561
  readonly label: "添加链接";
@@ -0,0 +1,10 @@
1
+ import type { WorkDocumentContentControlProperties } from '../work-document-content-control';
2
+ export interface DocumentContentControlDialogProps {
3
+ editing: boolean;
4
+ properties: WorkDocumentContentControlProperties;
5
+ restoreFocusTarget: () => HTMLElement | null;
6
+ onCancel: () => void;
7
+ onChange: (properties: WorkDocumentContentControlProperties) => void;
8
+ onSubmit: () => void;
9
+ }
10
+ export declare function DocumentContentControlDialog({ editing, properties, restoreFocusTarget, onCancel, onChange, onSubmit, }: DocumentContentControlDialogProps): import("react").JSX.Element;
@@ -40,6 +40,7 @@ interface DocumentToolbarProps {
40
40
  pageChromeShowPageNumber: boolean;
41
41
  onRequestImage: () => void;
42
42
  onInsertTextBox?: () => void;
43
+ onInsertContentControl?: () => void;
43
44
  onPageChromeEditingPartChange: (part: DocumentPageChromeEditingPart) => void;
44
45
  onClosePageChrome: () => void;
45
46
  onTogglePageChromePageNumber: () => void;
@@ -87,5 +88,5 @@ interface DocumentToolbarProps {
87
88
  onOpenWordCount: () => void;
88
89
  onOpenFindReplace: (mode: DocumentFindReplaceMode) => void;
89
90
  }
90
- export declare function DocumentToolbar({ editor, defaultRibbonCollapsed, reviewOnly, suggestionOnly, 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, }: DocumentToolbarProps): import("react").JSX.Element;
91
+ export declare function DocumentToolbar({ editor, defaultRibbonCollapsed, reviewOnly, suggestionOnly, 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, }: DocumentToolbarProps): import("react").JSX.Element;
91
92
  export {};
@@ -12,6 +12,7 @@ export interface DocumentInsertCommands {
12
12
  insertImage: (file: File) => Promise<void>;
13
13
  insertNote: (kind: WorkDocumentNoteKind) => boolean;
14
14
  insertTextBox: () => boolean;
15
+ openContentControl: () => void;
15
16
  openIndexEntry: () => void;
16
17
  openIndex: () => void;
17
18
  openTableOfContents: () => void;
@@ -0,0 +1,59 @@
1
+ import { type Editor, Node } from '@tiptap/core';
2
+ import { type Node as ProseMirrorNode } from '@tiptap/pm/model';
3
+ /**
4
+ * The deliberately small content-control surface exposed by Writer.
5
+ *
6
+ * Data binding, repeating sections, dates, drop-downs, pictures, and other
7
+ * active form semantics are intentionally not represented by this model. A
8
+ * control is an inline, editable container whose metadata can round-trip to a
9
+ * passive Word `w:sdt`.
10
+ */
11
+ export type WorkDocumentContentControlType = 'text' | 'richText';
12
+ export type WorkDocumentContentControlLock = 'unlocked' | 'contentLocked' | 'sdtLocked' | 'sdtContentLocked';
13
+ export type WorkDocumentContentControlAppearance = 'boundingBox' | 'hidden' | 'tags';
14
+ export interface WorkDocumentContentControlProperties {
15
+ id: string;
16
+ nativeId: number | null;
17
+ type: WorkDocumentContentControlType;
18
+ alias: string;
19
+ tag: string;
20
+ lock: WorkDocumentContentControlLock;
21
+ multiLine: boolean;
22
+ appearance: WorkDocumentContentControlAppearance;
23
+ color: string | null;
24
+ }
25
+ export interface DocumentContentControlInsertOptions extends Partial<WorkDocumentContentControlProperties> {
26
+ /** Initial plain text for an empty selection. */
27
+ text?: string;
28
+ }
29
+ export interface DocumentContentControlCommandOptions {
30
+ restoreFocus?: boolean;
31
+ /** Explicitly permits deleting a control whose `w:sdt` is locked. */
32
+ allowLocked?: boolean;
33
+ }
34
+ export interface SelectedDocumentContentControl {
35
+ node: ProseMirrorNode;
36
+ position: number;
37
+ }
38
+ declare module '@tiptap/core' {
39
+ interface Commands<ReturnType> {
40
+ documentContentControl: {
41
+ insertDocumentContentControl: (options?: DocumentContentControlInsertOptions) => ReturnType;
42
+ setDocumentContentControlProperties: (value: Partial<WorkDocumentContentControlProperties>, options?: DocumentContentControlCommandOptions) => ReturnType;
43
+ deleteDocumentContentControl: (options?: DocumentContentControlCommandOptions) => ReturnType;
44
+ };
45
+ }
46
+ }
47
+ export declare const DOCUMENT_CONTENT_CONTROL_DEFAULTS: WorkDocumentContentControlProperties;
48
+ /** Transaction meta used by the typed commands to cross the lock guard. */
49
+ export declare const DOCUMENT_CONTENT_CONTROL_MUTATION_META = "documentContentControlMutation";
50
+ export declare const DocumentContentControl: Node<any, any>;
51
+ export declare function documentContentControlProperties(editor: Editor): WorkDocumentContentControlProperties;
52
+ export declare function setDocumentContentControlProperties(editor: Editor, value: Partial<WorkDocumentContentControlProperties>, options?: DocumentContentControlCommandOptions): boolean;
53
+ export declare function selectedDocumentContentControl(stateOrEditor: Editor | Editor['state']): SelectedDocumentContentControl | null;
54
+ export declare function normalizeDocumentContentControlProperties(value: Partial<Record<keyof WorkDocumentContentControlProperties, unknown>>): WorkDocumentContentControlProperties;
55
+ export declare function contentControlLocksContent(value: WorkDocumentContentControlLock | unknown): boolean;
56
+ export declare function contentControlLocksShell(value: WorkDocumentContentControlLock | unknown): boolean;
57
+ export declare function contentControlCss(value: Partial<Record<keyof WorkDocumentContentControlProperties, unknown>>): string;
58
+ export declare function contentControlDomAttributes(value: Partial<Record<keyof WorkDocumentContentControlProperties, unknown>>): Record<string, string | undefined>;
59
+ export declare function documentContentControlPropertiesFromElement(element: Element): WorkDocumentContentControlProperties;
@@ -0,0 +1,24 @@
1
+ import type { ParagraphChild } from 'docx';
2
+ import { type WorkDocumentContentControlProperties } from './work-document-content-control';
3
+ export interface DocxContentControlPatch {
4
+ startMarker: string;
5
+ endMarker: string;
6
+ properties: WorkDocumentContentControlProperties;
7
+ }
8
+ export interface DocxContentControlMarkerRegistration {
9
+ startMarker: string;
10
+ endMarker: string;
11
+ }
12
+ /** Collects native content-control patches while the docx package is built. */
13
+ export declare class DocxContentControlPatchCollector {
14
+ readonly patches: DocxContentControlPatch[];
15
+ private nextMarker;
16
+ register(properties: WorkDocumentContentControlProperties): DocxContentControlMarkerRegistration;
17
+ }
18
+ export declare function docxContentControlRuns(element: HTMLElement, docx: typeof import('docx'), collector: DocxContentControlPatchCollector, children: ParagraphChild[]): ParagraphChild[];
19
+ /**
20
+ * Replaces generated marker runs with native inline `w:sdt` controls in every
21
+ * Word story. The patcher is intentionally conservative: a marker pair must
22
+ * be in one paragraph and may contain only generated runs.
23
+ */
24
+ export declare function patchDocxContentControls(buffer: ArrayBuffer, patches: readonly DocxContentControlPatch[]): Promise<ArrayBuffer>;
@@ -0,0 +1,28 @@
1
+ import { type WorkDocumentContentControlProperties } from './work-document-content-control';
2
+ export interface ImportedDocxContentControlMarker {
3
+ start: string;
4
+ end: string;
5
+ properties: WorkDocumentContentControlProperties;
6
+ }
7
+ export interface ImportedDocxContentControlMarkers {
8
+ controls: ImportedDocxContentControlMarker[];
9
+ unsupported: number;
10
+ }
11
+ export interface DocxContentControlInspection {
12
+ supported: number;
13
+ unsupported: number;
14
+ }
15
+ /**
16
+ * Inspects body-level inline `w:sdt` controls without changing the package.
17
+ * Structural controls such as TOC/INDEX are left to their dedicated
18
+ * importers, so they are not reported as unsupported form controls here.
19
+ */
20
+ export declare function inspectDocxContentControls(document: Document): DocxContentControlInspection;
21
+ /**
22
+ * Moves the bounded inline control body into ordinary runs and surrounds it
23
+ * with text markers. Mammoth can then convert the runs normally; the markers
24
+ * are wrapped back into an editable HTML node after conversion.
25
+ */
26
+ export declare function markDocxContentControls(document: Document): ImportedDocxContentControlMarkers;
27
+ export declare function applyImportedDocxContentControlMarkers(document: Document, markers: ImportedDocxContentControlMarkers): void;
28
+ export declare function hasImportedDocxContentControlMarkers(markers: ImportedDocxContentControlMarkers): boolean;
@@ -3,6 +3,7 @@ import { type ImportedDocxCaptionMarkers } from './work-docx-caption-import';
3
3
  import { type ImportedDocxChangeMarkers } from './work-docx-change-import';
4
4
  import { type ImportedDocxCitationMarkers } from './work-docx-citation-import';
5
5
  import { type ImportedDocxCommentMarkers } from './work-docx-comment-import';
6
+ import { type ImportedDocxContentControlMarkers } from './work-docx-content-control-import';
6
7
  import { type ImportedDocxEquationMarkers } from './work-docx-equation-import';
7
8
  import { type ImportedDocxFieldMarkers } from './work-docx-field-import';
8
9
  import { type ImportedDocxImageLayoutMarkers } from './work-docx-image-layout-import';
@@ -48,6 +49,7 @@ export interface PreparedDocxImport {
48
49
  numberingChangeMarkers: ImportedDocxNumberingChangeMarkers;
49
50
  imageLayoutMarkers: ImportedDocxImageLayoutMarkers;
50
51
  textBoxMarkers: ImportedDocxTextBoxMarkers;
52
+ contentControlMarkers: ImportedDocxContentControlMarkers;
51
53
  paragraphIdentityMarkers: ImportedDocxParagraphIdentityMarkers;
52
54
  paragraphFormattingChangeMarkers: ImportedDocxParagraphFormattingChangeMarkers;
53
55
  paragraphAlignmentMarkers: ImportedDocxParagraphAlignmentMarkers;
@@ -66,6 +68,6 @@ export interface PreparedDocxImport {
66
68
  trackChanges: boolean;
67
69
  }
68
70
  export declare function prepareDocxImport(buffer: ArrayBuffer, sourcePackage?: OoxmlPackage): Promise<PreparedDocxImport>;
69
- export declare function applyDocxSectionsToHtml(html: string, sections: PreparedDocxImport['sections'], captionMarkers?: ImportedDocxCaptionMarkers, bookmarkMarkers?: ImportedDocxBookmarkMarkers, changeMarkers?: ImportedDocxChangeMarkers, commentMarkers?: ImportedDocxCommentMarkers, fieldMarkers?: ImportedDocxFieldMarkers, tableOfContentsMarkers?: ImportedDocxTableOfContentsMarkers, indexMarkers?: ImportedDocxIndexMarkers, equationMarkers?: ImportedDocxEquationMarkers, citationMarkers?: ImportedDocxCitationMarkers, listMarkers?: ImportedDocxListMarkers, numberingChangeMarkers?: ImportedDocxNumberingChangeMarkers, imageLayoutMarkers?: ImportedDocxImageLayoutMarkers, paragraphIdentityMarkers?: ImportedDocxParagraphIdentityMarkers, paragraphFormattingChangeMarkers?: ImportedDocxParagraphFormattingChangeMarkers, paragraphAlignmentMarkers?: ImportedDocxParagraphAlignmentMarkers, runFormattingMarkers?: ImportedDocxRunFormattingMarkers, paragraphDirectionMarkers?: ImportedDocxParagraphDirectionMarkers, paragraphIndentMarkers?: ImportedDocxParagraphIndentMarkers, paragraphSpacingMarkers?: ImportedDocxParagraphSpacingMarkers, paragraphBorderMarkers?: ImportedDocxParagraphBorderMarkers, paragraphShadingMarkers?: ImportedDocxParagraphShadingMarkers, paragraphPaginationMarkers?: ImportedDocxParagraphPaginationMarkers, bibliography?: WorkDocumentContent['bibliography'], tabStopMarkers?: ImportedDocxParagraphTabStopMarkers, tableCellMarkers?: ImportedDocxTableCellMarkers, tableRowMarkers?: ImportedDocxTableRowMarkers, tableSizingMarkers?: ImportedDocxTableSizingMarkers, textBoxMarkers?: ImportedDocxTextBoxMarkers): string;
71
+ export declare function applyDocxSectionsToHtml(html: string, sections: PreparedDocxImport['sections'], captionMarkers?: ImportedDocxCaptionMarkers, bookmarkMarkers?: ImportedDocxBookmarkMarkers, changeMarkers?: ImportedDocxChangeMarkers, commentMarkers?: ImportedDocxCommentMarkers, fieldMarkers?: ImportedDocxFieldMarkers, tableOfContentsMarkers?: ImportedDocxTableOfContentsMarkers, indexMarkers?: ImportedDocxIndexMarkers, equationMarkers?: ImportedDocxEquationMarkers, citationMarkers?: ImportedDocxCitationMarkers, listMarkers?: ImportedDocxListMarkers, numberingChangeMarkers?: ImportedDocxNumberingChangeMarkers, imageLayoutMarkers?: ImportedDocxImageLayoutMarkers, paragraphIdentityMarkers?: ImportedDocxParagraphIdentityMarkers, paragraphFormattingChangeMarkers?: ImportedDocxParagraphFormattingChangeMarkers, paragraphAlignmentMarkers?: ImportedDocxParagraphAlignmentMarkers, runFormattingMarkers?: ImportedDocxRunFormattingMarkers, paragraphDirectionMarkers?: ImportedDocxParagraphDirectionMarkers, paragraphIndentMarkers?: ImportedDocxParagraphIndentMarkers, paragraphSpacingMarkers?: ImportedDocxParagraphSpacingMarkers, paragraphBorderMarkers?: ImportedDocxParagraphBorderMarkers, paragraphShadingMarkers?: ImportedDocxParagraphShadingMarkers, paragraphPaginationMarkers?: ImportedDocxParagraphPaginationMarkers, bibliography?: WorkDocumentContent['bibliography'], tabStopMarkers?: ImportedDocxParagraphTabStopMarkers, tableCellMarkers?: ImportedDocxTableCellMarkers, tableRowMarkers?: ImportedDocxTableRowMarkers, tableSizingMarkers?: ImportedDocxTableSizingMarkers, textBoxMarkers?: ImportedDocxTextBoxMarkers, contentControlMarkers?: ImportedDocxContentControlMarkers): string;
70
72
  export declare function readDocxLayout(buffer: ArrayBuffer): Promise<ImportedDocumentLayout>;
71
73
  export {};
package/dist/styles.css CHANGED
@@ -7650,6 +7650,39 @@ button.work-office-collaboration-participant:hover .work-office-collaboration-lo
7650
7650
  min-width: 12px;
7651
7651
  }
7652
7652
 
7653
+ .work-document-selection-toolbar .work-document-underline-split-root > button, .work-document-selection-toolbar .work-document-strike-split-root > button {
7654
+ color: var(--a3s-muted);
7655
+ cursor: pointer;
7656
+ appearance: none;
7657
+ touch-action: manipulation;
7658
+ background: none;
7659
+ border: 1px solid #0000;
7660
+ flex: none;
7661
+ place-items: center;
7662
+ margin: 0;
7663
+ display: inline-grid;
7664
+ }
7665
+
7666
+ .work-document-selection-toolbar .work-document-underline-split-root > button:hover, .work-document-selection-toolbar .work-document-strike-split-root > button:hover {
7667
+ border-color: var(--a3s-line);
7668
+ background: var(--a3s-panel-soft);
7669
+ color: var(--a3s-ink);
7670
+ }
7671
+
7672
+ .work-document-selection-toolbar .work-document-underline-split-root > button[aria-pressed="true"], .work-document-selection-toolbar .work-document-strike-split-root > button[aria-pressed="true"] {
7673
+ border-color: color-mix(in srgb,
7674
+ var(--work-office-accent) 28%,
7675
+ var(--a3s-line));
7676
+ background: color-mix(in srgb,
7677
+ var(--work-office-accent) 11%,
7678
+ var(--a3s-panel));
7679
+ color: var(--work-office-accent);
7680
+ }
7681
+
7682
+ .work-document-selection-toolbar .work-document-underline-split-root > .work-document-underline-primary, .work-document-selection-toolbar .work-document-strike-split-root > .work-document-strike-primary, .work-document-selection-toolbar .work-document-underline-split-root > .work-document-underline-primary:hover, .work-document-selection-toolbar .work-document-strike-split-root > .work-document-strike-primary:hover, .work-document-selection-toolbar .work-document-underline-split-root > .work-document-underline-primary[aria-pressed="true"], .work-document-selection-toolbar .work-document-strike-split-root > .work-document-strike-primary[aria-pressed="true"] {
7683
+ border-right-color: #0000;
7684
+ }
7685
+
7653
7686
  .work-document-selection-toolbar > .work-document-underline-control {
7654
7687
  gap: 0;
7655
7688
  height: 28px;
@@ -12938,6 +12971,131 @@ sub [data-office-character-position-half-points], sup [data-office-character-pos
12938
12971
  padding: 0;
12939
12972
  }
12940
12973
 
12974
+ .work-document-content-control {
12975
+ --work-document-content-control-color: var(--a3s-accent);
12976
+ --work-document-content-control-appearance: boundingBox;
12977
+ border: 1px solid
12978
+ color-mix(in srgb,
12979
+ var(--work-document-content-control-color) 62%,
12980
+ transparent);
12981
+ background: color-mix(in srgb,
12982
+ var(--work-document-content-control-color) 8%,
12983
+ transparent);
12984
+ -webkit-box-decoration-break: clone;
12985
+ box-decoration-break: clone;
12986
+ border-radius: 3px;
12987
+ min-width: 1.25em;
12988
+ padding: 0 .18em;
12989
+ transition: background-color .12s, border-color .12s;
12990
+ display: inline-block;
12991
+ position: relative;
12992
+ }
12993
+
12994
+ .work-document-content-control:hover, .work-document-content-control.ProseMirror-selectednode {
12995
+ border-color: var(--work-document-content-control-color);
12996
+ background: color-mix(in srgb,
12997
+ var(--work-document-content-control-color) 14%,
12998
+ transparent);
12999
+ }
13000
+
13001
+ .work-document-content-control[data-content-control-appearance="hidden"] {
13002
+ background: none;
13003
+ border-color: #0000;
13004
+ }
13005
+
13006
+ .work-document-content-control[data-content-control-appearance="tags"]:before {
13007
+ content: attr(data-content-control-label);
13008
+ max-width: 18em;
13009
+ color: var(--work-document-content-control-color);
13010
+ white-space: nowrap;
13011
+ pointer-events: none;
13012
+ font-size: .68em;
13013
+ line-height: 1;
13014
+ position: absolute;
13015
+ top: -1.1em;
13016
+ left: -1px;
13017
+ overflow: hidden;
13018
+ }
13019
+
13020
+ .work-document-content-control[data-content-control-lock="contentLocked"], .work-document-content-control[data-content-control-lock="sdtContentLocked"], .work-document-content-control[data-content-control-lock="sdtLocked"] {
13021
+ background: color-mix(in srgb,
13022
+ var(--work-document-content-control-color) 5%,
13023
+ transparent);
13024
+ }
13025
+
13026
+ .work-document-content-control:empty:after {
13027
+ content: "输入内容";
13028
+ color: color-mix(in srgb, currentColor 48%, transparent);
13029
+ pointer-events: none;
13030
+ }
13031
+
13032
+ .work-document-content-control[contenteditable="false"] {
13033
+ cursor: not-allowed;
13034
+ }
13035
+
13036
+ @media print {
13037
+ .work-document-content-control {
13038
+ background: none;
13039
+ border-color: #0000;
13040
+ }
13041
+
13042
+ .work-document-content-control[data-content-control-appearance="tags"]:before {
13043
+ display: none;
13044
+ }
13045
+ }
13046
+
13047
+ .work-document-content-control-dialog-fields, .work-document-content-control-dialog-selects, .work-document-content-control-dialog-options {
13048
+ gap: 12px;
13049
+ display: grid;
13050
+ }
13051
+
13052
+ .work-document-content-control-dialog-fields, .work-document-content-control-dialog-selects {
13053
+ grid-template-columns: repeat(2, minmax(0, 1fr));
13054
+ }
13055
+
13056
+ .work-document-content-control-dialog-fields label, .work-document-content-control-dialog-selects label, .work-document-content-control-dialog-field, .work-document-content-control-color {
13057
+ color: var(--a3s-text-muted);
13058
+ gap: 5px;
13059
+ font-size: 12px;
13060
+ display: grid;
13061
+ }
13062
+
13063
+ .work-document-content-control-dialog-options {
13064
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
13065
+ align-items: center;
13066
+ margin-top: 12px;
13067
+ }
13068
+
13069
+ .work-document-content-control-color {
13070
+ grid-template-columns: auto auto 1fr;
13071
+ align-items: center;
13072
+ }
13073
+
13074
+ .work-document-content-control-color input[type="color"] {
13075
+ border: 1px solid var(--a3s-line);
13076
+ background: none;
13077
+ border-radius: 5px;
13078
+ width: 28px;
13079
+ height: 28px;
13080
+ padding: 2px;
13081
+ }
13082
+
13083
+ .work-document-content-control-color-reset {
13084
+ color: var(--a3s-accent);
13085
+ cursor: pointer;
13086
+ font: inherit;
13087
+ background: none;
13088
+ border: 0;
13089
+ justify-self: start;
13090
+ font-size: 11px;
13091
+ }
13092
+
13093
+ @media (width <= 640px) {
13094
+ .work-document-content-control-dialog-fields, .work-document-content-control-dialog-selects, .work-document-content-control-dialog-options {
13095
+ grid-template-columns: minmax(0, 1fr);
13096
+ }
13097
+ }
13098
+
12941
13099
  .work-document-table-of-contents {
12942
13100
  box-sizing: border-box;
12943
13101
  border: 1px solid color-mix(in srgb, var(--a3s-line) 82%, #8aa7d8);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a3s-lab/office",
3
- "version": "0.47.0",
3
+ "version": "0.48.1",
4
4
  "description": "Open-source collaborative browser editors for documents, Markdown, spreadsheets, presentations, and PDFs.",
5
5
  "keywords": [
6
6
  "office",
@@ -106,6 +106,7 @@
106
106
  "playground:visual:document-opentype": "playwright test visual-tests/document-opentype.functional.spec.ts --config playwright.config.ts",
107
107
  "playground:visual:document-strike": "playwright test visual-tests/document-strike.functional.spec.ts --config playwright.config.ts",
108
108
  "playground:visual:document-text-box": "playwright test visual-tests/document-text-box.functional.spec.ts --config playwright.config.ts",
109
+ "playground:visual:document-content-control": "playwright test visual-tests/document-content-control.functional.spec.ts --config playwright.config.ts",
109
110
  "playground:visual:spreadsheet-data-validation": "playwright test visual-tests/spreadsheet-data-validation.functional.spec.ts --config playwright.config.ts",
110
111
  "playground:visual:spreadsheet-conditional-format": "playwright test visual-tests/spreadsheet-conditional-format.functional.spec.ts --config playwright.config.ts",
111
112
  "playground:visual:spreadsheet-date-time": "playwright test visual-tests/spreadsheet-date-time.functional.spec.ts --config playwright.config.ts",
@@ -139,10 +140,12 @@
139
140
  "performance:pdf": "bun .a3s-test/performance/generate-fixtures.ts --pdf-only && bun .a3s-test/performance/benchmark-pdf.ts --url http://127.0.0.1:4175/playground/ --runs 3 --timeout-ms 120000",
140
141
  "performance:presentation": "bun .a3s-test/performance/generate-fixtures.ts --presentations-only && bun .a3s-test/performance/benchmark-presentation.ts --url http://127.0.0.1:4175/playground/ --runs 3 --timeout-ms 120000 --modes default,content-visibility",
141
142
  "test": "rstest",
142
- "test:e2e": "bun run test:e2e:fixtures && a3s-test run tests/e2e/word-page-color.acl --json && a3s-test run tests/e2e/word-page-setup-phone.acl --json && a3s-test run tests/e2e/word-paragraph-layout-phone.acl --json && a3s-test run tests/e2e/word-list-formatting-phone.acl --json && a3s-test run tests/e2e/word-font-picker-phone.acl --json && a3s-test run tests/e2e/word-comments-drawer.acl --json && a3s-test run tests/e2e/word-comment-windowing.acl --json && a3s-test run tests/e2e/word-citations-phone.acl --json && a3s-test run tests/e2e/word-navigation-search.acl --json && a3s-test run tests/e2e/word-navigation-windowing.acl --json && a3s-test run tests/e2e/word-find-replace-phone.acl --json && a3s-test run tests/e2e/word-page-navigation.acl --json && a3s-test run tests/e2e/word-page-windowing.acl --json && a3s-test run tests/e2e/word-ai-question.acl --json && a3s-test run tests/e2e/word-picture-insert.acl --json && a3s-test run tests/e2e/word-picture-alt-text-phone.acl --json && a3s-test run tests/e2e/word-text-box-phone.acl --json && a3s-test run tests/e2e/word-track-changes-phone.acl --json && a3s-test run tests/e2e/word-formatting-revision.acl --json && a3s-test run tests/e2e/word-paragraph-formatting-revision.acl --json && a3s-test run tests/e2e/word-numbering-revision.acl --json && a3s-test run tests/e2e/word-document-comparison.acl --json && a3s-test run tests/e2e/word-review-conflict-phone.acl --json && a3s-test run tests/e2e/word-revision-windowing.acl --json && a3s-test run tests/e2e/word-table-phone.acl --json && a3s-test run tests/e2e/word-table-borders.acl --json && a3s-test run tests/e2e/word-theme-table.acl --json && a3s-test run tests/e2e/word-styled-table.acl --json && a3s-test run tests/e2e/word-multi-page-table.acl --json && a3s-test run tests/e2e/word-cross-reference-phone.acl --json && a3s-test run tests/e2e/word-bookmark-links-phone.acl --json && a3s-test run tests/e2e/word-notes-phone.acl --json && a3s-test run tests/e2e/word-fields-phone.acl --json && a3s-test run tests/e2e/spreadsheet-phone-rename.acl --json && a3s-test run tests/e2e/spreadsheet-phone-find.acl --json && a3s-test run tests/e2e/spreadsheet-phone-context-menu.acl --json && a3s-test run tests/e2e/spreadsheet-phone-task-pane.acl --json && a3s-test run tests/e2e/spreadsheet-maximum-sparse.acl --json && a3s-test run tests/e2e/spreadsheet-cell-style.acl --json && a3s-test run tests/e2e/spreadsheet-paste-special.acl --json && a3s-test run tests/e2e/spreadsheet-hyperlink.acl --json && a3s-test run tests/e2e/presentation-cut-paste-focus.acl --json && a3s-test run tests/e2e/presentation-presenter-view.acl --json && a3s-test run tests/e2e/presentation-phone-chart-pane.acl --json && a3s-test run tests/e2e/presentation-phone-comments.acl --json && a3s-test run tests/e2e/pdf-thumbnail-keyboard.acl --json && a3s-test run tests/e2e/pdf-page-drawer-phone.acl --json && a3s-test run tests/e2e/markdown-phone-modes.acl --json && a3s-test run tests/e2e/office-sidebar-breakpoint.acl --json && a3s-test run tests/e2e/office-docs-navigation.acl --json && a3s-test run tests/e2e/collaboration-playground-entry.acl --json && a3s-test run tests/e2e/collaboration-document-comments.acl --command-timeout-ms 120000 --json && a3s-test run tests/e2e/collaboration-document-suggestions.acl --command-timeout-ms 120000 --json && a3s-test run tests/e2e/collaboration-participants.acl --json && a3s-test run tests/e2e/collaboration-pdf-annotations.acl --json && a3s-test run tests/e2e/collaboration-spreadsheet-cells.acl --json && a3s-test run tests/e2e/collaboration-presentation-elements.acl --json",
143
- "test:e2e:check": "bun run test:e2e:fixtures && a3s-test check tests/e2e/word-page-color.acl --json && a3s-test check tests/e2e/word-page-setup-phone.acl --json && a3s-test check tests/e2e/word-paragraph-layout-phone.acl --json && a3s-test check tests/e2e/word-list-formatting-phone.acl --json && a3s-test check tests/e2e/word-font-picker-phone.acl --json && a3s-test check tests/e2e/word-comments-drawer.acl --json && a3s-test check tests/e2e/word-comment-windowing.acl --json && a3s-test check tests/e2e/word-citations-phone.acl --json && a3s-test check tests/e2e/word-navigation-search.acl --json && a3s-test check tests/e2e/word-navigation-windowing.acl --json && a3s-test check tests/e2e/word-find-replace-phone.acl --json && a3s-test check tests/e2e/word-page-navigation.acl --json && a3s-test check tests/e2e/word-page-windowing.acl --json && a3s-test check tests/e2e/word-ai-question.acl --json && a3s-test check tests/e2e/word-picture-insert.acl --json && a3s-test check tests/e2e/word-picture-alt-text-phone.acl --json && a3s-test check tests/e2e/word-text-box-phone.acl --json && a3s-test check tests/e2e/word-track-changes-phone.acl --json && a3s-test check tests/e2e/word-formatting-revision.acl --json && a3s-test check tests/e2e/word-paragraph-formatting-revision.acl --json && a3s-test check tests/e2e/word-numbering-revision.acl --json && a3s-test check tests/e2e/word-document-comparison.acl --json && a3s-test check tests/e2e/word-review-conflict-phone.acl --json && a3s-test check tests/e2e/word-revision-windowing.acl --json && a3s-test check tests/e2e/word-table-phone.acl --json && a3s-test check tests/e2e/word-table-borders.acl --json && a3s-test check tests/e2e/word-theme-table.acl --json && a3s-test check tests/e2e/word-styled-table.acl --json && a3s-test check tests/e2e/word-multi-page-table.acl --json && a3s-test check tests/e2e/word-cross-reference-phone.acl --json && a3s-test check tests/e2e/word-bookmark-links-phone.acl --json && a3s-test check tests/e2e/word-notes-phone.acl --json && a3s-test check tests/e2e/word-fields-phone.acl --json && a3s-test check tests/e2e/spreadsheet-phone-rename.acl --json && a3s-test check tests/e2e/spreadsheet-phone-find.acl --json && a3s-test check tests/e2e/spreadsheet-phone-context-menu.acl --json && a3s-test check tests/e2e/spreadsheet-phone-task-pane.acl --json && a3s-test check tests/e2e/spreadsheet-maximum-sparse.acl --json && a3s-test check tests/e2e/spreadsheet-cell-style.acl --json && a3s-test check tests/e2e/spreadsheet-paste-special.acl --json && a3s-test check tests/e2e/spreadsheet-hyperlink.acl --json && a3s-test check tests/e2e/presentation-cut-paste-focus.acl --json && a3s-test check tests/e2e/presentation-presenter-view.acl --json && a3s-test check tests/e2e/presentation-phone-chart-pane.acl --json && a3s-test check tests/e2e/presentation-phone-comments.acl --json && a3s-test check tests/e2e/pdf-thumbnail-keyboard.acl --json && a3s-test check tests/e2e/pdf-page-drawer-phone.acl --json && a3s-test check tests/e2e/markdown-phone-modes.acl --json && a3s-test check tests/e2e/office-sidebar-breakpoint.acl --json && a3s-test check tests/e2e/office-docs-navigation.acl --json && a3s-test check tests/e2e/collaboration-playground-entry.acl --json && a3s-test check tests/e2e/collaboration-document-comments.acl --json && a3s-test check tests/e2e/collaboration-document-suggestions.acl --json && a3s-test check tests/e2e/collaboration-participants.acl --json && a3s-test check tests/e2e/collaboration-pdf-annotations.acl --json && a3s-test check tests/e2e/collaboration-spreadsheet-cells.acl --json && a3s-test check tests/e2e/collaboration-presentation-elements.acl --json",
143
+ "test:e2e": "bun run test:e2e:fixtures && a3s-test run tests/e2e/word-page-color.acl --json && a3s-test run tests/e2e/word-page-setup-phone.acl --json && a3s-test run tests/e2e/word-paragraph-layout-phone.acl --json && a3s-test run tests/e2e/word-list-formatting-phone.acl --json && a3s-test run tests/e2e/word-font-picker-phone.acl --json && a3s-test run tests/e2e/word-comments-drawer.acl --json && a3s-test run tests/e2e/word-comment-windowing.acl --json && a3s-test run tests/e2e/word-citations-phone.acl --json && a3s-test run tests/e2e/word-navigation-search.acl --json && a3s-test run tests/e2e/word-navigation-windowing.acl --json && a3s-test run tests/e2e/word-find-replace-phone.acl --json && a3s-test run tests/e2e/word-page-navigation.acl --json && a3s-test run tests/e2e/word-page-windowing.acl --json && a3s-test run tests/e2e/word-ai-question.acl --json && a3s-test run tests/e2e/word-picture-insert.acl --json && a3s-test run tests/e2e/word-picture-alt-text-phone.acl --json && a3s-test run tests/e2e/word-text-box-phone.acl --json && a3s-test run tests/e2e/word-content-controls-phone.acl --json && a3s-test run tests/e2e/word-track-changes-phone.acl --json && a3s-test run tests/e2e/word-formatting-revision.acl --json && a3s-test run tests/e2e/word-paragraph-formatting-revision.acl --json && a3s-test run tests/e2e/word-numbering-revision.acl --json && a3s-test run tests/e2e/word-document-comparison.acl --json && a3s-test run tests/e2e/word-review-conflict-phone.acl --json && a3s-test run tests/e2e/word-revision-windowing.acl --json && a3s-test run tests/e2e/word-table-phone.acl --json && a3s-test run tests/e2e/word-table-borders.acl --json && a3s-test run tests/e2e/word-theme-table.acl --json && a3s-test run tests/e2e/word-styled-table.acl --json && a3s-test run tests/e2e/word-multi-page-table.acl --json && a3s-test run tests/e2e/word-cross-reference-phone.acl --json && a3s-test run tests/e2e/word-bookmark-links-phone.acl --json && a3s-test run tests/e2e/word-notes-phone.acl --json && a3s-test run tests/e2e/word-fields-phone.acl --json && a3s-test run tests/e2e/spreadsheet-phone-rename.acl --json && a3s-test run tests/e2e/spreadsheet-phone-find.acl --json && a3s-test run tests/e2e/spreadsheet-phone-context-menu.acl --json && a3s-test run tests/e2e/spreadsheet-phone-task-pane.acl --json && a3s-test run tests/e2e/spreadsheet-maximum-sparse.acl --json && a3s-test run tests/e2e/spreadsheet-cell-style.acl --json && a3s-test run tests/e2e/spreadsheet-paste-special.acl --json && a3s-test run tests/e2e/spreadsheet-hyperlink.acl --json && a3s-test run tests/e2e/presentation-cut-paste-focus.acl --json && a3s-test run tests/e2e/presentation-presenter-view.acl --json && a3s-test run tests/e2e/presentation-phone-chart-pane.acl --json && a3s-test run tests/e2e/presentation-phone-comments.acl --json && a3s-test run tests/e2e/pdf-thumbnail-keyboard.acl --json && a3s-test run tests/e2e/pdf-page-drawer-phone.acl --json && a3s-test run tests/e2e/markdown-phone-modes.acl --json && a3s-test run tests/e2e/office-sidebar-breakpoint.acl --json && a3s-test run tests/e2e/office-docs-navigation.acl --json && a3s-test run tests/e2e/collaboration-playground-entry.acl --json && a3s-test run tests/e2e/collaboration-document-comments.acl --command-timeout-ms 120000 --json && a3s-test run tests/e2e/collaboration-document-suggestions.acl --command-timeout-ms 120000 --json && a3s-test run tests/e2e/collaboration-participants.acl --json && a3s-test run tests/e2e/collaboration-pdf-annotations.acl --json && a3s-test run tests/e2e/collaboration-spreadsheet-cells.acl --json && a3s-test run tests/e2e/collaboration-presentation-elements.acl --json",
144
+ "test:e2e:check": "bun run test:e2e:fixtures && a3s-test check tests/e2e/word-page-color.acl --json && a3s-test check tests/e2e/word-page-setup-phone.acl --json && a3s-test check tests/e2e/word-paragraph-layout-phone.acl --json && a3s-test check tests/e2e/word-list-formatting-phone.acl --json && a3s-test check tests/e2e/word-font-picker-phone.acl --json && a3s-test check tests/e2e/word-comments-drawer.acl --json && a3s-test check tests/e2e/word-comment-windowing.acl --json && a3s-test check tests/e2e/word-citations-phone.acl --json && a3s-test check tests/e2e/word-navigation-search.acl --json && a3s-test check tests/e2e/word-navigation-windowing.acl --json && a3s-test check tests/e2e/word-find-replace-phone.acl --json && a3s-test check tests/e2e/word-page-navigation.acl --json && a3s-test check tests/e2e/word-page-windowing.acl --json && a3s-test check tests/e2e/word-ai-question.acl --json && a3s-test check tests/e2e/word-picture-insert.acl --json && a3s-test check tests/e2e/word-picture-alt-text-phone.acl --json && a3s-test check tests/e2e/word-text-box-phone.acl --json && a3s-test check tests/e2e/word-content-controls-phone.acl --json && a3s-test check tests/e2e/word-track-changes-phone.acl --json && a3s-test check tests/e2e/word-formatting-revision.acl --json && a3s-test check tests/e2e/word-paragraph-formatting-revision.acl --json && a3s-test check tests/e2e/word-numbering-revision.acl --json && a3s-test check tests/e2e/word-document-comparison.acl --json && a3s-test check tests/e2e/word-review-conflict-phone.acl --json && a3s-test check tests/e2e/word-revision-windowing.acl --json && a3s-test check tests/e2e/word-table-phone.acl --json && a3s-test check tests/e2e/word-table-borders.acl --json && a3s-test check tests/e2e/word-theme-table.acl --json && a3s-test check tests/e2e/word-styled-table.acl --json && a3s-test check tests/e2e/word-multi-page-table.acl --json && a3s-test check tests/e2e/word-cross-reference-phone.acl --json && a3s-test check tests/e2e/word-bookmark-links-phone.acl --json && a3s-test check tests/e2e/word-notes-phone.acl --json && a3s-test check tests/e2e/word-fields-phone.acl --json && a3s-test check tests/e2e/spreadsheet-phone-rename.acl --json && a3s-test check tests/e2e/spreadsheet-phone-find.acl --json && a3s-test check tests/e2e/spreadsheet-phone-context-menu.acl --json && a3s-test check tests/e2e/spreadsheet-phone-task-pane.acl --json && a3s-test check tests/e2e/spreadsheet-maximum-sparse.acl --json && a3s-test check tests/e2e/spreadsheet-cell-style.acl --json && a3s-test check tests/e2e/spreadsheet-paste-special.acl --json && a3s-test check tests/e2e/spreadsheet-hyperlink.acl --json && a3s-test check tests/e2e/presentation-cut-paste-focus.acl --json && a3s-test check tests/e2e/presentation-presenter-view.acl --json && a3s-test check tests/e2e/presentation-phone-chart-pane.acl --json && a3s-test check tests/e2e/presentation-phone-comments.acl --json && a3s-test check tests/e2e/pdf-thumbnail-keyboard.acl --json && a3s-test check tests/e2e/pdf-page-drawer-phone.acl --json && a3s-test check tests/e2e/markdown-phone-modes.acl --json && a3s-test check tests/e2e/office-sidebar-breakpoint.acl --json && a3s-test check tests/e2e/office-docs-navigation.acl --json && a3s-test check tests/e2e/collaboration-playground-entry.acl --json && a3s-test check tests/e2e/collaboration-document-comments.acl --json && a3s-test check tests/e2e/collaboration-document-suggestions.acl --json && a3s-test check tests/e2e/collaboration-participants.acl --json && a3s-test check tests/e2e/collaboration-pdf-annotations.acl --json && a3s-test check tests/e2e/collaboration-spreadsheet-cells.acl --json && a3s-test check tests/e2e/collaboration-presentation-elements.acl --json",
144
145
  "test:e2e:writer-text-box": "bun run test:e2e:fixtures && A3S_TEST_SUITE=tests/e2e/word-text-box-phone.acl bash scripts/run-a3s-test-web-gate.sh",
145
146
  "test:e2e:writer-text-box:check": "a3s-test check tests/e2e/word-text-box-phone.acl --json",
147
+ "test:e2e:writer-content-control": "bun run test:e2e:fixtures && A3S_TEST_SUITE=tests/e2e/word-content-controls-phone.acl bash scripts/run-a3s-test-web-gate.sh",
148
+ "test:e2e:writer-content-control:check": "a3s-test check tests/e2e/word-content-controls-phone.acl --json",
146
149
  "test:e2e:fixtures": "bun scripts/create-e2e-fixtures.ts",
147
150
  "test:e2e:numbering-revision": "A3S_TEST_SUITE=tests/e2e/word-numbering-revision.acl bash scripts/run-a3s-test-web-gate.sh",
148
151
  "test:e2e:numbering-revision:check": "a3s-test check tests/e2e/word-numbering-revision.acl --json",