@univerjs/docs-ui 0.3.0 → 0.4.0-alpha.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/lib/cjs/index.js +7 -6
- package/lib/es/index.js +303 -127
- package/lib/locale/fa-IR.json +81 -0
- package/lib/types/commands/commands/__tests__/create-command-test-bed.d.ts +2 -2
- package/lib/types/commands/commands/replace-content.command.d.ts +14 -1
- package/lib/types/components/editor/TextEditor.d.ts +2 -2
- package/lib/types/components/editor/utils.d.ts +7 -0
- package/lib/types/components/range-selector/RangeSelector.d.ts +2 -2
- package/lib/types/controllers/config.schema.d.ts +1 -1
- package/lib/types/controllers/doc-header-footer.controller.d.ts +2 -2
- package/lib/types/controllers/render-controllers/back-scroll.render-controller.d.ts +2 -2
- package/lib/types/controllers/render-controllers/doc-clipboard.controller.d.ts +4 -2
- package/lib/types/controllers/render-controllers/doc-editor-bridge.controller.d.ts +2 -2
- package/lib/types/controllers/render-controllers/doc-resize.render-controller.d.ts +1 -1
- package/lib/types/controllers/render-controllers/doc.render-controller.d.ts +2 -2
- package/lib/types/docs-ui-plugin.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/locale/fa-IR.d.ts +3 -0
- package/lib/types/services/clipboard/clipboard.service.d.ts +1 -1
- package/lib/types/services/doc-state-change-manager.service.d.ts +1 -1
- package/lib/types/services/editor/editor-manager.service.d.ts +14 -4
- package/lib/types/services/editor/editor.d.ts +30 -18
- package/lib/types/services/selection/convert-rect-range.d.ts +1 -1
- package/lib/types/services/selection/doc-selection-render.service.d.ts +4 -2
- package/lib/types/services/selection/rect-range.d.ts +1 -1
- package/lib/types/services/selection/selection-utils.d.ts +2 -2
- package/lib/umd/index.js +7 -6
- package/package.json +18 -19
package/lib/es/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
|
|
5
|
-
import { Inject, Disposable, toDisposable, UniverInstanceType, BuildTextUtils, IUniverInstanceService, TextX, JSONX, TextXActionType, getBodySlice, Tools, UpdateDocsAttributeType, ObjectRelativeFromH, ObjectRelativeFromV, CommandType, ICommandService, IUndoRedoService, DOC_RANGE_TYPE, RANGE_DIRECTION, COLORS, BooleanNumber, Rectangle, RxDisposable, DataStreamTreeTokenType, ILogService, DEFAULT_STYLES, createIdentifier, EDITOR_ACTIVATED, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FOCUSING_EDITOR_INPUT_FORMULA, DEFAULT_EMPTY_DOCUMENT_VALUE, VerticalAlign, HorizontalAlign, IContextService, useDependency, LocaleService, isInternalEditorID, debounce,
|
|
5
|
+
import { Inject, Disposable, toDisposable, UniverInstanceType, BuildTextUtils, IUniverInstanceService, TextX, JSONX, TextXActionType, getBodySlice, Tools, UpdateDocsAttributeType, ObjectRelativeFromH, ObjectRelativeFromV, CommandType, ICommandService, IUndoRedoService, DOC_RANGE_TYPE, RANGE_DIRECTION, COLORS, BooleanNumber, Rectangle, RxDisposable, DataStreamTreeTokenType, ILogService, DEFAULT_STYLES, createIdentifier, EDITOR_ACTIVATED, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, FOCUSING_EDITOR_INPUT_FORMULA, DEFAULT_EMPTY_DOCUMENT_VALUE, VerticalAlign, HorizontalAlign, IContextService, DocumentFlavor, useDependency, LocaleService, isInternalEditorID, debounce, PresetListType, sequenceExecuteAsync, FOCUSING_DOC, FOCUSING_UNIVER_EDITOR, FOCUSING_COMMON_DRAWINGS, MemoryCursor, BaselineOffset, PRESET_LIST_TYPE, GridType, sortRulesFactory, useObservable, TableCellHeightRule, TableSizeType, generateRandomId, TableAlignmentType, TableTextWrapType, PositionedObjectLayoutType, getCustomRangeSlice, getCustomDecorationSlice, LRUMap, ColorKit, skipParseTagNames, CustomRangeType, DataStreamTreeNodeType, SliceBodyType, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, normalizeBody, updateAttributeByInsert, SpacingRule, ThemeService, Injector, connectInjector, IConfigService, QuickListTypeMap, Direction, DisposableCollection, fromEventSubject, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, checkForSubstrings, UndoCommandId, RedoCommandId, DependentOn, Plugin, touchDependencies, mergeOverrideWithDependencies } from "@univerjs/core";
|
|
6
6
|
import { DocSelectionManagerService, RichTextEditingMutation, DocSkeletonManagerService, SetTextSelectionsOperation, DocStateEmitService, DocInterceptorService } from "@univerjs/docs";
|
|
7
7
|
import { IRenderManagerService, Liquid, GlyphType, DocumentSkeletonPageType, getPageFromPath, getTableIdAndSliceIndex, NORMAL_TEXT_SELECTION_PLUGIN_STYLE, getColor, RegularPolygon, Rect, getOffsetRectForDom, ScrollTimer, CURSOR_TYPE, getSystemHighlightColor, Vector2, PageLayoutType, DocumentEditArea, Shape, Path, getCharSpaceApply, getNumberUnitValue, hasListGlyph, isIndentByGlyph, isFirstGlyph, getParagraphByGlyph, pixelToPt, ptToPixel, parseDataStreamToTree, Viewport, ScrollBar, Layer, Documents, DocBackground, lineIterator, getLastLine, pxToNum, TRANSFORM_CHANGE_OBSERVABLE_TYPE, UniverRenderEnginePlugin } from "@univerjs/engine-render";
|
|
8
8
|
import * as require$$0 from "react";
|
|
@@ -321,10 +321,11 @@ function addCustomRangeBySelectionFactory(accessor, param) {
|
|
|
321
321
|
}
|
|
322
322
|
__name(addCustomRangeBySelectionFactory, "addCustomRangeBySelectionFactory");
|
|
323
323
|
function deleteCustomRangeFactory(accessor, params) {
|
|
324
|
-
|
|
324
|
+
var _a28;
|
|
325
|
+
const { unitId, segmentId, insert } = params, univerInstanceService = accessor.get(IUniverInstanceService), selection = (_a28 = accessor.get(DocSelectionManagerService).getTextRanges({ unitId, subUnitId: unitId })) == null ? void 0 : _a28[0], documentDataModel = univerInstanceService.getUnit(unitId);
|
|
325
326
|
if (!documentDataModel)
|
|
326
327
|
return !1;
|
|
327
|
-
const doMutation = {
|
|
328
|
+
const textRange = selection != null && selection.collapsed ? { index: selection.startOffset } : void 0, doMutation = {
|
|
328
329
|
id: RichTextEditingMutation.id,
|
|
329
330
|
params: {
|
|
330
331
|
unitId: params.unitId,
|
|
@@ -336,12 +337,13 @@ function deleteCustomRangeFactory(accessor, params) {
|
|
|
336
337
|
documentDataModel,
|
|
337
338
|
rangeId: params.rangeId,
|
|
338
339
|
insert,
|
|
339
|
-
segmentId
|
|
340
|
+
segmentId,
|
|
341
|
+
textRange
|
|
340
342
|
});
|
|
341
343
|
if (!textX)
|
|
342
344
|
return !1;
|
|
343
345
|
const path = getRichTextEditPath(documentDataModel, segmentId);
|
|
344
|
-
return doMutation.params.actions = jsonX.editOp(textX.serialize(), path), doMutation;
|
|
346
|
+
return doMutation.params.actions = jsonX.editOp(textX.serialize(), path), doMutation.params.textRanges = textRange ? [{ startOffset: textRange.index, endOffset: textRange.index, collapsed: !0 }] : void 0, doMutation;
|
|
345
347
|
}
|
|
346
348
|
__name(deleteCustomRangeFactory, "deleteCustomRangeFactory");
|
|
347
349
|
function hasParagraphInTable(paragraph, tables) {
|
|
@@ -445,15 +447,82 @@ function isElementVisible(element2) {
|
|
|
445
447
|
return !(rect.width === 0 || rect.height === 0 || rect.bottom < 0 || rect.top > window.innerHeight || rect.right < 0 || rect.left > window.innerWidth);
|
|
446
448
|
}
|
|
447
449
|
__name(isElementVisible, "isElementVisible");
|
|
448
|
-
const
|
|
450
|
+
const ReplaceSnapshotCommand = {
|
|
451
|
+
id: "doc.command-replace-snapshot",
|
|
452
|
+
type: CommandType.COMMAND,
|
|
453
|
+
// eslint-disable-next-line max-lines-per-function, complexity
|
|
454
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
455
|
+
const { unitId, snapshot, textRanges, segmentId = "", options } = params, univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService), docSelectionManagerService = accessor.get(DocSelectionManagerService), docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC), prevSnapshot = docDataModel == null ? void 0 : docDataModel.getSelfOrHeaderFooterModel(segmentId).getSnapshot();
|
|
456
|
+
if (docDataModel == null || prevSnapshot == null)
|
|
457
|
+
return !1;
|
|
458
|
+
const { body, tableSource, footers, headers, lists, drawings, drawingsOrder } = snapshot, {
|
|
459
|
+
body: prevBody,
|
|
460
|
+
tableSource: prevTableSource,
|
|
461
|
+
footers: prevFooters,
|
|
462
|
+
headers: prevHeaders,
|
|
463
|
+
lists: prevLists,
|
|
464
|
+
drawings: prevDrawings,
|
|
465
|
+
drawingsOrder: prevDrawingsOrder
|
|
466
|
+
} = prevSnapshot;
|
|
467
|
+
if (body == null || prevBody == null)
|
|
468
|
+
return !1;
|
|
469
|
+
if (Tools.diffValue(body, prevBody) && textRanges)
|
|
470
|
+
return docSelectionManagerService.replaceDocRanges(textRanges, {
|
|
471
|
+
unitId,
|
|
472
|
+
subUnitId: unitId
|
|
473
|
+
}, !1), !0;
|
|
474
|
+
const doMutation = {
|
|
475
|
+
id: RichTextEditingMutation.id,
|
|
476
|
+
params: {
|
|
477
|
+
unitId,
|
|
478
|
+
actions: [],
|
|
479
|
+
textRanges
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
options && (doMutation.params.options = options);
|
|
483
|
+
const rawActions = [], jsonX = JSONX.getInstance();
|
|
484
|
+
if (!Tools.diffValue(body, prevBody)) {
|
|
485
|
+
const actions = jsonX.replaceOp(["body"], prevBody, body);
|
|
486
|
+
actions != null && rawActions.push(actions);
|
|
487
|
+
}
|
|
488
|
+
if (!Tools.diffValue(tableSource, prevTableSource)) {
|
|
489
|
+
const actions = jsonX.replaceOp(["tableSource"], prevTableSource, tableSource);
|
|
490
|
+
actions != null && rawActions.push(actions);
|
|
491
|
+
}
|
|
492
|
+
if (!Tools.diffValue(footers, prevFooters)) {
|
|
493
|
+
const actions = jsonX.replaceOp(["footers"], prevFooters, footers);
|
|
494
|
+
actions != null && rawActions.push(actions);
|
|
495
|
+
}
|
|
496
|
+
if (!Tools.diffValue(headers, prevHeaders)) {
|
|
497
|
+
const actions = jsonX.replaceOp(["headers"], prevHeaders, headers);
|
|
498
|
+
actions != null && rawActions.push(actions);
|
|
499
|
+
}
|
|
500
|
+
if (!Tools.diffValue(lists, prevLists)) {
|
|
501
|
+
const actions = jsonX.replaceOp(["lists"], prevLists, lists);
|
|
502
|
+
actions != null && rawActions.push(actions);
|
|
503
|
+
}
|
|
504
|
+
if (!Tools.diffValue(drawings, prevDrawings)) {
|
|
505
|
+
const actions = jsonX.replaceOp(["drawings"], prevDrawings, drawings);
|
|
506
|
+
actions != null && rawActions.push(actions);
|
|
507
|
+
}
|
|
508
|
+
if (!Tools.diffValue(drawingsOrder, prevDrawingsOrder)) {
|
|
509
|
+
const actions = jsonX.replaceOp(["drawingsOrder"], prevDrawingsOrder, drawingsOrder);
|
|
510
|
+
actions != null && rawActions.push(actions);
|
|
511
|
+
}
|
|
512
|
+
return doMutation.params.actions = rawActions.reduce((acc, cur) => JSONX.compose(acc, cur), null), !!commandService.syncExecuteCommand(doMutation.id, doMutation.params);
|
|
513
|
+
}, "handler")
|
|
514
|
+
}, ReplaceContentCommand = {
|
|
449
515
|
id: "doc.command-replace-content",
|
|
450
516
|
type: CommandType.COMMAND,
|
|
451
517
|
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
452
|
-
const { unitId, body, textRanges, segmentId = "", options } = params, univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService), docSelectionManagerService = accessor.get(DocSelectionManagerService), docDataModel = univerInstanceService.
|
|
453
|
-
if (docDataModel == null || prevBody == null
|
|
518
|
+
const { unitId, body, textRanges, segmentId = "", options } = params, univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService), docSelectionManagerService = accessor.get(DocSelectionManagerService), docDataModel = univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_DOC), prevBody = docDataModel == null ? void 0 : docDataModel.getSelfOrHeaderFooterModel(segmentId).getSnapshot().body;
|
|
519
|
+
if (docDataModel == null || prevBody == null)
|
|
454
520
|
return !1;
|
|
455
521
|
const doMutation = getMutationParams(unitId, segmentId, docDataModel, prevBody, body);
|
|
456
|
-
return doMutation.params.textRanges = textRanges, options && (doMutation.params.options = options),
|
|
522
|
+
return doMutation.params.textRanges = textRanges, options && (doMutation.params.options = options), doMutation.params.actions == null && textRanges ? (docSelectionManagerService.replaceDocRanges(textRanges, {
|
|
523
|
+
unitId,
|
|
524
|
+
subUnitId: unitId
|
|
525
|
+
}, !1), !0) : !!commandService.syncExecuteCommand(doMutation.id, doMutation.params);
|
|
457
526
|
}, "handler")
|
|
458
527
|
}, CoverContentCommand = {
|
|
459
528
|
id: "doc.command-cover-content",
|
|
@@ -469,15 +538,8 @@ const ReplaceContentCommand = {
|
|
|
469
538
|
), undoRedoService.clearUndoRedo(unitId), !0;
|
|
470
539
|
}, "handler")
|
|
471
540
|
};
|
|
472
|
-
function
|
|
473
|
-
const
|
|
474
|
-
id: RichTextEditingMutation.id,
|
|
475
|
-
params: {
|
|
476
|
-
unitId,
|
|
477
|
-
actions: [],
|
|
478
|
-
textRanges: []
|
|
479
|
-
}
|
|
480
|
-
}, textX = new TextX(), jsonX = JSONX.getInstance(), deleteLen = (prevBody == null ? void 0 : prevBody.dataStream.length) - 2;
|
|
541
|
+
function getMutationActions(segmentId, docDatModel, prevBody, body) {
|
|
542
|
+
const textX = new TextX(), jsonX = JSONX.getInstance(), deleteLen = (prevBody == null ? void 0 : prevBody.dataStream.length) - 2;
|
|
481
543
|
deleteLen > 0 && textX.push({
|
|
482
544
|
t: TextXActionType.DELETE,
|
|
483
545
|
len: deleteLen,
|
|
@@ -491,7 +553,19 @@ function getMutationParams(unitId, segmentId, docDatModel, prevBody, body) {
|
|
|
491
553
|
segmentId
|
|
492
554
|
});
|
|
493
555
|
const path = getRichTextEditPath(docDatModel, segmentId);
|
|
494
|
-
return
|
|
556
|
+
return jsonX.editOp(textX.serialize(), path);
|
|
557
|
+
}
|
|
558
|
+
__name(getMutationActions, "getMutationActions");
|
|
559
|
+
function getMutationParams(unitId, segmentId, docDatModel, prevBody, body) {
|
|
560
|
+
const doMutation = {
|
|
561
|
+
id: RichTextEditingMutation.id,
|
|
562
|
+
params: {
|
|
563
|
+
unitId,
|
|
564
|
+
actions: [],
|
|
565
|
+
textRanges: []
|
|
566
|
+
}
|
|
567
|
+
}, actions = getMutationActions(segmentId, docDatModel, prevBody, body);
|
|
568
|
+
return doMutation.params.actions = actions, doMutation;
|
|
495
569
|
}
|
|
496
570
|
__name(getMutationParams, "getMutationParams");
|
|
497
571
|
CommandType.COMMAND;
|
|
@@ -917,14 +991,16 @@ const _NodePositionConvertToRectRange = class _NodePositionConvertToRectRange {
|
|
|
917
991
|
}
|
|
918
992
|
if (tables.length === 0)
|
|
919
993
|
return;
|
|
920
|
-
const totalColumns = tables[0].rows[0].cells.length;
|
|
921
|
-
if (startColumnIndex === 0 && endColumnIndex === totalColumns - 1)
|
|
922
|
-
return nodePositionGroup.push({
|
|
923
|
-
anchor: anchorNodePosition,
|
|
924
|
-
focus: focusNodePosition
|
|
925
|
-
}), nodePositionGroup;
|
|
926
994
|
for (const table of tables)
|
|
927
995
|
this._collectPositionGroup(table, nodePositionGroup, startRowIndex, endRowIndex, startColumnIndex, endColumnIndex, segmentPage, compare);
|
|
996
|
+
const totalColumns = tables[0].rows[0].cells.length;
|
|
997
|
+
if (startColumnIndex === 0 && endColumnIndex === totalColumns - 1) {
|
|
998
|
+
const firstPosition = nodePositionGroup[0], lastPosition = nodePositionGroup[nodePositionGroup.length - 1];
|
|
999
|
+
nodePositionGroup.length = 0, nodePositionGroup.push({
|
|
1000
|
+
anchor: compare ? firstPosition.anchor : lastPosition.anchor,
|
|
1001
|
+
focus: compare ? lastPosition.focus : firstPosition.focus
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
928
1004
|
return nodePositionGroup;
|
|
929
1005
|
}
|
|
930
1006
|
_collectPositionGroup(table, nodePositionGroup, startRowIndex, endRowIndex, startColumnIndex, endColumnIndex, segmentPage, compare) {
|
|
@@ -1705,7 +1781,7 @@ let DocSelectionRenderService = (_a2 = class extends RxDisposable {
|
|
|
1705
1781
|
* @deprecated
|
|
1706
1782
|
*/
|
|
1707
1783
|
activate(x, y, force = !1) {
|
|
1708
|
-
const isFocusing = this._input === document.activeElement;
|
|
1784
|
+
const isFocusing = this._input === document.activeElement || document.activeElement === document.body || document.activeElement === null;
|
|
1709
1785
|
this._container.style.left = `${x}px`, this._container.style.top = `${y}px`, this._container.style.zIndex = "1000", (isFocusing || force) && this.focus();
|
|
1710
1786
|
}
|
|
1711
1787
|
hasFocus() {
|
|
@@ -1811,7 +1887,7 @@ let DocSelectionRenderService = (_a2 = class extends RxDisposable {
|
|
|
1811
1887
|
return;
|
|
1812
1888
|
}
|
|
1813
1889
|
const { segmentId, segmentPage } = startNode;
|
|
1814
|
-
segmentId && this._currentSegmentId && segmentId !== this._currentSegmentId && this.setSegment(segmentId), segmentId && segmentPage !== this._currentSegmentPage && this.setSegmentPage(segmentPage), this._anchorNodePosition = position, evt.shiftKey && this._getActiveRangeInstance() ? this._updateActiveRangePosition(position) :
|
|
1890
|
+
segmentId && this._currentSegmentId && segmentId !== this._currentSegmentId && this.setSegment(segmentId), segmentId && segmentPage !== this._currentSegmentPage && this.setSegmentPage(segmentPage), this._anchorNodePosition = position, evt.shiftKey && this._getActiveRangeInstance() ? this._updateActiveRangePosition(position) : evt.ctrlKey ? this._removeAllCollapsedTextRanges() : this._isEmpty() || this._removeAllRanges(), scene.disableObjectsEvent();
|
|
1815
1891
|
const scrollTimer = ScrollTimer.create(scene);
|
|
1816
1892
|
this._scrollTimers.push(scrollTimer), scrollTimer.startScroll(evtOffsetX, evtOffsetY), this._onSelectionStart$.next((_a28 = this._getActiveRangeInstance()) == null ? void 0 : _a28.startNodePosition), (_b2 = scene.getTransformer()) == null || _b2.clearSelectedObjects();
|
|
1817
1893
|
let preMoveOffsetX = evtOffsetX, preMoveOffsetY = evtOffsetY;
|
|
@@ -1824,11 +1900,15 @@ let DocSelectionRenderService = (_a2 = class extends RxDisposable {
|
|
|
1824
1900
|
if ([...this._scenePointerMoveSubs, ...this._scenePointerUpSubs].forEach((e) => {
|
|
1825
1901
|
e.unsubscribe();
|
|
1826
1902
|
}), scene.enableObjectsEvent(), this._anchorNodePosition && !this._focusNodePosition) {
|
|
1903
|
+
if (evt.ctrlKey) {
|
|
1904
|
+
this._disposeScrollTimers();
|
|
1905
|
+
return;
|
|
1906
|
+
}
|
|
1827
1907
|
const textRange = new TextRange(scene, mainComponent, skeleton, this._anchorNodePosition, void 0, this._selectionStyle, this._currentSegmentId, this._currentSegmentPage);
|
|
1828
1908
|
this._addTextRange(textRange);
|
|
1829
1909
|
} else if (this._anchorNodePosition && this._focusNodePosition) {
|
|
1830
1910
|
for (const textRange of this._rangeListCache)
|
|
1831
|
-
this._addTextRange(textRange);
|
|
1911
|
+
evt.ctrlKey ? textRange.collapsed ? textRange.dispose() : this._addTextRange(textRange) : this._addTextRange(textRange);
|
|
1832
1912
|
this._addRectRanges(this._rectRangeListCache), this._rangeListCache = [], this._rectRangeListCache = [];
|
|
1833
1913
|
}
|
|
1834
1914
|
this._anchorNodePosition = null, this._focusNodePosition = null;
|
|
@@ -1840,9 +1920,7 @@ let DocSelectionRenderService = (_a2 = class extends RxDisposable {
|
|
|
1840
1920
|
style: this._selectionStyle,
|
|
1841
1921
|
isEditing: !1
|
|
1842
1922
|
};
|
|
1843
|
-
this._textSelectionInner$.next(selectionInfo), this.
|
|
1844
|
-
timer == null || timer.dispose();
|
|
1845
|
-
}), this._scrollTimers = [], this._updateInputPosition(!0);
|
|
1923
|
+
this._textSelectionInner$.next(selectionInfo), this._disposeScrollTimers(), this._updateInputPosition(!0);
|
|
1846
1924
|
}));
|
|
1847
1925
|
}
|
|
1848
1926
|
removeAllRanges() {
|
|
@@ -1851,6 +1929,11 @@ let DocSelectionRenderService = (_a2 = class extends RxDisposable {
|
|
|
1851
1929
|
getActiveTextRange() {
|
|
1852
1930
|
return this._getActiveRangeInstance();
|
|
1853
1931
|
}
|
|
1932
|
+
_disposeScrollTimers() {
|
|
1933
|
+
this._scrollTimers.forEach((timer) => {
|
|
1934
|
+
timer == null || timer.dispose();
|
|
1935
|
+
}), this._scrollTimers = [];
|
|
1936
|
+
}
|
|
1854
1937
|
_setSystemHighlightColorToStyle() {
|
|
1855
1938
|
const { r, g, b, a } = getSystemHighlightColor(), style = {
|
|
1856
1939
|
strokeWidth: 1.5,
|
|
@@ -1970,6 +2053,10 @@ let DocSelectionRenderService = (_a2 = class extends RxDisposable {
|
|
|
1970
2053
|
range.dispose();
|
|
1971
2054
|
}), this._rectRangeList = [];
|
|
1972
2055
|
}
|
|
2056
|
+
_removeAllCollapsedTextRanges() {
|
|
2057
|
+
for (const range of this._rangeList)
|
|
2058
|
+
range.collapsed && range.dispose();
|
|
2059
|
+
}
|
|
1973
2060
|
_deactivateAllTextRanges() {
|
|
1974
2061
|
this._rangeList.forEach((range) => {
|
|
1975
2062
|
range.deactivate();
|
|
@@ -2324,23 +2411,18 @@ const _Editor = class _Editor extends Disposable {
|
|
|
2324
2411
|
}
|
|
2325
2412
|
// get editor id.
|
|
2326
2413
|
getEditorId() {
|
|
2327
|
-
return this.
|
|
2414
|
+
return this._getEditorId();
|
|
2328
2415
|
}
|
|
2329
2416
|
// get document data.
|
|
2330
2417
|
getDocumentData() {
|
|
2331
|
-
|
|
2332
|
-
return this._univerInstanceService.getUnit(editorUnitId, UniverInstanceType.UNIVER_DOC).getSnapshot();
|
|
2418
|
+
return this._getDocDataModel().getSnapshot();
|
|
2333
2419
|
}
|
|
2334
2420
|
// Set the new document data.
|
|
2335
2421
|
setDocumentData(data, textRanges) {
|
|
2336
|
-
const { id
|
|
2337
|
-
this._commandService.executeCommand(
|
|
2422
|
+
const { id } = data;
|
|
2423
|
+
this._commandService.executeCommand(ReplaceSnapshotCommand.id, {
|
|
2338
2424
|
unitId: id,
|
|
2339
|
-
|
|
2340
|
-
...body,
|
|
2341
|
-
dataStream: body != null && body.dataStream.endsWith(`\r
|
|
2342
|
-
`) ? body.dataStream.substring(0, body.dataStream.length - 2) : body.dataStream
|
|
2343
|
-
},
|
|
2425
|
+
snapshot: data,
|
|
2344
2426
|
textRanges
|
|
2345
2427
|
});
|
|
2346
2428
|
}
|
|
@@ -2349,11 +2431,8 @@ const _Editor = class _Editor extends Disposable {
|
|
|
2349
2431
|
const editorUnitId = this.getEditorId();
|
|
2350
2432
|
return this._undoRedoService.clearUndoRedo(editorUnitId);
|
|
2351
2433
|
}
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
*/
|
|
2355
|
-
get documentDataModel() {
|
|
2356
|
-
return this._param.documentDataModel;
|
|
2434
|
+
dispose() {
|
|
2435
|
+
this._getDocDataModel().dispose();
|
|
2357
2436
|
}
|
|
2358
2437
|
/**
|
|
2359
2438
|
* @deprecated use getEditorId.
|
|
@@ -2361,6 +2440,12 @@ const _Editor = class _Editor extends Disposable {
|
|
|
2361
2440
|
get editorUnitId() {
|
|
2362
2441
|
return this._param.editorUnitId;
|
|
2363
2442
|
}
|
|
2443
|
+
/**
|
|
2444
|
+
* @deprecated @TODO: @JOCS remove this in the future.
|
|
2445
|
+
*/
|
|
2446
|
+
get params() {
|
|
2447
|
+
return this._param;
|
|
2448
|
+
}
|
|
2364
2449
|
get cancelDefaultResizeListener() {
|
|
2365
2450
|
return this._param.cancelDefaultResizeListener;
|
|
2366
2451
|
}
|
|
@@ -2368,7 +2453,8 @@ const _Editor = class _Editor extends Disposable {
|
|
|
2368
2453
|
return this._param.render;
|
|
2369
2454
|
}
|
|
2370
2455
|
isSingleChoice() {
|
|
2371
|
-
|
|
2456
|
+
var _a28;
|
|
2457
|
+
return (_a28 = this._param.isSingleChoice) != null ? _a28 : !1;
|
|
2372
2458
|
}
|
|
2373
2459
|
/** @deprecated */
|
|
2374
2460
|
setOpenForSheetUnitId(unitId) {
|
|
@@ -2439,13 +2525,13 @@ const _Editor = class _Editor extends Disposable {
|
|
|
2439
2525
|
*/
|
|
2440
2526
|
getValue() {
|
|
2441
2527
|
var _a28;
|
|
2442
|
-
return (((_a28 = this.
|
|
2528
|
+
return (((_a28 = this._getDocDataModel().getBody()) == null ? void 0 : _a28.dataStream) || "").replace(/\r\n/g, "").replace(/\n/g, "").replace(/\n/g, "");
|
|
2443
2529
|
}
|
|
2444
2530
|
/**
|
|
2445
2531
|
* @deprecated use getDocumentData.
|
|
2446
2532
|
*/
|
|
2447
2533
|
getBody() {
|
|
2448
|
-
return this.
|
|
2534
|
+
return this._getDocDataModel().getBody();
|
|
2449
2535
|
}
|
|
2450
2536
|
/**
|
|
2451
2537
|
* @deprecated.
|
|
@@ -2456,32 +2542,46 @@ const _Editor = class _Editor extends Disposable {
|
|
|
2456
2542
|
...param
|
|
2457
2543
|
};
|
|
2458
2544
|
}
|
|
2545
|
+
/**
|
|
2546
|
+
* @deprecated.
|
|
2547
|
+
*/
|
|
2459
2548
|
verticalAlign() {
|
|
2460
|
-
var _a28
|
|
2461
|
-
const
|
|
2462
|
-
if (
|
|
2549
|
+
var _a28;
|
|
2550
|
+
const docDataModel = this._getDocDataModel();
|
|
2551
|
+
if (docDataModel == null)
|
|
2463
2552
|
return;
|
|
2464
2553
|
const { width, height } = this._param.editorDom.getBoundingClientRect();
|
|
2465
2554
|
if (height === 0 || width === 0)
|
|
2466
2555
|
return;
|
|
2467
2556
|
if (!this.isSingle()) {
|
|
2468
|
-
|
|
2557
|
+
docDataModel.updateDocumentDataPageSize(width, void 0);
|
|
2469
2558
|
return;
|
|
2470
2559
|
}
|
|
2471
2560
|
let fontSize = DEFAULT_STYLES.fs;
|
|
2472
|
-
(
|
|
2561
|
+
(_a28 = this._param.canvasStyle) != null && _a28.fontSize && (fontSize = this._param.canvasStyle.fontSize);
|
|
2473
2562
|
const top = (height - fontSize * 4 / 3) / 2 - 2;
|
|
2474
|
-
|
|
2563
|
+
docDataModel.updateDocumentDataMargin({
|
|
2475
2564
|
t: top < 0 ? 0 : top
|
|
2476
|
-
}),
|
|
2565
|
+
}), docDataModel.updateDocumentDataPageSize(void 0, void 0);
|
|
2477
2566
|
}
|
|
2567
|
+
/**
|
|
2568
|
+
* @deprecated.
|
|
2569
|
+
*/
|
|
2478
2570
|
updateCanvasStyle() {
|
|
2479
2571
|
var _a28;
|
|
2480
|
-
const
|
|
2481
|
-
if (
|
|
2572
|
+
const docDataModel = this._getDocDataModel();
|
|
2573
|
+
if (docDataModel == null)
|
|
2482
2574
|
return;
|
|
2483
2575
|
const documentStyle = {};
|
|
2484
|
-
(_a28 = this._param.canvasStyle) != null && _a28.fontSize && (documentStyle.textStyle == null && (documentStyle.textStyle = {}), documentStyle.textStyle.fs = this._param.canvasStyle.fontSize),
|
|
2576
|
+
(_a28 = this._param.canvasStyle) != null && _a28.fontSize && (documentStyle.textStyle == null && (documentStyle.textStyle = {}), documentStyle.textStyle.fs = this._param.canvasStyle.fontSize), docDataModel.updateDocumentStyle(documentStyle);
|
|
2577
|
+
}
|
|
2578
|
+
_getDocDataModel() {
|
|
2579
|
+
const editorUnitId = this._getEditorId();
|
|
2580
|
+
return this._univerInstanceService.getUnit(editorUnitId, UniverInstanceType.UNIVER_DOC);
|
|
2581
|
+
}
|
|
2582
|
+
_getEditorId() {
|
|
2583
|
+
var _a28;
|
|
2584
|
+
return ((_a28 = this._param.initialSnapshot) == null ? void 0 : _a28.id) || this._param.editorUnitId || "";
|
|
2485
2585
|
}
|
|
2486
2586
|
};
|
|
2487
2587
|
__name(_Editor, "Editor");
|
|
@@ -2539,6 +2639,7 @@ let EditorService = (_b = class extends Disposable {
|
|
|
2539
2639
|
})
|
|
2540
2640
|
);
|
|
2541
2641
|
}
|
|
2642
|
+
/** @deprecated */
|
|
2542
2643
|
_blurSheetEditor(target) {
|
|
2543
2644
|
if (editorFocusInElements.some((item) => target.classList.contains(item)))
|
|
2544
2645
|
return;
|
|
@@ -2561,10 +2662,12 @@ let EditorService = (_b = class extends Disposable {
|
|
|
2561
2662
|
isEditor(editorUnitId) {
|
|
2562
2663
|
return this._editors.has(editorUnitId);
|
|
2563
2664
|
}
|
|
2665
|
+
/** @deprecated */
|
|
2564
2666
|
isSheetEditor(editorUnitId) {
|
|
2565
2667
|
const editor = this._editors.get(editorUnitId);
|
|
2566
2668
|
return !!(editor && editor.isSheetEditor());
|
|
2567
2669
|
}
|
|
2670
|
+
/** @deprecated */
|
|
2568
2671
|
closeRangePrompt() {
|
|
2569
2672
|
const documentDataModel = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
2570
2673
|
if (!documentDataModel)
|
|
@@ -2580,15 +2683,18 @@ let EditorService = (_b = class extends Disposable {
|
|
|
2580
2683
|
getSpreadsheetFocusState() {
|
|
2581
2684
|
return this._spreadsheetFocusState;
|
|
2582
2685
|
}
|
|
2686
|
+
/** @deprecated */
|
|
2583
2687
|
focusStyle(editorUnitId) {
|
|
2584
2688
|
const editor = this.getEditor(editorUnitId);
|
|
2585
2689
|
if (!editor)
|
|
2586
2690
|
return !1;
|
|
2587
2691
|
editor.setFocus(!0), this._contextService.setContextValue(EDITOR_ACTIVATED, !0), this._contextService.setContextValue(FOCUSING_EDITOR_STANDALONE, !0), this._contextService.setContextValue(FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, editor.isSingle()), this._spreadsheetFocusState || this.singleSelection(editor.isSingleChoice()), this._focusStyle$.next(editorUnitId), this.setFocusId(editorUnitId);
|
|
2588
2692
|
}
|
|
2693
|
+
/** @deprecated */
|
|
2589
2694
|
singleSelection(state) {
|
|
2590
2695
|
this._singleSelection$.next(state);
|
|
2591
2696
|
}
|
|
2697
|
+
/** @deprecated */
|
|
2592
2698
|
selectionChangingState() {
|
|
2593
2699
|
const editorUnitId = this.getFocusId();
|
|
2594
2700
|
if (editorUnitId == null)
|
|
@@ -2663,10 +2769,12 @@ let EditorService = (_b = class extends Disposable {
|
|
|
2663
2769
|
getFirstEditor() {
|
|
2664
2770
|
return [...this.getAllEditor().values()][0];
|
|
2665
2771
|
}
|
|
2772
|
+
/** @deprecated */
|
|
2666
2773
|
resize(unitId) {
|
|
2667
2774
|
const editor = this.getEditor(unitId);
|
|
2668
2775
|
editor != null && (editor.verticalAlign(), this._resize$.next(unitId));
|
|
2669
2776
|
}
|
|
2777
|
+
/** @deprecated */
|
|
2670
2778
|
isVisible(id) {
|
|
2671
2779
|
var _a28;
|
|
2672
2780
|
return (_a28 = this.getEditor(id)) == null ? void 0 : _a28.isVisible();
|
|
@@ -2688,8 +2796,9 @@ let EditorService = (_b = class extends Disposable {
|
|
|
2688
2796
|
return this._currentSheetSubUnitId;
|
|
2689
2797
|
}
|
|
2690
2798
|
register(config, container) {
|
|
2691
|
-
var _a28, _b2, _c, _d
|
|
2692
|
-
const { initialSnapshot,
|
|
2799
|
+
var _a28, _b2, _c, _d;
|
|
2800
|
+
const { initialSnapshot, canvasStyle = {} } = config, editorUnitId = initialSnapshot.id;
|
|
2801
|
+
this._univerInstanceService.getUnit(editorUnitId, UniverInstanceType.UNIVER_DOC) == null && this._univerInstanceService.createUnit(
|
|
2693
2802
|
UniverInstanceType.UNIVER_DOC,
|
|
2694
2803
|
initialSnapshot || this._getBlank(editorUnitId),
|
|
2695
2804
|
{ makeCurrent: !1 }
|
|
@@ -2698,13 +2807,13 @@ let EditorService = (_b = class extends Disposable {
|
|
|
2698
2807
|
if (render2 == null && (this._renderManagerService.create(editorUnitId), render2 = this._renderManagerService.getRenderById(editorUnitId)), render2) {
|
|
2699
2808
|
render2.engine.setContainer(container);
|
|
2700
2809
|
const editor = new Editor(
|
|
2701
|
-
{ ...config, render: render2,
|
|
2810
|
+
{ ...config, render: render2, editorDom: container, canvasStyle },
|
|
2702
2811
|
this._univerInstanceService,
|
|
2703
2812
|
this._docSelectionManagerService,
|
|
2704
2813
|
this._commandService,
|
|
2705
2814
|
this._undoRedoService
|
|
2706
2815
|
);
|
|
2707
|
-
this._editors.set(editorUnitId, editor),
|
|
2816
|
+
this._editors.set(editorUnitId, editor), config.scrollBar || (_d = (_c = (_b2 = (_a28 = render2.mainComponent) == null ? void 0 : _a28.getScene()) == null ? void 0 : _b2.getViewports()) == null ? void 0 : _c[0].getScrollBar()) == null || _d.dispose(), !editor.isSheetEditor() && !config.noNeedVerticalAlign && (editor.verticalAlign(), editor.updateCanvasStyle());
|
|
2708
2817
|
}
|
|
2709
2818
|
return toDisposable(() => {
|
|
2710
2819
|
this._unRegister(editorUnitId);
|
|
@@ -2712,15 +2821,17 @@ let EditorService = (_b = class extends Disposable {
|
|
|
2712
2821
|
}
|
|
2713
2822
|
_unRegister(editorUnitId) {
|
|
2714
2823
|
const editor = this._editors.get(editorUnitId);
|
|
2715
|
-
if (editor == null || (this._renderManagerService.removeRender(editorUnitId), editor.
|
|
2824
|
+
if (editor == null || (this._renderManagerService.removeRender(editorUnitId), editor.dispose(), this._editors.delete(editorUnitId), this._univerInstanceService.disposeUnit(editorUnitId), this._contextService.setContextValue(FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE, !1), !this.isSheetEditor(editorUnitId))) return;
|
|
2716
2825
|
if (this._univerInstanceService.getAllUnitsForType(UniverInstanceType.UNIVER_SHEET).length > 0) {
|
|
2717
2826
|
const current = this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET);
|
|
2718
2827
|
current && this._univerInstanceService.focusUnit(current.getUnitId());
|
|
2719
2828
|
}
|
|
2720
2829
|
}
|
|
2830
|
+
/** @deprecated */
|
|
2721
2831
|
refreshValueChange(editorUnitId) {
|
|
2722
2832
|
this._refreshValueChange(editorUnitId);
|
|
2723
2833
|
}
|
|
2834
|
+
/** @deprecated */
|
|
2724
2835
|
checkValueLegality(editorUnitId) {
|
|
2725
2836
|
const editor = this._editors.get(editorUnitId);
|
|
2726
2837
|
if (editor == null)
|
|
@@ -2788,7 +2899,33 @@ const IEditorService = createIdentifier("univer.editor.service"), textEditorCont
|
|
|
2788
2899
|
textEditorContainerDisabled,
|
|
2789
2900
|
textEditorContainerPlaceholder,
|
|
2790
2901
|
textEditorValidationError
|
|
2791
|
-
}
|
|
2902
|
+
};
|
|
2903
|
+
function genSnapShotByValue(id = "", value = "") {
|
|
2904
|
+
const dataStream = `${value}${DEFAULT_EMPTY_DOCUMENT_VALUE}`, paragraphs = [], sectionBreaks = [];
|
|
2905
|
+
for (let i = 0; i < dataStream.length; i++)
|
|
2906
|
+
dataStream[i] === "\r" && paragraphs.push({
|
|
2907
|
+
startIndex: i
|
|
2908
|
+
}), dataStream[i] === `
|
|
2909
|
+
` && sectionBreaks.push({
|
|
2910
|
+
startIndex: i
|
|
2911
|
+
});
|
|
2912
|
+
return {
|
|
2913
|
+
id,
|
|
2914
|
+
body: {
|
|
2915
|
+
dataStream,
|
|
2916
|
+
tables: [],
|
|
2917
|
+
textRuns: [],
|
|
2918
|
+
paragraphs,
|
|
2919
|
+
sectionBreaks
|
|
2920
|
+
},
|
|
2921
|
+
tableSource: {},
|
|
2922
|
+
documentStyle: {
|
|
2923
|
+
documentFlavor: DocumentFlavor.MODERN
|
|
2924
|
+
}
|
|
2925
|
+
};
|
|
2926
|
+
}
|
|
2927
|
+
__name(genSnapShotByValue, "genSnapShotByValue");
|
|
2928
|
+
const excludeProps = /* @__PURE__ */ new Set([
|
|
2792
2929
|
"snapshot",
|
|
2793
2930
|
"resizeCallBack",
|
|
2794
2931
|
"cancelDefaultResizeListener",
|
|
@@ -2843,10 +2980,12 @@ function TextEditor(props) {
|
|
|
2843
2980
|
cancelDefaultResizeListener !== !0 && editorService.resize(id), resizeCallBack && resizeCallBack(editorDom);
|
|
2844
2981
|
});
|
|
2845
2982
|
resizeObserver.observe(editorDom);
|
|
2983
|
+
const initialSnapshot = snapshot != null ? snapshot : genSnapShotByValue(id, value);
|
|
2984
|
+
initialSnapshot.id !== id && (initialSnapshot.id = id);
|
|
2846
2985
|
const registerSubscription = editorService.register(
|
|
2847
2986
|
{
|
|
2848
2987
|
editorUnitId: id,
|
|
2849
|
-
initialSnapshot
|
|
2988
|
+
initialSnapshot,
|
|
2850
2989
|
cancelDefaultResizeListener,
|
|
2851
2990
|
isSheetEditor,
|
|
2852
2991
|
canvasStyle,
|
|
@@ -2866,7 +3005,7 @@ function TextEditor(props) {
|
|
|
2866
3005
|
const activeChange = debounce((state) => {
|
|
2867
3006
|
setActive(state), onActive && onActive(state);
|
|
2868
3007
|
}, 30), ANIMATION_DELAY = 160, valueChange = debounce((editor) => {
|
|
2869
|
-
const unitId = editor.
|
|
3008
|
+
const unitId = editor.getEditorId(), isLegality = editorService.checkValueLegality(unitId);
|
|
2870
3009
|
setTimeout(() => {
|
|
2871
3010
|
const rect = editor.getBoundingClientRect();
|
|
2872
3011
|
setValidationOffset([rect.left, rect.top - 16]), rect.left + rect.top > 0 && setValidationVisible(isLegality), editor.onlyInputFormula() ? setValidationContent(localeService.t("textEditor.formulaError")) : setValidationContent(localeService.t("textEditor.rangeError"));
|
|
@@ -3092,13 +3231,11 @@ const IRangeSelectorService = createIdentifier(
|
|
|
3092
3231
|
rangeSelectorModalContainerDeleteButton,
|
|
3093
3232
|
rangeSelectorModalAdd,
|
|
3094
3233
|
rangeSelectorModalAddButton
|
|
3095
|
-
},
|
|
3096
|
-
pointerEvents: "none"
|
|
3097
|
-
cursor: "not-allowed",
|
|
3098
|
-
opacity: 0.5
|
|
3234
|
+
}, dialogOnlyInputStyle = {
|
|
3235
|
+
pointerEvents: "none"
|
|
3099
3236
|
};
|
|
3100
3237
|
function RangeSelector(props) {
|
|
3101
|
-
const { onChange, id, value = "", width = 220, placeholder = "", size = "middle", onActive, onValid, isSingleChoice = !1, openForSheetUnitId, openForSheetSubUnitId, isReadonly = !1, className, textEditorClassName, onSelectorVisibleChange: _onSelectorVisibleChange
|
|
3238
|
+
const { dialogOnly, onChange, id, value = "", width = 220, placeholder = "", size = "middle", onActive, onValid, isSingleChoice = !1, openForSheetUnitId, openForSheetSubUnitId, isReadonly = !1, className, textEditorClassName, onSelectorVisibleChange: _onSelectorVisibleChange } = props, onSelectorVisibleChange = useEvent(_onSelectorVisibleChange), [rangeDataList, setRangeDataList] = useState([""]), addNewItem = /* @__PURE__ */ __name((newValue) => {
|
|
3102
3239
|
setRangeDataList((prevRangeDataList) => [...prevRangeDataList, newValue]);
|
|
3103
3240
|
}, "addNewItem"), removeItem = /* @__PURE__ */ __name((indexToRemove) => {
|
|
3104
3241
|
setRangeDataList(
|
|
@@ -3115,7 +3252,7 @@ function RangeSelector(props) {
|
|
|
3115
3252
|
const newList = [...prevRangeDataList];
|
|
3116
3253
|
return newList.length > 0 && (newList[newList.length - 1] = newValue), newList;
|
|
3117
3254
|
});
|
|
3118
|
-
}, "changeLastItem"), editorService = useDependency(IEditorService), rangeSelectorService = useDependency(IRangeSelectorService), univerInstanceService = useDependency(IUniverInstanceService), [selectorVisible, setSelectorVisible] = useState(!1), localeService = useDependency(LocaleService), [active, setActive] = useState(!1), [valid, setValid] = useState(!0), [rangeValue, setRangeValue] = useState(value), [currentInputIndex, setCurrentInputIndex] = useState(-1), selectorRef = useRef(null), currentInputIndexRef = useRef(-1), openForSheetUnitIdRef = useRef(openForSheetUnitId), openForSheetSubUnitIdRef = useRef(openForSheetSubUnitId), isSingleChoiceRef = useRef(isSingleChoice), isReadonlyRef = useRef(isReadonly)
|
|
3255
|
+
}, "changeLastItem"), editorService = useDependency(IEditorService), rangeSelectorService = useDependency(IRangeSelectorService), univerInstanceService = useDependency(IUniverInstanceService), [selectorVisible, setSelectorVisible] = useState(!1), localeService = useDependency(LocaleService), [active, setActive] = useState(!1), [valid, setValid] = useState(!0), [rangeValue, setRangeValue] = useState(value), [currentInputIndex, setCurrentInputIndex] = useState(-1), selectorRef = useRef(null), currentInputIndexRef = useRef(-1), openForSheetUnitIdRef = useRef(openForSheetUnitId), openForSheetSubUnitIdRef = useRef(openForSheetSubUnitId), isSingleChoiceRef = useRef(isSingleChoice), isReadonlyRef = useRef(isReadonly);
|
|
3119
3256
|
useEffect(() => {
|
|
3120
3257
|
const selector = selectorRef.current;
|
|
3121
3258
|
if (!selector)
|
|
@@ -3203,13 +3340,22 @@ function RangeSelector(props) {
|
|
|
3203
3340
|
let sClassName = styles$6.rangeSelector;
|
|
3204
3341
|
isReadonly ? sClassName = `${styles$6.rangeSelector} ${styles$6.rangeSelectorDisabled}` : valid ? active && (sClassName = `${styles$6.rangeSelector} ${styles$6.rangeSelectorActive}`) : sClassName = `${styles$6.rangeSelector} ${styles$6.rangeSelectorError}`, textEditorClassName && (sClassName = `${sClassName} ${textEditorClassName}`);
|
|
3205
3342
|
let height = 28;
|
|
3206
|
-
size === "mini" ? height = 20 : size === "small" ? height = 24 : size === "large" && (height = 32)
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3343
|
+
return size === "mini" ? height = 20 : size === "small" ? height = 24 : size === "large" && (height = 32), /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
3344
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3345
|
+
"div",
|
|
3346
|
+
{
|
|
3347
|
+
className: sClassName,
|
|
3348
|
+
ref: selectorRef,
|
|
3349
|
+
style: { width, height, cursor: dialogOnly ? "pointer" : void 0 },
|
|
3350
|
+
onClickCapture: /* @__PURE__ */ __name((event) => {
|
|
3351
|
+
dialogOnly && (event.stopPropagation(), event.preventDefault(), handleOpenModal());
|
|
3352
|
+
}, "onClickCapture"),
|
|
3353
|
+
children: [
|
|
3354
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TextEditor, { style: dialogOnly ? dialogOnlyInputStyle : void 0, placeholder, value, isReadonly, isSingleChoice, openForSheetUnitId, openForSheetSubUnitId, onValid: onEditorValid, onActive: onEditorActive, onChange: handleTextValueChange, id, onlyInputRange: !0, canvasStyle: { fontSize: 10 }, className: styles$6.rangeSelectorEditor }),
|
|
3355
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { title: localeService.t("rangeSelector.buttonTooltip"), placement: "bottom", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: styles$6.rangeSelectorIcon, onClick: handleOpenModal, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectRangeSingle, {}) }) })
|
|
3356
|
+
]
|
|
3357
|
+
}
|
|
3358
|
+
),
|
|
3213
3359
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3214
3360
|
Dialog,
|
|
3215
3361
|
{
|
|
@@ -6632,7 +6778,8 @@ let DocClipboardService = (_a4 = class extends Disposable {
|
|
|
6632
6778
|
async _setClipboardData(documentBodyList, snapshot, needCache = !0) {
|
|
6633
6779
|
var _a28, _b2;
|
|
6634
6780
|
const copyId = genId(), text = (documentBodyList.length > 1 ? documentBodyList.map((body) => body.dataStream).join(`
|
|
6635
|
-
`) : documentBodyList[0].dataStream).replaceAll(DataStreamTreeTokenType.CUSTOM_RANGE_START, "").replaceAll(DataStreamTreeTokenType.CUSTOM_RANGE_END, "")
|
|
6781
|
+
`) : documentBodyList[0].dataStream).replaceAll(DataStreamTreeTokenType.CUSTOM_RANGE_START, "").replaceAll(DataStreamTreeTokenType.CUSTOM_RANGE_END, "").replaceAll(DataStreamTreeTokenType.TABLE_START, "").replaceAll(DataStreamTreeTokenType.TABLE_END, "").replaceAll(DataStreamTreeTokenType.TABLE_ROW_START, "").replaceAll(DataStreamTreeTokenType.TABLE_ROW_END, "").replaceAll(DataStreamTreeTokenType.TABLE_CELL_START, "").replaceAll(DataStreamTreeTokenType.TABLE_CELL_END, "").replaceAll(`\r
|
|
6782
|
+
`, " ");
|
|
6636
6783
|
let html = this._umdToHtml.convert(documentBodyList);
|
|
6637
6784
|
if (documentBodyList.length === 1 && needCache) {
|
|
6638
6785
|
html = html.replace(/(<[a-z]+)/, (_p0, p1) => `${p1} data-copy-id="${copyId}"`);
|
|
@@ -6726,10 +6873,6 @@ function whenDocOrEditor(contextService) {
|
|
|
6726
6873
|
return contextService.getContextValue(FOCUSING_DOC) || contextService.getContextValue(EDITOR_ACTIVATED);
|
|
6727
6874
|
}
|
|
6728
6875
|
__name(whenDocOrEditor, "whenDocOrEditor");
|
|
6729
|
-
function whenFocusEditor(contextService) {
|
|
6730
|
-
return contextService.getContextValue(EDITOR_ACTIVATED);
|
|
6731
|
-
}
|
|
6732
|
-
__name(whenFocusEditor, "whenFocusEditor");
|
|
6733
6876
|
const DOC_CLIPBOARD_PRIORITY = 999, DocCopyCommand = {
|
|
6734
6877
|
id: CopyCommand.id,
|
|
6735
6878
|
name: "doc.command.copy",
|
|
@@ -7554,7 +7697,6 @@ let DocParagraphSettingController = (_a5 = class extends Disposable {
|
|
|
7554
7697
|
}
|
|
7555
7698
|
}, __name(_a5, "DocParagraphSettingController"), _a5);
|
|
7556
7699
|
DocParagraphSettingController = __decorateClass$m([
|
|
7557
|
-
OnLifecycle(LifecycleStages.Rendered, DocParagraphSettingController),
|
|
7558
7700
|
__decorateParam$m(0, ICommandService),
|
|
7559
7701
|
__decorateParam$m(1, Inject(ComponentManager)),
|
|
7560
7702
|
__decorateParam$m(2, Inject(ISidebarService))
|
|
@@ -8100,7 +8242,7 @@ function HeaderFooterMenuItemFactory(accessor) {
|
|
|
8100
8242
|
return {
|
|
8101
8243
|
id: OpenHeaderFooterPanelCommand.id,
|
|
8102
8244
|
type: MenuItemType.BUTTON,
|
|
8103
|
-
icon: "
|
|
8245
|
+
icon: "HeaderFooterSingle",
|
|
8104
8246
|
tooltip: "toolbar.headerFooter",
|
|
8105
8247
|
hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), getHeaderFooterMenuHiddenObservable(accessor), (one, two) => one || two)
|
|
8106
8248
|
};
|
|
@@ -8601,7 +8743,6 @@ let DocUIController = (_a6 = class extends Disposable {
|
|
|
8601
8743
|
}
|
|
8602
8744
|
}, __name(_a6, "DocUIController"), _a6);
|
|
8603
8745
|
DocUIController = __decorateClass$l([
|
|
8604
|
-
OnLifecycle(LifecycleStages.Rendered, DocUIController),
|
|
8605
8746
|
__decorateParam$l(0, Inject(Injector)),
|
|
8606
8747
|
__decorateParam$l(1, Inject(ComponentManager)),
|
|
8607
8748
|
__decorateParam$l(2, ICommandService),
|
|
@@ -8628,7 +8769,7 @@ let DocBackScrollRenderController = (_a7 = class extends RxDisposable {
|
|
|
8628
8769
|
if (params == null)
|
|
8629
8770
|
return;
|
|
8630
8771
|
const { isEditing, unitId } = params;
|
|
8631
|
-
unitId !== this._context.unitId || !isEditing || this._scrollToSelection();
|
|
8772
|
+
unitId !== this._context.unitId || !isEditing || this._context.unitId !== DOCS_NORMAL_EDITOR_UNIT_ID_KEY && this._scrollToSelection();
|
|
8632
8773
|
});
|
|
8633
8774
|
}
|
|
8634
8775
|
scrollToRange(range) {
|
|
@@ -8639,10 +8780,11 @@ let DocBackScrollRenderController = (_a7 = class extends RxDisposable {
|
|
|
8639
8780
|
this.scrollToNode(anchorNodePosition);
|
|
8640
8781
|
}
|
|
8641
8782
|
scrollToNode(startNodePosition) {
|
|
8783
|
+
var _a28;
|
|
8642
8784
|
const { unitId, scene, mainComponent } = this._context, skeleton = this._docSkeletonManagerService.getSkeleton();
|
|
8643
8785
|
if (mainComponent == null || skeleton == null)
|
|
8644
8786
|
return;
|
|
8645
|
-
const documentOffsetConfig = mainComponent.getOffsetConfig(), { docsLeft, docsTop } = documentOffsetConfig, convertor = new NodePositionConvertToCursor(documentOffsetConfig, skeleton), { contentBoxPointGroup } = convertor.getRangePointData(startNodePosition, startNodePosition), { left: aLeft, top: aTop, height } = getAnchorBounding(contentBoxPointGroup), left = aLeft + docsLeft, top = aTop + docsTop, viewportMain = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN),
|
|
8787
|
+
const documentOffsetConfig = mainComponent.getOffsetConfig(), { docsLeft, docsTop } = documentOffsetConfig, convertor = new NodePositionConvertToCursor(documentOffsetConfig, skeleton), { contentBoxPointGroup } = convertor.getRangePointData(startNodePosition, startNodePosition), { left: aLeft, top: aTop, height } = getAnchorBounding(contentBoxPointGroup), left = aLeft + docsLeft, top = aTop + docsTop, viewportMain = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN), editor = this._editorService.getEditor(unitId);
|
|
8646
8788
|
if (viewportMain == null)
|
|
8647
8789
|
return;
|
|
8648
8790
|
const {
|
|
@@ -8652,7 +8794,7 @@ let DocBackScrollRenderController = (_a7 = class extends RxDisposable {
|
|
|
8652
8794
|
bottom: boundBottom
|
|
8653
8795
|
} = viewportMain.getBounding().viewBound;
|
|
8654
8796
|
let offsetY = 0, offsetX = 0;
|
|
8655
|
-
const delta =
|
|
8797
|
+
const delta = editor ? (_a28 = editor.params.backScrollOffset) != null ? _a28 : 0 : 100;
|
|
8656
8798
|
top < boundTop ? offsetY = top - boundTop - delta : top > boundBottom - height && (offsetY = top - boundBottom + height + delta), left < boundLeft ? offsetX = left - boundLeft : left > boundRight - ANCHOR_WIDTH && (offsetX = left - boundRight + ANCHOR_WIDTH);
|
|
8657
8799
|
const config = viewportMain.transViewportScroll2ScrollValue(offsetX, offsetY);
|
|
8658
8800
|
viewportMain.scrollByBarDeltaValue(config);
|
|
@@ -8683,13 +8825,15 @@ let DocRenderController = (_a8 = class extends RxDisposable {
|
|
|
8683
8825
|
reRender(unitId) {
|
|
8684
8826
|
var _a28, _b2;
|
|
8685
8827
|
const docSkeletonManagerService = (_a28 = this._renderManagerService.getRenderById(unitId)) == null ? void 0 : _a28.with(DocSkeletonManagerService), skeleton = docSkeletonManagerService == null ? void 0 : docSkeletonManagerService.getSkeleton();
|
|
8686
|
-
if (!
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
this.
|
|
8828
|
+
if (!skeleton || !!skeleton.getViewModel().getDataModel().getSnapshot().disabled)
|
|
8829
|
+
return;
|
|
8830
|
+
skeleton.calculate();
|
|
8831
|
+
const editor = this._editorService.getEditor(unitId);
|
|
8832
|
+
if (this._editorService.isEditor(unitId) && !(editor != null && editor.params.scrollBar)) {
|
|
8833
|
+
(_b2 = this._context.mainComponent) == null || _b2.makeDirty();
|
|
8834
|
+
return;
|
|
8692
8835
|
}
|
|
8836
|
+
this._recalculateSizeBySkeleton(skeleton);
|
|
8693
8837
|
}
|
|
8694
8838
|
_addNewRender() {
|
|
8695
8839
|
const { scene, engine } = this._context, viewMain = new Viewport(VIEWPORT_KEY.VIEW_MAIN, scene, {
|
|
@@ -8758,7 +8902,9 @@ let DocRenderController = (_a8 = class extends RxDisposable {
|
|
|
8758
8902
|
const page = pages[i], { pageWidth, pageHeight } = page;
|
|
8759
8903
|
docsComponent.pageLayoutType === PageLayoutType.VERTICAL ? (height += pageHeight, height += docsComponent.pageMarginTop, i === len - 1 && (height += docsComponent.pageMarginTop), width = Math.max(width, pageWidth)) : docsComponent.pageLayoutType === PageLayoutType.HORIZONTAL && (width += pageWidth, i !== len - 1 && (width += docsComponent.pageMarginLeft), height = Math.max(height, pageHeight));
|
|
8760
8904
|
}
|
|
8761
|
-
docsComponent.resize(width, height), docBackground.resize(width, height)
|
|
8905
|
+
docsComponent.resize(width, height), docBackground.resize(width, height);
|
|
8906
|
+
const editor = this._editorService.getEditor(unitId);
|
|
8907
|
+
(!this._editorService.isEditor(unitId) || editor != null && editor.params.scrollBar) && scene.resize(width, height);
|
|
8762
8908
|
}
|
|
8763
8909
|
}, __name(_a8, "DocRenderController"), _a8);
|
|
8764
8910
|
DocRenderController = __decorateClass$j([
|
|
@@ -9147,7 +9293,6 @@ let DocAutoFormatController = (_a11 = class extends Disposable {
|
|
|
9147
9293
|
}
|
|
9148
9294
|
}, __name(_a11, "DocAutoFormatController"), _a11);
|
|
9149
9295
|
DocAutoFormatController = __decorateClass$g([
|
|
9150
|
-
OnLifecycle(LifecycleStages.Rendered, DocAutoFormatController),
|
|
9151
9296
|
__decorateParam$g(0, Inject(DocAutoFormatService))
|
|
9152
9297
|
], DocAutoFormatController);
|
|
9153
9298
|
function firstLineInTable(table) {
|
|
@@ -9188,24 +9333,50 @@ function findLineBeforeAndAfterTable(table) {
|
|
|
9188
9333
|
}
|
|
9189
9334
|
__name(findLineBeforeAndAfterTable, "findLineBeforeAndAfterTable");
|
|
9190
9335
|
function findBellowCell(cell) {
|
|
9191
|
-
|
|
9336
|
+
var _a28, _b2;
|
|
9337
|
+
const row = cell.parent, table = row == null ? void 0 : row.parent, tableId = table == null ? void 0 : table.tableId;
|
|
9192
9338
|
if (row == null || table == null)
|
|
9193
9339
|
return;
|
|
9194
|
-
const bellowRow = table.rows[table.rows.indexOf(row) + 1];
|
|
9195
|
-
if (bellowRow == null)
|
|
9340
|
+
const col = row.cells.indexOf(cell), bellowRow = table.rows[table.rows.indexOf(row) + 1];
|
|
9341
|
+
if (bellowRow == null) {
|
|
9342
|
+
if (tableId.indexOf("#-#")) {
|
|
9343
|
+
const [id, index] = tableId.split("#-#"), pages = (_b2 = (_a28 = table.parent) == null ? void 0 : _a28.parent) == null ? void 0 : _b2.pages, nextTableId = `${id}#-#${Number.parseInt(index) + 1}`;
|
|
9344
|
+
if (pages)
|
|
9345
|
+
for (const page of pages) {
|
|
9346
|
+
const { skeTables } = page;
|
|
9347
|
+
if (skeTables.has(nextTableId)) {
|
|
9348
|
+
const nextTable = skeTables.get(nextTableId);
|
|
9349
|
+
if (nextTable != null && nextTable.rows.length)
|
|
9350
|
+
return nextTable.rows[0].cells[col];
|
|
9351
|
+
}
|
|
9352
|
+
}
|
|
9353
|
+
}
|
|
9196
9354
|
return;
|
|
9197
|
-
|
|
9355
|
+
}
|
|
9198
9356
|
return bellowRow.cells[col];
|
|
9199
9357
|
}
|
|
9200
9358
|
__name(findBellowCell, "findBellowCell");
|
|
9201
9359
|
function findAboveCell(cell) {
|
|
9360
|
+
var _a28, _b2;
|
|
9202
9361
|
const row = cell.parent, table = row == null ? void 0 : row.parent;
|
|
9203
9362
|
if (row == null || table == null)
|
|
9204
9363
|
return;
|
|
9205
|
-
const aboveRow = table.rows[table.rows.indexOf(row) - 1];
|
|
9206
|
-
if (aboveRow == null)
|
|
9364
|
+
const aboveRow = table.rows[table.rows.indexOf(row) - 1], col = row.cells.indexOf(cell);
|
|
9365
|
+
if (aboveRow == null) {
|
|
9366
|
+
if (table.tableId.indexOf("#-#")) {
|
|
9367
|
+
const [id, index] = table.tableId.split("#-#"), pages = (_b2 = (_a28 = table.parent) == null ? void 0 : _a28.parent) == null ? void 0 : _b2.pages, nextTableId = `${id}#-#${Number.parseInt(index) - 1}`;
|
|
9368
|
+
if (pages)
|
|
9369
|
+
for (const page of pages) {
|
|
9370
|
+
const { skeTables } = page;
|
|
9371
|
+
if (skeTables.has(nextTableId)) {
|
|
9372
|
+
const nextTable = skeTables.get(nextTableId);
|
|
9373
|
+
if (nextTable != null && nextTable.rows.length)
|
|
9374
|
+
return nextTable.rows[nextTable.rows.length - 1].cells[col];
|
|
9375
|
+
}
|
|
9376
|
+
}
|
|
9377
|
+
}
|
|
9207
9378
|
return;
|
|
9208
|
-
|
|
9379
|
+
}
|
|
9209
9380
|
return aboveRow.cells[col];
|
|
9210
9381
|
}
|
|
9211
9382
|
__name(findAboveCell, "findAboveCell");
|
|
@@ -9379,8 +9550,8 @@ let DocMoveCursorController = (_a12 = class extends Disposable {
|
|
|
9379
9550
|
direction === Direction.LEFT ? cursor = Math.min(range.startIndex, cursor) : cursor = Math.max(range.endIndex + 1, cursor);
|
|
9380
9551
|
}), this._textSelectionManagerService.replaceTextRanges([
|
|
9381
9552
|
{
|
|
9382
|
-
startOffset: cursor,
|
|
9383
|
-
endOffset: cursor,
|
|
9553
|
+
startOffset: Math.max(0, cursor),
|
|
9554
|
+
endOffset: Math.max(0, cursor),
|
|
9384
9555
|
style
|
|
9385
9556
|
}
|
|
9386
9557
|
], !1), this._scrollToFocusNodePosition(docDataModel.getUnitId(), cursor);
|
|
@@ -9395,8 +9566,8 @@ let DocMoveCursorController = (_a12 = class extends Disposable {
|
|
|
9395
9566
|
let cursor;
|
|
9396
9567
|
collapsed ? cursor = direction === Direction.UP ? 0 : dataStreamLength - 2 : cursor = direction === Direction.UP ? startOffset : endOffset, this._textSelectionManagerService.replaceTextRanges([
|
|
9397
9568
|
{
|
|
9398
|
-
startOffset: cursor,
|
|
9399
|
-
endOffset: cursor,
|
|
9569
|
+
startOffset: Math.max(0, cursor),
|
|
9570
|
+
endOffset: Math.max(0, cursor),
|
|
9400
9571
|
style
|
|
9401
9572
|
}
|
|
9402
9573
|
], !1);
|
|
@@ -9537,7 +9708,6 @@ let DocMoveCursorController = (_a12 = class extends Disposable {
|
|
|
9537
9708
|
}
|
|
9538
9709
|
}, __name(_a12, "DocMoveCursorController"), _a12);
|
|
9539
9710
|
DocMoveCursorController = __decorateClass$f([
|
|
9540
|
-
OnLifecycle(LifecycleStages.Rendered, DocMoveCursorController),
|
|
9541
9711
|
__decorateParam$f(0, IUniverInstanceService),
|
|
9542
9712
|
__decorateParam$f(1, IRenderManagerService),
|
|
9543
9713
|
__decorateParam$f(2, Inject(DocSelectionManagerService)),
|
|
@@ -9641,7 +9811,6 @@ let DocTableController = (_a13 = class extends Disposable {
|
|
|
9641
9811
|
}
|
|
9642
9812
|
}, __name(_a13, "DocTableController"), _a13);
|
|
9643
9813
|
DocTableController = __decorateClass$e([
|
|
9644
|
-
OnLifecycle(LifecycleStages.Rendered, DocTableController),
|
|
9645
9814
|
__decorateParam$e(0, ICommandService),
|
|
9646
9815
|
__decorateParam$e(1, Inject(ComponentManager))
|
|
9647
9816
|
], DocTableController);
|
|
@@ -10078,8 +10247,8 @@ var __defProp$a = Object.defineProperty, __getOwnPropDesc$a = Object.getOwnPrope
|
|
|
10078
10247
|
return kind && result && __defProp$a(target, key, result), result;
|
|
10079
10248
|
}, "__decorateClass$a"), __decorateParam$a = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$a"), _a17;
|
|
10080
10249
|
let DocClipboardController = (_a17 = class extends RxDisposable {
|
|
10081
|
-
constructor(_context, _commandService, _docClipboardService, _docSelectionRenderService, _contextService) {
|
|
10082
|
-
super(), this._context = _context, this._commandService = _commandService, this._docClipboardService = _docClipboardService, this._docSelectionRenderService = _docSelectionRenderService, this._contextService = _contextService, this._init();
|
|
10250
|
+
constructor(_context, _commandService, _docClipboardService, _docSelectionRenderService, _contextService, _editorService) {
|
|
10251
|
+
super(), this._context = _context, this._commandService = _commandService, this._docClipboardService = _docClipboardService, this._docSelectionRenderService = _docSelectionRenderService, this._contextService = _contextService, this._editorService = _editorService, this._init();
|
|
10083
10252
|
}
|
|
10084
10253
|
_init() {
|
|
10085
10254
|
this._initLegacyPasteCommand();
|
|
@@ -10094,7 +10263,7 @@ let DocClipboardController = (_a17 = class extends RxDisposable {
|
|
|
10094
10263
|
const clipboardEvent = config.event;
|
|
10095
10264
|
let htmlContent = (_a29 = clipboardEvent.clipboardData) == null ? void 0 : _a29.getData("text/html");
|
|
10096
10265
|
const textContent = (_b2 = clipboardEvent.clipboardData) == null ? void 0 : _b2.getData("text/plain");
|
|
10097
|
-
|
|
10266
|
+
this._editorService.getEditor(this._context.unitId) && (htmlContent != null ? htmlContent : "").indexOf("</table>") > -1 && (htmlContent = ""), this._docClipboardService.legacyPaste(htmlContent, textContent);
|
|
10098
10267
|
});
|
|
10099
10268
|
}
|
|
10100
10269
|
}, __name(_a17, "DocClipboardController"), _a17);
|
|
@@ -10102,7 +10271,8 @@ DocClipboardController = __decorateClass$a([
|
|
|
10102
10271
|
__decorateParam$a(1, ICommandService),
|
|
10103
10272
|
__decorateParam$a(2, IDocClipboardService),
|
|
10104
10273
|
__decorateParam$a(3, Inject(DocSelectionRenderService)),
|
|
10105
|
-
__decorateParam$a(4, IContextService)
|
|
10274
|
+
__decorateParam$a(4, IContextService),
|
|
10275
|
+
__decorateParam$a(5, IEditorService)
|
|
10106
10276
|
], DocClipboardController);
|
|
10107
10277
|
var __defProp$9 = Object.defineProperty, __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor, __decorateClass$9 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
|
|
10108
10278
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
@@ -10264,7 +10434,8 @@ let DocEditorBridgeController = (_a19 = class extends Disposable {
|
|
|
10264
10434
|
const params = command.params, { unitId } = params;
|
|
10265
10435
|
if (this._editorService.isSheetEditor(unitId) || unitId !== this._context.unitId)
|
|
10266
10436
|
return;
|
|
10267
|
-
this.
|
|
10437
|
+
const editor = this._editorService.getEditor(unitId);
|
|
10438
|
+
editor && !editor.params.scrollBar && (this._resize(unitId), this._valueChange());
|
|
10268
10439
|
}
|
|
10269
10440
|
})
|
|
10270
10441
|
);
|
|
@@ -10749,7 +10920,6 @@ let DocStateChangeManagerService = (_a25 = class extends RxDisposable {
|
|
|
10749
10920
|
}
|
|
10750
10921
|
}, __name(_a25, "DocStateChangeManagerService"), _a25);
|
|
10751
10922
|
DocStateChangeManagerService = __decorateClass$2([
|
|
10752
|
-
OnLifecycle(LifecycleStages.Ready, DocStateChangeManagerService),
|
|
10753
10923
|
__decorateParam$2(0, Inject(IUndoRedoService)),
|
|
10754
10924
|
__decorateParam$2(1, ICommandService),
|
|
10755
10925
|
__decorateParam$2(2, IUniverInstanceService),
|
|
@@ -10781,7 +10951,6 @@ let DocsRenderService = (_a26 = class extends RxDisposable {
|
|
|
10781
10951
|
}
|
|
10782
10952
|
}, __name(_a26, "DocsRenderService"), _a26);
|
|
10783
10953
|
DocsRenderService = __decorateClass$1([
|
|
10784
|
-
OnLifecycle(LifecycleStages.Ready, DocsRenderService),
|
|
10785
10954
|
__decorateParam$1(0, IUniverInstanceService),
|
|
10786
10955
|
__decorateParam$1(1, IRenderManagerService)
|
|
10787
10956
|
], DocsRenderService);
|
|
@@ -10871,10 +11040,21 @@ let UniverDocsUIPlugin = (_a27 = class extends Plugin {
|
|
|
10871
11040
|
menu && this._configService.setConfig("menu", menu, { merge: !0 }), this._configService.setConfig(PLUGIN_CONFIG_KEY, rest), this._initDependencies(_injector), this._initializeShortcut(), this._initCommand();
|
|
10872
11041
|
}
|
|
10873
11042
|
onReady() {
|
|
10874
|
-
this._initRenderBasics(), this._markDocAsFocused()
|
|
11043
|
+
this._initRenderBasics(), this._markDocAsFocused(), touchDependencies(this._injector, [
|
|
11044
|
+
[DocStateChangeManagerService],
|
|
11045
|
+
[DocsRenderService]
|
|
11046
|
+
]);
|
|
10875
11047
|
}
|
|
10876
11048
|
onRendered() {
|
|
10877
|
-
this._initUI(), this._initRenderModules()
|
|
11049
|
+
this._initUI(), this._initRenderModules(), touchDependencies(this._injector, [
|
|
11050
|
+
[DocAutoFormatController],
|
|
11051
|
+
[DocMoveCursorController],
|
|
11052
|
+
[DocParagraphSettingController],
|
|
11053
|
+
[DocTableController],
|
|
11054
|
+
// FIXME: LifecycleStages.Rendered must be used, otherwise the menu cannot be added to the DOM, but the sheet ui
|
|
11055
|
+
// plugin can be added in LifecycleStages.Ready
|
|
11056
|
+
[DocUIController]
|
|
11057
|
+
]);
|
|
10878
11058
|
}
|
|
10879
11059
|
_initCommand() {
|
|
10880
11060
|
[
|
|
@@ -10931,6 +11111,7 @@ let UniverDocsUIPlugin = (_a27 = class extends Plugin {
|
|
|
10931
11111
|
InnerPasteCommand,
|
|
10932
11112
|
CutContentCommand,
|
|
10933
11113
|
ReplaceContentCommand,
|
|
11114
|
+
ReplaceSnapshotCommand,
|
|
10934
11115
|
CoverContentCommand,
|
|
10935
11116
|
SetDocZoomRatioCommand,
|
|
10936
11117
|
SelectAllOperation,
|
|
@@ -10964,14 +11145,12 @@ let UniverDocsUIPlugin = (_a27 = class extends Plugin {
|
|
|
10964
11145
|
mergeOverrideWithDependencies([
|
|
10965
11146
|
[DocClipboardController],
|
|
10966
11147
|
[DocEditorBridgeController],
|
|
10967
|
-
// Controller
|
|
10968
11148
|
[DocUIController],
|
|
10969
11149
|
[DocAutoFormatController],
|
|
10970
11150
|
[DocTableController],
|
|
10971
11151
|
[DocMoveCursorController],
|
|
10972
11152
|
[AppUIController],
|
|
10973
11153
|
[DocParagraphSettingController],
|
|
10974
|
-
// Services
|
|
10975
11154
|
[IEditorService, { useClass: EditorService }],
|
|
10976
11155
|
[IRangeSelectorService, { useClass: RangeSelectorService }],
|
|
10977
11156
|
[IDocClipboardService, { useClass: DocClipboardService }],
|
|
@@ -10997,13 +11176,11 @@ let UniverDocsUIPlugin = (_a27 = class extends Plugin {
|
|
|
10997
11176
|
}
|
|
10998
11177
|
_initRenderBasics() {
|
|
10999
11178
|
[
|
|
11000
|
-
// Services.
|
|
11001
11179
|
[DocSkeletonManagerService],
|
|
11002
11180
|
[DocSelectionRenderService],
|
|
11003
11181
|
[DocInterceptorService],
|
|
11004
11182
|
[DocPageLayoutService],
|
|
11005
11183
|
[DocIMEInputManagerService],
|
|
11006
|
-
// Controllers.
|
|
11007
11184
|
[DocRenderController],
|
|
11008
11185
|
[DocZoomRenderController]
|
|
11009
11186
|
].forEach((m2) => {
|
|
@@ -11012,9 +11189,7 @@ let UniverDocsUIPlugin = (_a27 = class extends Plugin {
|
|
|
11012
11189
|
}
|
|
11013
11190
|
_initRenderModules() {
|
|
11014
11191
|
[
|
|
11015
|
-
// Services
|
|
11016
11192
|
[DocEventManagerService],
|
|
11017
|
-
// Controllers.
|
|
11018
11193
|
[DocBackScrollRenderController],
|
|
11019
11194
|
[DocSelectionRenderController],
|
|
11020
11195
|
[DocHeaderFooterController],
|
|
@@ -11118,6 +11293,7 @@ export {
|
|
|
11118
11293
|
RangeSelectorService,
|
|
11119
11294
|
RectRange,
|
|
11120
11295
|
ReplaceContentCommand,
|
|
11296
|
+
ReplaceSnapshotCommand,
|
|
11121
11297
|
ResetInlineFormatTextBackgroundColorCommand,
|
|
11122
11298
|
SelectAllOperation,
|
|
11123
11299
|
SetDocZoomRatioCommand,
|