@univerjs/docs-ui 0.4.0 → 0.4.1-experimental.20241023-bbb123f
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 +4 -4
- package/lib/es/index.js +182 -35
- package/lib/locale/en-US.json +1 -0
- package/lib/locale/fa-IR.json +1 -0
- package/lib/locale/ru-RU.json +2 -1
- package/lib/locale/vi-VN.json +2 -1
- package/lib/locale/zh-CN.json +1 -0
- package/lib/locale/zh-TW.json +2 -1
- package/lib/types/commands/commands/doc-header-footer.command.d.ts +4 -0
- package/lib/types/commands/commands/switch-doc-mode.command.d.ts +4 -0
- package/lib/types/controllers/doc-header-footer.controller.d.ts +2 -0
- package/lib/types/controllers/menu/menu.d.ts +1 -0
- package/lib/types/controllers/render-controllers/doc.render-controller.d.ts +2 -3
- package/lib/types/controllers/render-controllers/zoom.render-controller.d.ts +2 -2
- package/lib/types/locale/zh-CN.d.ts +1 -0
- package/lib/types/services/doc-auto-format.service.d.ts +2 -2
- package/lib/types/services/selection/text-range.d.ts +2 -2
- package/lib/types/views/doc-container/DocContainer.d.ts +1 -1
- package/lib/umd/index.js +4 -4
- package/package.json +8 -8
- package/LICENSE +0 -176
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, 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,
|
|
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, DOCS_ZEN_EDITOR_UNIT_ID_KEY, Injector, connectInjector, IConfigService, QuickListTypeMap, Direction, DisposableCollection, fromEventSubject, DOCS_FORMULA_BAR_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";
|
|
@@ -65,7 +65,7 @@ let DocAutoFormatService = (_a = class extends Disposable {
|
|
|
65
65
|
selection,
|
|
66
66
|
isBody: !selection.segmentId,
|
|
67
67
|
paragraphs: getParagraphsInRange$1(selection, (_c = (_b2 = doc.getBody()) == null ? void 0 : _b2.paragraphs) != null ? _c : []),
|
|
68
|
-
customRanges: BuildTextUtils.customRange.
|
|
68
|
+
customRanges: BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection, (_e = (_d = doc.getBody()) == null ? void 0 : _d.customRanges) != null ? _e : []),
|
|
69
69
|
commandId: id,
|
|
70
70
|
commandParams: params
|
|
71
71
|
}, matched = autoFormats.find((i) => i.match(context));
|
|
@@ -2933,7 +2933,7 @@ function genSnapShotByValue(id = "", value = "") {
|
|
|
2933
2933
|
},
|
|
2934
2934
|
tableSource: {},
|
|
2935
2935
|
documentStyle: {
|
|
2936
|
-
documentFlavor: DocumentFlavor.
|
|
2936
|
+
documentFlavor: DocumentFlavor.UNSPECIFIED
|
|
2937
2937
|
}
|
|
2938
2938
|
};
|
|
2939
2939
|
}
|
|
@@ -3423,7 +3423,56 @@ function RangeSelector(props) {
|
|
|
3423
3423
|
] });
|
|
3424
3424
|
}
|
|
3425
3425
|
__name(RangeSelector, "RangeSelector");
|
|
3426
|
-
const
|
|
3426
|
+
const SwitchDocModeCommand = {
|
|
3427
|
+
id: "doc.command.switch-mode",
|
|
3428
|
+
type: CommandType.COMMAND,
|
|
3429
|
+
// eslint-disable-next-line max-lines-per-function, complexity
|
|
3430
|
+
handler: /* @__PURE__ */ __name(async (accessor) => {
|
|
3431
|
+
var _a28, _b2, _c, _d, _e;
|
|
3432
|
+
const commandService = accessor.get(ICommandService), renderManagerService = accessor.get(IRenderManagerService), docSelectionManagerService = accessor.get(DocSelectionManagerService), docDataModel = accessor.get(IUniverInstanceService).getCurrentUniverDocInstance();
|
|
3433
|
+
if (docDataModel == null)
|
|
3434
|
+
return !1;
|
|
3435
|
+
const unitId = docDataModel.getUnitId(), skeleton = (_a28 = renderManagerService.getRenderById(unitId)) == null ? void 0 : _a28.with(DocSkeletonManagerService).getSkeleton(), docSelectionRenderService = (_b2 = renderManagerService.getRenderById(unitId)) == null ? void 0 : _b2.with(DocSelectionRenderService);
|
|
3436
|
+
if (skeleton == null || docSelectionRenderService == null)
|
|
3437
|
+
return !1;
|
|
3438
|
+
const segmentId = docSelectionRenderService == null ? void 0 : docSelectionRenderService.getSegment(), segmentPage = docSelectionRenderService == null ? void 0 : docSelectionRenderService.getSegmentPage(), documentFlavor = docDataModel.getSnapshot().documentStyle.documentFlavor, docRanges = docSelectionManagerService.getDocRanges(), doMutation = {
|
|
3439
|
+
id: RichTextEditingMutation.id,
|
|
3440
|
+
params: {
|
|
3441
|
+
unitId,
|
|
3442
|
+
actions: [],
|
|
3443
|
+
textRanges: docRanges
|
|
3444
|
+
}
|
|
3445
|
+
}, jsonX = JSONX.getInstance(), rawActions = [];
|
|
3446
|
+
let action;
|
|
3447
|
+
if (documentFlavor === void 0 ? action = jsonX.insertOp(["documentStyle", "documentFlavor"], DocumentFlavor.MODERN) : documentFlavor === DocumentFlavor.MODERN ? action = jsonX.replaceOp(["documentStyle", "documentFlavor"], documentFlavor, DocumentFlavor.TRADITIONAL) : action = jsonX.replaceOp(["documentStyle", "documentFlavor"], documentFlavor, DocumentFlavor.MODERN), action)
|
|
3448
|
+
rawActions.push(action);
|
|
3449
|
+
else
|
|
3450
|
+
return !1;
|
|
3451
|
+
if (documentFlavor !== DocumentFlavor.MODERN) {
|
|
3452
|
+
const snapshot = docDataModel.getSnapshot(), { drawings = {}, body } = snapshot, customBlocks = (_c = body == null ? void 0 : body.customBlocks) != null ? _c : [];
|
|
3453
|
+
for (const drawingId in drawings) {
|
|
3454
|
+
const drawing = drawings[drawingId], customBlock = customBlocks.find((block) => block.blockId === drawingId);
|
|
3455
|
+
if (customBlock == null)
|
|
3456
|
+
continue;
|
|
3457
|
+
const drawingPositionV = drawing.docTransform.positionV, { relativeFrom: prevRelativeFrom, posOffset: prevPosOffset } = drawingPositionV;
|
|
3458
|
+
if (prevRelativeFrom === ObjectRelativeFromV.PARAGRAPH)
|
|
3459
|
+
continue;
|
|
3460
|
+
const { startIndex } = customBlock, glyph = skeleton.findNodeByCharIndex(startIndex, segmentId, segmentPage), line = (_d = glyph == null ? void 0 : glyph.parent) == null ? void 0 : _d.parent, column = line == null ? void 0 : line.parent, paragraphStartLine = column == null ? void 0 : column.lines.find((l2) => l2.paragraphIndex === (line == null ? void 0 : line.paragraphIndex) && l2.paragraphStart), page = (_e = column == null ? void 0 : column.parent) == null ? void 0 : _e.parent;
|
|
3461
|
+
if (glyph == null || line == null || paragraphStartLine == null || column == null || page == null)
|
|
3462
|
+
continue;
|
|
3463
|
+
let delta = 0;
|
|
3464
|
+
prevRelativeFrom === ObjectRelativeFromV.LINE ? delta -= line.top : prevRelativeFrom === ObjectRelativeFromV.PAGE && (delta += page.marginTop), delta += paragraphStartLine.top;
|
|
3465
|
+
const newPositionV = {
|
|
3466
|
+
...drawingPositionV,
|
|
3467
|
+
relativeFrom: ObjectRelativeFromV.PARAGRAPH,
|
|
3468
|
+
posOffset: (prevPosOffset != null ? prevPosOffset : 0) - delta
|
|
3469
|
+
}, updateDrawingAction = jsonX.replaceOp(["drawings", drawingId, "docTransform", "positionV"], drawingPositionV, newPositionV);
|
|
3470
|
+
updateDrawingAction && rawActions.push(updateDrawingAction);
|
|
3471
|
+
}
|
|
3472
|
+
}
|
|
3473
|
+
return doMutation.params.actions = rawActions.reduce((acc, cur) => JSONX.compose(acc, cur), null), !!commandService.syncExecuteCommand(doMutation.id, doMutation.params);
|
|
3474
|
+
}, "handler")
|
|
3475
|
+
}, COMPONENT_DOC_HEADER_FOOTER_PANEL = "COMPONENT_DOC_HEADER_FOOTER_PANEL", panel = "univer-panel", optionsSection = "univer-options-section", optionsFormItem = "univer-options-form-item", optionsInput = "univer-options-input", optionsMarginSetting = "univer-options-margin-setting", styles$5 = {
|
|
3427
3476
|
panel,
|
|
3428
3477
|
optionsSection,
|
|
3429
3478
|
optionsFormItem,
|
|
@@ -3436,7 +3485,7 @@ function getSegmentId(documentStyle, editArea, pageIndex) {
|
|
|
3436
3485
|
}
|
|
3437
3486
|
__name(getSegmentId, "getSegmentId");
|
|
3438
3487
|
const DocHeaderFooterOptions = /* @__PURE__ */ __name((props) => {
|
|
3439
|
-
const localeService = useDependency(LocaleService), univerInstanceService = useDependency(IUniverInstanceService), renderManagerService = useDependency(IRenderManagerService), commandService = useDependency(ICommandService),
|
|
3488
|
+
const localeService = useDependency(LocaleService), univerInstanceService = useDependency(IUniverInstanceService), renderManagerService = useDependency(IRenderManagerService), commandService = useDependency(ICommandService), layoutService = useDependency(ILayoutService), { unitId } = props, docSelectionRenderService = renderManagerService.getRenderById(unitId).with(DocSelectionRenderService), [options, setOptions] = useState({}), handleCheckboxChange = /* @__PURE__ */ __name((val, type) => {
|
|
3440
3489
|
var _a28;
|
|
3441
3490
|
setOptions((prev) => ({
|
|
3442
3491
|
...prev,
|
|
@@ -3486,12 +3535,9 @@ const DocHeaderFooterOptions = /* @__PURE__ */ __name((props) => {
|
|
|
3486
3535
|
}
|
|
3487
3536
|
}), docSelectionRenderService.removeAllRanges(), docSelectionRenderService.blur();
|
|
3488
3537
|
}, "handleMarginChange"), closeHeaderFooter = /* @__PURE__ */ __name(() => {
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
return;
|
|
3493
|
-
const { scene } = renderObject, transformer = scene.getTransformerByCreate(), docSkeletonManagerService = renderObject.with(DocSkeletonManagerService), skeleton = docSkeletonManagerService == null ? void 0 : docSkeletonManagerService.getSkeleton(), viewModel = docSkeletonManagerService == null ? void 0 : docSkeletonManagerService.getViewModel(), render2 = renderManagerService.getRenderById(unitId);
|
|
3494
|
-
render2 == null || viewModel == null || skeleton == null || (docSelectionManagerService.replaceTextRanges([]), transformer.clearSelectedObjects(), docSelectionRenderService.setSegment(""), docSelectionRenderService.setSegmentPage(-1), viewModel.setEditArea(DocumentEditArea.BODY), skeleton.calculate(), (_a28 = render2.mainComponent) == null || _a28.makeDirty(!0));
|
|
3538
|
+
commandService.executeCommand(CloseHeaderFooterCommand.id, {
|
|
3539
|
+
unitId
|
|
3540
|
+
});
|
|
3495
3541
|
}, "closeHeaderFooter");
|
|
3496
3542
|
return useEffect(() => {
|
|
3497
3543
|
const docDataModel = univerInstanceService.getUniverDocInstance(unitId), documentStyle = docDataModel == null ? void 0 : docDataModel.getSnapshot().documentStyle;
|
|
@@ -3698,7 +3744,17 @@ let DocHeaderFooterController = (_a3 = class extends Disposable {
|
|
|
3698
3744
|
this._context = _context, this._commandService = _commandService, this._editorService = _editorService, this._instanceSrv = _instanceSrv, this._renderManagerService = _renderManagerService, this._docSkeletonManagerService = _docSkeletonManagerService, this._docSelectionRenderService = _docSelectionRenderService, this._localeService = _localeService, this._componentManager = _componentManager, this._initialize();
|
|
3699
3745
|
}
|
|
3700
3746
|
_initialize() {
|
|
3701
|
-
this.
|
|
3747
|
+
this._init(), this._drawHeaderFooterLabel(), this._initCustomComponents(), this._listenSwitchMode();
|
|
3748
|
+
}
|
|
3749
|
+
// Close header footer panel when switch mode.
|
|
3750
|
+
_listenSwitchMode() {
|
|
3751
|
+
this.disposeWithMe(
|
|
3752
|
+
this._commandService.beforeCommandExecuted((command) => {
|
|
3753
|
+
SwitchDocModeCommand.id === command.id && this._docSkeletonManagerService.getViewModel().getEditArea() !== DocumentEditArea.BODY && this._commandService.executeCommand(CloseHeaderFooterCommand.id, {
|
|
3754
|
+
unitId: this._context.unitId
|
|
3755
|
+
});
|
|
3756
|
+
})
|
|
3757
|
+
);
|
|
3702
3758
|
}
|
|
3703
3759
|
_initCustomComponents() {
|
|
3704
3760
|
const componentManager = this._componentManager;
|
|
@@ -3711,7 +3767,7 @@ let DocHeaderFooterController = (_a3 = class extends Disposable {
|
|
|
3711
3767
|
_initialMain(unitId) {
|
|
3712
3768
|
const docObject = neoGetDocObject(this._context), { document: document2 } = docObject;
|
|
3713
3769
|
this.disposeWithMe(document2.onDblclick$.subscribeEvent(async (evt) => {
|
|
3714
|
-
if (this._isEditorReadOnly(unitId))
|
|
3770
|
+
if (this._isEditorReadOnly(unitId) || !this._isTraditionalMode())
|
|
3715
3771
|
return;
|
|
3716
3772
|
const { offsetX, offsetY } = evt, {
|
|
3717
3773
|
pageLayoutType = PageLayoutType.VERTICAL,
|
|
@@ -3756,7 +3812,7 @@ let DocHeaderFooterController = (_a3 = class extends Disposable {
|
|
|
3756
3812
|
if (unitId == null)
|
|
3757
3813
|
return;
|
|
3758
3814
|
const currentRender = this._renderManagerService.getRenderById(unitId);
|
|
3759
|
-
if (this._editorService.isEditor(unitId) || this._instanceSrv.getUniverDocInstance(unitId) == null || currentRender == null)
|
|
3815
|
+
if (this._editorService.isEditor(unitId) || this._instanceSrv.getUniverDocInstance(unitId) == null || !this._isTraditionalMode() || currentRender == null)
|
|
3760
3816
|
return;
|
|
3761
3817
|
const { mainComponent } = currentRender, docsComponent = mainComponent;
|
|
3762
3818
|
this.disposeWithMe(
|
|
@@ -3824,6 +3880,9 @@ let DocHeaderFooterController = (_a3 = class extends Disposable {
|
|
|
3824
3880
|
const editor = this._editorService.getEditor(unitId);
|
|
3825
3881
|
return editor ? editor.isReadOnly() : !1;
|
|
3826
3882
|
}
|
|
3883
|
+
_isTraditionalMode() {
|
|
3884
|
+
return this._context.unit.getSnapshot().documentStyle.documentFlavor === DocumentFlavor.TRADITIONAL;
|
|
3885
|
+
}
|
|
3827
3886
|
_getDocDataModel() {
|
|
3828
3887
|
return this._context.unit;
|
|
3829
3888
|
}
|
|
@@ -3979,6 +4038,17 @@ const CoreHeaderFooterCommandId = "doc.command.core-header-footer", CoreHeaderFo
|
|
|
3979
4038
|
id: "doc.command.open-header-footer-panel",
|
|
3980
4039
|
type: CommandType.COMMAND,
|
|
3981
4040
|
handler: /* @__PURE__ */ __name(async (accessor, _params) => accessor.get(ICommandService).executeCommand(SidebarDocHeaderFooterPanelOperation.id, { value: "open" }), "handler")
|
|
4041
|
+
}, CloseHeaderFooterCommand = {
|
|
4042
|
+
id: "doc.command.close-header-footer",
|
|
4043
|
+
type: CommandType.COMMAND,
|
|
4044
|
+
handler: /* @__PURE__ */ __name(async (accessor, params) => {
|
|
4045
|
+
var _a28;
|
|
4046
|
+
const commandService = accessor.get(ICommandService), renderManagerService = accessor.get(IRenderManagerService), docSelectionManagerService = accessor.get(DocSelectionManagerService), { unitId } = params, renderObject = renderManagerService.getRenderById(unitId);
|
|
4047
|
+
if (renderObject == null)
|
|
4048
|
+
return !1;
|
|
4049
|
+
const { scene } = renderObject, transformer = scene.getTransformerByCreate(), docSkeletonManagerService = renderObject.with(DocSkeletonManagerService), docSelectionRenderService = renderObject.with(DocSelectionRenderService), skeleton = docSkeletonManagerService == null ? void 0 : docSkeletonManagerService.getSkeleton(), viewModel = docSkeletonManagerService == null ? void 0 : docSkeletonManagerService.getViewModel();
|
|
4050
|
+
return viewModel == null || skeleton == null ? !1 : (docSelectionManagerService.replaceTextRanges([]), transformer.clearSelectedObjects(), docSelectionRenderService.setSegment(""), docSelectionRenderService.setSegmentPage(-1), viewModel.setEditArea(DocumentEditArea.BODY), skeleton.calculate(), (_a28 = renderObject.mainComponent) == null || _a28.makeDirty(!0), commandService.executeCommand(SidebarDocHeaderFooterPanelOperation.id, { value: "close" }));
|
|
4051
|
+
}, "handler")
|
|
3982
4052
|
}, COMPONENT_PREFIX = "UI_PLUGIN_DOCS", COLOR_PICKER_COMPONENT = `${COMPONENT_PREFIX}_COLOR_PICKER_COMPONENT`, FONT_FAMILY_COMPONENT = `${COMPONENT_PREFIX}_FONT_FAMILY_COMPONENT`, FONT_FAMILY_ITEM_COMPONENT = `${COMPONENT_PREFIX}_FONT_FAMILY_ITEM_COMPONENT`, FONT_SIZE_COMPONENT = `${COMPONENT_PREFIX}_FONT_SIZE_COMPONENT`, docListTypePicker = "univer-doc-list-type-picker", docListTypePickerItem = "univer-doc-list-type-picker-item", docListTypePickerItemActive = "univer-doc-list-type-picker-item-active", styles$4 = {
|
|
3983
4053
|
docListTypePicker,
|
|
3984
4054
|
docListTypePickerItem,
|
|
@@ -7767,6 +7837,38 @@ function getInsertTableHiddenObservable(accessor) {
|
|
|
7767
7837
|
});
|
|
7768
7838
|
}
|
|
7769
7839
|
__name(getInsertTableHiddenObservable, "getInsertTableHiddenObservable");
|
|
7840
|
+
function getHeaderFooterDisabledObservable(accessor) {
|
|
7841
|
+
const univerInstanceService = accessor.get(IUniverInstanceService), commandService = accessor.get(ICommandService);
|
|
7842
|
+
return new Observable((subscriber) => {
|
|
7843
|
+
const subscription0 = commandService.onCommandExecuted((command) => {
|
|
7844
|
+
if (command.id === SwitchDocModeCommand.id) {
|
|
7845
|
+
const docDataModel = univerInstanceService.getCurrentUniverDocInstance();
|
|
7846
|
+
if (docDataModel == null) {
|
|
7847
|
+
subscriber.next(!0);
|
|
7848
|
+
return;
|
|
7849
|
+
}
|
|
7850
|
+
const documentStyle = docDataModel.getSnapshot().documentStyle;
|
|
7851
|
+
subscriber.next((documentStyle == null ? void 0 : documentStyle.documentFlavor) !== DocumentFlavor.TRADITIONAL);
|
|
7852
|
+
}
|
|
7853
|
+
}), subscription = univerInstanceService.focused$.subscribe((unitId) => {
|
|
7854
|
+
var _a28;
|
|
7855
|
+
if (unitId == null) {
|
|
7856
|
+
subscriber.next(!0);
|
|
7857
|
+
return;
|
|
7858
|
+
}
|
|
7859
|
+
const docDataModel = univerInstanceService.getUnit(unitId);
|
|
7860
|
+
if (docDataModel == null) {
|
|
7861
|
+
subscriber.next(!0);
|
|
7862
|
+
return;
|
|
7863
|
+
}
|
|
7864
|
+
return subscriber.next(((_a28 = docDataModel.getSnapshot().documentStyle) == null ? void 0 : _a28.documentFlavor) !== DocumentFlavor.TRADITIONAL);
|
|
7865
|
+
});
|
|
7866
|
+
return () => {
|
|
7867
|
+
subscription.unsubscribe(), subscription0.dispose();
|
|
7868
|
+
};
|
|
7869
|
+
});
|
|
7870
|
+
}
|
|
7871
|
+
__name(getHeaderFooterDisabledObservable, "getHeaderFooterDisabledObservable");
|
|
7770
7872
|
function getTableDisabledObservable(accessor) {
|
|
7771
7873
|
const docSelectionManagerService = accessor.get(DocSelectionManagerService), univerInstanceService = accessor.get(IUniverInstanceService);
|
|
7772
7874
|
return new Observable((subscriber) => {
|
|
@@ -8112,6 +8214,7 @@ function HeaderFooterMenuItemFactory(accessor) {
|
|
|
8112
8214
|
type: MenuItemType.BUTTON,
|
|
8113
8215
|
icon: "HeaderFooterSingle",
|
|
8114
8216
|
tooltip: "toolbar.headerFooter",
|
|
8217
|
+
disabled$: getHeaderFooterDisabledObservable(accessor),
|
|
8115
8218
|
hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), getHeaderFooterMenuHiddenObservable(accessor), (one, two) => one || two)
|
|
8116
8219
|
};
|
|
8117
8220
|
}
|
|
@@ -8324,6 +8427,28 @@ function CheckListMenuItemFactory(accessor) {
|
|
|
8324
8427
|
};
|
|
8325
8428
|
}
|
|
8326
8429
|
__name(CheckListMenuItemFactory, "CheckListMenuItemFactory");
|
|
8430
|
+
function DocSwitchModeMenuItemFactory(accessor) {
|
|
8431
|
+
const commandService = accessor.get(ICommandService), univerInstanceService = accessor.get(IUniverInstanceService);
|
|
8432
|
+
return {
|
|
8433
|
+
id: SwitchDocModeCommand.id,
|
|
8434
|
+
type: MenuItemType.BUTTON,
|
|
8435
|
+
icon: "KeyboardSingle",
|
|
8436
|
+
tooltip: "toolbar.documentFlavor",
|
|
8437
|
+
hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, void 0, DOCS_ZEN_EDITOR_UNIT_ID_KEY),
|
|
8438
|
+
activated$: new Observable((subscriber) => {
|
|
8439
|
+
var _a28;
|
|
8440
|
+
const subscription = commandService.onCommandExecuted((c) => {
|
|
8441
|
+
var _a29;
|
|
8442
|
+
if (c.id === SwitchDocModeCommand.id) {
|
|
8443
|
+
const instance2 = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
|
|
8444
|
+
subscriber.next(((_a29 = instance2 == null ? void 0 : instance2.getSnapshot()) == null ? void 0 : _a29.documentStyle.documentFlavor) === DocumentFlavor.MODERN);
|
|
8445
|
+
}
|
|
8446
|
+
}), instance = univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC);
|
|
8447
|
+
return subscriber.next(((_a28 = instance == null ? void 0 : instance.getSnapshot()) == null ? void 0 : _a28.documentStyle.documentFlavor) === DocumentFlavor.MODERN), () => subscription.dispose();
|
|
8448
|
+
})
|
|
8449
|
+
};
|
|
8450
|
+
}
|
|
8451
|
+
__name(DocSwitchModeMenuItemFactory, "DocSwitchModeMenuItemFactory");
|
|
8327
8452
|
function ResetBackgroundColorMenuItemFactory(accessor) {
|
|
8328
8453
|
return {
|
|
8329
8454
|
id: ResetInlineFormatTextBackgroundColorCommand.id,
|
|
@@ -8486,6 +8611,10 @@ const menuSchema = {
|
|
|
8486
8611
|
[OpenHeaderFooterPanelCommand.id]: {
|
|
8487
8612
|
order: 9,
|
|
8488
8613
|
menuItemFactory: HeaderFooterMenuItemFactory
|
|
8614
|
+
},
|
|
8615
|
+
[SwitchDocModeCommand.id]: {
|
|
8616
|
+
order: 10,
|
|
8617
|
+
menuItemFactory: DocSwitchModeMenuItemFactory
|
|
8489
8618
|
}
|
|
8490
8619
|
},
|
|
8491
8620
|
[ContextMenuPosition.MAIN_AREA]: {
|
|
@@ -8687,8 +8816,8 @@ var __defProp$j = Object.defineProperty, __getOwnPropDesc$j = Object.getOwnPrope
|
|
|
8687
8816
|
return kind && result && __defProp$j(target, key, result), result;
|
|
8688
8817
|
}, "__decorateClass$j"), __decorateParam$j = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$j"), _a8;
|
|
8689
8818
|
let DocRenderController = (_a8 = class extends RxDisposable {
|
|
8690
|
-
constructor(_context,
|
|
8691
|
-
super(), this._context = _context, this.
|
|
8819
|
+
constructor(_context, _commandService, _docSelectionRenderService, _docSkeletonManagerService, _editorService, _renderManagerService, _univerInstanceService) {
|
|
8820
|
+
super(), this._context = _context, this._commandService = _commandService, this._docSelectionRenderService = _docSelectionRenderService, this._docSkeletonManagerService = _docSkeletonManagerService, this._editorService = _editorService, this._renderManagerService = _renderManagerService, this._univerInstanceService = _univerInstanceService, this._addNewRender(), this._initRenderRefresh(), this._initCommandListener();
|
|
8692
8821
|
}
|
|
8693
8822
|
reRender(unitId) {
|
|
8694
8823
|
var _a28, _b2;
|
|
@@ -8733,8 +8862,8 @@ let DocRenderController = (_a8 = class extends RxDisposable {
|
|
|
8733
8862
|
}
|
|
8734
8863
|
_addComponent() {
|
|
8735
8864
|
const { scene, unit: documentModel, components } = this._context, config = {
|
|
8736
|
-
pageMarginLeft:
|
|
8737
|
-
pageMarginTop:
|
|
8865
|
+
pageMarginLeft: 20,
|
|
8866
|
+
pageMarginTop: 20
|
|
8738
8867
|
}, documents = new Documents(DOCS_VIEW_KEY.MAIN, void 0, config);
|
|
8739
8868
|
documents.zIndex = DOCS_COMPONENT_DEFAULT_Z_INDEX;
|
|
8740
8869
|
const docBackground = new DocBackground(DOCS_VIEW_KEY.BACKGROUND, void 0, config);
|
|
@@ -8766,9 +8895,11 @@ let DocRenderController = (_a8 = class extends RxDisposable {
|
|
|
8766
8895
|
if (pages == null)
|
|
8767
8896
|
return;
|
|
8768
8897
|
let width = 0, height = 0;
|
|
8898
|
+
const documentFlavor = this._context.unit.getSnapshot().documentStyle.documentFlavor;
|
|
8769
8899
|
for (let i = 0, len = pages.length; i < len; i++) {
|
|
8770
|
-
const page = pages[i]
|
|
8771
|
-
|
|
8900
|
+
const page = pages[i];
|
|
8901
|
+
let { pageWidth, pageHeight, marginLeft, marginRight, marginTop, marginBottom } = page;
|
|
8902
|
+
documentFlavor === DocumentFlavor.MODERN && (pageWidth === Number.POSITIVE_INFINITY && (pageWidth = page.width + marginLeft + marginRight), pageHeight === Number.POSITIVE_INFINITY && (pageHeight = page.height + marginTop + marginBottom)), 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));
|
|
8772
8903
|
}
|
|
8773
8904
|
docsComponent.resize(width, height), docBackground.resize(width, height);
|
|
8774
8905
|
const editor = this._editorService.getEditor(unitId);
|
|
@@ -8776,13 +8907,12 @@ let DocRenderController = (_a8 = class extends RxDisposable {
|
|
|
8776
8907
|
}
|
|
8777
8908
|
}, __name(_a8, "DocRenderController"), _a8);
|
|
8778
8909
|
DocRenderController = __decorateClass$j([
|
|
8779
|
-
__decorateParam$j(1,
|
|
8780
|
-
__decorateParam$j(2,
|
|
8781
|
-
__decorateParam$j(3, Inject(
|
|
8782
|
-
__decorateParam$j(4,
|
|
8783
|
-
__decorateParam$j(5,
|
|
8784
|
-
__decorateParam$j(6,
|
|
8785
|
-
__decorateParam$j(7, IUniverInstanceService)
|
|
8910
|
+
__decorateParam$j(1, ICommandService),
|
|
8911
|
+
__decorateParam$j(2, Inject(DocSelectionRenderService)),
|
|
8912
|
+
__decorateParam$j(3, Inject(DocSkeletonManagerService)),
|
|
8913
|
+
__decorateParam$j(4, IEditorService),
|
|
8914
|
+
__decorateParam$j(5, IRenderManagerService),
|
|
8915
|
+
__decorateParam$j(6, IUniverInstanceService)
|
|
8786
8916
|
], DocRenderController);
|
|
8787
8917
|
const _DocIMEInputManagerService = class _DocIMEInputManagerService extends RxDisposable {
|
|
8788
8918
|
constructor(_context) {
|
|
@@ -10441,8 +10571,8 @@ const _DocPageLayoutService = class _DocPageLayoutService extends Disposable {
|
|
|
10441
10571
|
if (parent == null || docsWidth === Number.POSITIVE_INFINITY || docsHeight === Number.POSITIVE_INFINITY)
|
|
10442
10572
|
return;
|
|
10443
10573
|
const { width: engineWidth, height: engineHeight } = parent;
|
|
10444
|
-
let docsLeft = 0, docsTop =
|
|
10445
|
-
engineWidth > (docsWidth + pageMarginLeft * 2) * zoomRatio ? (docsLeft = engineWidth / 2 - docsWidth * zoomRatio / 2, docsLeft /= zoomRatio, sceneWidth = (engineWidth - pageMarginLeft * 2) / zoomRatio, scrollToX = 0) : (docsLeft = pageMarginLeft, sceneWidth = docsWidth + pageMarginLeft * 2, scrollToX = (sceneWidth - engineWidth / zoomRatio) / 2), engineHeight > docsHeight ?
|
|
10574
|
+
let docsLeft = 0, docsTop = pageMarginTop, sceneWidth = 0, sceneHeight = 0, scrollToX = Number.POSITIVE_INFINITY;
|
|
10575
|
+
engineWidth > (docsWidth + pageMarginLeft * 2) * zoomRatio ? (docsLeft = engineWidth / 2 - docsWidth * zoomRatio / 2, docsLeft /= zoomRatio, sceneWidth = (engineWidth - pageMarginLeft * 2) / zoomRatio, scrollToX = 0) : (docsLeft = pageMarginLeft, sceneWidth = docsWidth + pageMarginLeft * 2, scrollToX = (sceneWidth - engineWidth / zoomRatio) / 2), engineHeight > docsHeight ? sceneHeight = (engineHeight - pageMarginTop * 2) / zoomRatio : sceneHeight = docsHeight + pageMarginTop * 2, scene.resize(sceneWidth, sceneHeight), engineWidth <= 1 && (docsLeft = -1e4, docsTop = -1e4), docsComponent.translate(docsLeft, docsTop), docBackground.translate(docsLeft, docsTop);
|
|
10446
10576
|
const viewport = scene.getViewport(VIEWPORT_KEY.VIEW_MAIN);
|
|
10447
10577
|
return scrollToX !== Number.POSITIVE_INFINITY && viewport != null && viewport.scrollToViewportPos({
|
|
10448
10578
|
viewportScrollX: scrollToX
|
|
@@ -10625,6 +10755,9 @@ let DocZoomRenderController = (_a24 = class extends Disposable {
|
|
|
10625
10755
|
const documentModel = this._univerInstanceService.getCurrentUniverDocInstance();
|
|
10626
10756
|
if (!documentModel)
|
|
10627
10757
|
return;
|
|
10758
|
+
const { documentFlavor } = documentModel.getSnapshot().documentStyle;
|
|
10759
|
+
if (documentFlavor === DocumentFlavor.MODERN)
|
|
10760
|
+
return;
|
|
10628
10761
|
const deltaFactor = Math.abs(e.deltaX);
|
|
10629
10762
|
let ratioDelta = deltaFactor < 40 ? 0.2 : deltaFactor < 80 ? 0.4 : 0.2;
|
|
10630
10763
|
ratioDelta *= e.deltaY > 0 ? -1 : 1, scene.scaleX < 1 && (ratioDelta /= 2);
|
|
@@ -10654,12 +10787,19 @@ let DocZoomRenderController = (_a24 = class extends Disposable {
|
|
|
10654
10787
|
const zoomRatio = this._context.unit.zoomRatio || 1;
|
|
10655
10788
|
this.updateViewZoom(zoomRatio);
|
|
10656
10789
|
}
|
|
10657
|
-
}))
|
|
10790
|
+
})), this.disposeWithMe(
|
|
10791
|
+
this._commandService.beforeCommandExecuted((command) => {
|
|
10792
|
+
command.id === SwitchDocModeCommand.id && this._commandService.executeCommand(SetDocZoomRatioCommand.id, {
|
|
10793
|
+
zoomRatio: 1,
|
|
10794
|
+
unitId: this._context.unitId
|
|
10795
|
+
});
|
|
10796
|
+
})
|
|
10797
|
+
);
|
|
10658
10798
|
}
|
|
10659
10799
|
updateViewZoom(zoomRatio, needRefreshSelection = !0) {
|
|
10660
10800
|
var _a28;
|
|
10661
10801
|
const docObject = neoGetDocObject(this._context);
|
|
10662
|
-
docObject.scene.scale(zoomRatio, zoomRatio), this._docPageLayoutService.calculatePagePosition(), needRefreshSelection && !this._editorService.isEditor(this._context.unitId) && this._textSelectionManagerService.refreshSelection(), (_a28 = docObject.scene.getTransformer()) == null || _a28.clearSelectedObjects();
|
|
10802
|
+
docObject.scene.scale(zoomRatio, zoomRatio), this._editorService.isEditor(this._context.unitId) || this._docPageLayoutService.calculatePagePosition(), needRefreshSelection && !this._editorService.isEditor(this._context.unitId) && this._textSelectionManagerService.refreshSelection(), (_a28 = docObject.scene.getTransformer()) == null || _a28.clearSelectedObjects();
|
|
10663
10803
|
}
|
|
10664
10804
|
}, __name(_a24, "DocZoomRenderController"), _a24);
|
|
10665
10805
|
DocZoomRenderController = __decorateClass$3([
|
|
@@ -10712,7 +10852,7 @@ let DocStateChangeManagerService = (_a25 = class extends RxDisposable {
|
|
|
10712
10852
|
var _a28;
|
|
10713
10853
|
if (changeStateInfo == null)
|
|
10714
10854
|
return;
|
|
10715
|
-
const { isCompositionEnd, ...changeState } = changeStateInfo, imeInputManagerService = (_a28 = this._renderManagerService.getRenderById(changeStateInfo.unitId)) == null ? void 0 : _a28.with(DocIMEInputManagerService);
|
|
10855
|
+
const { isCompositionEnd, isSync, syncer, ...changeState } = changeStateInfo, imeInputManagerService = (_a28 = this._renderManagerService.getRenderById(isSync ? syncer : changeStateInfo.unitId)) == null ? void 0 : _a28.with(DocIMEInputManagerService);
|
|
10716
10856
|
if (imeInputManagerService != null) {
|
|
10717
10857
|
if (isCompositionEnd) {
|
|
10718
10858
|
const historyParams = imeInputManagerService.fetchComposedUndoRedoMutationParams();
|
|
@@ -10798,7 +10938,9 @@ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPrope
|
|
|
10798
10938
|
for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10799
10939
|
(decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
|
|
10800
10940
|
return kind && result && __defProp$1(target, key, result), result;
|
|
10801
|
-
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1")
|
|
10941
|
+
}, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
|
|
10942
|
+
const DOC_MAIN_CANVAS_ID = "univer-doc-main-canvas";
|
|
10943
|
+
var _a26;
|
|
10802
10944
|
let DocsRenderService = (_a26 = class extends RxDisposable {
|
|
10803
10945
|
constructor(_instanceSrv, _renderManagerService) {
|
|
10804
10946
|
super(), this._instanceSrv = _instanceSrv, this._renderManagerService = _renderManagerService, this._init();
|
|
@@ -10807,8 +10949,11 @@ let DocsRenderService = (_a26 = class extends RxDisposable {
|
|
|
10807
10949
|
this._renderManagerService.createRender$.pipe(takeUntil(this.dispose$)).subscribe((unitId) => this._createRenderWithId(unitId)), this._instanceSrv.getAllUnitsForType(UniverInstanceType.UNIVER_DOC).forEach((documentModel) => this._createRenderer(documentModel)), this._instanceSrv.getTypeOfUnitAdded$(UniverInstanceType.UNIVER_DOC).pipe(takeUntil(this.dispose$)).subscribe((doc) => this._createRenderer(doc)), this._instanceSrv.getTypeOfUnitDisposed$(UniverInstanceType.UNIVER_DOC).pipe(takeUntil(this.dispose$)).subscribe((doc) => this._disposeRenderer(doc));
|
|
10808
10950
|
}
|
|
10809
10951
|
_createRenderer(doc) {
|
|
10810
|
-
|
|
10811
|
-
|
|
10952
|
+
var _a28;
|
|
10953
|
+
const unitId = doc.getUnitId(), workbookId = (_a28 = this._instanceSrv.getCurrentUnitForType(UniverInstanceType.UNIVER_DOC)) == null ? void 0 : _a28.getUnitId();
|
|
10954
|
+
this._renderManagerService.created$.subscribe((renderer) => {
|
|
10955
|
+
renderer.unitId === workbookId && (renderer.engine.getCanvas().setId(DOC_MAIN_CANVAS_ID), renderer.engine.getCanvas().getContext().setId(DOC_MAIN_CANVAS_ID));
|
|
10956
|
+
}), this._renderManagerService.has(unitId) || (this._createRenderWithId(unitId), this._renderManagerService.setCurrent(unitId));
|
|
10812
10957
|
}
|
|
10813
10958
|
_createRenderWithId(unitId) {
|
|
10814
10959
|
this._renderManagerService.createRender(unitId);
|
|
@@ -10965,6 +11110,7 @@ let UniverDocsUIPlugin = (_a27 = class extends Plugin {
|
|
|
10965
11110
|
DocTableDeleteRowsCommand,
|
|
10966
11111
|
DocTableDeleteColumnsCommand,
|
|
10967
11112
|
DocTableDeleteTableCommand,
|
|
11113
|
+
CloseHeaderFooterCommand,
|
|
10968
11114
|
DocTableTabCommand,
|
|
10969
11115
|
TabCommand,
|
|
10970
11116
|
AfterSpaceCommand,
|
|
@@ -10975,6 +11121,7 @@ let UniverDocsUIPlugin = (_a27 = class extends Plugin {
|
|
|
10975
11121
|
ToggleCheckListCommand,
|
|
10976
11122
|
QuickListCommand,
|
|
10977
11123
|
IMEInputCommand,
|
|
11124
|
+
SwitchDocModeCommand,
|
|
10978
11125
|
DocParagraphSettingCommand,
|
|
10979
11126
|
InnerPasteCommand,
|
|
10980
11127
|
CutContentCommand,
|
package/lib/locale/en-US.json
CHANGED
package/lib/locale/fa-IR.json
CHANGED
package/lib/locale/ru-RU.json
CHANGED
|
@@ -32,7 +32,8 @@
|
|
|
32
32
|
"alignRight": "Выровнять по правому краю",
|
|
33
33
|
"alignJustify": "Выровнять по ширине",
|
|
34
34
|
"headerFooter": "Header & Footer",
|
|
35
|
-
"checklist": "Task list"
|
|
35
|
+
"checklist": "Task list",
|
|
36
|
+
"documentFlavor": "Modern Mode"
|
|
36
37
|
},
|
|
37
38
|
"table": {
|
|
38
39
|
"insert": "Insert",
|
package/lib/locale/vi-VN.json
CHANGED
package/lib/locale/zh-CN.json
CHANGED
package/lib/locale/zh-TW.json
CHANGED
|
@@ -20,4 +20,8 @@ export declare const CoreHeaderFooterCommand: ICommand<ICoreHeaderFooterParams>;
|
|
|
20
20
|
interface IOpenHeaderFooterPanelParams {
|
|
21
21
|
}
|
|
22
22
|
export declare const OpenHeaderFooterPanelCommand: ICommand<IOpenHeaderFooterPanelParams>;
|
|
23
|
+
interface ICloseHeaderFooterParams {
|
|
24
|
+
unitId: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const CloseHeaderFooterCommand: ICommand<ICloseHeaderFooterParams>;
|
|
23
27
|
export {};
|
|
@@ -25,11 +25,13 @@ export declare class DocHeaderFooterController extends Disposable implements IRe
|
|
|
25
25
|
private _loadedMap;
|
|
26
26
|
constructor(_context: IRenderContext<DocumentDataModel>, _commandService: ICommandService, _editorService: IEditorService, _instanceSrv: IUniverInstanceService, _renderManagerService: IRenderManagerService, _docSkeletonManagerService: DocSkeletonManagerService, _docSelectionRenderService: DocSelectionRenderService, _localeService: LocaleService, _componentManager: ComponentManager);
|
|
27
27
|
private _initialize;
|
|
28
|
+
private _listenSwitchMode;
|
|
28
29
|
private _initCustomComponents;
|
|
29
30
|
private _init;
|
|
30
31
|
private _initialMain;
|
|
31
32
|
private _getTransformCoordForDocumentOffset;
|
|
32
33
|
private _drawHeaderFooterLabel;
|
|
33
34
|
private _isEditorReadOnly;
|
|
35
|
+
private _isTraditionalMode;
|
|
34
36
|
private _getDocDataModel;
|
|
35
37
|
}
|
|
@@ -21,5 +21,6 @@ export declare function AlignJustifyMenuItemFactory(accessor: IAccessor): IMenuB
|
|
|
21
21
|
export declare function OrderListMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<PresetListType, PresetListType>;
|
|
22
22
|
export declare function BulletListMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<PresetListType, PresetListType>;
|
|
23
23
|
export declare function CheckListMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
24
|
+
export declare function DocSwitchModeMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
24
25
|
export declare function ResetBackgroundColorMenuItemFactory(accessor: IAccessor): IMenuButtonItem;
|
|
25
26
|
export declare function BackgroundColorSelectorMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<string>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { DocumentDataModel, ICommandService,
|
|
1
|
+
import { DocumentDataModel, ICommandService, IUniverInstanceService, RxDisposable } from '@univerjs/core';
|
|
2
2
|
import { IRenderContext, IRenderModule, IRenderManagerService } from '@univerjs/engine-render';
|
|
3
3
|
import { DocSkeletonManagerService } from '@univerjs/docs';
|
|
4
4
|
import { IEditorService } from '../../services/editor/editor-manager.service';
|
|
5
5
|
import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service';
|
|
6
6
|
export declare class DocRenderController extends RxDisposable implements IRenderModule {
|
|
7
7
|
private readonly _context;
|
|
8
|
-
private readonly _contextService;
|
|
9
8
|
private readonly _commandService;
|
|
10
9
|
private readonly _docSelectionRenderService;
|
|
11
10
|
private readonly _docSkeletonManagerService;
|
|
12
11
|
private readonly _editorService;
|
|
13
12
|
private readonly _renderManagerService;
|
|
14
13
|
private readonly _univerInstanceService;
|
|
15
|
-
constructor(_context: IRenderContext<DocumentDataModel>,
|
|
14
|
+
constructor(_context: IRenderContext<DocumentDataModel>, _commandService: ICommandService, _docSelectionRenderService: DocSelectionRenderService, _docSkeletonManagerService: DocSkeletonManagerService, _editorService: IEditorService, _renderManagerService: IRenderManagerService, _univerInstanceService: IUniverInstanceService);
|
|
16
15
|
reRender(unitId: string): void;
|
|
17
16
|
private _addNewRender;
|
|
18
17
|
private _addComponent;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Disposable, ICommandService, IContextService, IUniverInstanceService
|
|
2
|
-
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
|
|
1
|
+
import { DocumentDataModel, Disposable, ICommandService, IContextService, IUniverInstanceService } from '@univerjs/core';
|
|
3
2
|
import { IRenderContext, IRenderModule } from '@univerjs/engine-render';
|
|
3
|
+
import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';
|
|
4
4
|
import { DocPageLayoutService } from '../../services/doc-page-layout.service';
|
|
5
5
|
import { IEditorService } from '../../services/editor/editor-manager.service';
|
|
6
6
|
export declare class DocZoomRenderController extends Disposable implements IRenderModule {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DocSelectionManagerService } from '@univerjs/docs';
|
|
1
|
+
import { DocumentDataModel, ICommandInfo, ICustomRange, IDisposable, IParagraphRange, Nullable, Disposable, IUniverInstanceService } from '@univerjs/core';
|
|
3
2
|
import { ITextRangeWithStyle } from '@univerjs/engine-render';
|
|
3
|
+
import { DocSelectionManagerService } from '@univerjs/docs';
|
|
4
4
|
export interface IAutoFormatContext {
|
|
5
5
|
unit: DocumentDataModel;
|
|
6
6
|
selection: ITextRangeWithStyle;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DOC_RANGE_TYPE, RANGE_DIRECTION
|
|
2
|
-
import {
|
|
1
|
+
import { Nullable, DOC_RANGE_TYPE, RANGE_DIRECTION } from '@univerjs/core';
|
|
2
|
+
import { Documents, DocumentSkeleton, INodePosition, IPoint, ISuccinctDocRangeParam, ITextSelectionStyle, Scene, ThinScene, Rect } from '@univerjs/engine-render';
|
|
3
3
|
import { IDocRange } from './range-interface';
|
|
4
4
|
export declare const TEXT_RANGE_LAYER_INDEX = 3;
|
|
5
5
|
export declare function cursorConvertToTextRange(scene: Scene, range: ISuccinctDocRangeParam, docSkeleton: DocumentSkeleton, document: Documents): Nullable<TextRange>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { default as React, Component } from 'react';
|
|
2
1
|
import { IUniverDocsUIConfig } from '../../controllers/config.schema';
|
|
2
|
+
import { default as React, Component } from 'react';
|
|
3
3
|
interface IBaseDocContainerProps {
|
|
4
4
|
config: IUniverDocsUIConfig;
|
|
5
5
|
changeLocale: (locale: string) => void;
|