@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.
- package/README.md +17 -0
- package/dist/{0~2133.js → 0~3320.js} +446 -24
- package/dist/{0~4042.js → 0~3534.js} +510 -4
- package/dist/0~document-editor.js +263 -3
- package/dist/0~work-docx-export.js +416 -668
- package/dist/0~work-docx-import.js +15 -4
- package/dist/0~work-office-diagnostics.js +5 -2
- package/dist/4174.js +5113 -4750
- package/dist/internal/features/work/editors/document-command-catalog.d.ts +9 -0
- package/dist/internal/features/work/editors/document-content-control-dialog.d.ts +10 -0
- package/dist/internal/features/work/editors/document-toolbar.d.ts +2 -1
- package/dist/internal/features/work/editors/use-document-insert-commands.d.ts +1 -0
- package/dist/internal/features/work/work-document-content-control.d.ts +59 -0
- package/dist/internal/features/work/work-docx-content-control-export.d.ts +24 -0
- package/dist/internal/features/work/work-docx-content-control-import.d.ts +28 -0
- package/dist/internal/features/work/work-docx-import.d.ts +3 -1
- package/dist/styles.css +125 -0
- package/package.json +6 -3
|
@@ -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
|
@@ -12938,6 +12938,131 @@ sub [data-office-character-position-half-points], sup [data-office-character-pos
|
|
|
12938
12938
|
padding: 0;
|
|
12939
12939
|
}
|
|
12940
12940
|
|
|
12941
|
+
.work-document-content-control {
|
|
12942
|
+
--work-document-content-control-color: var(--a3s-accent);
|
|
12943
|
+
--work-document-content-control-appearance: boundingBox;
|
|
12944
|
+
border: 1px solid
|
|
12945
|
+
color-mix(in srgb,
|
|
12946
|
+
var(--work-document-content-control-color) 62%,
|
|
12947
|
+
transparent);
|
|
12948
|
+
background: color-mix(in srgb,
|
|
12949
|
+
var(--work-document-content-control-color) 8%,
|
|
12950
|
+
transparent);
|
|
12951
|
+
-webkit-box-decoration-break: clone;
|
|
12952
|
+
box-decoration-break: clone;
|
|
12953
|
+
border-radius: 3px;
|
|
12954
|
+
min-width: 1.25em;
|
|
12955
|
+
padding: 0 .18em;
|
|
12956
|
+
transition: background-color .12s, border-color .12s;
|
|
12957
|
+
display: inline-block;
|
|
12958
|
+
position: relative;
|
|
12959
|
+
}
|
|
12960
|
+
|
|
12961
|
+
.work-document-content-control:hover, .work-document-content-control.ProseMirror-selectednode {
|
|
12962
|
+
border-color: var(--work-document-content-control-color);
|
|
12963
|
+
background: color-mix(in srgb,
|
|
12964
|
+
var(--work-document-content-control-color) 14%,
|
|
12965
|
+
transparent);
|
|
12966
|
+
}
|
|
12967
|
+
|
|
12968
|
+
.work-document-content-control[data-content-control-appearance="hidden"] {
|
|
12969
|
+
background: none;
|
|
12970
|
+
border-color: #0000;
|
|
12971
|
+
}
|
|
12972
|
+
|
|
12973
|
+
.work-document-content-control[data-content-control-appearance="tags"]:before {
|
|
12974
|
+
content: attr(data-content-control-label);
|
|
12975
|
+
max-width: 18em;
|
|
12976
|
+
color: var(--work-document-content-control-color);
|
|
12977
|
+
white-space: nowrap;
|
|
12978
|
+
pointer-events: none;
|
|
12979
|
+
font-size: .68em;
|
|
12980
|
+
line-height: 1;
|
|
12981
|
+
position: absolute;
|
|
12982
|
+
top: -1.1em;
|
|
12983
|
+
left: -1px;
|
|
12984
|
+
overflow: hidden;
|
|
12985
|
+
}
|
|
12986
|
+
|
|
12987
|
+
.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"] {
|
|
12988
|
+
background: color-mix(in srgb,
|
|
12989
|
+
var(--work-document-content-control-color) 5%,
|
|
12990
|
+
transparent);
|
|
12991
|
+
}
|
|
12992
|
+
|
|
12993
|
+
.work-document-content-control:empty:after {
|
|
12994
|
+
content: "输入内容";
|
|
12995
|
+
color: color-mix(in srgb, currentColor 48%, transparent);
|
|
12996
|
+
pointer-events: none;
|
|
12997
|
+
}
|
|
12998
|
+
|
|
12999
|
+
.work-document-content-control[contenteditable="false"] {
|
|
13000
|
+
cursor: not-allowed;
|
|
13001
|
+
}
|
|
13002
|
+
|
|
13003
|
+
@media print {
|
|
13004
|
+
.work-document-content-control {
|
|
13005
|
+
background: none;
|
|
13006
|
+
border-color: #0000;
|
|
13007
|
+
}
|
|
13008
|
+
|
|
13009
|
+
.work-document-content-control[data-content-control-appearance="tags"]:before {
|
|
13010
|
+
display: none;
|
|
13011
|
+
}
|
|
13012
|
+
}
|
|
13013
|
+
|
|
13014
|
+
.work-document-content-control-dialog-fields, .work-document-content-control-dialog-selects, .work-document-content-control-dialog-options {
|
|
13015
|
+
gap: 12px;
|
|
13016
|
+
display: grid;
|
|
13017
|
+
}
|
|
13018
|
+
|
|
13019
|
+
.work-document-content-control-dialog-fields, .work-document-content-control-dialog-selects {
|
|
13020
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
13021
|
+
}
|
|
13022
|
+
|
|
13023
|
+
.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 {
|
|
13024
|
+
color: var(--a3s-text-muted);
|
|
13025
|
+
gap: 5px;
|
|
13026
|
+
font-size: 12px;
|
|
13027
|
+
display: grid;
|
|
13028
|
+
}
|
|
13029
|
+
|
|
13030
|
+
.work-document-content-control-dialog-options {
|
|
13031
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
13032
|
+
align-items: center;
|
|
13033
|
+
margin-top: 12px;
|
|
13034
|
+
}
|
|
13035
|
+
|
|
13036
|
+
.work-document-content-control-color {
|
|
13037
|
+
grid-template-columns: auto auto 1fr;
|
|
13038
|
+
align-items: center;
|
|
13039
|
+
}
|
|
13040
|
+
|
|
13041
|
+
.work-document-content-control-color input[type="color"] {
|
|
13042
|
+
border: 1px solid var(--a3s-line);
|
|
13043
|
+
background: none;
|
|
13044
|
+
border-radius: 5px;
|
|
13045
|
+
width: 28px;
|
|
13046
|
+
height: 28px;
|
|
13047
|
+
padding: 2px;
|
|
13048
|
+
}
|
|
13049
|
+
|
|
13050
|
+
.work-document-content-control-color-reset {
|
|
13051
|
+
color: var(--a3s-accent);
|
|
13052
|
+
cursor: pointer;
|
|
13053
|
+
font: inherit;
|
|
13054
|
+
background: none;
|
|
13055
|
+
border: 0;
|
|
13056
|
+
justify-self: start;
|
|
13057
|
+
font-size: 11px;
|
|
13058
|
+
}
|
|
13059
|
+
|
|
13060
|
+
@media (width <= 640px) {
|
|
13061
|
+
.work-document-content-control-dialog-fields, .work-document-content-control-dialog-selects, .work-document-content-control-dialog-options {
|
|
13062
|
+
grid-template-columns: minmax(0, 1fr);
|
|
13063
|
+
}
|
|
13064
|
+
}
|
|
13065
|
+
|
|
12941
13066
|
.work-document-table-of-contents {
|
|
12942
13067
|
box-sizing: border-box;
|
|
12943
13068
|
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.
|
|
3
|
+
"version": "0.48.0",
|
|
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",
|