@univerjs/docs-ui 1.4.0 → 1.5.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 +7 -75
- package/lib/cjs/index.js +64 -35
- package/lib/es/index.js +64 -35
- package/lib/index.css +4 -21
- package/lib/index.js +64 -35
- package/lib/umd/index.js +12 -12
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
## Package Overview
|
|
10
10
|
|
|
11
|
-
| Package | UMD global | CSS | Locales | Facade entry |
|
|
12
|
-
| --- | --- | :---: | :---: | :---: |
|
|
13
|
-
| `@univerjs/docs-ui` | `UniverDocsUi` | Yes | Yes | Yes |
|
|
11
|
+
| Package | UMD global | CSS | Locales | Facade entry | Worker entry |
|
|
12
|
+
| --- | --- | :---: | :---: | :---: | :---: |
|
|
13
|
+
| `@univerjs/docs-ui` | `UniverDocsUi` | Yes | Yes | Yes | No |
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
@@ -20,10 +20,10 @@ pnpm add @univerjs/docs-ui
|
|
|
20
20
|
npm install @univerjs/docs-ui
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Keep all `@univerjs/*` packages on the same version.
|
|
24
|
-
|
|
25
23
|
## Usage
|
|
26
24
|
|
|
25
|
+
Start with the [integration setup](https://docs.univer.ai/) for your document type, including its required plugins, styles, and locale resources. The snippet below assumes that setup is complete.
|
|
26
|
+
|
|
27
27
|
```ts
|
|
28
28
|
import '@univerjs/docs-ui/lib/index.css';
|
|
29
29
|
import EnUS from '@univerjs/docs-ui/locale/en-US';
|
|
@@ -34,77 +34,9 @@ univer.registerPlugin(UniverDocsUIPlugin);
|
|
|
34
34
|
// Merge EnUS into your Univer locale map when this package contributes UI text.
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
The optional `IUniverDocsUIConfig.toc` setting controls the left-hand document outline for heading navigation.
|
|
40
|
-
|
|
41
|
-
| `toc` | Modern documents | Traditional documents |
|
|
42
|
-
| --- | --- | --- |
|
|
43
|
-
| Omitted | Enabled | Disabled |
|
|
44
|
-
| `true` | Enabled | Enabled |
|
|
45
|
-
| `false` | Disabled | Disabled |
|
|
46
|
-
|
|
47
|
-
Set it when registering the plugin to override the document mode's default:
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
univer.registerPlugin(UniverDocsUIPlugin, {
|
|
51
|
-
toc: false,
|
|
52
|
-
});
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Preset integrations can pass the same option to `UniverDocsCorePreset({ container: 'app', toc: false })`.
|
|
56
|
-
When enabled, the outline collapses if there is insufficient space or table content overlaps it,
|
|
57
|
-
and reopens when the layout provides enough space without overlap.
|
|
58
|
-
|
|
59
|
-
## Heading collapse
|
|
60
|
-
|
|
61
|
-
Modern documents show a Canvas triangle beside visible Heading 1 through Heading 5 paragraphs
|
|
62
|
-
that have section content. Click it to collapse or expand the section. This is independent of
|
|
63
|
-
the document outline's `toc` setting. Traditional documents and embedded text editors do not
|
|
64
|
-
show these controls.
|
|
65
|
-
|
|
66
|
-
Collapsing keeps the heading visible and hides its following section, including nested headings,
|
|
67
|
-
tables, and images. Expanding the parent retains each nested heading's own collapse state.
|
|
68
|
-
Hidden content remains in the document snapshot. Collapse changes participate in undo/redo and
|
|
69
|
-
collaboration, so other editors share the state. Selections inside hidden content move to a
|
|
70
|
-
visible heading, and caret navigation skips hidden content. Collaborative table edits and history
|
|
71
|
-
can update hidden cells without drawing a rectangular selection over that heading.
|
|
72
|
-
|
|
73
|
-
The paragraph menu leaves the Canvas arrow accessible when constrained against the canvas edge,
|
|
74
|
-
including headings resolved through inherited styles. The triangle and its tooltip are drawn on Canvas. Colors follow `ThemeService`, including
|
|
75
|
-
runtime theme changes. After a 500 ms hover, the control shows the localized “Collapse”
|
|
76
|
-
or “Expand” tooltip above it; if the viewport clips the top, the tooltip appears below.
|
|
77
|
-
Scrolling, zooming, leaving the control, or activating it clears the tooltip.
|
|
78
|
-
|
|
79
|
-
See [the snapshot and command contract](../docs/README.md#heading-collapse-in-modern-documents)
|
|
80
|
-
to change collapse state programmatically through `SetHeadingCollapsedCommand`.
|
|
81
|
-
|
|
82
|
-
## Format painter
|
|
83
|
-
|
|
84
|
-
Use the shared Start ribbon format painter to copy character formatting. Include a paragraph
|
|
85
|
-
mark in the source selection to also copy paragraph formatting and list formatting. Drag over
|
|
86
|
-
a target selection or click a word to apply. Text, paragraph identities, and embedded entities
|
|
87
|
-
are retained, and each application is undoable. The same text command serves embedded Shape
|
|
88
|
-
text editors. The source format is captured when the brush is activated.
|
|
89
|
-
The clear-formatting icon resets the selected text and paragraphs to default formatting,
|
|
90
|
-
retains their content and identities, and supports undo.
|
|
91
|
-
|
|
92
|
-
## Typing format at text boundaries
|
|
93
|
-
|
|
94
|
-
Backspace in ordinary document text retains the removed character's formatting for immediate
|
|
95
|
-
input. Forward Delete and Cut resolve formatting at the surviving caret. Replacing a text
|
|
96
|
-
selection uses its first character's format, regardless of selection direction. In table cells,
|
|
97
|
-
character-by-character Backspace resolves the surviving caret format; selection Backspace retains
|
|
98
|
-
the first selected character's format.
|
|
37
|
+
## Integration Notes
|
|
99
38
|
|
|
100
|
-
|
|
101
|
-
Formatting commands such as Bold update this input format without clearing it.
|
|
102
|
-
It is not serialized as an empty text run. Explicit `paragraphMarkTextStyle` remains authoritative
|
|
103
|
-
after repositioning or reopening; deletion does not overwrite this explicit paragraph style.
|
|
104
|
-
Modern paragraphs, including list items, retain their first character's formatting on the existing
|
|
105
|
-
paragraph-ending character when all text is deleted. This keeps empty-paragraph input and list
|
|
106
|
-
markers stable after editing elsewhere, undo/redo and reopening. Explicit list-marker and
|
|
107
|
-
paragraph-mark style overrides retain their precedence.
|
|
39
|
+
- Import `@univerjs/docs-ui/facade` when using this package through Univer Facade APIs.
|
|
108
40
|
|
|
109
41
|
## Resources
|
|
110
42
|
|
package/lib/cjs/index.js
CHANGED
|
@@ -264,7 +264,7 @@ function getCustomDecorationAtPosition(customDecorations, position) {
|
|
|
264
264
|
return customDecorations.filter((customDecoration) => position > customDecoration.startIndex && position <= customDecoration.endIndex);
|
|
265
265
|
}
|
|
266
266
|
|
|
267
|
-
// \0@oxc-project+runtime@0.
|
|
267
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/typeof.js
|
|
268
268
|
function _typeof(o) {
|
|
269
269
|
"@babel/helpers - typeof";
|
|
270
270
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -274,25 +274,25 @@ function _typeof(o) {
|
|
|
274
274
|
}, _typeof(o);
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
// \0@oxc-project+runtime@0.
|
|
278
|
-
function toPrimitive(t,
|
|
277
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPrimitive.js
|
|
278
|
+
function toPrimitive(t, e) {
|
|
279
279
|
if ("object" != _typeof(t) || !t) return t;
|
|
280
|
-
var
|
|
281
|
-
if (void 0 !==
|
|
282
|
-
var i =
|
|
280
|
+
var r;
|
|
281
|
+
if ("undefined" != typeof Symbol && void 0 !== (r = t[Symbol.toPrimitive])) {
|
|
282
|
+
var i = r.call(t, e || "default");
|
|
283
283
|
if ("object" != _typeof(i)) return i;
|
|
284
284
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
285
285
|
}
|
|
286
|
-
return ("string" ===
|
|
286
|
+
return ("string" === e ? String : Number)(t);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
// \0@oxc-project+runtime@0.
|
|
289
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/toPropertyKey.js
|
|
290
290
|
function toPropertyKey(t) {
|
|
291
291
|
var i = toPrimitive(t, "string");
|
|
292
292
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
// \0@oxc-project+runtime@0.
|
|
295
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/defineProperty.js
|
|
296
296
|
function _defineProperty(e, r, t) {
|
|
297
297
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
298
298
|
value: t,
|
|
@@ -302,14 +302,14 @@ function _defineProperty(e, r, t) {
|
|
|
302
302
|
}) : e[r] = t, e;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
// \0@oxc-project+runtime@0.
|
|
305
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorateParam.js
|
|
306
306
|
function __decorateParam(paramIndex, decorator) {
|
|
307
307
|
return function(target, key) {
|
|
308
308
|
decorator(target, key, paramIndex);
|
|
309
309
|
};
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
// \0@oxc-project+runtime@0.
|
|
312
|
+
// \0@oxc-project+runtime@0.157.0/helpers/esm/decorate.js
|
|
313
313
|
function __decorate(decorators, target, key, desc) {
|
|
314
314
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
315
315
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -21440,7 +21440,7 @@ function resolveDocsCustomBlockRenderViewport(params) {
|
|
|
21440
21440
|
|
|
21441
21441
|
// package.json
|
|
21442
21442
|
var name = "@univerjs/docs-ui";
|
|
21443
|
-
var version = "1.
|
|
21443
|
+
var version = "1.5.0";
|
|
21444
21444
|
|
|
21445
21445
|
// src/commands/commands/doc-paragraph-setting.command.ts
|
|
21446
21446
|
const DocParagraphSettingCommand = {
|
|
@@ -23055,7 +23055,7 @@ function MobileDocPasteOptions({ popup }) {
|
|
|
23055
23055
|
if (!state || state.unitId !== unitId) return null;
|
|
23056
23056
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
23057
23057
|
"aria-label": localeService.t("docs-ui.pasteOptions.title"),
|
|
23058
|
-
className: "
|
|
23058
|
+
className: "[&_svg]:! univer-min-w-11 univer-shadow-sm",
|
|
23059
23059
|
style: keyboard.visible ? {
|
|
23060
23060
|
position: "fixed",
|
|
23061
23061
|
bottom: keyboard.inset + 56,
|
|
@@ -23065,6 +23065,7 @@ function MobileDocPasteOptions({ popup }) {
|
|
|
23065
23065
|
selection === null || selection === void 0 || selection.suspendMobileEditingInput();
|
|
23066
23066
|
setOpen(true);
|
|
23067
23067
|
},
|
|
23068
|
+
size: "icon",
|
|
23068
23069
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DocPasteOptionsIcon, { "aria-hidden": "true" })
|
|
23069
23070
|
}), open && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
23070
23071
|
className: "univer-pointer-events-none univer-fixed univer-inset-x-0 univer-top-0",
|
|
@@ -23082,8 +23083,8 @@ function MobileDocPasteOptions({ popup }) {
|
|
|
23082
23083
|
className: "univer-flex univer-w-full univer-items-center univer-justify-between univer-gap-2 univer-px-4",
|
|
23083
23084
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("docs-ui.pasteOptions.title") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
23084
23085
|
variant: "text",
|
|
23085
|
-
className: "univer-min-h-11",
|
|
23086
23086
|
onClick: () => setOpen(false),
|
|
23087
|
+
size: "middle",
|
|
23087
23088
|
children: localeService.t("docs-ui.mobile.done")
|
|
23088
23089
|
})]
|
|
23089
23090
|
}),
|
|
@@ -23096,8 +23097,9 @@ function MobileDocPasteOptions({ popup }) {
|
|
|
23096
23097
|
"aria-checked": state.mode === option.value,
|
|
23097
23098
|
disabled: busy,
|
|
23098
23099
|
variant: "text",
|
|
23099
|
-
className: "
|
|
23100
|
+
className: "univer-justify-start univer-whitespace-normal univer-text-start",
|
|
23100
23101
|
onClick: () => changeMode(option.value),
|
|
23102
|
+
size: "middle",
|
|
23101
23103
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
23102
23104
|
className: "univer-inline-flex univer-size-5 univer-shrink-0 univer-items-center",
|
|
23103
23105
|
children: state.mode === option.value && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CheckMarkIcon, {})
|
|
@@ -23308,9 +23310,9 @@ function DocHeaderFooterOptionsContent({ unitId }) {
|
|
|
23308
23310
|
}) })]
|
|
23309
23311
|
}),
|
|
23310
23312
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
23311
|
-
className: "univer-mb-1 univer-
|
|
23313
|
+
className: "univer-mb-1 univer-grid univer-grid-cols-2 univer-items-end univer-gap-4",
|
|
23312
23314
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("docs-ui.headerFooter.headerTopMargin") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
23313
|
-
className: "univer-mt-1.5 univer-w-
|
|
23315
|
+
className: "univer-mt-1.5 univer-w-full",
|
|
23314
23316
|
min: 0,
|
|
23315
23317
|
max: 200,
|
|
23316
23318
|
precision: 1,
|
|
@@ -23319,7 +23321,7 @@ function DocHeaderFooterOptionsContent({ unitId }) {
|
|
|
23319
23321
|
handleMarginChange(val ?? 0, "marginHeader");
|
|
23320
23322
|
}
|
|
23321
23323
|
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("docs-ui.headerFooter.footerBottomMargin") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
23322
|
-
className: "univer-mt-1.5 univer-w-
|
|
23324
|
+
className: "univer-mt-1.5 univer-w-full",
|
|
23323
23325
|
min: 0,
|
|
23324
23326
|
max: 200,
|
|
23325
23327
|
precision: 1,
|
|
@@ -24432,13 +24434,16 @@ function MobileSettingRow({ label, unit, children }) {
|
|
|
24432
24434
|
const MobileSettingNumber = (0, react.forwardRef)((props, ref) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.InputNumber, {
|
|
24433
24435
|
...props,
|
|
24434
24436
|
ref,
|
|
24435
|
-
className: (0, _univerjs_design.clsx)(props.className, "univer-
|
|
24436
|
-
inputClassName: (0, _univerjs_design.clsx)(props.inputClassName, "
|
|
24437
|
+
className: (0, _univerjs_design.clsx)(props.className, "univer-w-full"),
|
|
24438
|
+
inputClassName: (0, _univerjs_design.clsx)(props.inputClassName, ""),
|
|
24439
|
+
size: "small",
|
|
24440
|
+
controls: false
|
|
24437
24441
|
}));
|
|
24438
24442
|
function MobileSettingSelect(props) {
|
|
24439
24443
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.MobileSelect, {
|
|
24440
24444
|
...props,
|
|
24441
|
-
className: (0, _univerjs_design.clsx)(props.className, "univer-
|
|
24445
|
+
className: (0, _univerjs_design.clsx)(props.className, "univer-w-full"),
|
|
24446
|
+
size: "small"
|
|
24442
24447
|
});
|
|
24443
24448
|
}
|
|
24444
24449
|
function MobileParagraphNumber({ min = 0, max = 100, step = .1, precision = 1, onChange, ...props }) {
|
|
@@ -24457,8 +24462,9 @@ function MobileParagraphAlignmentButton({ label, selected, onClick, children })
|
|
|
24457
24462
|
variant: "text",
|
|
24458
24463
|
"aria-label": label,
|
|
24459
24464
|
"aria-pressed": selected,
|
|
24460
|
-
className: (0, _univerjs_design.clsx)("univer-
|
|
24465
|
+
className: (0, _univerjs_design.clsx)("univer-w-full", { "!univer-bg-gray-200 dark:!univer-bg-gray-700": selected }),
|
|
24461
24466
|
onClick,
|
|
24467
|
+
size: "middle",
|
|
24462
24468
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
24463
24469
|
className: "univer-flex univer-size-5 univer-items-center univer-justify-center univer-text-lg",
|
|
24464
24470
|
children
|
|
@@ -24559,8 +24565,9 @@ function MobileHeaderFooterOptions({ unitId }) {
|
|
|
24559
24565
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
24560
24566
|
className: "univer-flex",
|
|
24561
24567
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
24562
|
-
className: "univer-
|
|
24568
|
+
className: "univer-w-full",
|
|
24563
24569
|
onClick: closeHeaderFooter,
|
|
24570
|
+
size: "middle",
|
|
24564
24571
|
children: localeService.t("docs-ui.headerFooter.closeHeaderFooter")
|
|
24565
24572
|
})
|
|
24566
24573
|
})
|
|
@@ -24879,6 +24886,7 @@ function useMobileDocEditState() {
|
|
|
24879
24886
|
const unitId = currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getUnitId();
|
|
24880
24887
|
const selectionService = unitId ? (_renderManagerService = renderManagerService.getRenderUnitById(unitId)) === null || _renderManagerService === void 0 ? void 0 : _renderManagerService.with(DocSelectionRenderService) : void 0;
|
|
24881
24888
|
return {
|
|
24889
|
+
unitId,
|
|
24882
24890
|
isEditing: (0, _univerjs_ui.useObservable)(selectionService === null || selectionService === void 0 ? void 0 : selectionService.mobileEditMode$, (selectionService === null || selectionService === void 0 ? void 0 : selectionService.isMobileEditMode) ?? false),
|
|
24883
24891
|
isReadOnly: unitId ? ((_editorService$getEdi = editorService.getEditor(unitId)) === null || _editorService$getEdi === void 0 ? void 0 : _editorService$getEdi.isReadOnly()) === true : true,
|
|
24884
24892
|
selectionService
|
|
@@ -24902,7 +24910,10 @@ function MobileDocToolbar() {
|
|
|
24902
24910
|
const menuManagerService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IMenuManagerService);
|
|
24903
24911
|
const workbenchService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IWorkbenchService);
|
|
24904
24912
|
const rootUnitType = (0, _univerjs_ui.useObservable)(workbenchService.rootUnitType$, null, true);
|
|
24905
|
-
const { isEditing, isReadOnly, selectionService } = useMobileDocEditState();
|
|
24913
|
+
const { unitId, isEditing, isReadOnly, selectionService } = useMobileDocEditState();
|
|
24914
|
+
const injector = (0, _univerjs_ui.useDependency)(_univerjs_core.Injector);
|
|
24915
|
+
const focusCoordinator = injector.has(IDocEmbedRuntimeFocusCoordinator) ? injector.get(IDocEmbedRuntimeFocusCoordinator) : void 0;
|
|
24916
|
+
const embeddedDocActive = (0, _univerjs_ui.useObservable)(() => (focusCoordinator === null || focusCoordinator === void 0 ? void 0 : focusCoordinator.runtimeSessionChanged$.pipe((0, rxjs.startWith)(void 0), (0, rxjs.map)(() => focusCoordinator.isChildUnitInActiveSession(unitId)))) ?? (0, rxjs.of)(false), (focusCoordinator === null || focusCoordinator === void 0 ? void 0 : focusCoordinator.isChildUnitInActiveSession(unitId)) ?? false, false, [focusCoordinator, unitId]);
|
|
24906
24917
|
const keyboardState = (0, _univerjs_ui.useObservable)(selectionService === null || selectionService === void 0 ? void 0 : selectionService.mobileKeyboardState$, {
|
|
24907
24918
|
visible: false,
|
|
24908
24919
|
inset: 0
|
|
@@ -24930,13 +24941,13 @@ function MobileDocToolbar() {
|
|
|
24930
24941
|
return () => subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
|
|
24931
24942
|
}, [selectionService, closeDrawer]);
|
|
24932
24943
|
const drawerSchemas = (0, react.useMemo)(() => drawer ? menuSchemas[drawer] : [], [drawer, menuSchemas]);
|
|
24933
|
-
if (rootUnitType !== _univerjs_core.UniverInstanceType.UNIVER_DOC) return null;
|
|
24944
|
+
if (rootUnitType !== _univerjs_core.UniverInstanceType.UNIVER_DOC && !embeddedDocActive) return null;
|
|
24934
24945
|
if (!isEditing) {
|
|
24935
24946
|
if (isReadOnly) return null;
|
|
24936
24947
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
24937
24948
|
type: "button",
|
|
24938
24949
|
"aria-label": localeService.t("docs-ui.mobile.edit"),
|
|
24939
|
-
className: (0, _univerjs_design.clsx)(_univerjs_design.resetButtonClassName, "univer-pointer-events-auto univer-absolute univer-bottom-4 univer-z-
|
|
24950
|
+
className: (0, _univerjs_design.clsx)(_univerjs_design.resetButtonClassName, "univer-pointer-events-auto univer-absolute univer-bottom-4 univer-z-50 univer-flex univer-size-14 univer-items-center univer-justify-center univer-rounded-full univer-bg-primary-600 univer-text-2xl univer-text-white univer-shadow-lg active:univer-scale-95 active:univer-bg-primary-700 dark:!univer-bg-primary-500 dark:active:!univer-bg-primary-600"),
|
|
24940
24951
|
style: {
|
|
24941
24952
|
insetInlineEnd: "1rem",
|
|
24942
24953
|
marginBottom: "env(safe-area-inset-bottom, 0px)"
|
|
@@ -24982,7 +24993,7 @@ function MobileDocToolbar() {
|
|
|
24982
24993
|
const quickMenuType = quickMenu === "block" ? DOC_PARAGRAPH_T_EDIT_MENU_ID : DOC_PARAGRAPH_T_ALIGN_MENU_ID;
|
|
24983
24994
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
24984
24995
|
keyboardVisible && quickMenu && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
24985
|
-
className: "univer-pointer-events-auto univer-absolute univer-inset-x-3 univer-z-
|
|
24996
|
+
className: "univer-pointer-events-auto univer-absolute univer-inset-x-3 univer-z-50 univer-overflow-hidden",
|
|
24986
24997
|
style: { bottom: `${keyboardState.inset + 48}px` },
|
|
24987
24998
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.MobileMenu, {
|
|
24988
24999
|
menuType: quickMenuType,
|
|
@@ -24991,7 +25002,7 @@ function MobileDocToolbar() {
|
|
|
24991
25002
|
})
|
|
24992
25003
|
}),
|
|
24993
25004
|
keyboardVisible && !drawer && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
24994
|
-
className: "univer-pointer-events-auto univer-absolute univer-inset-x-0 univer-z-
|
|
25005
|
+
className: "univer-pointer-events-auto univer-absolute univer-inset-x-0 univer-z-50 univer-box-border univer-flex univer-h-12 univer-items-center univer-gap-0.5 univer-border-0 univer-border-t univer-border-solid univer-border-gray-200 univer-bg-gray-0 univer-px-1 dark:!univer-border-gray-700 dark:!univer-bg-gray-800",
|
|
24995
25006
|
style: {
|
|
24996
25007
|
bottom: `${keyboardState.inset}px`,
|
|
24997
25008
|
paddingBottom: "env(safe-area-inset-bottom, 0px)"
|
|
@@ -31926,10 +31937,8 @@ function MobileRichTextToolbar({ editorId, className }) {
|
|
|
31926
31937
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
31927
31938
|
"data-u-comp": "mobile-rich-text-toolbar",
|
|
31928
31939
|
className: (0, _univerjs_design.clsx)("univer-box-border univer-bg-gray-0 univer-shadow-[0_1px_0_rgba(0,0,0,0.06)] dark:!univer-bg-gray-800", className),
|
|
31929
|
-
onPointerDown: (event) =>
|
|
31930
|
-
|
|
31931
|
-
event.stopPropagation();
|
|
31932
|
-
},
|
|
31940
|
+
onPointerDown: (event) => event.stopPropagation(),
|
|
31941
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
31933
31942
|
children: !colorsVisible ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
31934
31943
|
className: "univer-grid univer-h-11 univer-grid-cols-7 univer-gap-1 univer-px-2",
|
|
31935
31944
|
children: [
|
|
@@ -32019,7 +32028,7 @@ function MobileRichTextToolbar({ editorId, className }) {
|
|
|
32019
32028
|
variant: "text",
|
|
32020
32029
|
size: "icon",
|
|
32021
32030
|
"aria-label": localeService.t("docs-ui.toolbar.textColor.main"),
|
|
32022
|
-
className: "univer-
|
|
32031
|
+
className: "univer-justify-self-center",
|
|
32023
32032
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.ColorWheelMultiIcon, { className: "!univer-size-6" })
|
|
32024
32033
|
})
|
|
32025
32034
|
})
|
|
@@ -32390,6 +32399,8 @@ function useOnChange(editor, onChange) {
|
|
|
32390
32399
|
function resizeEditor(editor, isSingle, layoutSize, pixelRatio, documentLayoutSize) {
|
|
32391
32400
|
var _editor$render$compon;
|
|
32392
32401
|
if (editor.render.isDisposed()) return;
|
|
32402
|
+
const selection = editor.docSelectionRenderService;
|
|
32403
|
+
const restoreSelection = selection.isFocusing || selection.getAllTextRanges().length > 0 || selection.getAllRectRanges().length > 0;
|
|
32393
32404
|
const { scene, mainComponent } = editor.render;
|
|
32394
32405
|
const docSkeletonManagerService = editor.render.with(_univerjs_docs.DocSkeletonManagerService);
|
|
32395
32406
|
const { width, height } = layoutSize ?? editor.getBoundingClientRect();
|
|
@@ -32405,7 +32416,7 @@ function resizeEditor(editor, isSingle, layoutSize, pixelRatio, documentLayoutSi
|
|
|
32405
32416
|
mainComponent === null || mainComponent === void 0 || mainComponent.translate(0, 0);
|
|
32406
32417
|
(_editor$render$compon = editor.render.components.get("__Document_Render_Background__")) === null || _editor$render$compon === void 0 || _editor$render$compon.translate(0, 0);
|
|
32407
32418
|
const selectionRanges = editor.getSelectionRanges();
|
|
32408
|
-
if (selectionRanges.length > 0) editor.setSelectionRanges(selectionRanges, false);
|
|
32419
|
+
if (restoreSelection && selectionRanges.length > 0) editor.setSelectionRanges(selectionRanges, false);
|
|
32409
32420
|
}
|
|
32410
32421
|
const useResize = (editor, isSingle = true, autoScrollbar, autoScroll, layoutSize, pixelRatio, documentLayoutSize) => {
|
|
32411
32422
|
const resize = (0, react.useCallback)(() => {
|
|
@@ -32663,6 +32674,21 @@ const RichTextEditor = (props) => {
|
|
|
32663
32674
|
};
|
|
32664
32675
|
|
|
32665
32676
|
// src/views/mobile-rich-text-editor/MobileRichTextEditor.tsx
|
|
32677
|
+
/**
|
|
32678
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
32679
|
+
*
|
|
32680
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
32681
|
+
* you may not use this file except in compliance with the License.
|
|
32682
|
+
* You may obtain a copy of the License at
|
|
32683
|
+
*
|
|
32684
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
32685
|
+
*
|
|
32686
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
32687
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
32688
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
32689
|
+
* See the License for the specific language governing permissions and
|
|
32690
|
+
* limitations under the License.
|
|
32691
|
+
*/
|
|
32666
32692
|
/** Compact object text input; expanding keeps the same document editor mounted. */
|
|
32667
32693
|
function MobileRichTextEditor(props) {
|
|
32668
32694
|
var _props$canvasStyle;
|
|
@@ -32687,7 +32713,7 @@ function MobileRichTextEditor(props) {
|
|
|
32687
32713
|
if (keyboardWasVisibleRef.current && !visible) confirmOnDismiss();
|
|
32688
32714
|
keyboardWasVisibleRef.current = visible;
|
|
32689
32715
|
}, [confirmOnDismiss, keyboardInset]);
|
|
32690
|
-
const buttonClassName = (0, _univerjs_design.clsx)("univer-
|
|
32716
|
+
const buttonClassName = (0, _univerjs_design.clsx)("univer-shrink-0", expanded ? "univer-flex-1" : "univer-w-10");
|
|
32691
32717
|
const expandButton = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
32692
32718
|
variant: "ghost",
|
|
32693
32719
|
className: buttonClassName,
|
|
@@ -32695,6 +32721,7 @@ function MobileRichTextEditor(props) {
|
|
|
32695
32721
|
"aria-expanded": expanded,
|
|
32696
32722
|
onPointerDown: (event) => event.preventDefault(),
|
|
32697
32723
|
onClick: () => onExpandedChange(!expanded),
|
|
32724
|
+
size: "middle",
|
|
32698
32725
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DownIcon, { className: (0, _univerjs_design.clsx)("univer-size-5", !expanded && "univer-rotate-180") })
|
|
32699
32726
|
});
|
|
32700
32727
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
@@ -32734,6 +32761,7 @@ function MobileRichTextEditor(props) {
|
|
|
32734
32761
|
"aria-label": labels.cancel,
|
|
32735
32762
|
onPointerDown: (event) => event.preventDefault(),
|
|
32736
32763
|
onClick: onCancel,
|
|
32764
|
+
size: "middle",
|
|
32737
32765
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CloseIcon, {})
|
|
32738
32766
|
}),
|
|
32739
32767
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
@@ -32742,6 +32770,7 @@ function MobileRichTextEditor(props) {
|
|
|
32742
32770
|
"aria-label": labels.confirm,
|
|
32743
32771
|
onPointerDown: (event) => event.preventDefault(),
|
|
32744
32772
|
onClick: onConfirm,
|
|
32773
|
+
size: "middle",
|
|
32745
32774
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CheckMarkIcon, {})
|
|
32746
32775
|
}),
|
|
32747
32776
|
expanded && expandButton
|