Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
refactor: remove sheets zen editor (#7032)
白熱874bc57cb0b5
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERSdeleted file mode 100644index a1d27d5029..0000000000--- a/.github/CODEOWNERS+++ /dev/null@@ -1,94 +0,0 @@-# CODEOWNERS--## project--.github @jikkai @hexf00--common @jikkai--**/package.json @jikkai--## documentation--docs @jikkai--CONTRIBUTING.md @jikkai--## core & fundamental--packages/core @jikkai-packages/core/src/services/resource-loader @VicKun4937-packages/core/src/services/resource-manager @VicKun4937-packages/core/src/services/permission @VicKun4937-packages/design @jikkai-packages/drawing @weird94-packages/drawing-ui @weird94-packages/engine-formula @Dushusir @wpxp123456-packages/engine-render @Jocs-packages/engine-render/components/docs @Jocs-packages/find-replace @siam-ese-packages/network @jikkai-packages/rpc @jikkai-packages/rpc-node @jikkai-packages/thread-comment @weird94-packages/thread-comment-ui @weird94-packages/ui @jikkai-packages/ui/src/services/clipboard @ybzky-packages/ui/src/services/popup/canvas-popup.service.ts @weird94-packages/uniscript @jikkai-packages/watermark @ybzky--## sheets--packages/data-validation @weird94-packages/sheets-data-validation @weird94-packages/sheets @VicKun4937-packages/sheets-conditional-formatting @VicKun4937-packages/sheets-conditional-formatting-ui @VicKun4937-packages/sheets-filter @ybzky-packages/sheets-filter-ui @ybzky-packages/sheets-find-replace @siam-ese-packages/sheets-formula @DR-Univer @wpxp123456 @Dushusir-packages/sheets-formula-ui @DR-Univer @wpxp123456 @Dushusir-packages/sheets-graphics @ybzky-packages/sheets-hyper-link @weird94-packages/sheets-hyper-link-ui @weird94-packages/sheets-numfmt @VicKun4937-packages/sheets-numfmt-ui @VicKun4937-packages/sheets-thread-comment @weird94-packages/sheets-thread-comment-ui @weird94-packages/sheets-ui @jikkai-packages/sheets-ui/src/controllers/clipboard @ybzky-packages/sheets-ui/src/controllers/editor @Jocs-packages/sheets-ui/src/services/clipboard @ybzky-packages/sheets-ui/src/services/editor @Jocs-packages/sheets-ui/src/services/editor-bridge.service.ts @Jocs-packages/sheets-zen-editor @Jocs-packages/sheets/src/services/numfmt @VicKun4937-packages/sheets/src/services/ref-range @VicKun4937-packages/sheets/src/services/ref-range @weird94-packages/sheets/src/services/sheet-interceptor @VicKun4937--## docs--packages/docs @Jocs-packages/docs-drawing @weird94-packages/docs-drawing-ui @weird94-packages/docs-hyper-link @weird94-packages/docs-hyper-link-ui @weird94-packages/docs-mention-ui @weird94-packages/docs-thread-comment-ui @weird94-packages/docs-ui @jikkai @Jocs--## slides--packages/slides @jikkai-packages/slides-ui @jikkai--## Facade API--**/facade/** @weird94 @VicKun4937--## Collaboration--**/mutations/** @ybzkydiff --git a/common/mockdata/package.json b/common/mockdata/package.jsonindex 78718a8985..bb71dfdd53 100644--- a/common/mockdata/package.json+++ b/common/mockdata/package.json@@ -66,7 +66,6 @@"@univerjs/sheets-thread-comment": "workspace:*","@univerjs/sheets-thread-comment-ui": "workspace:*","@univerjs/sheets-ui": "workspace:*",- "@univerjs/sheets-zen-editor": "workspace:*","@univerjs/slides": "workspace:*","@univerjs/slides-ui": "workspace:*","@univerjs/thread-comment": "workspace:*",diff --git a/common/mockdata/src/sheets/demo/default-workbook-data-demo.ts b/common/mockdata/src/sheets/demo/default-workbook-data-demo.tsindex 73eb28f8df..4a27203d1a 100644--- a/common/mockdata/src/sheets/demo/default-workbook-data-demo.ts+++ b/common/mockdata/src/sheets/demo/default-workbook-data-demo.ts@@ -14408,7 +14408,7 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {25: {10: {p: {- id: '__INTERNAL_EDITOR__ZEN_EDITOR',+ id: '__INTERNAL_EDITOR__DOCS_NORMAL',documentStyle: {pageSize: {width: 37.2261962890625,@@ -14461,7 +14461,7 @@ export const DEFAULT_WORKBOOK_DATA_DEMO: IWorkbookData = {},11: {p: {- id: '__INTERNAL_EDITOR__ZEN_EDITOR',+ id: '__INTERNAL_EDITOR__DOCS_NORMAL',documentStyle: {pageSize: {width: 37.2261962890625,diff --git a/examples/package.json b/examples/package.jsonindex e0ed8e38a0..98bc33bae5 100644--- a/examples/package.json+++ b/examples/package.json@@ -69,7 +69,6 @@"@univerjs/sheets-thread-comment": "workspace:*","@univerjs/sheets-thread-comment-ui": "workspace:*","@univerjs/sheets-ui": "workspace:*",- "@univerjs/sheets-zen-editor": "workspace:*","@univerjs/slides": "workspace:*","@univerjs/slides-ui": "workspace:*","@univerjs/themes": "workspace:*",diff --git a/examples/src/sheets-multi-units/main.ts b/examples/src/sheets-multi-units/main.tsindex 34d2bf315e..f97adcaa32 100644--- a/examples/src/sheets-multi-units/main.ts+++ b/examples/src/sheets-multi-units/main.ts@@ -35,7 +35,6 @@ import { UniverSheetsSortPlugin } from '@univerjs/sheets-sort';import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';import { UniverSheetsThreadCommentUIPlugin } from '@univerjs/sheets-thread-comment-ui';import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';-import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';import { UniverThreadCommentUIPlugin } from '@univerjs/thread-comment-ui';import { UniverUIPlugin } from '@univerjs/ui';import { SwitchUnits } from './switch-units';@@ -54,7 +53,6 @@ import '@univerjs/sheets-conditional-formatting/facade';import '@univerjs/sheets-find-replace/facade';import '@univerjs/sheets-drawing/facade';import '@univerjs/sheets-drawing-ui/facade';-import '@univerjs/sheets-zen-editor/facade';import '@univerjs/sheets-crosshair-highlight/facade';import '@univerjs/sheets-sort/facade';import '../global.css';@@ -91,7 +89,6 @@ univer.registerPlugin(UniverDocsMentionUIPlugin);univer.registerPlugin(UniverSheetsPlugin);univer.registerPlugin(UniverSheetsUIPlugin);univer.registerPlugin(UniverSheetsNumfmtPlugin);-univer.registerPlugin(UniverSheetsZenEditorPlugin);univer.registerPlugin(UniverFormulaEnginePlugin);univer.registerPlugin(UniverSheetsNumfmtUIPlugin);univer.registerPlugin(UniverSheetsFormulaPlugin);diff --git a/examples/src/sheets-no-worker/main.ts b/examples/src/sheets-no-worker/main.tsindex a8288c320e..a084502a54 100644--- a/examples/src/sheets-no-worker/main.ts+++ b/examples/src/sheets-no-worker/main.ts@@ -37,7 +37,6 @@ import { UniverSheetsSortPlugin } from '@univerjs/sheets-sort';import { UniverSheetsTablePlugin } from '@univerjs/sheets-table';import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';-import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';import { UniverUIPlugin } from '@univerjs/ui';import '@univerjs/sheets/facade';@@ -54,7 +53,6 @@ import '@univerjs/sheets-conditional-formatting/facade';import '@univerjs/sheets-find-replace/facade';import '@univerjs/sheets-drawing/facade';import '@univerjs/sheets-drawing-ui/facade';-import '@univerjs/sheets-zen-editor/facade';import '@univerjs/sheets-crosshair-highlight/facade';import '@univerjs/sheets-formula-ui/facade';import '@univerjs/sheets-table/facade';@@ -106,7 +104,6 @@ function createNewInstance() {});univer.registerPlugin(UniverSheetsUIPlugin);univer.registerPlugin(UniverSheetsNumfmtPlugin);- univer.registerPlugin(UniverSheetsZenEditorPlugin);univer.registerPlugin(UniverFormulaEnginePlugin);univer.registerPlugin(UniverSheetsFormulaPlugin, { writeArrayFormulaToSnapshot: true });univer.registerPlugin(UniverSheetsDataValidationPlugin);diff --git a/examples/src/sheets-webcomponent/main.tsx b/examples/src/sheets-webcomponent/main.tsxindex 997c264271..def0385f6f 100644--- a/examples/src/sheets-webcomponent/main.tsx+++ b/examples/src/sheets-webcomponent/main.tsx@@ -51,7 +51,6 @@ import { UniverSheetsTableUIPlugin } from '@univerjs/sheets-table-ui';import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';import { UniverSheetsThreadCommentUIPlugin, UniverThreadCommentUIPlugin } from '@univerjs/sheets-thread-comment-ui';import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';-import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';import { UniverThreadCommentPlugin } from '@univerjs/thread-comment';import { UniverUIPlugin } from '@univerjs/ui';import { UniverVue3AdapterPlugin } from '@univerjs/ui-adapter-vue3';@@ -125,8 +124,6 @@ class MyWebComponent extends LitElement {univer.registerPlugin(UniverSheetsThreadCommentUIPlugin);// sheet find and replace pluginsuniver.registerPlugin(UniverSheetsFindReplacePlugin);- // zen editor plugin- univer.registerPlugin(UniverSheetsZenEditorPlugin);// crosshair highlight pluginuniver.registerPlugin(UniverSheetsCrosshairHighlightPlugin);// watermark plugindiff --git a/examples/src/sheets/main.ts b/examples/src/sheets/main.tsindex 46627b85d0..2dcce91bdd 100644--- a/examples/src/sheets/main.ts+++ b/examples/src/sheets/main.ts@@ -55,7 +55,6 @@ import { UniverSheetsSortPlugin } from '@univerjs/sheets-sort';import { UniverSheetsTablePlugin } from '@univerjs/sheets-table';import { UniverSheetsThreadCommentPlugin } from '@univerjs/sheets-thread-comment';import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';-import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';import { UniverUIPlugin } from '@univerjs/ui';import { UniverVue3AdapterPlugin } from '@univerjs/ui-adapter-vue3';import { UniverWebComponentAdapterPlugin } from '@univerjs/ui-adapter-web-component';@@ -81,7 +80,6 @@ import '@univerjs/sheets-conditional-formatting/facade';import '@univerjs/sheets-find-replace/facade';import '@univerjs/sheets-drawing/facade';import '@univerjs/sheets-drawing-ui/facade';-import '@univerjs/sheets-zen-editor/facade';import '@univerjs/sheets-crosshair-highlight/facade';import '@univerjs/sheets-formula-ui/facade';import '@univerjs/sheets-table/facade';@@ -160,7 +158,6 @@ function createNewInstance() {}],[UniverSheetsUIPlugin],[UniverSheetsNumfmtPlugin],- [UniverSheetsZenEditorPlugin],[UniverFormulaEnginePlugin, { notExecuteFormula: true }],[UniverSheetsFormulaPlugin, { notExecuteFormula: true }],[UniverSheetsDataValidationPlugin],diff --git a/examples/src/theme-customizer/components/univer-preview.tsx b/examples/src/theme-customizer/components/univer-preview.tsxindex 9b13214602..81f6415020 100644--- a/examples/src/theme-customizer/components/univer-preview.tsx+++ b/examples/src/theme-customizer/components/univer-preview.tsx@@ -43,7 +43,6 @@ import { UniverSheetsSortUIPlugin } from '@univerjs/sheets-sort-ui';import { UniverSheetsTablePlugin } from '@univerjs/sheets-table';import { UniverSheetsTableUIPlugin } from '@univerjs/sheets-table-ui';import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';-import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';import { UniverUIPlugin } from '@univerjs/ui';import { useEffect, useRef } from 'react';import { PREVIEW_CONTAINER_ID } from '../constants';@@ -76,7 +75,6 @@ export function UniverPreview(props: { theme: Theme; darkMode: boolean }) {}],[UniverSheetsUIPlugin],[UniverSheetsNumfmtPlugin],- [UniverSheetsZenEditorPlugin],[UniverFormulaEnginePlugin],[UniverSheetsFormulaPlugin],[UniverSheetsFormulaUIPlugin],diff --git a/packages/core/src/common/const.ts b/packages/core/src/common/const.tsindex 2273e511c6..71999c0821 100644--- a/packages/core/src/common/const.ts+++ b/packages/core/src/common/const.ts@@ -20,8 +20,6 @@ export const DOCS_NORMAL_EDITOR_UNIT_ID_KEY = `${PREFIX}DOCS_NORMAL`;export const DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY = `${PREFIX}DOCS_FORMULA_BAR`;-export const DOCS_ZEN_EDITOR_UNIT_ID_KEY = `${PREFIX}ZEN_EDITOR`;-export const DOCS_COMMENT_EDITOR_UNIT_ID_KEY = `${PREFIX}COMMENT_EDITOR`;export const DEFAULT_EMPTY_DOCUMENT_VALUE = '\r\n';diff --git a/packages/core/src/types/const/const.ts b/packages/core/src/types/const/const.tsindex 6925511f53..c35a96db46 100644--- a/packages/core/src/types/const/const.ts+++ b/packages/core/src/types/const/const.ts@@ -16,7 +16,7 @@import type { Nullable } from '../../shared';import type { IParagraphStyle, ITextStyle } from '../interfaces';-import { DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY } from '../../common/const';+import { DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY } from '../../common/const';import {BooleanNumber,HorizontalAlign,@@ -168,7 +168,7 @@ export const DEFAULT_STYLES = {},};-export const SHEET_EDITOR_UNITS = [DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY];+export const SHEET_EDITOR_UNITS = [DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY];export const NAMED_STYLE_MAP: Record<NamedStyleType, Nullable<ITextStyle>> = {[NamedStyleType.HEADING_1]: { fs: 20, bl: 1 }, // Heading 1: 20pt, bolddiff --git a/packages/docs-drawing-ui/src/controllers/render-controllers/doc-drawing-transform-update.controller.ts b/packages/docs-drawing-ui/src/controllers/render-controllers/doc-drawing-transform-update.controller.tsindex 77dfa65cb2..5606928323 100644--- a/packages/docs-drawing-ui/src/controllers/render-controllers/doc-drawing-transform-update.controller.ts+++ b/packages/docs-drawing-ui/src/controllers/render-controllers/doc-drawing-transform-update.controller.ts@@ -20,7 +20,6 @@ import type { Documents, DocumentSkeleton, IDocumentSkeletonHeaderFooter, IDocumimport {BooleanNumber,Disposable,- DOCS_ZEN_EDITOR_UNIT_ID_KEY,fromEventSubject,ICommandService,Inject,@@ -135,7 +134,7 @@ export class DocDrawingTransformUpdateController extends Disposable implements I}// TODO: @JOCS, Do not use unitId to check if it's need to render images or isEditor. maybe need a config?- if (this._editorService.isEditor(unitId) && unitId !== DOCS_ZEN_EDITOR_UNIT_ID_KEY) {+ if (this._editorService.isEditor(unitId)) {mainComponent?.makeDirty();return;}diff --git a/packages/docs-drawing-ui/src/menu/image.menu.ts b/packages/docs-drawing-ui/src/menu/image.menu.tsindex f82ed8f8a4..64f2d6d390 100644--- a/packages/docs-drawing-ui/src/menu/image.menu.ts+++ b/packages/docs-drawing-ui/src/menu/image.menu.ts@@ -16,7 +16,7 @@import type { IAccessor } from '@univerjs/core';import type { IMenuItem } from '@univerjs/ui';-import { DOCS_ZEN_EDITOR_UNIT_ID_KEY, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';+import { IUniverInstanceService, UniverInstanceType } from '@univerjs/core';import { DocSelectionManagerService } from '@univerjs/docs';import { getMenuHiddenObservable, MenuItemType } from '@univerjs/ui';@@ -68,7 +68,7 @@ export function ImageMenuFactory(accessor: IAccessor): IMenuItem {icon: 'AddImageIcon',tooltip: 'docs-drawing-ui.title',disabled$: getDisableWhenSelectionInTableObservable(accessor),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, undefined, DOCS_ZEN_EDITOR_UNIT_ID_KEY),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -78,6 +78,6 @@ export function UploadFloatImageMenuFactory(_accessor: IAccessor): IMenuItem {title: 'docs-drawing-ui.upload.float',type: MenuItemType.BUTTON,icon: 'AddImageIcon',- hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_DOC, undefined, DOCS_ZEN_EDITOR_UNIT_ID_KEY),+ hidden$: getMenuHiddenObservable(_accessor, UniverInstanceType.UNIVER_DOC),};}diff --git a/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.ts b/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.tsindex 1c5730f81a..7a0f632cc7 100644--- a/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.ts+++ b/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.ts@@ -16,7 +16,7 @@import type { DocumentDataModel } from '@univerjs/core';import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';-import { CustomRangeType, Disposable, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, ICommandService, Inject } from '@univerjs/core';+import { CustomRangeType, Disposable, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, ICommandService, Inject } from '@univerjs/core';import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs';import { DocEventManagerService } from '@univerjs/docs-ui';import { ClickDocHyperLinkOperation, ToggleDocHyperLinkInfoPopupOperation } from '../../commands/operations/popup.operation';@@ -37,7 +37,7 @@ export class DocHyperLinkEventRenderController extends Disposable implements IRe) {super();- if (this._context.unitId === DOCS_ZEN_EDITOR_UNIT_ID_KEY || this._context.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {+ if (this._context.unitId === DOCS_NORMAL_EDITOR_UNIT_ID_KEY) {return;}diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-contextmenu.render-controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-contextmenu.render-controller.tsindex 0b1a816610..9f77fb3e7e 100644--- a/packages/docs-ui/src/controllers/render-controllers/doc-contextmenu.render-controller.ts+++ b/packages/docs-ui/src/controllers/render-controllers/doc-contextmenu.render-controller.ts@@ -21,7 +21,6 @@ import {Disposable,DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,DOCS_NORMAL_EDITOR_UNIT_ID_KEY,- DOCS_ZEN_EDITOR_UNIT_ID_KEY,DocumentBlockRangeType,ICommandService,Inject,@@ -36,7 +35,6 @@ const SKIP_UNIT_IDS = [DEFAULT_EMPTY_DOCUMENT_VALUE,DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,DOCS_NORMAL_EDITOR_UNIT_ID_KEY,- DOCS_ZEN_EDITOR_UNIT_ID_KEY,];/**diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.tsindex 9bb2798002..0f569d3d57 100644--- a/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.ts+++ b/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.ts@@ -15,7 +15,7 @@*/import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';-import { Disposable, DOCS_ZEN_EDITOR_UNIT_ID_KEY, fromEventSubject, Inject, isInternalEditorID } from '@univerjs/core';+import { Disposable, fromEventSubject, Inject, isInternalEditorID } from '@univerjs/core';import { DocSelectionManagerService } from '@univerjs/docs';import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '@univerjs/engine-render';import { animationFrameScheduler, filter, throttleTime } from 'rxjs';@@ -31,7 +31,7 @@ export class DocResizeRenderController extends Disposable implements IRenderModusuper();const unitId = this._context.unitId;- if (isInternalEditorID(unitId) && unitId !== DOCS_ZEN_EDITOR_UNIT_ID_KEY) return this;+ if (isInternalEditorID(unitId)) return this;this._initResize();}diff --git a/packages/docs-ui/src/menu/menu.ts b/packages/docs-ui/src/menu/menu.tsindex b193a14c84..4fa9abb845 100644--- a/packages/docs-ui/src/menu/menu.ts+++ b/packages/docs-ui/src/menu/menu.ts@@ -22,7 +22,6 @@ import {BooleanNumber,BuildTextUtils,DEFAULT_STYLES,- DOCS_ZEN_EDITOR_UNIT_ID_KEY,DocumentBlockRangeType,DocumentFlavor,HorizontalAlign,@@ -865,7 +864,7 @@ export function HeaderFooterMenuItemFactory(accessor: IAccessor): IMenuButtonItetype: MenuItemType.BUTTON,icon: 'HeaderFooterIcon',tooltip: 'docs-ui.toolbar.headerFooter',- hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, undefined, DOCS_ZEN_EDITOR_UNIT_ID_KEY), getHeaderFooterMenuHiddenObservable(accessor), (one, two) => {+ hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), getHeaderFooterMenuHiddenObservable(accessor), (one, two) => {return one || two;}),};@@ -881,8 +880,7 @@ export function TableMenuFactory(accessor: IAccessor): IMenuItem {icon: TableIcon,tooltip: 'docs-ui.toolbar.table.main',disabled$: getTableDisabledObservable(accessor),- // Do not show header footer menu and insert table at zen mode.- hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, undefined, DOCS_ZEN_EDITOR_UNIT_ID_KEY), getInsertTableHiddenObservable(accessor), (one, two) => {+ hidden$: combineLatest(getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC), getInsertTableHiddenObservable(accessor), (one, two) => {return one || two;}),};@@ -943,7 +941,7 @@ export function AlignLeftMenuItemFactory(accessor: IAccessor): IMenuButtonItem {return disposable.dispose;}),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, undefined, DOCS_ZEN_EDITOR_UNIT_ID_KEY),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -977,7 +975,7 @@ export function AlignCenterMenuItemFactory(accessor: IAccessor): IMenuButtonItemreturn disposable.dispose;}),disabled$: disableMenuWhenNoDocRange(accessor),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, undefined, DOCS_ZEN_EDITOR_UNIT_ID_KEY),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -1011,7 +1009,7 @@ export function AlignRightMenuItemFactory(accessor: IAccessor): IMenuButtonItemreturn disposable.dispose;}),disabled$: disableMenuWhenNoDocRange(accessor),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, undefined, DOCS_ZEN_EDITOR_UNIT_ID_KEY),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -1045,7 +1043,7 @@ export function AlignJustifyMenuItemFactory(accessor: IAccessor): IMenuButtonItereturn disposable.dispose;}),disabled$: disableMenuWhenNoDocRange(accessor),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, undefined, DOCS_ZEN_EDITOR_UNIT_ID_KEY),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -1103,7 +1101,7 @@ export function AlignMenuItemFactory(accessor: IAccessor): IMenuSelectorItem<Horselections: HORIZONTAL_ALIGN_OPTIONS,value$,disabled$: disableMenuWhenNoDocRange(accessor),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, undefined, DOCS_ZEN_EDITOR_UNIT_ID_KEY),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -1114,7 +1112,7 @@ export function HorizontalLineFactory(accessor: IAccessor): IMenuButtonItem {icon: 'ReduceIcon',tooltip: 'docs-ui.toolbar.horizontalLine',disabled$: disableMenuWhenNoDocRange(accessor),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, undefined, DOCS_ZEN_EDITOR_UNIT_ID_KEY),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),};}@@ -1227,7 +1225,7 @@ export function DocSwitchModeMenuItemFactory(accessor: IAccessor): IMenuButtonIttype: MenuItemType.BUTTON,icon: 'KeyboardIcon',tooltip: 'docs-ui.toolbar.documentFlavor',- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, undefined, DOCS_ZEN_EDITOR_UNIT_ID_KEY),+ hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC),activated$: new Observable<boolean>((subscriber) => {const subscription = commandService.onCommandExecuted((c) => {if (c.id === RichTextEditingMutation.id) {diff --git a/packages/sheets-data-validation-ui/src/controllers/__tests__/dv-alert.controller.spec.ts b/packages/sheets-data-validation-ui/src/controllers/__tests__/dv-alert.controller.spec.tsindex 6f6488da91..000561715c 100644--- a/packages/sheets-data-validation-ui/src/controllers/__tests__/dv-alert.controller.spec.ts+++ b/packages/sheets-data-validation-ui/src/controllers/__tests__/dv-alert.controller.spec.ts@@ -24,10 +24,9 @@ afterEach(() => {});describe('DataValidationAlertController', () => {- it('shows an alert for invalid hovered cells and clears it when repeated or zen mode opens', async () => {+ it('shows an alert for invalid hovered cells and clears it on repeated hover', async () => {vi.useFakeTimers();const currentCell$ = new Subject<{ location: { unitId: string; subUnitId: string; row: number; col: number } }>();- const visible$ = new Subject<boolean>();const currentAlert = new Map<string, { alert: { location: { unitId: string; subUnitId: string; row: number; col: number } } }>();const showAlert = vi.fn((alert) => currentAlert.set('SHEET_DATA_VALIDATION_ALERT', { alert }));const removeAlert = vi.fn((key: string) => currentAlert.delete(key));@@ -42,7 +41,6 @@ describe('DataValidationAlertController', () => {{ currentAlert, removeAlert, showAlert } as never,{ getUnit: vi.fn(() => ({ getSheetBySheetId: vi.fn(() => ({ getSheetId: () => 'sheet-1' })) })) } as never,{ t: (key: string) => key } as never,- { visible$ } as never,dataValidationModel as never);@@ -62,9 +60,6 @@ describe('DataValidationAlertController', () => {currentCell$.next({ location });await vi.advanceTimersByTimeAsync(120);expect(removeAlert).toHaveBeenCalledWith('SHEET_DATA_VALIDATION_ALERT');-- visible$.next(true);- expect(removeAlert).toHaveBeenCalledWith('SHEET_DATA_VALIDATION_ALERT');});it('removes alerts when the hovered cell has no validation rule', async () => {@@ -77,7 +72,6 @@ describe('DataValidationAlertController', () => {{ currentAlert: new Map(), removeAlert, showAlert: vi.fn() } as never,{ getUnit: vi.fn(() => ({ getSheetBySheetId: vi.fn(() => ({ getSheetId: () => 'sheet-1' })) })) } as never,{ t: (key: string) => key } as never,- { visible$: new Subject<boolean>() } as never,{getRuleByLocation: vi.fn(() => null),validator: vi.fn(),diff --git a/packages/sheets-data-validation-ui/src/controllers/dv-alert.controller.ts b/packages/sheets-data-validation-ui/src/controllers/dv-alert.controller.tsindex a7b19cc414..b17b1af127 100644--- a/packages/sheets-data-validation-ui/src/controllers/dv-alert.controller.ts+++ b/packages/sheets-data-validation-ui/src/controllers/dv-alert.controller.ts@@ -19,7 +19,6 @@ import type { BaseDataValidator } from '@univerjs/data-validation';import { DataValidationStatus, Disposable, Inject, IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';import { SheetDataValidationModel } from '@univerjs/sheets-data-validation';import { CellAlertManagerService, CellAlertType, HoverManagerService } from '@univerjs/sheets-ui';-import { IZenZoneService } from '@univerjs/ui';import { debounceTime } from 'rxjs';const ALERT_KEY = 'SHEET_DATA_VALIDATION_ALERT';@@ -30,7 +29,6 @@ export class DataValidationAlertController extends Disposable {@Inject(CellAlertManagerService) private readonly _cellAlertManagerService: CellAlertManagerService,@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,@Inject(LocaleService) private readonly _localeService: LocaleService,- @IZenZoneService private readonly _zenZoneService: IZenZoneService,@Inject(SheetDataValidationModel) private readonly _dataValidationModel: SheetDataValidationModel) {super();@@ -39,7 +37,6 @@ export class DataValidationAlertController extends Disposable {private _init() {this._initCellAlertPopup();- this._initZenService();}private _initCellAlertPopup() {@@ -90,12 +87,4 @@ export class DataValidationAlertController extends Disposable {this._cellAlertManagerService.removeAlert(ALERT_KEY);}));}-- private _initZenService() {- this.disposeWithMe(this._zenZoneService.visible$.subscribe((visible) => {- if (visible) {- this._cellAlertManagerService.removeAlert(ALERT_KEY);- }- }));- }}diff --git a/packages/sheets-data-validation-ui/src/services/__tests__/dropdown-manager.service.spec.ts b/packages/sheets-data-validation-ui/src/services/__tests__/dropdown-manager.service.spec.tsindex fb02d2485d..2a90524b09 100644--- a/packages/sheets-data-validation-ui/src/services/__tests__/dropdown-manager.service.spec.ts+++ b/packages/sheets-data-validation-ui/src/services/__tests__/dropdown-manager.service.spec.ts@@ -29,7 +29,6 @@ import { DataValidationDropdownManagerService } from '../dropdown-manager.servicdescribe('DataValidationDropdownManagerService', () => {it('shows a list dropdown, saves the selection, opens the editor, and reacts to hide triggers', async () => {- const zenVisible$ = new Subject<boolean>();const selectionMoveEnd$ = new Subject<ISelectionWithStyle[]>();const popupDispose = vi.fn();let dropdownParam: IDropdownParam | undefined;@@ -62,9 +61,6 @@ describe('DataValidationDropdownManagerService', () => {]),})),} as never,- {- visible$: zenVisible$,- } as never,{getRuleByLocation: vi.fn((unitId: string, subUnitId: string, row: number, col: number) => {if (unitId === 'book-1' && subUnitId === 'sheet-1' && row === 1 && col === 2) {@@ -181,10 +177,6 @@ describe('DataValidationDropdownManagerService', () => {] as never);expect(service.activeDropdown).toBeNull();- service.showDataValidationDropdown('book-1', 'sheet-1', 1, 2, onHide);- zenVisible$.next(true);- expect(service.activeDropdown).toBeNull();-service.showDataValidationDropdown('book-1', 'sheet-1', 1, 2, onHide);service.hideDropdown();expect(onHide).toHaveBeenCalledTimes(2);@@ -222,9 +214,6 @@ describe('DataValidationDropdownManagerService', () => {]),})),} as never,- {- visible$: new Subject<boolean>(),- } as never,{getRuleByLocation: vi.fn(() => rule),} as never,diff --git a/packages/sheets-data-validation-ui/src/services/dropdown-manager.service.ts b/packages/sheets-data-validation-ui/src/services/dropdown-manager.service.tsindex 52507750f8..40f7dda29f 100644--- a/packages/sheets-data-validation-ui/src/services/dropdown-manager.service.ts+++ b/packages/sheets-data-validation-ui/src/services/dropdown-manager.service.ts@@ -26,7 +26,7 @@ import { serializeListOptions, SetRangeValuesCommand, SheetsSelectionsService }import { getCellValueOrigin, getDataValidationCellValue, SheetDataValidationModel } from '@univerjs/sheets-data-validation';import { getPatternType } from '@univerjs/sheets-numfmt';import { IEditorBridgeService, ISheetCellDropdownManagerService, SetCellEditVisibleOperation } from '@univerjs/sheets-ui';-import { IZenZoneService, KeyCode } from '@univerjs/ui';+import { KeyCode } from '@univerjs/ui';import { Subject } from 'rxjs';import { OpenValidationPanelOperation } from '../commands/operations/data-validation.operation';import { SHEETS_DATA_VALIDATION_UI_PLUGIN_CONFIG_KEY } from '../config/config';@@ -88,8 +88,6 @@ export class DataValidationDropdownManagerService extends Disposable {activeDropdown$ = this._activeDropdown$.asObservable();- private _zenVisible = false;-get activeDropdown() {return this._activeDropdown;}@@ -97,7 +95,6 @@ export class DataValidationDropdownManagerService extends Disposable {constructor(@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,@Inject(DataValidatorRegistryService) private readonly _dataValidatorRegistryService: DataValidatorRegistryService,- @IZenZoneService private readonly _zenZoneService: IZenZoneService,@Inject(SheetDataValidationModel) private readonly _dataValidationModel: SheetDataValidationModel,@Inject(SheetsSelectionsService) private readonly _sheetsSelectionsService: SheetsSelectionsService,@Inject(ISheetCellDropdownManagerService) private readonly _cellDropdownManagerService: ISheetCellDropdownManagerService,@@ -108,23 +105,12 @@ export class DataValidationDropdownManagerService extends Disposable {@IConfigService private readonly _configService: IConfigService) {super();- this._init();-this._initSelectionChange();this.disposeWithMe(() => {this._activeDropdown$.complete();});}- private _init() {- this.disposeWithMe(this._zenZoneService.visible$.subscribe((visible) => {- this._zenVisible = visible;- if (visible) {- this.hideDropdown();- }- }));- }-private _getDropdownByCell(unitId: string | undefined, subUnitId: string | undefined, row: number, col: number) {const workbook = unitId ?this._univerInstanceService.getUnit<Workbook>(unitId, UniverInstanceType.UNIVER_SHEET)@@ -164,10 +150,6 @@ export class DataValidationDropdownManagerService extends Disposable {this._currentPopup.dispose();};- if (this._zenVisible) {- return;- }-this._activeDropdown = param;this._activeDropdown$.next(this._activeDropdown);diff --git a/packages/sheets-drawing-ui/src/controllers/sheet-cell-image-copy-paste.controller.ts b/packages/sheets-drawing-ui/src/controllers/sheet-cell-image-copy-paste.controller.tsindex 6285dcedfa..97e798fe34 100644--- a/packages/sheets-drawing-ui/src/controllers/sheet-cell-image-copy-paste.controller.ts+++ b/packages/sheets-drawing-ui/src/controllers/sheet-cell-image-copy-paste.controller.ts@@ -16,7 +16,7 @@import type { DocumentDataModel, IDocDrawingBase } from '@univerjs/core';import type { IInnerPasteCommandParams } from '@univerjs/docs-ui';-import { BuildTextUtils, createDocumentModelWithStyle, Disposable, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, ICommandService, Inject, IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';+import { BuildTextUtils, createDocumentModelWithStyle, Disposable, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, ICommandService, Inject, IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';import { InnerPasteCommand } from '@univerjs/docs-ui';import { getCurrentTypeOfRenderer, IRenderManagerService } from '@univerjs/engine-render';import { EditingRenderController, SetCellEditVisibleOperation } from '@univerjs/sheets-ui';@@ -25,7 +25,6 @@ import { IDialogService } from '@univerjs/ui';const DISABLE_UNITS = [DOCS_NORMAL_EDITOR_UNIT_ID_KEY,DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,- DOCS_ZEN_EDITOR_UNIT_ID_KEY,];export class SheetCellImageCopyPasteController extends Disposable {constructor(@@ -71,40 +70,38 @@ export class SheetCellImageCopyPasteController extends Disposable {}const docUnitId = currentDoc.getUnitId();if (DISABLE_UNITS.includes(docUnitId)) {- if (docUnitId !== DOCS_ZEN_EDITOR_UNIT_ID_KEY) {- const handleCloseDialog = () => {- this._dialogService.close('sheet-cell-image-copy-paste');- this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {- visible: false,- });- };- // empty- if (currentDoc.getBody()?.dataStream === '\r\n') {- this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {- visible: false,- });- this._setCellImage(Object.values(doc.drawings!)[0]);- } else {- this._dialogService.open({- id: 'sheet-cell-image-copy-paste',- title: {- label: this._localeService.t('sheets-drawing-ui.cell-image.pasteTitle'),- },- children: {- label: this._localeService.t('sheets-drawing-ui.cell-image.pasteContent'),- },- width: 320,- destroyOnClose: true,- onClose: handleCloseDialog,- showOk: true,- showCancel: true,- onOk: () => {- handleCloseDialog();- this._setCellImage(Object.values(doc.drawings!)[0]);- },- onCancel: handleCloseDialog,- });- }+ const handleCloseDialog = () => {+ this._dialogService.close('sheet-cell-image-copy-paste');+ this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {+ visible: false,+ });+ };+ // empty+ if (currentDoc.getBody()?.dataStream === '\r\n') {+ this._commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {+ visible: false,+ });+ this._setCellImage(Object.values(doc.drawings!)[0]);+ } else {+ this._dialogService.open({+ id: 'sheet-cell-image-copy-paste',+ title: {+ label: this._localeService.t('sheets-drawing-ui.cell-image.pasteTitle'),+ },+ children: {+ label: this._localeService.t('sheets-drawing-ui.cell-image.pasteContent'),+ },+ width: 320,+ destroyOnClose: true,+ onClose: handleCloseDialog,+ showOk: true,+ showCancel: true,+ onOk: () => {+ handleCloseDialog();+ this._setCellImage(Object.values(doc.drawings!)[0]);+ },+ onCancel: handleCloseDialog,+ });}}}diff --git a/packages/sheets-drawing-ui/src/controllers/sheet-cell-image.controller.ts b/packages/sheets-drawing-ui/src/controllers/sheet-cell-image.controller.tsindex b7008f7ed1..5d574073f0 100644--- a/packages/sheets-drawing-ui/src/controllers/sheet-cell-image.controller.ts+++ b/packages/sheets-drawing-ui/src/controllers/sheet-cell-image.controller.ts@@ -15,12 +15,10 @@*/import type { ICellData, IDocDrawingBase, Nullable } from '@univerjs/core';-import type { IReplaceSnapshotCommandParams } from '@univerjs/docs-ui';import type { IImageData } from '@univerjs/drawing';import type { ISheetLocationBase } from '@univerjs/sheets';-import { Disposable, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, ICommandService, Inject, Injector, InterceptorEffectEnum } from '@univerjs/core';+import { Disposable, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, Inject, Injector, InterceptorEffectEnum } from '@univerjs/core';import { DocDrawingController } from '@univerjs/docs-drawing';-import { ReplaceSnapshotCommand } from '@univerjs/docs-ui';import { IDrawingManagerService } from '@univerjs/drawing';import { InterceptCellContentPriority, INTERCEPTOR_POINT, SheetInterceptorService } from '@univerjs/sheets';import { IEditorBridgeService } from '@univerjs/sheets-ui';@@ -63,7 +61,6 @@ export function resizeImageByCell(injector: Injector, location: ISheetLocationBaexport class SheetCellImageController extends Disposable {constructor(- @ICommandService private readonly _commandService: ICommandService,@Inject(SheetInterceptorService) private readonly _sheetInterceptorService: SheetInterceptorService,@Inject(Injector) private readonly _injector: Injector,@IDrawingManagerService private readonly _drawingManagerService: IDrawingManagerService,@@ -86,18 +83,6 @@ export class SheetCellImageController extends Disposable {this._drawingManagerService.initializeNotification(DOCS_NORMAL_EDITOR_UNIT_ID_KEY);}}));-- this.disposeWithMe(this._commandService.onCommandExecuted((commandInfo) => {- if (commandInfo.id === ReplaceSnapshotCommand.id) {- const params = commandInfo.params as IReplaceSnapshotCommandParams;- const unitId = params.unitId;- if (unitId === DOCS_ZEN_EDITOR_UNIT_ID_KEY) {- this._drawingManagerService.removeDrawingDataForUnit(DOCS_ZEN_EDITOR_UNIT_ID_KEY);- this._docDrawingController.loadDrawingDataForUnit(DOCS_ZEN_EDITOR_UNIT_ID_KEY);- this._drawingManagerService.initializeNotification(DOCS_ZEN_EDITOR_UNIT_ID_KEY);- }- }- }));}private _initCellContentInterceptor() {diff --git a/packages/sheets-formula-ui/src/controllers/__tests__/formula-alert-render.controller.spec.ts b/packages/sheets-formula-ui/src/controllers/__tests__/formula-alert-render.controller.spec.tsindex cf92ea2a19..55afd1b5bd 100644--- a/packages/sheets-formula-ui/src/controllers/__tests__/formula-alert-render.controller.spec.ts+++ b/packages/sheets-formula-ui/src/controllers/__tests__/formula-alert-render.controller.spec.ts@@ -32,10 +32,9 @@ afterEach(() => {});describe('FormulaAlertRenderController', () => {- it('shows formula alerts for hovered cells and hides them for repeated hovers or zen mode', async () => {+ it('shows formula alerts for hovered cells and hides them for repeated hovers', async () => {vi.useFakeTimers();const currentCell$ = new Subject<{ location: { unitId: string; subUnitId: string; row: number; col: number } }>();- const visible$ = new Subject<boolean>();const currentAlert = new Map<string, { alert: { location: { unitId: string; subUnitId: string; row: number; col: number } } }>();const showAlert = vi.fn((alert) => currentAlert.set('SHEET_FORMULA_ALERT', { alert }));const removeAlert = vi.fn((key: string) => currentAlert.delete(key));@@ -46,8 +45,7 @@ describe('FormulaAlertRenderController', () => {{ currentCell$ } as never,{ currentAlert, removeAlert, showAlert } as never,{ t: (key: string) => key } as never,- { getArrayFormulaCellData: vi.fn(() => null) } as never,- { visible$ } as never+ { getArrayFormulaCellData: vi.fn(() => null) } as never);expect(controller).toBeTruthy();@@ -66,9 +64,6 @@ describe('FormulaAlertRenderController', () => {currentCell$.next({ location });await vi.advanceTimersByTimeAsync(120);expect(removeAlert).toHaveBeenCalledWith('SHEET_FORMULA_ALERT');-- visible$.next(true);- expect(removeAlert).toHaveBeenCalledWith('SHEET_FORMULA_ALERT');});it('hides alerts when there is no extractable formula error', async () => {@@ -82,8 +77,7 @@ describe('FormulaAlertRenderController', () => {{ currentCell$ } as never,{ currentAlert: new Map(), removeAlert, showAlert: vi.fn() } as never,{ t: (key: string) => key } as never,- { getArrayFormulaCellData: vi.fn(() => null) } as never,- { visible$: new Subject<boolean>() } as never+ { getArrayFormulaCellData: vi.fn(() => null) } as never);expect(controller).toBeTruthy();diff --git a/packages/sheets-formula-ui/src/controllers/formula-alert-render.controller.ts b/packages/sheets-formula-ui/src/controllers/formula-alert-render.controller.tsindex 634a34ea98..ed6f8c145b 100644--- a/packages/sheets-formula-ui/src/controllers/formula-alert-render.controller.ts+++ b/packages/sheets-formula-ui/src/controllers/formula-alert-render.controller.ts@@ -19,7 +19,6 @@ import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';import { Disposable, Inject, isICellData, LocaleService } from '@univerjs/core';import { ErrorType, extractFormulaError, FormulaDataModel } from '@univerjs/engine-formula';import { CellAlertManagerService, CellAlertType, HoverManagerService } from '@univerjs/sheets-ui';-import { IZenZoneService } from '@univerjs/ui';import { debounceTime } from 'rxjs';const ALERT_KEY = 'SHEET_FORMULA_ALERT';@@ -45,8 +44,7 @@ export class FormulaAlertRenderController extends Disposable implements IRenderM@Inject(HoverManagerService) private readonly _hoverManagerService: HoverManagerService,@Inject(CellAlertManagerService) private readonly _cellAlertManagerService: CellAlertManagerService,@Inject(LocaleService) private readonly _localeService: LocaleService,- @Inject(FormulaDataModel) private readonly _formulaDataModel: FormulaDataModel,- @IZenZoneService private readonly _zenZoneService: IZenZoneService+ @Inject(FormulaDataModel) private readonly _formulaDataModel: FormulaDataModel) {super();this._init();@@ -54,7 +52,6 @@ export class FormulaAlertRenderController extends Disposable implements IRenderMprivate _init() {this._initCellAlertPopup();- this._initZenService();}private _initCellAlertPopup() {@@ -113,14 +110,6 @@ export class FormulaAlertRenderController extends Disposable implements IRenderM}));}- private _initZenService() {- this.disposeWithMe(this._zenZoneService.visible$.subscribe((visible) => {- if (visible) {- this._hideAlert();- }- }));- }-private _hideAlert() {this._cellAlertManagerService.removeAlert(ALERT_KEY);}diff --git a/packages/sheets-hyper-link-ui/src/commands/operations/__tests__/popup.operations.spec.ts b/packages/sheets-hyper-link-ui/src/commands/operations/__tests__/popup.operations.spec.tsindex 191d906ee7..05c3c209b2 100644--- a/packages/sheets-hyper-link-ui/src/commands/operations/__tests__/popup.operations.spec.ts+++ b/packages/sheets-hyper-link-ui/src/commands/operations/__tests__/popup.operations.spec.ts@@ -15,7 +15,7 @@*/import type { IOpenHyperLinkEditPanelOperationParams } from '../popup.operations';-import { DOCS_ZEN_EDITOR_UNIT_ID_KEY, ICommandService, IUniverInstanceService } from '@univerjs/core';+import { ICommandService, IUniverInstanceService } from '@univerjs/core';import { SheetsSelectionsService } from '@univerjs/sheets';import { IEditorBridgeService } from '@univerjs/sheets-ui';import { describe, expect, it, vi } from 'vitest';@@ -61,11 +61,9 @@ function createWorkbook(worksheet: ReturnType<typeof createWorksheet>) {function createUniverInstanceService(options?: {workbook?: ReturnType<typeof createWorkbook> | null;- focusedUnitId?: string;}) {return {getCurrentUnitOfType: () => options?.workbook ?? null,- getFocusedUnit: () => options?.focusedUnitId ? { getUnitId: () => options.focusedUnitId } : null,};}@@ -109,8 +107,8 @@ describe('hyper-link popup operations', () => {const worksheet = createWorksheet();const workbook = createWorkbook(worksheet);- const createInsertAccessor = (visible: boolean, focusedUnitId?: string, hasSelection = true, activeWorkbook: ReturnType<typeof createWorkbook> | null = workbook) => createAccessor([- [IUniverInstanceService, createUniverInstanceService({ workbook: activeWorkbook, focusedUnitId })],+ const createInsertAccessor = (visible: boolean, hasSelection = true, activeWorkbook: ReturnType<typeof createWorkbook> | null = workbook) => createAccessor([+ [IUniverInstanceService, createUniverInstanceService({ workbook: activeWorkbook })],[ICommandService, { executeCommand }],[SheetsSelectionsService, { getCurrentLastSelection: () => (hasSelection ? { range: { startRow: 3, startColumn: 4 } } : null) }],[IEditorBridgeService, { isVisible: () => ({ visible }) }],@@ -118,15 +116,13 @@ describe('hyper-link popup operations', () => {expect(InsertHyperLinkOperation.handler(createInsertAccessor(false))).toBe(true);expect(InsertHyperLinkOperation.handler(createInsertAccessor(true))).toBe(true);- expect(InsertHyperLinkOperation.handler(createInsertAccessor(false, DOCS_ZEN_EDITOR_UNIT_ID_KEY))).toBe(true);expect(executeCommand).toHaveBeenNthCalledWith(1, OpenHyperLinkEditPanelOperation.id, expect.objectContaining({ type: HyperLinkEditSourceType.VIEWING }));expect(executeCommand).toHaveBeenNthCalledWith(2, OpenHyperLinkEditPanelOperation.id, expect.objectContaining({ type: HyperLinkEditSourceType.EDITING }));- expect(executeCommand).toHaveBeenNthCalledWith(3, OpenHyperLinkEditPanelOperation.id, expect.objectContaining({ type: HyperLinkEditSourceType.ZEN_EDITOR }));- expect(InsertHyperLinkOperation.handler(createInsertAccessor(false, undefined, true, null))).toBe(false);+ expect(InsertHyperLinkOperation.handler(createInsertAccessor(false, true, null))).toBe(false);- expect(InsertHyperLinkOperation.handler(createInsertAccessor(false, undefined, false))).toBe(false);+ expect(InsertHyperLinkOperation.handler(createInsertAccessor(false, false))).toBe(false);});it('respects disabled cells and toggles between insert and close commands from the toolbar', () => {diff --git a/packages/sheets-hyper-link-ui/src/commands/operations/popup.operations.ts b/packages/sheets-hyper-link-ui/src/commands/operations/popup.operations.tsindex 8e00bc4a1a..368daa23da 100644--- a/packages/sheets-hyper-link-ui/src/commands/operations/popup.operations.ts+++ b/packages/sheets-hyper-link-ui/src/commands/operations/popup.operations.ts@@ -16,7 +16,7 @@import type { ICommand } from '@univerjs/core';import type { ISheetCommandSharedParams } from '@univerjs/sheets';-import { CommandType, DOCS_ZEN_EDITOR_UNIT_ID_KEY, ICommandService, IUniverInstanceService } from '@univerjs/core';+import { CommandType, ICommandService, IUniverInstanceService } from '@univerjs/core';import { getSheetCommandTarget, SheetsSelectionsService } from '@univerjs/sheets';import { IEditorBridgeService } from '@univerjs/sheets-ui';import { SheetsHyperLinkPopupService } from '../../services/popup.service';@@ -79,15 +79,12 @@ export const InsertHyperLinkOperation: ICommand = {const row = selection.range.startRow;const col = selection.range.startColumn;const visible = editorBridgeService.isVisible();- const isZenEditor = univerInstanceService.getFocusedUnit()?.getUnitId() === DOCS_ZEN_EDITOR_UNIT_ID_KEY;return commandService.executeCommand(OpenHyperLinkEditPanelOperation.id, {unitId: target.unitId,subUnitId: target.subUnitId,row,col,- type: isZenEditor ?- HyperLinkEditSourceType.ZEN_EDITOR- : visible.visible ? HyperLinkEditSourceType.EDITING : HyperLinkEditSourceType.VIEWING,+ type: visible.visible ? HyperLinkEditSourceType.EDITING : HyperLinkEditSourceType.VIEWING,});},};diff --git a/packages/sheets-hyper-link-ui/src/controllers/popup.controller.ts b/packages/sheets-hyper-link-ui/src/controllers/popup.controller.tsindex b1e07e1e9c..42ec641c4a 100644--- a/packages/sheets-hyper-link-ui/src/controllers/popup.controller.ts+++ b/packages/sheets-hyper-link-ui/src/controllers/popup.controller.ts@@ -17,7 +17,7 @@import type { Nullable, Workbook } from '@univerjs/core';import type { ISheetLocationBase } from '@univerjs/sheets';import type { Subscription } from 'rxjs';-import { CustomRangeType, Disposable, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, ICommandService, Inject, IPermissionService, IUniverInstanceService, Rectangle, UniverInstanceType } from '@univerjs/core';+import { CustomRangeType, Disposable, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, ICommandService, Inject, IPermissionService, IUniverInstanceService, Rectangle, UniverInstanceType } from '@univerjs/core';import { DocSelectionManagerService } from '@univerjs/docs';import { DocEventManagerService } from '@univerjs/docs-ui';import { IRenderManagerService } from '@univerjs/engine-render';@@ -37,8 +37,7 @@ import {WorksheetViewPermission,} from '@univerjs/sheets';import { HoverManagerService, HoverRenderController, IEditorBridgeService, SheetSkeletonManagerService } from '@univerjs/sheets-ui';-import { IZenZoneService } from '@univerjs/ui';-import { debounceTime, map, Observable, switchMap } from 'rxjs';+import { debounceTime, map, switchMap } from 'rxjs';import { SheetsHyperLinkPopupService } from '../services/popup.service';import { HyperLinkEditSourceType } from '../types/enums/edit-source';@@ -52,8 +51,7 @@ export class SheetsHyperLinkPopupController extends Disposable {@ICommandService private readonly _commandService: ICommandService,@IEditorBridgeService private readonly _editorBridgeService: IEditorBridgeService,@Inject(DocSelectionManagerService) private readonly _textSelectionManagerService: DocSelectionManagerService,- @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,- @IZenZoneService private readonly _zenZoneService: IZenZoneService+ @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService) {super();@@ -61,7 +59,6 @@ export class SheetsHyperLinkPopupController extends Disposable {this._initCommandListener();this._initHoverEditingListener();this._initTextSelectionListener();- this._initZenEditor();}private _getLinkPermission(location: ISheetLocationBase) {@@ -248,58 +245,6 @@ export class SheetsHyperLinkPopupController extends Disposable {});}- private _initZenEditor() {- this.disposeWithMe(- this._zenZoneService.visible$.subscribe((visible) => {- if (visible) {- this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING);- this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.EDITING);- this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.EDITING);- this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.VIEWING);- } else {- this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.ZEN_EDITOR);- this._sheetsHyperLinkPopupService.endEditing(HyperLinkEditSourceType.ZEN_EDITOR);- }- })- );-- this.disposeWithMe(- this._univerInstanceService.focused$.pipe(- switchMap((id) => {- const render = id === DOCS_ZEN_EDITOR_UNIT_ID_KEY ? this._renderManagerService.getRenderById(id) : null;- if (render) {- return render.with(DocEventManagerService).hoverCustomRanges$.pipe(debounceTime(200));- }-- return new Observable<null>((sub) => {- sub.next(null);- });- })- ).subscribe((value) => {- const range = value?.find((range) => range.range.rangeType === CustomRangeType.HYPERLINK);- const state = this._editorBridgeService.getEditCellState();- if (range && state) {- const { unitId, sheetId, row, column } = state;- const { editPermission, viewPermission, copyPermission } = this._getLinkPermission({ unitId, subUnitId: sheetId, row, col: column });- if (viewPermission) {- this._sheetsHyperLinkPopupService.showPopup({- type: HyperLinkEditSourceType.ZEN_EDITOR,- unitId,- subUnitId: sheetId,- row,- col: column,- customRange: range.range,- editPermission,- copyPermission,- });- }- } else {- this._sheetsHyperLinkPopupService.hideCurrentPopup(HyperLinkEditSourceType.ZEN_EDITOR);- }- })- );- }-private _initTextSelectionListener() {this.disposeWithMe(this._textSelectionManagerService.textSelection$.subscribe((selection) => {diff --git a/packages/sheets-hyper-link-ui/src/menu/menu.ts b/packages/sheets-hyper-link-ui/src/menu/menu.tsindex a4b1d3d2d1..3c94ba4ea9 100644--- a/packages/sheets-hyper-link-ui/src/menu/menu.ts+++ b/packages/sheets-hyper-link-ui/src/menu/menu.ts@@ -17,7 +17,7 @@import type { DocumentDataModel, IAccessor, Nullable } from '@univerjs/core';import type { IEditorBridgeServiceVisibleParam } from '@univerjs/sheets-ui';import type { IMenuItem, IShortcutItem } from '@univerjs/ui';-import { DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';+import { DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';import { DocSelectionRenderService } from '@univerjs/docs-ui';import { IRenderManagerService } from '@univerjs/engine-render';import { getSheetCommandTarget, RangeProtectionPermissionEditPoint, WorkbookEditablePermission, WorksheetEditPermission, WorksheetInsertHyperlinkPermission, WorksheetSetCellValuePermission } from '@univerjs/sheets';@@ -27,7 +27,7 @@ import { combineLatest, map, of, switchMap } from 'rxjs';import { InsertHyperLinkOperation, InsertHyperLinkToolbarOperation } from '../commands/operations/popup.operations';import { DisableLinkType, getShouldDisableCellLink, shouldDisableAddLink } from '../utils';-const getEditingLinkDisable$ = (accessor: IAccessor, unitId = DOCS_ZEN_EDITOR_UNIT_ID_KEY) => {+const getEditingLinkDisable$ = (accessor: IAccessor, unitId = DOCS_NORMAL_EDITOR_UNIT_ID_KEY) => {const univerInstanceService = accessor.get(IUniverInstanceService);const docSelctionService = accessor.get(IRenderManagerService).getRenderById(unitId)?.with(DocSelectionRenderService);if (!docSelctionService) {@@ -107,8 +107,6 @@ const linkMenu = {icon: 'LinkIcon',};-export const genZenEditorMenuId = (id: string) => `${id}-zen-editor`;-export const insertLinkMenuFactory = (accessor: IAccessor) => {return {...linkMenu,@@ -119,15 +117,6 @@ export const insertLinkMenuFactory = (accessor: IAccessor) => {} as IMenuItem;};-export const zenEditorInsertLinkMenuFactory = (accessor: IAccessor) => {- return {- ...linkMenu,- id: genZenEditorMenuId(linkMenu.commandId),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, DOCS_ZEN_EDITOR_UNIT_ID_KEY),- disabled$: getEditingLinkDisable$(accessor),- } as IMenuItem;-};-const linkToolbarMenu = {tooltip: 'sheets-hyper-link-ui.form.addTitle',commandId: InsertHyperLinkToolbarOperation.id,@@ -144,15 +133,6 @@ export const insertLinkMenuToolbarFactory = (accessor: IAccessor) => {};};-export const zenEditorInsertLinkMenuToolbarFactory = (accessor: IAccessor) => {- return {- ...linkToolbarMenu,- id: genZenEditorMenuId(linkToolbarMenu.commandId),- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.UNIVER_DOC, DOCS_ZEN_EDITOR_UNIT_ID_KEY),- disabled$: getEditingLinkDisable$(accessor),- };-};-export const InsertLinkShortcut: IShortcutItem = {id: InsertHyperLinkToolbarOperation.id,binding: KeyCode.K | MetaKeys.CTRL_COMMAND,diff --git a/packages/sheets-hyper-link-ui/src/menu/schema.ts b/packages/sheets-hyper-link-ui/src/menu/schema.tsindex 8d41079187..7cb368da16 100644--- a/packages/sheets-hyper-link-ui/src/menu/schema.ts+++ b/packages/sheets-hyper-link-ui/src/menu/schema.ts@@ -17,7 +17,7 @@import type { MenuSchemaType } from '@univerjs/ui';import { ContextMenuGroup, ContextMenuPosition, RibbonInsertGroup } from '@univerjs/ui';import { InsertHyperLinkToolbarOperation } from '../commands/operations/popup.operations';-import { genZenEditorMenuId, insertLinkMenuFactory, insertLinkMenuToolbarFactory, zenEditorInsertLinkMenuFactory, zenEditorInsertLinkMenuToolbarFactory } from './menu';+import { insertLinkMenuFactory, insertLinkMenuToolbarFactory } from './menu';export const menuSchema: MenuSchemaType = {[RibbonInsertGroup.MEDIA]: {@@ -25,10 +25,6 @@ export const menuSchema: MenuSchemaType = {order: 1,menuItemFactory: insertLinkMenuToolbarFactory,},- [genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]: {- order: 1,- menuItemFactory: zenEditorInsertLinkMenuToolbarFactory,- },},[ContextMenuPosition.MAIN_AREA]: {[ContextMenuGroup.OTHERS]: {@@ -37,10 +33,6 @@ export const menuSchema: MenuSchemaType = {order: 0,menuItemFactory: insertLinkMenuFactory,},- [genZenEditorMenuId(InsertHyperLinkToolbarOperation.id)]: {- order: 0,- menuItemFactory: zenEditorInsertLinkMenuFactory,- },},},};diff --git a/packages/sheets-hyper-link-ui/src/services/__tests__/popup.service.spec.ts b/packages/sheets-hyper-link-ui/src/services/__tests__/popup.service.spec.tsindex 04cb60c58f..8dd35c381e 100644--- a/packages/sheets-hyper-link-ui/src/services/__tests__/popup.service.spec.ts+++ b/packages/sheets-hyper-link-ui/src/services/__tests__/popup.service.spec.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { CustomRangeType, DOCS_ZEN_EDITOR_UNIT_ID_KEY, Injector } from '@univerjs/core';+import { CustomRangeType, Injector } from '@univerjs/core';import { describe, expect, it, vi } from 'vitest';import { HyperLinkEditSourceType } from '../../types/enums/edit-source';import { SheetsHyperLinkPopupService } from '../popup.service';@@ -28,8 +28,6 @@ function createDisposable() {function createService(options?: {workbook?: unknown;- document?: unknown;- zenVisible?: boolean;}) {const cellDisposable = createDisposable();const positionDisposable = createDisposable();@@ -50,12 +48,7 @@ function createService(options?: {replaceTextRanges: vi.fn(),};const univerInstanceService = {- getUnit: vi.fn((unitId: string) => {- if (unitId === DOCS_ZEN_EDITOR_UNIT_ID_KEY) {- return options?.document ?? null;- }- return options?.workbook ?? null;- }),+ getUnit: vi.fn(() => options?.workbook ?? null),};return {@@ -64,9 +57,7 @@ function createService(options?: {new Injector(),univerInstanceService as never,{ isVisible: () => ({ visible: false }), getEditCellState: vi.fn() } as never,- textSelectionManagerService as never,- docCanvasPopManagerService as never,- { visible: options?.zenVisible ?? false } as never+ textSelectionManagerService as never),sheetCanvasPopManagerService,docCanvasPopManagerService,@@ -116,21 +107,8 @@ describe('SheetsHyperLinkPopupService', () => {expect(service.currentPopup).toBeNull();});- it('routes popups by source type and blocks sheet popups while zen mode is visible', () => {- const blocked = createService({ zenVisible: true });-- blocked.service.showPopup({- unitId: 'unit-1',- subUnitId: 'sheet-1',- row: 0,- col: 0,- customRange: { rangeId: 'r1', startIndex: 1, endIndex: 3, rangeType: CustomRangeType.HYPERLINK },- customRangeRect: { left: 0, top: 0, right: 10, bottom: 10 },- type: HyperLinkEditSourceType.VIEWING,- });- expect(blocked.service.currentPopup).toBeNull();-- const active = createService({ zenVisible: false });+ it('routes popups by source type', () => {+ const active = createService();active.service.showPopup({unitId: 'unit-1',@@ -154,20 +132,7 @@ describe('SheetsHyperLinkPopupService', () => {});expect(active.sheetCanvasPopManagerService.attachPopupByPosition).toHaveBeenCalledTimes(1);- active.service.showPopup({- unitId: 'unit-1',- subUnitId: 'sheet-1',- row: 0,- col: 0,- customRange: { rangeId: 'r3', startIndex: 0, endIndex: 2, rangeType: CustomRangeType.HYPERLINK },- type: HyperLinkEditSourceType.ZEN_EDITOR,- });- expect(active.docCanvasPopManagerService.attachPopupToRange).toHaveBeenCalledWith({- startOffset: 0,- endOffset: 3,- collapsed: false,- }, expect.any(Object), DOCS_ZEN_EDITOR_UNIT_ID_KEY);- expect(blocked.sheetCanvasPopManagerService.attachPopupByPosition).not.toHaveBeenCalled();+ expect(active.docCanvasPopManagerService.attachPopupToRange).not.toHaveBeenCalled();});it('starts viewing edits from cell content and preserves editor state while keep-visible is enabled', () => {@@ -199,39 +164,4 @@ describe('SheetsHyperLinkPopupService', () => {service.endEditing(HyperLinkEditSourceType.VIEWING);expect(service.currentEditing).toBeNull();});-- it('starts zen editor editing from the real custom range in the zen document', () => {- const document = {- getBody: () => ({- dataStream: 'abcdef',- customRanges: [{ rangeId: 'range-3', startIndex: 1, endIndex: 3, rangeType: CustomRangeType.HYPERLINK }],- }),- };- const { service, docCanvasPopManagerService, textSelectionManagerService } = createService({ document });-- service.startEditing({- unitId: 'unit-1',- subUnitId: 'sheet-1',- row: 1,- col: 1,- customRangeId: 'range-3',- type: HyperLinkEditSourceType.ZEN_EDITOR,- });-- expect(textSelectionManagerService.replaceTextRanges).toHaveBeenCalledWith([- {- startOffset: 1,- endOffset: 4,- },- ]);- expect(docCanvasPopManagerService.attachPopupToRange).toHaveBeenCalledWith({- startOffset: 1,- endOffset: 3,- collapsed: false,- }, expect.any(Object), DOCS_ZEN_EDITOR_UNIT_ID_KEY);- expect(service.currentEditing).toEqual(expect.objectContaining({- label: 'bcd',- type: HyperLinkEditSourceType.ZEN_EDITOR,- }));- });});diff --git a/packages/sheets-hyper-link-ui/src/services/popup.service.ts b/packages/sheets-hyper-link-ui/src/services/popup.service.tsindex 77527c6339..3c2600992b 100644--- a/packages/sheets-hyper-link-ui/src/services/popup.service.ts+++ b/packages/sheets-hyper-link-ui/src/services/popup.service.ts@@ -14,16 +14,15 @@* limitations under the License.*/-import type { DocumentDataModel, ICustomRange, IDisposable, INeedCheckDisposable, ITextRange, Nullable, Workbook } from '@univerjs/core';+import type { ICustomRange, IDisposable, INeedCheckDisposable, ITextRange, Nullable, Workbook } from '@univerjs/core';import type { IBoundRectNoAngle } from '@univerjs/engine-render';import type { ISheetLocationBase } from '@univerjs/sheets';import type { ICanvasPopup } from '@univerjs/sheets-ui';-import { BuildTextUtils, CustomRangeType, Disposable, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DOCS_ZEN_EDITOR_UNIT_ID_KEY, Inject, Injector, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';+import { BuildTextUtils, CustomRangeType, Disposable, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, Inject, Injector, IUniverInstanceService, UniverInstanceType } from '@univerjs/core';import { DocSelectionManagerService } from '@univerjs/docs';-import { calcDocRangePositions, DocCanvasPopManagerService } from '@univerjs/docs-ui';+import { calcDocRangePositions } from '@univerjs/docs-ui';import { IRenderManagerService } from '@univerjs/engine-render';import { getCustomRangePosition, getEditingCustomRangePosition, IEditorBridgeService, SheetCanvasPopManagerService } from '@univerjs/sheets-ui';-import { IZenZoneService } from '@univerjs/ui';import { BehaviorSubject, Subject } from 'rxjs';import { HyperLinkEditSourceType } from '../types/enums/edit-source';import { CellLinkEdit } from '../views/CellLinkEdit';@@ -95,9 +94,7 @@ export class SheetsHyperLinkPopupService extends Disposable {@Inject(Injector) private readonly _injector: Injector,@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,@IEditorBridgeService private readonly _editorBridgeService: IEditorBridgeService,- @Inject(DocSelectionManagerService) private readonly _textSelectionManagerService: DocSelectionManagerService,- @Inject(DocCanvasPopManagerService) private readonly _docCanvasPopManagerService: DocCanvasPopManagerService,- @IZenZoneService private readonly _zenZoneService: IZenZoneService+ @Inject(DocSelectionManagerService) private readonly _textSelectionManagerService: DocSelectionManagerService) {super();@@ -118,16 +115,12 @@ export class SheetsHyperLinkPopupService extends Disposable {return this._isKeepVisible;}- // eslint-disable-next-line max-lines-per-functionshowPopup(location: IHyperLinkPopupOptions) {if (this._currentPopup && isEqualLink(location, this._currentPopup)) {return;}this.hideCurrentPopup(undefined, true);- if (location.type !== HyperLinkEditSourceType.ZEN_EDITOR && this._zenZoneService.visible) {- return;- }const currentEditing = this._currentEditing$.getValue();if (currentEditing && isEqualLink(location, currentEditing)) {return;@@ -153,19 +146,6 @@ export class SheetsHyperLinkPopupService extends Disposable {customRangeRect,popup);- } else if (location.type === HyperLinkEditSourceType.ZEN_EDITOR) {- if (!customRange) {- return;- }- disposable = this._docCanvasPopManagerService.attachPopupToRange(- {- startOffset: customRange.startIndex,- endOffset: customRange.endIndex + 1,- collapsed: false,- },- popup,- DOCS_ZEN_EDITOR_UNIT_ID_KEY- );} else {if (location.showAll) {disposable = this._sheetCanvasPopManagerService.attachPopupToCell(location.row, location.col, popup, unitId, subUnitId);@@ -274,26 +254,7 @@ export class SheetsHyperLinkPopupService extends Disposable {startAddEditing(link: IHyperLinkEditing) {const { unitId, subUnitId, type } = link;- if (type === HyperLinkEditSourceType.ZEN_EDITOR) {- const document: Nullable<DocumentDataModel> = this._univerInstanceService.getUnit(DOCS_ZEN_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);- if (!document) {- return;- }- const range = this._textSelectionManagerService.getActiveTextRange();- if (!range) {- return;- }- this._currentEditingPopup = this._docCanvasPopManagerService.attachPopupToRange(- range,- this._editPopup,- DOCS_ZEN_EDITOR_UNIT_ID_KEY- );- const label = document.getBody()?.dataStream.slice(range.startOffset, range.endOffset);- this._currentEditing$.next({- ...link,- label,- });- } else if (type === HyperLinkEditSourceType.EDITING) {+ if (type === HyperLinkEditSourceType.EDITING) {const range = this._getEditingRange();if (!range) {@@ -338,7 +299,6 @@ export class SheetsHyperLinkPopupService extends Disposable {}}- // eslint-disable-next-line complexity, max-lines-per-functionstartEditing(link: Required<IHyperLinkEditing>) {this._currentEditingPopup?.dispose();this.hideCurrentPopup(undefined, true);@@ -346,29 +306,7 @@ export class SheetsHyperLinkPopupService extends Disposable {const { unitId, subUnitId } = link;let customRange;let label;- if (link.type === HyperLinkEditSourceType.ZEN_EDITOR) {- const document: Nullable<DocumentDataModel> = this._univerInstanceService.getUnit(DOCS_ZEN_EDITOR_UNIT_ID_KEY, UniverInstanceType.UNIVER_DOC);- customRange = document?.getBody()?.customRanges?.find((range) => range.rangeId === link.customRangeId);- label = customRange ? document?.getBody()?.dataStream.slice(customRange.startIndex, customRange.endIndex + 1) : '';- if (!customRange || !label) {- return;- }- this._textSelectionManagerService.replaceTextRanges([- {- startOffset: customRange.startIndex,- endOffset: customRange.endIndex + 1,- },- ]);- this._currentEditingPopup = this._docCanvasPopManagerService.attachPopupToRange(- {- startOffset: customRange.startIndex,- endOffset: customRange.endIndex,- collapsed: false,- },- this._editPopup,- DOCS_ZEN_EDITOR_UNIT_ID_KEY- );- } else if (link.type === HyperLinkEditSourceType.EDITING) {+ if (link.type === HyperLinkEditSourceType.EDITING) {const customRangeInfo = getEditingCustomRangePosition(this._injector, link.unitId, link.subUnitId, link.row, link.col, link.customRangeId);if (!customRangeInfo || !customRangeInfo.rects?.length) {return;diff --git a/packages/sheets-hyper-link-ui/src/types/enums/edit-source.ts b/packages/sheets-hyper-link-ui/src/types/enums/edit-source.tsindex 21cbe1c000..9daead449a 100644--- a/packages/sheets-hyper-link-ui/src/types/enums/edit-source.ts+++ b/packages/sheets-hyper-link-ui/src/types/enums/edit-source.ts@@ -17,5 +17,4 @@export enum HyperLinkEditSourceType {EDITING = 'editing',VIEWING = 'viewing',- ZEN_EDITOR = 'zen_mode',}diff --git a/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsx b/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsxindex 79c920eaf9..f2338b8fe4 100644--- a/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsx+++ b/packages/sheets-hyper-link-ui/src/views/CellLinkEdit/index.tsx@@ -15,18 +15,15 @@*/import type { DocumentDataModel, Nullable, Workbook } from '@univerjs/core';-import type { ISelectionWithStyle, ISetSelectionsOperationParams } from '@univerjs/sheets';+import type { ISelectionWithStyle } from '@univerjs/sheets';import {BuildTextUtils,ColorKit,CustomRangeType,DataStreamTreeTokenType,DisposableCollection,- DOCS_ZEN_EDITOR_UNIT_ID_KEY,- FOCUSING_SHEET,generateRandomId,ICommandService,- IContextService,IUniverInstanceService,LocaleService,ThemeService,@@ -35,14 +32,14 @@ import {} from '@univerjs/core';import { borderClassName, Button, clsx, FormLayout, Input, Select } from '@univerjs/design';import { DocSelectionManagerService } from '@univerjs/docs';-import { DocBackScrollRenderController, DocSelectionRenderService } from '@univerjs/docs-ui';+import { DocSelectionRenderService } from '@univerjs/docs-ui';import { deserializeRangeWithSheet, IDefinedNamesService, serializeRange, serializeRangeWithSheet } from '@univerjs/engine-formula';import { IRenderManagerService } from '@univerjs/engine-render';-import { SetSelectionsOperation, SetWorksheetActiveOperation, SheetsSelectionsService } from '@univerjs/sheets';+import { SetWorksheetActiveOperation, SheetsSelectionsService } from '@univerjs/sheets';import { RangeSelector } from '@univerjs/sheets-formula-ui';import { AddHyperLinkCommand, AddRichHyperLinkCommand, SheetHyperLinkType, SheetsHyperLinkParserService, UpdateHyperLinkCommand, UpdateRichHyperLinkCommand } from '@univerjs/sheets-hyper-link';import { IEditorBridgeService, IMarkSelectionService, ScrollToRangeOperation } from '@univerjs/sheets-ui';-import { IZenZoneService, KeyCode, useDependency, useEvent, useObservable } from '@univerjs/ui';+import { KeyCode, useDependency, useEvent, useObservable } from '@univerjs/ui';import { useCallback, useEffect, useMemo, useRef, useState } from 'react';import { CloseHyperLinkPopupOperation } from '../../commands/operations/popup.operations';import { isLegalLink, serializeUrl } from '../../common/util';@@ -71,13 +68,10 @@ export const CellLinkEdit = () => {const commandService = useDependency(ICommandService);const sidePanelService = useDependency(SheetsHyperLinkSidePanelService);const sidePanelOptions = useMemo(() => sidePanelService.getOptions(), [sidePanelService]);- const zenZoneService = useDependency(IZenZoneService);const renderManagerService = useDependency(IRenderManagerService);const markSelectionService = useDependency(IMarkSelectionService);const textSelectionService = useDependency(DocSelectionManagerService);- const contextService = useDependency(IContextService);const themeService = useDependency(ThemeService);- const docSelectionManagerService = useDependency(DocSelectionManagerService);const [selectorDialogVisible, setSelectorDialogVisible] = useState(false);const sheetsSelectionService = useDependency(SheetsSelectionsService);const selections = useMemo(() => sheetsSelectionService.getCurrentSelections(), []);@@ -249,9 +243,7 @@ export const CellLinkEdit = () => {}, [type]);useEffect(() => {- const render = editing?.type === HyperLinkEditSourceType.ZEN_EDITOR ?- renderManagerService.getRenderById(DOCS_ZEN_EDITOR_UNIT_ID_KEY) :- renderManagerService.getRenderById(editorBridgeService.getCurrentEditorId());+ const render = renderManagerService.getRenderById(editorBridgeService.getCurrentEditorId());const disposeCollection = new DisposableCollection();if (render) {@@ -266,7 +258,7 @@ export const CellLinkEdit = () => {editorBridgeService.disableForceKeepVisible();disposeCollection.dispose();};- }, [editing?.type, editorBridgeService, renderManagerService]);+ }, [editorBridgeService, renderManagerService]);useEffect(() => {if (isFocusRangeSelector) {@@ -279,15 +271,6 @@ export const CellLinkEdit = () => {};}, [isFocusRangeSelector, selectorDialogVisible, popupService]);- useEffect(() => {- return () => {- if (zenZoneService.temporaryHidden) {- zenZoneService.show();- contextService.setContextValue(FOCUSING_SHEET, false);- }- };- }, [contextService, zenZoneService]);-useEffect(() => {if (isFocusRangeSelector) {editorBridgeService.enableForceKeepVisible();@@ -371,7 +354,7 @@ export const CellLinkEdit = () => {if (editing) {if (id) {- const commandId = (editing.type === HyperLinkEditSourceType.ZEN_EDITOR || editing.type === HyperLinkEditSourceType.EDITING) ? UpdateRichHyperLinkCommand.id : UpdateHyperLinkCommand.id;+ const commandId = editing.type === HyperLinkEditSourceType.EDITING ? UpdateRichHyperLinkCommand.id : UpdateHyperLinkCommand.id;await commandService.executeCommand(commandId, {id,unitId: editing.unitId,@@ -382,12 +365,10 @@ export const CellLinkEdit = () => {},row: editing.row,column: editing.col,- documentId: editing.type === HyperLinkEditSourceType.ZEN_EDITOR ?- DOCS_ZEN_EDITOR_UNIT_ID_KEY- : editorBridgeService.getCurrentEditorId(),+ documentId: editorBridgeService.getCurrentEditorId(),});} else {- const commandId = (editing.type === HyperLinkEditSourceType.ZEN_EDITOR || editing.type === HyperLinkEditSourceType.EDITING) ? AddRichHyperLinkCommand.id : AddHyperLinkCommand.id;+ const commandId = editing.type === HyperLinkEditSourceType.EDITING ? AddRichHyperLinkCommand.id : AddHyperLinkCommand.id;await commandService.executeCommand(commandId, {unitId: editing.unitId,subUnitId: editing.subUnitId,@@ -398,9 +379,7 @@ export const CellLinkEdit = () => {payload: formatUrl(type, payload),display: showLabel ? display : '',},- documentId: editing.type === HyperLinkEditSourceType.ZEN_EDITOR ?- DOCS_ZEN_EDITOR_UNIT_ID_KEY- : editorBridgeService.getCurrentEditorId(),+ documentId: editorBridgeService.getCurrentEditorId(),});}}@@ -505,33 +484,12 @@ export const CellLinkEdit = () => {onRangeSelectorDialogVisibleChange={async (visible) => {setSelectorDialogVisible(visible);if (visible) {- if (editing.type === HyperLinkEditSourceType.ZEN_EDITOR) {- zenZoneService.hide();- contextService.setContextValue(FOCUSING_SHEET, true);- }if (editing.type !== HyperLinkEditSourceType.VIEWING) {editorBridgeService.enableForceKeepVisible();}setHide(true);} else {await resolverService.navigateToRange(editing.unitId, editing.subUnitId, { startRow: editing.row, endRow: editing.row, startColumn: editing.col, endColumn: editing.col }, true);- if (editing.type === HyperLinkEditSourceType.ZEN_EDITOR) {- await commandService.executeCommand(SetSelectionsOperation.id, {- unitId: editing.unitId,- subUnitId: editing.subUnitId,- selections: [{ range: { startRow: editing.row, endRow: editing.row, startColumn: editing.col, endColumn: editing.col } }],- } as ISetSelectionsOperationParams);-- zenZoneService.show();- contextService.setContextValue(FOCUSING_SHEET, false);- const docBackScrollRenderController = renderManagerService.getRenderById(DOCS_ZEN_EDITOR_UNIT_ID_KEY)?.with(DocBackScrollRenderController);- const range = docSelectionManagerService.getTextRanges({ unitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY, subUnitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY })?.[0];-- if (docBackScrollRenderController && range) {- docBackScrollRenderController.scrollToRange(range);- docSelectionManagerService.refreshSelection({ unitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY, subUnitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY });- }- }editorBridgeService.disableForceKeepVisible();setHide(false);}diff --git a/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsx b/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsxindex 7680a7b1b2..f0bca8fd9f 100644--- a/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsx+++ b/packages/sheets-hyper-link-ui/src/views/CellLinkPopup/index.tsx@@ -16,12 +16,12 @@import type { ICustomRange, Nullable, Workbook } from '@univerjs/core';import type { IHyperLinkPopup } from '../../services/popup.service';-import { DOCS_ZEN_EDITOR_UNIT_ID_KEY, ICommandService, IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';+import { ICommandService, IUniverInstanceService, LocaleService, UniverInstanceType } from '@univerjs/core';import { borderClassName, clsx, MessageType, Tooltip } from '@univerjs/design';import { AllBorderIcon, CopyIcon, LinkIcon, UnlinkIcon, WriteIcon, XlsxMultiIcon } from '@univerjs/icons';import { CancelHyperLinkCommand, CancelRichHyperLinkCommand, SheetHyperLinkType, SheetsHyperLinkParserService } from '@univerjs/sheets-hyper-link';import { IEditorBridgeService } from '@univerjs/sheets-ui';-import { IMessageService, IZenZoneService, useDependency } from '@univerjs/ui';+import { IMessageService, useDependency } from '@univerjs/ui';import { useEffect, useState } from 'react';import { OpenHyperLinkEditPanelOperation } from '../../commands/operations/popup.operations';import { SheetsHyperLinkPopupService } from '../../services/popup.service';@@ -55,7 +55,6 @@ export const CellLinkPopupPure = (props: ICellLinkPopupPureProps) => {const resolverService = useDependency(SheetsHyperLinkResolverService);const editorBridgeService = useDependency(IEditorBridgeService);const parserHyperLinkService = useDependency(SheetsHyperLinkParserService);- const zenZoneService = useDependency(IZenZoneService);const { customRange, row, col, unitId, subUnitId, editPermission, copyPermission, type } = props;if (!customRange?.properties?.url) {@@ -79,10 +78,6 @@ export const CellLinkPopupPure = (props: ICellLinkPopupPureProps) => {univer-truncate univer-text-sm univer-leading-5 univer-text-primary-600`, { 'univer-text-red-500': isError })}onClick={() => {- if (zenZoneService.visible) {- return;- }-if (isError) {return;}@@ -170,16 +165,14 @@ export const CellLinkPopupPure = (props: ICellLinkPopupPureProps) => {dark:hover:!univer-bg-gray-700`}onClick={() => {- const commandId = (type === HyperLinkEditSourceType.EDITING || type === HyperLinkEditSourceType.ZEN_EDITOR) ? CancelRichHyperLinkCommand.id : CancelHyperLinkCommand.id;+ const commandId = type === HyperLinkEditSourceType.EDITING ? CancelRichHyperLinkCommand.id : CancelHyperLinkCommand.id;if (commandService.syncExecuteCommand(commandId, {unitId,subUnitId,id: customRange.rangeId,row,column: col,- documentId: type === HyperLinkEditSourceType.ZEN_EDITOR ?- DOCS_ZEN_EDITOR_UNIT_ID_KEY- : editorBridgeService.getCurrentEditorId(),+ documentId: editorBridgeService.getCurrentEditorId(),})) {popupService.hideCurrentPopup(undefined, true);}diff --git a/packages/sheets-note-ui/src/services/sheets-note-popup.service.ts b/packages/sheets-note-ui/src/services/sheets-note-popup.service.tsindex 24406f0c2b..eac0a132e0 100644--- a/packages/sheets-note-ui/src/services/sheets-note-popup.service.ts+++ b/packages/sheets-note-ui/src/services/sheets-note-popup.service.ts@@ -18,7 +18,6 @@ import type { IDisposable, Nullable } from '@univerjs/core';import type { ISheetLocationBase } from '@univerjs/sheets';import { Disposable, DisposableCollection, Inject } from '@univerjs/core';import { CellPopupManagerService } from '@univerjs/sheets-ui';-import { IZenZoneService } from '@univerjs/ui';import { BehaviorSubject } from 'rxjs';import { SHEET_NOTE_COMPONENT } from '../views/config';@@ -40,25 +39,15 @@ export class SheetsNotePopupService extends Disposable {}constructor(- @IZenZoneService private readonly _zenZoneService: IZenZoneService,@Inject(CellPopupManagerService) private readonly _cellPopupManagerService: CellPopupManagerService) {super();- this._initZenVisible();this.disposeWithMe(() => {this._activePopup$.complete();});}- private _initZenVisible() {- this.disposeWithMe(this._zenZoneService.visible$.subscribe((visible) => {- if (visible) {- this.hidePopup();- }- }));- }-override dispose(): void {super.dispose();this.hidePopup();@@ -80,9 +69,6 @@ export class SheetsNotePopupService extends Disposable {if (this._lastPopup) {this._lastPopup.dispose();};- if (this._zenZoneService.visible) {- return;- }this._activePopup = location;this._activePopup$.next(location);diff --git a/packages/sheets-numfmt-ui/src/controllers/__tests__/editor.controller.spec.ts b/packages/sheets-numfmt-ui/src/controllers/__tests__/editor.controller.spec.tsindex 3ab6e26c5e..faed29a661 100644--- a/packages/sheets-numfmt-ui/src/controllers/__tests__/editor.controller.spec.ts+++ b/packages/sheets-numfmt-ui/src/controllers/__tests__/editor.controller.spec.ts@@ -291,7 +291,7 @@ describe('test editor', () => {it('edit number with bullet should keep rich text', () => {const sheetInterceptorService = testBed.get(SheetInterceptorService);const richTextParams = {- id: '__INTERNAL_EDITOR__ZEN_EDITOR',+ id: '__INTERNAL_EDITOR__DOCS_NORMAL',documentStyle: {pageSize: {width: 595,diff --git a/packages/sheets-numfmt-ui/src/controllers/numfmt-alert-render.controller.ts b/packages/sheets-numfmt-ui/src/controllers/numfmt-alert-render.controller.tsindex a9cf053080..2e8cc0e193 100644--- a/packages/sheets-numfmt-ui/src/controllers/numfmt-alert-render.controller.ts+++ b/packages/sheets-numfmt-ui/src/controllers/numfmt-alert-render.controller.ts@@ -21,7 +21,6 @@ import { Disposable, IConfigService, Inject, isRealNum, isTextFormat, LocaleServimport { INumfmtService } from '@univerjs/sheets';import { SHEETS_NUMFMT_PLUGIN_CONFIG_KEY } from '@univerjs/sheets-numfmt';import { CellAlertManagerService, CellAlertType, HoverManagerService } from '@univerjs/sheets-ui';-import { IZenZoneService } from '@univerjs/ui';import { debounceTime } from 'rxjs';const ALERT_KEY = 'SHEET_NUMFMT_ALERT';@@ -32,7 +31,6 @@ export class NumfmtAlertRenderController extends Disposable implements IRenderMo@Inject(HoverManagerService) private readonly _hoverManagerService: HoverManagerService,@Inject(CellAlertManagerService) private readonly _cellAlertManagerService: CellAlertManagerService,@Inject(LocaleService) private readonly _localeService: LocaleService,- @IZenZoneService private readonly _zenZoneService: IZenZoneService,@Inject(INumfmtService) private _numfmtService: INumfmtService,@IConfigService private readonly _configService: IConfigService) {@@ -42,7 +40,6 @@ export class NumfmtAlertRenderController extends Disposable implements IRenderMoprivate _init() {this._initCellAlertPopup();- this._initZenService();}private _initCellAlertPopup() {@@ -112,14 +109,6 @@ export class NumfmtAlertRenderController extends Disposable implements IRenderMo}));}- private _initZenService() {- this.disposeWithMe(this._zenZoneService.visible$.subscribe((visible) => {- if (visible) {- this._hideAlert();- }- }));- }-private _hideAlert() {this._cellAlertManagerService.removeAlert(ALERT_KEY);}diff --git a/packages/sheets-thread-comment-ui/src/__tests__/create-thread-comment-ui-test-bed.ts b/packages/sheets-thread-comment-ui/src/__tests__/create-thread-comment-ui-test-bed.tsindex f7d77a1de2..840e7575ab 100644--- a/packages/sheets-thread-comment-ui/src/__tests__/create-thread-comment-ui-test-bed.ts+++ b/packages/sheets-thread-comment-ui/src/__tests__/create-thread-comment-ui-test-bed.ts@@ -34,8 +34,6 @@ import {import { SheetsThreadCommentModel } from '@univerjs/sheets-thread-comment';import { CellPopupManagerService, ISheetClipboardService, SheetCanvasPopManagerService } from '@univerjs/sheets-ui';import { AddCommentMutation, DeleteCommentMutation, IThreadCommentDataSourceService, ThreadCommentDataSourceService, ThreadCommentModel } from '@univerjs/thread-comment';-import { IZenZoneService } from '@univerjs/ui';-import { BehaviorSubject } from 'rxjs';import { vi } from 'vitest';const TEST_WORKBOOK_DATA: IWorkbookData = {@@ -79,13 +77,6 @@ export function createThreadCommentUiTestBed(workbookData?: IWorkbookData, depenconst cellPopupManagerService = {showPopup: vi.fn(() => popupDisposable),};- const zenVisible$ = new BehaviorSubject(false);- const zenZoneService = {- visible$: zenVisible$,- get visible() {- return zenVisible$.getValue();- },- };const sheetClipboardService = {addClipboardHook: vi.fn((hook) => {clipboardHook = hook;@@ -114,7 +105,6 @@ export function createThreadCommentUiTestBed(workbookData?: IWorkbookData, depen[ISheetClipboardService, { useValue: sheetClipboardService as unknown as ISheetClipboardService }],[CellPopupManagerService, { useValue: cellPopupManagerService as unknown as CellPopupManagerService }],[SheetCanvasPopManagerService, { useValue: {} as SheetCanvasPopManagerService }],- [IZenZoneService, { useValue: zenZoneService as unknown as IZenZoneService }],] as Dependency[]).forEach((dependency) => this._injector.add(dependency));dependencies?.forEach((dependency) => this._injector.add(dependency));@@ -142,7 +132,6 @@ export function createThreadCommentUiTestBed(workbookData?: IWorkbookData, depencommandService: get(ICommandService),cellPopupManagerService,popupDisposable,- zenVisible$,getClipboardHook: () => clipboardHook,};}diff --git a/packages/sheets-thread-comment-ui/src/services/__tests__/sheets-thread-comment-popup.service.spec.ts b/packages/sheets-thread-comment-ui/src/services/__tests__/sheets-thread-comment-popup.service.spec.tsindex 1ef8511128..b8dab3fc65 100644--- a/packages/sheets-thread-comment-ui/src/services/__tests__/sheets-thread-comment-popup.service.spec.ts+++ b/packages/sheets-thread-comment-ui/src/services/__tests__/sheets-thread-comment-popup.service.spec.ts@@ -79,23 +79,4 @@ describe('SheetsThreadCommentPopupService', () => {expect(testBed.popupDisposable.dispose).toHaveBeenCalled();expect(onHide).toHaveBeenCalledTimes(1);});-- it('hides the popup when zen mode becomes visible', () => {- const service = testBed.injector.createInstance(SheetsThreadCommentPopupService);-- service.showPopup({- unitId: 'test',- subUnitId: 'sheet1',- row: 4,- col: 5,- commentId: 'comment-2',- });- expect(service.activePopup).toEqual(expect.objectContaining({- commentId: 'comment-2',- }));-- testBed.zenVisible$.next(true);-- expect(service.activePopup).toBeNull();- });});diff --git a/packages/sheets-thread-comment-ui/src/services/sheets-thread-comment-popup.service.ts b/packages/sheets-thread-comment-ui/src/services/sheets-thread-comment-popup.service.tsindex 7b790ec61f..c770036add 100644--- a/packages/sheets-thread-comment-ui/src/services/sheets-thread-comment-popup.service.ts+++ b/packages/sheets-thread-comment-ui/src/services/sheets-thread-comment-popup.service.ts@@ -18,7 +18,6 @@ import type { IDisposable, Nullable } from '@univerjs/core';import type { ISheetLocationBase } from '@univerjs/sheets';import { Disposable, DisposableCollection, Inject } from '@univerjs/core';import { CellPopupManagerService, SheetCanvasPopManagerService } from '@univerjs/sheets-ui';-import { IZenZoneService } from '@univerjs/ui';import { BehaviorSubject } from 'rxjs';import { SHEETS_THREAD_COMMENT_MODAL } from '../types/const';@@ -42,25 +41,15 @@ export class SheetsThreadCommentPopupService extends Disposable {constructor(@Inject(SheetCanvasPopManagerService) private readonly _canvasPopupManagerService: SheetCanvasPopManagerService,- @IZenZoneService private readonly _zenZoneService: IZenZoneService,@Inject(CellPopupManagerService) private readonly _cellPopupManagerService: CellPopupManagerService) {super();- this._initZenVisible();this.disposeWithMe(() => {this._activePopup$.complete();});}- private _initZenVisible() {- this.disposeWithMe(this._zenZoneService.visible$.subscribe((visible) => {- if (visible) {- this.hidePopup();- }- }));- }-override dispose(): void {super.dispose();this.hidePopup();@@ -82,9 +71,6 @@ export class SheetsThreadCommentPopupService extends Disposable {if (this._lastPopup) {this._lastPopup.dispose();};- if (this._zenZoneService.visible) {- return;- }this._activePopup = location;this._activePopup$.next(location);diff --git a/packages/sheets-ui/src/controllers/force-string-alert-render.controller.ts b/packages/sheets-ui/src/controllers/force-string-alert-render.controller.tsindex 9527cd3efd..9d862b79b9 100644--- a/packages/sheets-ui/src/controllers/force-string-alert-render.controller.ts+++ b/packages/sheets-ui/src/controllers/force-string-alert-render.controller.ts@@ -18,7 +18,6 @@ import type { Workbook } from '@univerjs/core';import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';import type { IUniverSheetsUIConfig } from '../config/config';import { CellValueType, Disposable, getNumfmtParseValueFilter, IConfigService, Inject, isRealNum, isTextFormat, LocaleService } from '@univerjs/core';-import { IZenZoneService } from '@univerjs/ui';import { SHEETS_UI_PLUGIN_CONFIG_KEY } from '../config/config';import { CellAlertManagerService, CellAlertType } from '../services/cell-alert-manager.service';import { HoverManagerService } from '../services/hover-manager.service';@@ -31,7 +30,6 @@ export class ForceStringAlertRenderController extends Disposable implements IRen@Inject(HoverManagerService) private readonly _hoverManagerService: HoverManagerService,@Inject(CellAlertManagerService) private readonly _cellAlertManagerService: CellAlertManagerService,@Inject(LocaleService) private readonly _localeService: LocaleService,- @IZenZoneService private readonly _zenZoneService: IZenZoneService,@IConfigService private readonly _configService: IConfigService) {super();@@ -40,7 +38,6 @@ export class ForceStringAlertRenderController extends Disposable implements IRenprivate _init() {this._initCellAlertPopup();- this._initZenService();}private _initCellAlertPopup() {@@ -118,14 +115,6 @@ export class ForceStringAlertRenderController extends Disposable implements IRen}));}- private _initZenService() {- this.disposeWithMe(this._zenZoneService.visible$.subscribe((visible) => {- if (visible) {- this._hideAlert();- }- }));- }-private _hideAlert() {this._cellAlertManagerService.removeAlert(ALERT_KEY);}diff --git a/packages/sheets-ui/src/facade/f-event.ts b/packages/sheets-ui/src/facade/f-event.tsindex cbf253791a..90655fd0d8 100644--- a/packages/sheets-ui/src/facade/f-event.ts+++ b/packages/sheets-ui/src/facade/f-event.ts@@ -101,8 +101,6 @@ export interface IBeforeSheetEditStartEventParams extends IEventBase {eventType?: DeviceInputEventType;/** Optional keycode triggering the edit */keycode?: KeyCode;- /** Whether the edit will happen in zen editor mode */- isZenEditor: boolean;}/**@@ -121,8 +119,6 @@ export interface ISheetEditStartedEventParams extends IEventBase {eventType?: DeviceInputEventType;/** Optional keycode that triggered the edit */keycode?: KeyCode;- /** Whether the edit is happening in zen editor mode */- isZenEditor: boolean;}/**@@ -139,8 +135,6 @@ export interface ISheetEditChangingEventParams extends IEventBase {column: number;/** Current value being edited */value: RichTextValue;- /** Whether the edit is happening in zen editor mode */- isZenEditor: boolean;}/**@@ -161,8 +155,6 @@ export interface IBeforeSheetEditEndEventParams extends IEventBase {eventType?: DeviceInputEventType;/** Optional keycode triggering the edit end */keycode?: KeyCode;- /** Whether the edit is happening in zen editor mode */- isZenEditor: boolean;/** Whether the edit will be confirmed or cancelled */isConfirm: boolean;}@@ -183,8 +175,6 @@ export interface ISheetEditEndedEventParams extends IEventBase {eventType?: DeviceInputEventType;/** Optional keycode that triggered the edit end */keycode?: KeyCode;- /** Whether the edit happened in zen editor mode */- isZenEditor: boolean;/** Whether the edit was confirmed or cancelled */isConfirm: boolean;}@@ -349,7 +339,7 @@ export interface IFSheetsUIEventNameMixin {* @example* ```ts* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetEditStart, (params) => {- * const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params;+ * const { worksheet, workbook, row, column, eventType, keycode } = params;* console.log(params);** // Cancel the cell edit start operation@@ -367,7 +357,7 @@ export interface IFSheetsUIEventNameMixin {* @example* ```ts* const disposable = univerAPI.addEvent(univerAPI.Event.SheetEditStarted, (params) => {- * const { worksheet, workbook, row, column, eventType, keycode, isZenEditor } = params;+ * const { worksheet, workbook, row, column, eventType, keycode } = params;* console.log(params);* });*@@ -382,7 +372,7 @@ export interface IFSheetsUIEventNameMixin {* @example* ```ts* const disposable = univerAPI.addEvent(univerAPI.Event.SheetEditChanging, (params) => {- * const { worksheet, workbook, row, column, value, isZenEditor } = params;+ * const { worksheet, workbook, row, column, value } = params;* console.log(params);* });*@@ -397,7 +387,7 @@ export interface IFSheetsUIEventNameMixin {* @example* ```ts* const disposable = univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => {- * const { worksheet, workbook, row, column, value, eventType, keycode, isZenEditor, isConfirm } = params;+ * const { worksheet, workbook, row, column, value, eventType, keycode, isConfirm } = params;* console.log(params);** // Cancel the cell edit end operation@@ -415,7 +405,7 @@ export interface IFSheetsUIEventNameMixin {* @example* ```ts* const disposable = univerAPI.addEvent(univerAPI.Event.SheetEditEnded, (params) => {- * const { worksheet, workbook, row, column, eventType, keycode, isZenEditor, isConfirm } = params;+ * const { worksheet, workbook, row, column, eventType, keycode, isConfirm } = params;* console.log(params);* });*diff --git a/packages/sheets-ui/src/facade/f-univer.ts b/packages/sheets-ui/src/facade/f-univer.tsindex 7f5d284d2e..f2b6ae112f 100644--- a/packages/sheets-ui/src/facade/f-univer.ts+++ b/packages/sheets-ui/src/facade/f-univer.ts@@ -217,7 +217,6 @@ export class FUniverSheetsUIMixin extends FUniver implements IFUniverSheetsUIMixkeycode,workbook,worksheet,- isZenEditor: false,};this.fireEvent(this.Event.BeforeSheetEditStart, eventParams);if (eventParams.cancel) {@@ -251,7 +250,6 @@ export class FUniverSheetsUIMixin extends FUniver implements IFUniverSheetsUIMixkeycode,workbook,worksheet,- isZenEditor: false,value: RichTextValue.create(univerInstanceService.getUnit<DocumentDataModel>(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)!.getSnapshot()),isConfirm: keycode !== KeyCode.ESC,};@@ -286,7 +284,6 @@ export class FUniverSheetsUIMixin extends FUniver implements IFUniverSheetsUIMixkeycode,workbook,worksheet,- isZenEditor: false,};this.fireEvent(this.Event.SheetEditStarted, eventParams);})@@ -316,7 +313,6 @@ export class FUniverSheetsUIMixin extends FUniver implements IFUniverSheetsUIMixkeycode,workbook,worksheet,- isZenEditor: false,isConfirm: keycode !== KeyCode.ESC,};this.fireEvent(this.Event.SheetEditEnded, eventParams);@@ -349,7 +345,6 @@ export class FUniverSheetsUIMixin extends FUniver implements IFUniverSheetsUIMixrow,column,value: RichTextValue.create(univerInstanceService.getUnit<DocumentDataModel>(DOCS_NORMAL_EDITOR_UNIT_ID_KEY)!.getSnapshot()),- isZenEditor: false,};this.fireEvent(this.Event.SheetEditChanging, eventParams);}diff --git a/packages/sheets-ui/src/services/__tests__/cell-dropdown-manager.service.spec.ts b/packages/sheets-ui/src/services/__tests__/cell-dropdown-manager.service.spec.tsindex 8aab7642ea..e0f0d5d2ee 100644--- a/packages/sheets-ui/src/services/__tests__/cell-dropdown-manager.service.spec.ts+++ b/packages/sheets-ui/src/services/__tests__/cell-dropdown-manager.service.spec.ts@@ -59,7 +59,6 @@ describe('SheetCellDropdownManagerService', () => {const service = new SheetCellDropdownManagerService({ attachPopupToCell } as any,- { visible: false } as any,renderManager as any,componentManager as any);@@ -102,26 +101,16 @@ describe('SheetCellDropdownManagerService', () => {disposable2.dispose();});- it('throws when zen mode is visible or popup cannot be attached', () => {+ it('throws when popup cannot be attached', () => {const commonArgs = [- { attachPopupToCell: vi.fn() },{ getRenderById: vi.fn(() => null) },{ register: vi.fn(() => ({ dispose: vi.fn() })) },] as const;- const zenVisibleService = new SheetCellDropdownManagerService(- commonArgs[0] as any,- { visible: true } as any,- commonArgs[1] as any,- commonArgs[2] as any- );- expect(() => zenVisibleService.showDropdown(createParam())).toThrowError('cannot show dropdown when zen mode is visible');-const attachFailService = new SheetCellDropdownManagerService({ attachPopupToCell: vi.fn(() => null) } as any,- { visible: false } as any,- commonArgs[1] as any,- commonArgs[2] as any+ commonArgs[0] as any,+ commonArgs[1] as any);expect(() => attachFailService.showDropdown(createParam())).toThrowError('cannot show dropdown');});diff --git a/packages/sheets-ui/src/services/cell-dropdown-manager.service.ts b/packages/sheets-ui/src/services/cell-dropdown-manager.service.tsindex e3bbbda0bc..eceb28f3cd 100644--- a/packages/sheets-ui/src/services/cell-dropdown-manager.service.ts+++ b/packages/sheets-ui/src/services/cell-dropdown-manager.service.ts@@ -19,7 +19,7 @@ import type { ISheetLocation } from '@univerjs/sheets';import type { ICellDropdown } from '../views/dropdown';import { createIdentifier, Disposable, DisposableCollection, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, Inject } from '@univerjs/core';import { IRenderManagerService } from '@univerjs/engine-render';-import { ComponentManager, IZenZoneService } from '@univerjs/ui';+import { ComponentManager } from '@univerjs/ui';import { dropdownMap } from '../views/dropdown';import { SheetCanvasPopManagerService } from './canvas-pop-manager.service';@@ -43,7 +43,6 @@ export const ISheetCellDropdownManagerService = createIdentifier<ISheetCellDropdexport class SheetCellDropdownManagerService extends Disposable implements ISheetCellDropdownManagerService {constructor(@Inject(SheetCanvasPopManagerService) private readonly _canvasPopupManagerService: SheetCanvasPopManagerService,- @IZenZoneService private readonly _zenZoneService: IZenZoneService,@IRenderManagerService private readonly _renderManagerService: IRenderManagerService,@Inject(ComponentManager) private readonly _componentManager: ComponentManager) {@@ -57,9 +56,6 @@ export class SheetCellDropdownManagerService extends Disposable implements ISheeshowDropdown(param: IDropdownParam): IDisposable {const { location, onHide, closeOnOutSide = true } = param;const { row, col, unitId, subUnitId } = location;- if (this._zenZoneService.visible) {- throw new Error('[SheetCellDropdownManagerService]: cannot show dropdown when zen mode is visible');- }const component = dropdownMap[param.type];const currentRender = this._renderManagerService.getRenderById(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);diff --git a/packages/sheets-zen-editor/README.md b/packages/sheets-zen-editor/README.mddeleted file mode 100644index 37b53196ce..0000000000--- a/packages/sheets-zen-editor/README.md+++ /dev/null@@ -1,42 +0,0 @@-# @univerjs/sheets-zen-editor--[](https://npmjs.com/package/@univerjs/sheets-zen-editor)-[](https://npmjs.com/package/@univerjs/sheets-zen-editor)-[](https://npmjs.com/package/@univerjs/sheets-zen-editor)--`@univerjs/sheets-zen-editor` adds the zen editor experience for immersive cell editing in Univer Sheets.--## Package Overview--| Package | UMD global | CSS | Locales | Facade entry |-| --- | --- | :---: | :---: | :---: |-| `@univerjs/sheets-zen-editor` | `UniverSheetsZenEditor` | Yes | Yes | Yes |--## Installation--```sh-pnpm add @univerjs/sheets-zen-editor-# or-npm install @univerjs/sheets-zen-editor-```--Keep all `@univerjs/*` packages on the same version.--## Usage--```ts-import '@univerjs/sheets-zen-editor/lib/index.css';-import EnUS from '@univerjs/sheets-zen-editor/locale/en-US';-import { UniverSheetsZenEditorPlugin } from '@univerjs/sheets-zen-editor';--univer.registerPlugin(UniverSheetsZenEditorPlugin);--// Merge EnUS into your Univer locale map when this package contributes UI text.-```--## Resources--- [Documentation](https://docs.univer.ai)-- [NPM package](https://npmjs.com/package/@univerjs/sheets-zen-editor)-- [GitHub repository](https://github.com/dream-num/univer)-diff --git a/packages/sheets-zen-editor/package.json b/packages/sheets-zen-editor/package.jsondeleted file mode 100644index 1d44f36fd2..0000000000--- a/packages/sheets-zen-editor/package.json+++ /dev/null@@ -1,107 +0,0 @@-{- "name": "@univerjs/sheets-zen-editor",- "version": "0.25.0",- "private": false,- "description": "Immersive cell editing experience for Univer Sheets.",- "author": "DreamNum Co., Ltd. <[email protected]>",- "license": "Apache-2.0",- "funding": {- "type": "opencollective",- "url": "https://opencollective.com/univer"- },- "homepage": "https://univer.ai",- "repository": {- "type": "git",- "url": "https://github.com/dream-num/univer"- },- "bugs": {- "url": "https://github.com/dream-num/univer/issues"- },- "keywords": [- "univer",- "sheets",- "zen-editor",- "cell-editor",- "ui"- ],- "exports": {- ".": "./src/index.ts",- "./*": "./src/*",- "./locale/*": "./src/locale/*.ts",- "./facade": "./src/facade/index.ts"- },- "main": "./src/index.ts",- "types": "./lib/types/index.d.ts",- "publishConfig": {- "access": "public",- "main": "./lib/es/index.js",- "module": "./lib/es/index.js",- "exports": {- ".": {- "import": "./lib/es/index.js",- "require": "./lib/cjs/index.js",- "types": "./lib/types/index.d.ts"- },- "./*": {- "import": "./lib/es/*",- "require": "./lib/cjs/*",- "types": "./lib/types/index.d.ts"- },- "./locale/*": {- "import": "./lib/es/locale/*.js",- "require": "./lib/cjs/locale/*.js",- "types": "./lib/types/locale/*.d.ts"- },- "./facade": {- "import": "./lib/es/facade.js",- "require": "./lib/cjs/facade.js",- "types": "./lib/types/facade/index.d.ts"- },- "./lib/facade": {- "import": "./lib/es/facade.js",- "require": "./lib/cjs/facade.js",- "types": "./lib/types/facade/index.d.ts"- },- "./lib/*": "./lib/*"- }- },- "directories": {- "lib": "lib"- },- "files": [- "lib"- ],- "scripts": {- "test": "vitest run",- "test:watch": "vitest",- "coverage": "vitest run --coverage",- "typecheck": "tsc --noEmit",- "build:bundle": "univer-cli build",- "build:types": "tsc -p tsconfig.node.json",- "build": "pnpm run build:bundle && pnpm run build:types"- },- "peerDependencies": {- "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc",- "rxjs": ">=7.0.0"- },- "dependencies": {- "@univerjs/core": "workspace:*",- "@univerjs/design": "workspace:*",- "@univerjs/docs": "workspace:*",- "@univerjs/docs-ui": "workspace:*",- "@univerjs/engine-render": "workspace:*",- "@univerjs/icons": "1.5.0",- "@univerjs/sheets": "workspace:*",- "@univerjs/sheets-ui": "workspace:*",- "@univerjs/ui": "workspace:*"- },- "devDependencies": {- "@univerjs-infra/shared": "workspace:*",- "postcss": "^8.5.15",- "react": "18.3.1",- "rxjs": "^7.8.2",- "tailwindcss": "3.4.18",- "typescript": "^6.0.3",- "vitest": "^4.1.8"- }-}diff --git a/packages/sheets-zen-editor/postcss.config.mjs b/packages/sheets-zen-editor/postcss.config.mjsdeleted file mode 100644index 7d59f53133..0000000000--- a/packages/sheets-zen-editor/postcss.config.mjs+++ /dev/null@@ -1 +0,0 @@-export { default } from '@univerjs-infra/shared/postcss';diff --git a/packages/sheets-zen-editor/src/commands/commands/__tests__/zen-editor.command.spec.ts b/packages/sheets-zen-editor/src/commands/commands/__tests__/zen-editor.command.spec.tsdeleted file mode 100644index 1c2870aeb4..0000000000--- a/packages/sheets-zen-editor/src/commands/commands/__tests__/zen-editor.command.spec.ts+++ /dev/null@@ -1,193 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { DOCS_ZEN_EDITOR_UNIT_ID_KEY, DocumentFlavor, IUniverInstanceService } from '@univerjs/core';-import { IEditorService } from '@univerjs/docs-ui';-import { IRenderManagerService } from '@univerjs/engine-render';-import { IEditorBridgeService } from '@univerjs/sheets-ui';-import { ISidebarService, IZenZoneService } from '@univerjs/ui';-import { describe, expect, it, vi } from 'vitest';-import { CancelZenEditCommand, ConfirmZenEditCommand, OpenZenEditorCommand } from '../zen-editor.command';--function createAccessor(pairs: Array<[unknown, unknown]>) {- const map = new Map<unknown, unknown>(pairs);- return {- get(token: unknown) {- if (!map.has(token)) {- throw new Error(`Unknown token: ${String(token)}`);- }- return map.get(token);- },- } as any;-}--describe('zen-editor commands', () => {- it('OpenZenEditorCommand should clone edit snapshot into zen editor and clear history', async () => {- const zenZoneService = { open: vi.fn() };- const setDocumentData = vi.fn();- const editor = {- getDocumentData: () => ({ id: 'zen-doc-origin', documentStyle: {}, body: { dataStream: 'origin' } }),- focus: vi.fn(),- setDocumentData,- clearUndoRedoHistory: vi.fn(),- };-- const accessor = createAccessor([- [IZenZoneService, zenZoneService],- [IEditorService, { getEditor: () => editor }],- [IEditorBridgeService, {- getLatestEditCellState: () => ({- documentLayoutObject: {- documentModel: {- getSnapshot: () => ({- body: { dataStream: 'new content' },- drawings: { d1: {} },- drawingsOrder: ['d1'],- tableSource: { source: 'table' },- settings: { zoomRatio: 2 },- }),- },- },- }),- }],- [IUniverInstanceService, { focusUnit: vi.fn() }],- [ISidebarService, { visible: false }],- ]);-- const result = await OpenZenEditorCommand.handler(accessor);-- expect(result).toBe(true);- expect(zenZoneService.open).toHaveBeenCalled();- expect(editor.focus).toHaveBeenCalled();- expect(setDocumentData).toHaveBeenCalledWith(expect.objectContaining({- id: 'zen-doc-origin',- body: { dataStream: 'new content' },- drawings: { d1: {} },- drawingsOrder: ['d1'],- tableSource: { source: 'table' },- settings: { zoomRatio: 2 },- }), [{ startOffset: 0, endOffset: 0, collapsed: true }]);- expect(editor.clearUndoRedoHistory).toHaveBeenCalled();- });-- it('OpenZenEditorCommand should fail when editor or edit snapshot is missing', async () => {- const noEditorAccessor = createAccessor([- [IZenZoneService, { open: vi.fn() }],- [IEditorService, { getEditor: () => null }],- [IEditorBridgeService, { getLatestEditCellState: () => null }],- [IUniverInstanceService, { focusUnit: vi.fn() }],- [ISidebarService, { visible: false }],- ]);- await expect(OpenZenEditorCommand.handler(noEditorAccessor)).resolves.toBe(false);-- const noSnapshotAccessor = createAccessor([- [IZenZoneService, { open: vi.fn() }],- [IEditorService, { getEditor: () => ({ getDocumentData: () => ({ documentStyle: {} }), focus: vi.fn(), setDocumentData: vi.fn(), clearUndoRedoHistory: vi.fn() }) }],- [IEditorBridgeService, { getLatestEditCellState: () => ({ documentLayoutObject: { documentModel: { getSnapshot: () => null } } }) }],- [IUniverInstanceService, { focusUnit: vi.fn() }],- [ISidebarService, { visible: false }],- ]);- await expect(OpenZenEditorCommand.handler(noSnapshotAccessor)).resolves.toBe(false);- });-- it('CancelZenEditCommand should close zen zone and return to current sheet', async () => {- const focusUnit = vi.fn();- const refreshEditCellState = vi.fn();-- const result = await CancelZenEditCommand.handler(createAccessor([- [IZenZoneService, { close: vi.fn() }],- [IEditorBridgeService, { refreshEditCellState }],- [IUniverInstanceService, {- getCurrentUnitOfType: () => ({ getUnitId: () => 'sheet-unit' }),- focusUnit,- }],- [ISidebarService, { visible: false }],- ]));-- expect(result).toBe(true);- expect(focusUnit).toHaveBeenCalledWith('sheet-unit');- expect(refreshEditCellState).toHaveBeenCalled();- });-- it('CancelZenEditCommand should return false without an active sheet', async () => {- const result = await CancelZenEditCommand.handler(createAccessor([- [IZenZoneService, { close: vi.fn() }],- [IEditorBridgeService, { refreshEditCellState: vi.fn() }],- [IUniverInstanceService, { getCurrentUnitOfType: () => null, focusUnit: vi.fn() }],- [ISidebarService, { visible: false }],- ]));-- expect(result).toBe(false);- });-- it('ConfirmZenEditCommand should submit doc snapshot back to sheet editor', async () => {- const submitCellData = vi.fn();- const refreshEditCellState = vi.fn();- const focusUnit = vi.fn();-- const result = await ConfirmZenEditCommand.handler(createAccessor([- [IZenZoneService, { close: vi.fn() }],- [IEditorBridgeService, { refreshEditCellState }],- [IUniverInstanceService, {- getCurrentUnitOfType: () => ({ getUnitId: () => 'sheet-unit' }),- focusUnit,- }],- [IEditorService, {- getEditor: (unitId: string) => {- if (unitId !== DOCS_ZEN_EDITOR_UNIT_ID_KEY) {- return null;- }- return {- getDocumentData: () => ({- id: 'doc-1',- documentStyle: { documentFlavor: DocumentFlavor.UNSPECIFIED },- body: { dataStream: '' },- }),- };- },- }],- [IRenderManagerService, {- getRenderById: () => ({- with: () => ({ submitCellData }),- }),- }],- [ISidebarService, { visible: false }],- ]));-- expect(result).toBe(true);- expect(submitCellData).toHaveBeenCalledTimes(1);- const submittedModel = submitCellData.mock.calls[0][0];- expect(submittedModel.getSnapshot().documentStyle.documentFlavor).toBe(DocumentFlavor.UNSPECIFIED);- expect(focusUnit).toHaveBeenCalledWith('sheet-unit');- expect(refreshEditCellState).toHaveBeenCalled();- });-- it('ConfirmZenEditCommand should return false without zen editor instance', async () => {- const result = await ConfirmZenEditCommand.handler(createAccessor([- [IZenZoneService, { close: vi.fn() }],- [IEditorBridgeService, { refreshEditCellState: vi.fn() }],- [IUniverInstanceService, {- getCurrentUnitOfType: () => ({ getUnitId: () => 'sheet-unit' }),- focusUnit: vi.fn(),- }],- [IEditorService, { getEditor: () => null }],- [IRenderManagerService, { getRenderById: () => null }],- [ISidebarService, { visible: false }],- ]));-- expect(result).toBe(false);- });-});diff --git a/packages/sheets-zen-editor/src/commands/commands/zen-editor.command.ts b/packages/sheets-zen-editor/src/commands/commands/zen-editor.command.tsdeleted file mode 100644index 3933d4c189..0000000000--- a/packages/sheets-zen-editor/src/commands/commands/zen-editor.command.ts+++ /dev/null@@ -1,162 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { ICommand, Workbook } from '@univerjs/core';-import { CommandType, delayAnimationFrame, DOCS_ZEN_EDITOR_UNIT_ID_KEY, DocumentDataModel, DocumentFlavor, IUniverInstanceService, Tools, UniverInstanceType } from '@univerjs/core';-import { IEditorService } from '@univerjs/docs-ui';-import { IRenderManagerService } from '@univerjs/engine-render';-import { EditingRenderController, IEditorBridgeService } from '@univerjs/sheets-ui';-import { ISidebarService, IZenZoneService } from '@univerjs/ui';--export const OpenZenEditorCommand: ICommand = {- id: 'zen-editor.command.open-zen-editor',- type: CommandType.COMMAND,- handler: async (accessor) => {- const zenZoneService = accessor.get(IZenZoneService);- const editorService = accessor.get(IEditorService);- const editorBridgeService = accessor.get(IEditorBridgeService);- const univerInstanceService = accessor.get(IUniverInstanceService);- const sideBarService = accessor.get(ISidebarService);-- if (sideBarService.visible) {- sideBarService.close();- await delayAnimationFrame();- }-- zenZoneService.open();-- const editor = editorService.getEditor(DOCS_ZEN_EDITOR_UNIT_ID_KEY);-- if (editor == null) {- return false;- }- const editCellState = editorBridgeService.getLatestEditCellState();-- if (editCellState == null) {- return false;- }-- const snapshot = editCellState.documentLayoutObject.documentModel?.getSnapshot();-- if (snapshot == null) {- return false;- }-- univerInstanceService.focusUnit(DOCS_ZEN_EDITOR_UNIT_ID_KEY);-- const { body, drawings, drawingsOrder, tableSource, settings } = Tools.deepClone(snapshot);-- const originSnapshot = editor.getDocumentData();-- const newSnapshot = {- ...originSnapshot,- body,- drawings,- drawingsOrder,- tableSource,- settings,- };-- const textRanges = [- {- startOffset: 0,- endOffset: 0,- collapsed: true,- },- ];- editor.focus();- editor.setDocumentData(newSnapshot, textRanges);- // Need to clear undo/redo service when open zen mode.- editor.clearUndoRedoHistory();-- return true;- },-};--export const CancelZenEditCommand: ICommand = {- id: 'zen-editor.command.cancel-zen-edit',- type: CommandType.COMMAND,- handler: async (accessor) => {- const zenZoneEditorService = accessor.get(IZenZoneService);- const editorBridgeService = accessor.get(IEditorBridgeService);- const univerInstanceManager = accessor.get(IUniverInstanceService);- const sideBarService = accessor.get(ISidebarService);-- if (sideBarService.visible) {- sideBarService.close();- await delayAnimationFrame();- }- zenZoneEditorService.close();-- const currentSheetInstance = univerInstanceManager.getCurrentUnitOfType<Workbook>(UniverInstanceType.UNIVER_SHEET);- if (currentSheetInstance) {- univerInstanceManager.focusUnit(currentSheetInstance.getUnitId());- editorBridgeService.refreshEditCellState();-- return true;- }-- return false;- },-};--export const ConfirmZenEditCommand: ICommand = {- id: 'zen-editor.command.confirm-zen-edit',-- type: CommandType.COMMAND,-- handler: async (accessor) => {- const zenZoneEditorService = accessor.get(IZenZoneService);- const editorBridgeService = accessor.get(IEditorBridgeService);- const univerInstanceManager = accessor.get(IUniverInstanceService);- const editorService = accessor.get(IEditorService);- const sideBarService = accessor.get(ISidebarService);-- if (sideBarService.visible) {- sideBarService.close();- await delayAnimationFrame();- }- zenZoneEditorService.close();-- const editor = editorService.getEditor(DOCS_ZEN_EDITOR_UNIT_ID_KEY);-- if (editor == null) {- return false;- }-- const renderManagerService = accessor.get(IRenderManagerService);-- const currentSheetInstance = univerInstanceManager.getCurrentUnitOfType<Workbook>(UniverInstanceType.UNIVER_SHEET);- if (currentSheetInstance) {- const currentSheetId = currentSheetInstance.getUnitId();-- const editingRenderController = renderManagerService.getRenderById(currentSheetId)?.with(EditingRenderController);-- if (editingRenderController) {- const snapshot = Tools.deepClone(editor.getDocumentData());- // Maybe we need a third Document flavor for sheet editor?- snapshot.documentStyle.documentFlavor = DocumentFlavor.UNSPECIFIED;- editingRenderController.submitCellData(new DocumentDataModel(snapshot));- }-- univerInstanceManager.focusUnit(currentSheetInstance.getUnitId());- editorBridgeService.refreshEditCellState();- return true;- }-- return false;- },-};diff --git a/packages/sheets-zen-editor/src/config/config.ts b/packages/sheets-zen-editor/src/config/config.tsdeleted file mode 100644index 4597c57e33..0000000000--- a/packages/sheets-zen-editor/src/config/config.ts+++ /dev/null@@ -1,27 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { MenuConfig } from '@univerjs/ui';--export const SHEETS_ZEN_EDITOR_PLUGIN_CONFIG_KEY = 'sheets-zen-editor.config';--export const configSymbol = Symbol(SHEETS_ZEN_EDITOR_PLUGIN_CONFIG_KEY);--export interface IUniverSheetsZenEditorConfig {- menu?: MenuConfig;-}--export const defaultPluginConfig: IUniverSheetsZenEditorConfig = {};diff --git a/packages/sheets-zen-editor/src/controllers/__tests__/zen-editor-ui.controller.spec.ts b/packages/sheets-zen-editor/src/controllers/__tests__/zen-editor-ui.controller.spec.tsdeleted file mode 100644index 162d48c453..0000000000--- a/packages/sheets-zen-editor/src/controllers/__tests__/zen-editor-ui.controller.spec.ts+++ /dev/null@@ -1,42 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { describe, expect, it, vi } from 'vitest';-import { ZEN_EDITOR_COMPONENT } from '../../views/zen-editor';-import { ZenEditorUIController } from '../zen-editor-ui.controller';--describe('ZenEditorUIController', () => {- it('should register zen component, commands, menus and shortcuts', () => {- const set = vi.fn(() => ({ dispose: vi.fn() }));- const registerCommand = vi.fn(() => ({ dispose: vi.fn() }));- const mergeMenu = vi.fn();- const registerShortcut = vi.fn(() => ({ dispose: vi.fn() }));-- const controller = new ZenEditorUIController(- { set } as any,- { registerCommand } as any,- { mergeMenu } as any,- { registerShortcut } as any- );-- expect(set).toHaveBeenCalledWith(ZEN_EDITOR_COMPONENT, expect.any(Function));- expect(registerCommand).toHaveBeenCalledTimes(3);- expect(mergeMenu).toHaveBeenCalledTimes(1);- expect(registerShortcut).toHaveBeenCalledTimes(2);-- controller.dispose();- });-});diff --git a/packages/sheets-zen-editor/src/controllers/__tests__/zen-editor.controller.spec.ts b/packages/sheets-zen-editor/src/controllers/__tests__/zen-editor.controller.spec.tsdeleted file mode 100644index 434559b4ac..0000000000--- a/packages/sheets-zen-editor/src/controllers/__tests__/zen-editor.controller.spec.ts+++ /dev/null@@ -1,100 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { Subject } from 'rxjs';-import { describe, expect, it, vi } from 'vitest';-import { ZenEditorController } from '../zen-editor.controller';--describe('ZenEditorController', () => {- it('should calculate page placement and sync viewport scroll', () => {- const resize = vi.fn();- const translateDoc = vi.fn();- const translateBg = vi.fn();- const scrollToBarPos = vi.fn();-- const controller = new ZenEditorController(- { position$: new Subject() } as any,- { getRenderById: vi.fn(() => null) } as any- );-- (controller as any)._calculatePagePosition({- document: {- width: 200,- height: 300,- pageMarginLeft: 20,- pageMarginTop: 10,- translate: translateDoc,- },- scene: {- getParent: () => ({ width: 600, height: 500 }),- getAncestorScale: () => ({ scaleX: 1, scaleY: 1 }),- resize,- getViewport: () => ({- transScroll2ViewportScrollValue: (x: number) => ({ x }),- scrollToBarPos,- }),- },- docBackground: {- translate: translateBg,- },- });-- expect(resize).toHaveBeenCalled();- expect(translateDoc).toHaveBeenCalled();- expect(translateBg).toHaveBeenCalled();- expect(scrollToBarPos).toHaveBeenCalled();-- controller.dispose();- });-- it('should ignore invalid render state and still support scroll-to-top helper', () => {- const scrollToRange = vi.fn();- const controller = new ZenEditorController(- { position$: new Subject() } as any,- {- getRenderById: () => ({- with: () => ({ scrollToRange }),- }),- } as any- );-- const result = (controller as any)._calculatePagePosition({- document: {- width: Number.POSITIVE_INFINITY,- height: Number.POSITIVE_INFINITY,- pageMarginLeft: 20,- pageMarginTop: 10,- translate: vi.fn(),- },- scene: {- getParent: () => null,- getAncestorScale: () => ({ scaleX: 1, scaleY: 1 }),- resize: vi.fn(),- getViewport: vi.fn(),- },- docBackground: {- translate: vi.fn(),- },- });-- expect(result).toBeUndefined();-- (controller as any)._scrollToTop();- expect(scrollToRange).toHaveBeenCalledWith({ startOffset: 0, endOffset: 0 });-- controller.dispose();- });-});diff --git a/packages/sheets-zen-editor/src/controllers/shortcuts/__tests__/zen-editor.shortcut.spec.ts b/packages/sheets-zen-editor/src/controllers/shortcuts/__tests__/zen-editor.shortcut.spec.tsdeleted file mode 100644index 7846c9b3a7..0000000000--- a/packages/sheets-zen-editor/src/controllers/shortcuts/__tests__/zen-editor.shortcut.spec.ts+++ /dev/null@@ -1,49 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { EDITOR_ACTIVATED, FOCUSING_DOC, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR } from '@univerjs/core';-import { describe, expect, it } from 'vitest';-import { whenZenEditorActivated, ZenEditorCancelShortcut, ZenEditorConfirmShortcut } from '../zen-editor.shortcut';--function createContext(values: Record<string, boolean>) {- return {- getContextValue: (key: string) => values[key] ?? false,- } as any;-}--describe('zen editor shortcuts', () => {- it('should activate only when doc/editor are focused and standalone editor is off', () => {- const context = createContext({- [FOCUSING_DOC]: true,- [FOCUSING_UNIVER_EDITOR]: true,- [EDITOR_ACTIVATED]: true,- [FOCUSING_EDITOR_STANDALONE]: false,- });-- expect(whenZenEditorActivated(context)).toBe(true);- expect(ZenEditorConfirmShortcut.preconditions?.(context as any)).toBe(true);- expect(ZenEditorCancelShortcut.preconditions?.(context as any)).toBe(true);-- const standaloneContext = createContext({- [FOCUSING_DOC]: true,- [FOCUSING_UNIVER_EDITOR]: true,- [EDITOR_ACTIVATED]: true,- [FOCUSING_EDITOR_STANDALONE]: true,- });-- expect(whenZenEditorActivated(standaloneContext)).toBe(false);- });-});diff --git a/packages/sheets-zen-editor/src/controllers/shortcuts/zen-editor.shortcut.ts b/packages/sheets-zen-editor/src/controllers/shortcuts/zen-editor.shortcut.tsdeleted file mode 100644index 83d2a9d525..0000000000--- a/packages/sheets-zen-editor/src/controllers/shortcuts/zen-editor.shortcut.ts+++ /dev/null@@ -1,53 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { IContextService } from '@univerjs/core';-import type { IShortcutItem } from '@univerjs/ui';-import { EDITOR_ACTIVATED, FOCUSING_DOC, FOCUSING_EDITOR_STANDALONE, FOCUSING_UNIVER_EDITOR } from '@univerjs/core';-import { KeyCode, MetaKeys } from '@univerjs/ui';-import { CancelZenEditCommand, ConfirmZenEditCommand } from '../../commands/commands/zen-editor.command';--export const ZenEditorConfirmShortcut: IShortcutItem = {- id: ConfirmZenEditCommand.id,- description: 'sheets-zen-editor.shortcut.sheet.zen-edit-confirm',- group: '4_sheet-edit',- groupTitle: 'sheets-ui.shortcut.sheet-edit',- preconditions: (contextService) => whenZenEditorActivated(contextService),- binding: KeyCode.ENTER | MetaKeys.ALT,-};--export const ZenEditorCancelShortcut: IShortcutItem = {- id: CancelZenEditCommand.id,- description: 'sheets-zen-editor.shortcut.sheet.zen-edit-cancel',- group: '4_sheet-edit',- groupTitle: 'sheets-ui.shortcut.sheet-edit',- preconditions: (contextService) => whenZenEditorActivated(contextService),- binding: KeyCode.ESC,-};--/**- * Requires the currently focused unit to be Doc and the zen editor is activated.- * @param contextService- * @returns- */-export function whenZenEditorActivated(contextService: IContextService) {- return (- contextService.getContextValue(FOCUSING_DOC) &&- contextService.getContextValue(FOCUSING_UNIVER_EDITOR) &&- contextService.getContextValue(EDITOR_ACTIVATED) &&- !contextService.getContextValue(FOCUSING_EDITOR_STANDALONE)- );-}diff --git a/packages/sheets-zen-editor/src/controllers/zen-editor-ui.controller.ts b/packages/sheets-zen-editor/src/controllers/zen-editor-ui.controller.tsdeleted file mode 100644index 691956bf05..0000000000--- a/packages/sheets-zen-editor/src/controllers/zen-editor-ui.controller.ts+++ /dev/null@@ -1,63 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { Disposable, ICommandService } from '@univerjs/core';-import { IMenuManagerService, IShortcutService, IZenZoneService } from '@univerjs/ui';--import { CancelZenEditCommand, ConfirmZenEditCommand, OpenZenEditorCommand } from '../commands/commands/zen-editor.command';-import { menuSchema } from '../menu/schema';-import { ZEN_EDITOR_COMPONENT, ZenEditor } from '../views/zen-editor';-import { ZenEditorCancelShortcut, ZenEditorConfirmShortcut } from './shortcuts/zen-editor.shortcut';--export class ZenEditorUIController extends Disposable {- constructor(- @IZenZoneService private readonly _zenZoneService: IZenZoneService,- @ICommandService private readonly _commandService: ICommandService,- @IMenuManagerService private readonly _menuManagerService: IMenuManagerService,- @IShortcutService private readonly _shortcutService: IShortcutService- ) {- super();-- this._initialize();- }-- private _initialize(): void {- this._initCustomComponents();- this._initCommands();- this._initMenus();- this._initShortcuts();- }-- private _initCustomComponents(): void {- this.disposeWithMe(this._zenZoneService.set(ZEN_EDITOR_COMPONENT, ZenEditor));- }-- private _initCommands(): void {- [OpenZenEditorCommand, CancelZenEditCommand, ConfirmZenEditCommand].forEach((c) => {- this.disposeWithMe(this._commandService.registerCommand(c));- });- }-- private _initMenus(): void {- this._menuManagerService.mergeMenu(menuSchema);- }-- private _initShortcuts(): void {- [ZenEditorConfirmShortcut, ZenEditorCancelShortcut].forEach((item) => {- this.disposeWithMe(this._shortcutService.registerShortcut(item));- });- }-}diff --git a/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts b/packages/sheets-zen-editor/src/controllers/zen-editor.controller.tsdeleted file mode 100644index e8c280f622..0000000000--- a/packages/sheets-zen-editor/src/controllers/zen-editor.controller.ts+++ /dev/null@@ -1,135 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { ITextRange } from '@univerjs/core';-import type { IDocObjectParam } from '@univerjs/docs-ui';-import type { Viewport } from '@univerjs/engine-render';-import {- DOCS_ZEN_EDITOR_UNIT_ID_KEY,- RxDisposable,-} from '@univerjs/core';-import { VIEWPORT_KEY as DOC_VIEWPORT_KEY, DocBackScrollRenderController } from '@univerjs/docs-ui';-import { IRenderManagerService } from '@univerjs/engine-render';-import { getEditorObject } from '@univerjs/sheets-ui';--import { takeUntil } from 'rxjs';-import { IZenEditorManagerService } from '../services/zen-editor.service';--export class ZenEditorController extends RxDisposable {- constructor(- @IZenEditorManagerService private readonly _zenEditorManagerService: IZenEditorManagerService,- @IRenderManagerService private readonly _renderManagerService: IRenderManagerService- ) {- super();-- this._initialize();- }-- private _initialize() {- this._syncZenEditorSize();- }-- // Listen to changes in the size of the zen editor container to set the size of the editor.- private _syncZenEditorSize() {- this._zenEditorManagerService.position$.pipe(takeUntil(this.dispose$)).subscribe((position) => {- if (position == null) {- return;- }-- const { width, height } = position;-- const editorObject = getEditorObject(DOCS_ZEN_EDITOR_UNIT_ID_KEY, this._renderManagerService);-- if (editorObject == null) {- return;- }-- // resize canvas- requestIdleCallback(() => {- editorObject.engine.resizeBySize(width, height);- this._calculatePagePosition(editorObject);- this._scrollToTop();- });- });- }-- private _calculatePagePosition(currentRender: IDocObjectParam) {- const { document: docsComponent, scene, docBackground } = currentRender;-- const parent = scene?.getParent();-- const { width: docsWidth, height: docsHeight, pageMarginLeft, pageMarginTop } = docsComponent;- if (parent == null || docsWidth === Number.POSITIVE_INFINITY || docsHeight === Number.POSITIVE_INFINITY) {- return;- }- const { width: engineWidth, height: engineHeight } = parent;-- let docsLeft = 0;- const docsTop = pageMarginTop;-- let sceneWidth = 0;-- let sceneHeight = 0;-- let scrollToX = Number.POSITIVE_INFINITY;-- const { scaleX, scaleY } = scene.getAncestorScale();-- if (engineWidth > (docsWidth + pageMarginLeft * 2) * scaleX) {- docsLeft = engineWidth / 2 - (docsWidth * scaleX) / 2;- docsLeft /= scaleX;- sceneWidth = (engineWidth - pageMarginLeft * 2) / scaleX;-- scrollToX = 0;- } else {- docsLeft = pageMarginLeft;- sceneWidth = docsWidth + pageMarginLeft * 2;-- scrollToX = (sceneWidth - engineWidth / scaleX) / 2;- }-- if (engineHeight > docsHeight) {- sceneHeight = (engineHeight - pageMarginTop * 2) / scaleY;- } else {- sceneHeight = docsHeight + pageMarginTop * 2;- }-- scene.resize(sceneWidth, sceneHeight);- docsComponent.translate(docsLeft, docsTop);- docBackground.translate(docsLeft, docsTop);-- const viewport = scene.getViewport(DOC_VIEWPORT_KEY.VIEW_MAIN) as Viewport;- if (scrollToX !== Number.POSITIVE_INFINITY && viewport != null) {- const actualX = viewport.transScroll2ViewportScrollValue(scrollToX, 0).x;- viewport.scrollToBarPos({- x: actualX,- });- }-- return this;- }-- private _scrollToTop() {- const backScrollController = this._renderManagerService.getRenderById(DOCS_ZEN_EDITOR_UNIT_ID_KEY)?.with(DocBackScrollRenderController);- const textRange = {- startOffset: 0,- endOffset: 0,- };- if (backScrollController) {- backScrollController.scrollToRange(textRange as ITextRange);- }- }-}diff --git a/packages/sheets-zen-editor/src/facade/f-univer.ts b/packages/sheets-zen-editor/src/facade/f-univer.tsdeleted file mode 100644index cea5872d53..0000000000--- a/packages/sheets-zen-editor/src/facade/f-univer.ts+++ /dev/null@@ -1,193 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { DocumentDataModel, Injector } from '@univerjs/core';-import type { IRichTextEditingMutationParams } from '@univerjs/docs';-import type { IBeforeSheetEditEndEventParams, IBeforeSheetEditStartEventParams, ISheetEditChangingEventParams, ISheetEditEndedEventParams, ISheetEditStartedEventParams } from '@univerjs/sheets-ui/facade';-import { CanceledError, DOCS_ZEN_EDITOR_UNIT_ID_KEY, ICommandService, IUniverInstanceService, RichTextValue } from '@univerjs/core';-import { FUniver } from '@univerjs/core/facade';-import { RichTextEditingMutation } from '@univerjs/docs';-import { IEditorBridgeService } from '@univerjs/sheets-ui';-import { CancelZenEditCommand, ConfirmZenEditCommand, OpenZenEditorCommand } from '@univerjs/sheets-zen-editor';--/**- * @ignore- */-export interface IFUniverSheetsZenEditorMixin {}--export class FUniverSheetsZenEditorMixin extends FUniver implements IFUniverSheetsZenEditorMixin {- // eslint-disable-next-line max-lines-per-function- private _initSheetZenEditorEvent(injector: Injector): void {- const commandService = injector.get(ICommandService);-- // Register before command execution handlers- this.disposeWithMe(- this.registerEventHandler(- this.Event.BeforeSheetEditStart,- () => commandService.beforeCommandExecuted((commandInfo) => {- if (commandInfo.id === OpenZenEditorCommand.id) {- const target = this.getSheetCommandTarget();- if (!target) return;-- const { workbook, worksheet } = target;- const loc = injector.get(IEditorBridgeService).getEditLocation()!;-- const eventParams: IBeforeSheetEditStartEventParams = {- workbook,- worksheet,- row: loc.row,- column: loc.column,- isZenEditor: true,- };- this.fireEvent(this.Event.BeforeSheetEditStart, eventParams);-- if (eventParams.cancel) {- throw new CanceledError();- }- }- })- )- );-- this.disposeWithMe(- this.registerEventHandler(- this.Event.BeforeSheetEditEnd,- () => commandService.beforeCommandExecuted((commandInfo) => {- if (commandInfo.id === CancelZenEditCommand.id || commandInfo.id === ConfirmZenEditCommand.id) {- const target = this.getSheetCommandTarget();- if (!target) return;-- const { workbook, worksheet } = target;- const loc = injector.get(IEditorBridgeService).getEditLocation()!;- const value = RichTextValue.create(injector.get(IUniverInstanceService).getUnit<DocumentDataModel>(DOCS_ZEN_EDITOR_UNIT_ID_KEY)!.getSnapshot());-- const eventParams: IBeforeSheetEditEndEventParams = {- workbook,- worksheet,- row: loc.row,- column: loc.column,- isZenEditor: true,- value,- isConfirm: commandInfo.id === ConfirmZenEditCommand.id,- };- this.fireEvent(this.Event.BeforeSheetEditEnd, eventParams);-- if (eventParams.cancel) {- throw new CanceledError();- }- }- })- )- );-- // Register command execution handlers- this.disposeWithMe(- this.registerEventHandler(- this.Event.SheetEditStarted,- () => commandService.onCommandExecuted((commandInfo) => {- if (commandInfo.id === OpenZenEditorCommand.id) {- const target = this.getSheetCommandTarget();- if (!target) return;-- const { workbook, worksheet } = target;- const loc = injector.get(IEditorBridgeService).getEditLocation()!;-- const eventParams: ISheetEditStartedEventParams = {- workbook,- worksheet,- row: loc.row,- column: loc.column,- isZenEditor: true,- };- this.fireEvent(this.Event.SheetEditStarted, eventParams);- }- })- )- );-- this.disposeWithMe(- this.registerEventHandler(- this.Event.SheetEditEnded,- () => commandService.onCommandExecuted((commandInfo) => {- if (commandInfo.id === CancelZenEditCommand.id || commandInfo.id === ConfirmZenEditCommand.id) {- const target = this.getSheetCommandTarget();- if (!target) return;-- const { workbook, worksheet } = target;- const loc = injector.get(IEditorBridgeService).getEditLocation()!;-- const eventParams: ISheetEditEndedEventParams = {- workbook,- worksheet,- row: loc.row,- column: loc.column,- isZenEditor: true,- isConfirm: commandInfo.id === ConfirmZenEditCommand.id,- };- this.fireEvent(this.Event.SheetEditEnded, eventParams);- }- })- )- );-- // Register rich text editing mutation handler- this.disposeWithMe(- this.registerEventHandler(- this.Event.SheetEditChanging,- () => commandService.onCommandExecuted((commandInfo) => {- if (commandInfo.id === RichTextEditingMutation.id) {- const target = this.getActiveSheet();- if (!target) {- return;- }- const { workbook, worksheet } = target;- const editorBridgeService = injector.get(IEditorBridgeService);- const univerInstanceService = injector.get(IUniverInstanceService);- const params = commandInfo.params as IRichTextEditingMutationParams;- if (!editorBridgeService.isVisible().visible) return;- const { unitId } = params;- if (unitId === DOCS_ZEN_EDITOR_UNIT_ID_KEY) {- const { row, column } = editorBridgeService.getEditLocation()!;- const eventParams: ISheetEditChangingEventParams = {- workbook,- worksheet,- row,- column,- value: RichTextValue.create(univerInstanceService.getUnit<DocumentDataModel>(DOCS_ZEN_EDITOR_UNIT_ID_KEY)!.getSnapshot()),- isZenEditor: true,- };- this.fireEvent(this.Event.SheetEditChanging, eventParams);- }- }- })- )- );- }-- /**- * @ignore- */- override _initialize(injector: Injector): void {- this._initSheetZenEditorEvent(injector);- }-}--FUniver.extend(FUniverSheetsZenEditorMixin);--declare module '@univerjs/core/facade' {- // eslint-disable-next-line ts/naming-convention- interface FUniver extends IFUniverSheetsZenEditorMixin { }-}diff --git a/packages/sheets-zen-editor/src/facade/f-workbook.ts b/packages/sheets-zen-editor/src/facade/f-workbook.tsdeleted file mode 100644index 9868ec4c62..0000000000--- a/packages/sheets-zen-editor/src/facade/f-workbook.ts+++ /dev/null@@ -1,72 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { ICommandService } from '@univerjs/core';-import { CancelZenEditCommand, ConfirmZenEditCommand, OpenZenEditorCommand } from '@univerjs/sheets-zen-editor';-import { FWorkbook } from '@univerjs/sheets/facade';--/**- * @ignore- */-export interface IFWorkbookSheetsZenEditorMixin {- /**- * Enter the zen editing process on the active cell- * @returns {Promise<boolean>} A promise that resolves to a boolean indicating whether the zen editing process was started successfully.- * @example- * ```ts- * const fWorkbook = univerAPI.getActiveWorkbook();- * const success = await fWorkbook.startZenEditingAsync();- * console.log(success);- * ```- */- startZenEditingAsync(): Promise<boolean>;-- /**- * End the zen editing process on the active cell and optionally save the changes- * @async- * @param {boolean} save - Whether to save the changes, default is true- * @returns {Promise<boolean>} A promise that resolves to a boolean indicating whether the zen editing process was ended successfully.- * @example- * ```ts- * const fWorkbook = univerAPI.getActiveWorkbook();- * const success = await fWorkbook.endZenEditingAsync(false);- * console.log(success);- * ```- */- endZenEditingAsync(save?: boolean): Promise<boolean>;-}--export class FWorkbookSheetsZenEditorMixin extends FWorkbook implements IFWorkbookSheetsZenEditorMixin {- override startZenEditingAsync(): Promise<boolean> {- const commandService = this._injector.get(ICommandService);-- return commandService.executeCommand(OpenZenEditorCommand.id);- }-- override endZenEditingAsync(save = true): Promise<boolean> {- const commandService = this._injector.get(ICommandService);-- return save- ? commandService.executeCommand(ConfirmZenEditCommand.id)- : commandService.executeCommand(CancelZenEditCommand.id);- }-}--FWorkbook.extend(FWorkbookSheetsZenEditorMixin);-declare module '@univerjs/sheets/facade' {- // eslint-disable-next-line ts/naming-convention- interface FWorkbook extends IFWorkbookSheetsZenEditorMixin {}-}diff --git a/packages/sheets-zen-editor/src/facade/index.ts b/packages/sheets-zen-editor/src/facade/index.tsdeleted file mode 100644index 1ee241d0f3..0000000000--- a/packages/sheets-zen-editor/src/facade/index.ts+++ /dev/null@@ -1,21 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import './f-univer';-import './f-workbook';--export type * from './f-univer';-export type * from './f-workbook';diff --git a/packages/sheets-zen-editor/src/global.css b/packages/sheets-zen-editor/src/global.cssdeleted file mode 100644index 7c05d4ddc4..0000000000--- a/packages/sheets-zen-editor/src/global.css+++ /dev/null@@ -1,2 +0,0 @@-@tailwind components;-@tailwind utilities;diff --git a/packages/sheets-zen-editor/src/index.ts b/packages/sheets-zen-editor/src/index.tsdeleted file mode 100644index 97202add60..0000000000--- a/packages/sheets-zen-editor/src/index.ts+++ /dev/null@@ -1,21 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import './global.css';--export { CancelZenEditCommand, ConfirmZenEditCommand, OpenZenEditorCommand } from './commands/commands/zen-editor.command';-export type { IUniverSheetsZenEditorConfig } from './config/config';-export { UniverSheetsZenEditorPlugin } from './plugin';diff --git a/packages/sheets-zen-editor/src/locale/ar-SA.ts b/packages/sheets-zen-editor/src/locale/ar-SA.tsdeleted file mode 100644index 89a8b4ad69..0000000000--- a/packages/sheets-zen-editor/src/locale/ar-SA.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'محرر ملء الشاشة',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'إلغاء التحرير في وضع ملء الشاشة',- 'zen-edit-confirm': 'تأكيد التحرير في وضع ملء الشاشة',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/ca-ES.ts b/packages/sheets-zen-editor/src/locale/ca-ES.tsdeleted file mode 100644index bde7640548..0000000000--- a/packages/sheets-zen-editor/src/locale/ca-ES.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Editor a pantalla completa',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Cancel·la edició Zen',- 'zen-edit-confirm': 'Confirma edició Zen',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/de-DE.ts b/packages/sheets-zen-editor/src/locale/de-DE.tsdeleted file mode 100644index 7e4a5a8342..0000000000--- a/packages/sheets-zen-editor/src/locale/de-DE.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Vollbild-Editor',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Zen-Bearbeitung abbrechen',- 'zen-edit-confirm': 'Zen-Bearbeitung bestätigen',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/en-US.ts b/packages/sheets-zen-editor/src/locale/en-US.tsdeleted file mode 100644index 8af1ee6408..0000000000--- a/packages/sheets-zen-editor/src/locale/en-US.ts+++ /dev/null@@ -1,31 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--const locale = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Full Screen Editor',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Cancel Zen Edit',- 'zen-edit-confirm': 'Confirm Zen Edit',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/es-ES.ts b/packages/sheets-zen-editor/src/locale/es-ES.tsdeleted file mode 100644index 58e61e477b..0000000000--- a/packages/sheets-zen-editor/src/locale/es-ES.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Editor a pantalla completa',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Cancelar edición Zen',- 'zen-edit-confirm': 'Confirmar edición Zen',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/fa-IR.ts b/packages/sheets-zen-editor/src/locale/fa-IR.tsdeleted file mode 100644index 75d85e3ddc..0000000000--- a/packages/sheets-zen-editor/src/locale/fa-IR.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'ویرایشگر تمام صفحه',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'لغو ویرایش Zen',- 'zen-edit-confirm': 'تایید ویرایش Zen',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/fr-FR.ts b/packages/sheets-zen-editor/src/locale/fr-FR.tsdeleted file mode 100644index 097ddb48dd..0000000000--- a/packages/sheets-zen-editor/src/locale/fr-FR.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Éditeur plein écran',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Annuler l\'édition plein écran',- 'zen-edit-confirm': 'Confirmer l\'édition plein écran',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/id-ID.ts b/packages/sheets-zen-editor/src/locale/id-ID.tsdeleted file mode 100644index a95ee65aa9..0000000000--- a/packages/sheets-zen-editor/src/locale/id-ID.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Editor Layar Penuh',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Batalkan Edit Zen',- 'zen-edit-confirm': 'Konfirmasi Edit Zen',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/it-IT.ts b/packages/sheets-zen-editor/src/locale/it-IT.tsdeleted file mode 100644index aac84f76d4..0000000000--- a/packages/sheets-zen-editor/src/locale/it-IT.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Editor a schermo intero',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Annulla modifica Zen',- 'zen-edit-confirm': 'Conferma modifica Zen',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/ja-JP.ts b/packages/sheets-zen-editor/src/locale/ja-JP.tsdeleted file mode 100644index 35f58bb98e..0000000000--- a/packages/sheets-zen-editor/src/locale/ja-JP.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: '禅モード',- },- shortcut: {- sheet: {- 'zen-edit-cancel': '禅モードをキャンセル',- 'zen-edit-confirm': '禅モードに移行',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/ko-KR.ts b/packages/sheets-zen-editor/src/locale/ko-KR.tsdeleted file mode 100644index cbbeb2cc25..0000000000--- a/packages/sheets-zen-editor/src/locale/ko-KR.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: '젠 에디터',- },- shortcut: {- sheet: {- 'zen-edit-cancel': '젠 편집 취소',- 'zen-edit-confirm': '젠 편집 확인',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/pl-PL.ts b/packages/sheets-zen-editor/src/locale/pl-PL.tsdeleted file mode 100644index 180a16b637..0000000000--- a/packages/sheets-zen-editor/src/locale/pl-PL.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Edytor pełnoekranowy',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Anuluj edycję w trybie Zen',- 'zen-edit-confirm': 'Potwierdź edycję w trybie Zen',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/pt-BR.ts b/packages/sheets-zen-editor/src/locale/pt-BR.tsdeleted file mode 100644index fdb9295b86..0000000000--- a/packages/sheets-zen-editor/src/locale/pt-BR.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Editor em Tela Cheia',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Cancelar Edição Zen',- 'zen-edit-confirm': 'Confirmar Edição Zen',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/ru-RU.ts b/packages/sheets-zen-editor/src/locale/ru-RU.tsdeleted file mode 100644index 8d22918272..0000000000--- a/packages/sheets-zen-editor/src/locale/ru-RU.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Редактор на весь экран',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Отменить Zen редактирование',- 'zen-edit-confirm': 'Подтвердить Zen редактирование',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/sk-SK.ts b/packages/sheets-zen-editor/src/locale/sk-SK.tsdeleted file mode 100644index 35ad933d48..0000000000--- a/packages/sheets-zen-editor/src/locale/sk-SK.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Editor na celú obrazovku',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Zrušiť zen úpravu',- 'zen-edit-confirm': 'Potvrdiť zen úpravu',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/vi-VN.ts b/packages/sheets-zen-editor/src/locale/vi-VN.tsdeleted file mode 100644index d8467a2408..0000000000--- a/packages/sheets-zen-editor/src/locale/vi-VN.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: 'Chế độ chỉnh sửa Zen',- },- shortcut: {- sheet: {- 'zen-edit-cancel': 'Hủy chỉnh sửa (trạng thái Zen mode)',- 'zen-edit-confirm': 'Bỏ chỉnh sửa (trạng thái Zen mode)',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/zh-CN.ts b/packages/sheets-zen-editor/src/locale/zh-CN.tsdeleted file mode 100644index 3682a56d7e..0000000000--- a/packages/sheets-zen-editor/src/locale/zh-CN.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: '禅模式编辑',- },- shortcut: {- sheet: {- 'zen-edit-cancel': '取消编辑(禅模式状态)',- 'zen-edit-confirm': '放弃编辑(禅模式状态)',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/zh-HK.ts b/packages/sheets-zen-editor/src/locale/zh-HK.tsdeleted file mode 100644index 00292a3a40..0000000000--- a/packages/sheets-zen-editor/src/locale/zh-HK.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: '禪模式編輯',- },- shortcut: {- sheet: {- 'zen-edit-cancel': '取消編輯(禪模式狀態)',- 'zen-edit-confirm': '放棄編輯(禪模式狀態)',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/locale/zh-TW.ts b/packages/sheets-zen-editor/src/locale/zh-TW.tsdeleted file mode 100644index 00292a3a40..0000000000--- a/packages/sheets-zen-editor/src/locale/zh-TW.ts+++ /dev/null@@ -1,33 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type enUS from './en-US';--const locale: typeof enUS = {- 'sheets-zen-editor': {- rightClick: {- zenEditor: '禪模式編輯',- },- shortcut: {- sheet: {- 'zen-edit-cancel': '取消編輯(禪模式狀態)',- 'zen-edit-confirm': '放棄編輯(禪模式狀態)',- },- },- },-};--export default locale;diff --git a/packages/sheets-zen-editor/src/menu/menu.ts b/packages/sheets-zen-editor/src/menu/menu.tsdeleted file mode 100644index be9e923d97..0000000000--- a/packages/sheets-zen-editor/src/menu/menu.ts+++ /dev/null@@ -1,38 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { IAccessor } from '@univerjs/core';-import type { IMenuButtonItem } from '@univerjs/ui';-import { RangeProtectionPermissionEditPoint, WorkbookEditablePermission, WorksheetEditPermission, WorksheetSetCellStylePermission, WorksheetSetCellValuePermission } from '@univerjs/sheets';-import { getCurrentExclusiveRangeInterest$, getCurrentRangeDisable$, IEditorBridgeService } from '@univerjs/sheets-ui';-import { MenuItemType } from '@univerjs/ui';-import { map, switchMap } from 'rxjs';-import { OpenZenEditorCommand } from '../commands/commands/zen-editor.command';--export function ZenEditorMenuItemFactory(accessor: IAccessor): IMenuButtonItem {- const editorBridgeService = accessor.get(IEditorBridgeService);- return {- id: OpenZenEditorCommand.id,- type: MenuItemType.BUTTON,- title: 'sheets-zen-editor.rightClick.zenEditor',- icon: 'AmplifyIcon',- hidden$: getCurrentExclusiveRangeInterest$(accessor),- disabled$: editorBridgeService.currentEditCell$.pipe(- switchMap((cell) => getCurrentRangeDisable$(accessor, { workbookTypes: [WorkbookEditablePermission], worksheetTypes: [WorksheetEditPermission, WorksheetSetCellValuePermission, WorksheetSetCellStylePermission], rangeTypes: [RangeProtectionPermissionEditPoint] })- .pipe(map((disabled) => disabled || (cell?.documentLayoutObject.documentModel?.getBody()?.customBlocks?.length ?? 0) > 0)))- ),- };-}diff --git a/packages/sheets-zen-editor/src/menu/schema.ts b/packages/sheets-zen-editor/src/menu/schema.tsdeleted file mode 100644index d4aaa2ef93..0000000000--- a/packages/sheets-zen-editor/src/menu/schema.ts+++ /dev/null@@ -1,31 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { MenuSchemaType } from '@univerjs/ui';-import { ContextMenuGroup, ContextMenuPosition } from '@univerjs/ui';-import { OpenZenEditorCommand } from '../commands/commands/zen-editor.command';-import { ZenEditorMenuItemFactory } from './menu';--export const menuSchema: MenuSchemaType = {- [ContextMenuPosition.MAIN_AREA]: {- [ContextMenuGroup.OTHERS]: {- [OpenZenEditorCommand.id]: {- order: 2,- menuItemFactory: ZenEditorMenuItemFactory,- },- },- },-};diff --git a/packages/sheets-zen-editor/src/plugin.ts b/packages/sheets-zen-editor/src/plugin.tsdeleted file mode 100644index 5888a339c2..0000000000--- a/packages/sheets-zen-editor/src/plugin.ts+++ /dev/null@@ -1,70 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { Dependency } from '@univerjs/core';-import type { IUniverSheetsZenEditorConfig } from './config/config';-import { IConfigService, Inject, Injector, merge, Plugin, UniverInstanceType } from '@univerjs/core';-import pkg from '../package.json';-import { defaultPluginConfig, SHEETS_ZEN_EDITOR_PLUGIN_CONFIG_KEY } from './config/config';-import { ZenEditorUIController } from './controllers/zen-editor-ui.controller';-import { ZenEditorController } from './controllers/zen-editor.controller';-import { IZenEditorManagerService, ZenEditorManagerService } from './services/zen-editor.service';--export class UniverSheetsZenEditorPlugin extends Plugin {- static override pluginName = 'SHEET_ZEN_EDITOR_PLUGIN';- static override packageName = pkg.name;- static override version = pkg.version;- static override type = UniverInstanceType.UNIVER_SHEET;-- constructor(- private readonly _config: Partial<IUniverSheetsZenEditorConfig> = defaultPluginConfig,- @Inject(Injector) override readonly _injector: Injector,- @IConfigService private readonly _configService: IConfigService- ) {- super();-- // Manage the plugin configuration.- const { menu, ...rest } = merge(- {},- defaultPluginConfig,- this._config- );- if (menu) {- this._configService.setConfig('menu', menu, { merge: true });- }- this._configService.setConfig(SHEETS_ZEN_EDITOR_PLUGIN_CONFIG_KEY, rest);-- this._initializeDependencies(this._injector);- }-- private _initializeDependencies(injector: Injector) {- const dependencies: Dependency[] = [- [ZenEditorUIController],- [ZenEditorController],- [IZenEditorManagerService, { useClass: ZenEditorManagerService }],- ];-- dependencies.forEach((dependency) => injector.add(dependency));- }-- override onReady(): void {- this._injector.get(ZenEditorUIController);- }-- override onSteady(): void {- this._injector.get(ZenEditorController);- }-}diff --git a/packages/sheets-zen-editor/src/services/__tests__/zen-editor.service.spec.ts b/packages/sheets-zen-editor/src/services/__tests__/zen-editor.service.spec.tsdeleted file mode 100644index 5aed2660fc..0000000000--- a/packages/sheets-zen-editor/src/services/__tests__/zen-editor.service.spec.ts+++ /dev/null@@ -1,36 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { describe, expect, it } from 'vitest';-import { ZenEditorManagerService } from '../zen-editor.service';--describe('ZenEditorManagerService', () => {- it('should expose and publish position updates', () => {- const service = new ZenEditorManagerService();- const values: Array<DOMRect | null | undefined | void> = [];- const subscription = service.position$.subscribe((value) => values.push(value));-- const rect = new DOMRect(10, 20, 300, 200);- service.setPosition(rect);-- expect(service.getPosition()).toBe(rect);- expect(values).toEqual([null, rect]);-- subscription.unsubscribe();- service.dispose();- expect(service.getPosition()).toBeNull();- });-});diff --git a/packages/sheets-zen-editor/src/services/zen-editor.service.ts b/packages/sheets-zen-editor/src/services/zen-editor.service.tsdeleted file mode 100644index a13f63d57f..0000000000--- a/packages/sheets-zen-editor/src/services/zen-editor.service.ts+++ /dev/null@@ -1,56 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { Nullable } from '@univerjs/core';-import type { Observable } from 'rxjs';-import { createIdentifier, Disposable } from '@univerjs/core';-import { BehaviorSubject } from 'rxjs';--export interface IZenEditorManagerService {- position$: Observable<Nullable<DOMRect>>;- setPosition(param: DOMRect): void;- getPosition(): Readonly<Nullable<DOMRect>>;-}--export class ZenEditorManagerService extends Disposable implements IZenEditorManagerService {- private _position: Nullable<DOMRect> = null;-- private readonly _position$ = new BehaviorSubject<Nullable<DOMRect>>(null);- readonly position$ = this._position$.asObservable();-- override dispose(): void {- this._position$.complete();- this._position = null;- }-- setPosition(param: DOMRect) {- this._position = param;-- this._refresh(param);- }-- getPosition(): Readonly<Nullable<DOMRect>> {- return this._position;- }-- private _refresh(param: DOMRect): void {- this._position$.next(param);- }-}--export const IZenEditorManagerService = createIdentifier<IZenEditorManagerService>(- 'univer.sheet-zen-editor-manager.service'-);diff --git a/packages/sheets-zen-editor/src/views/zen-editor/ZenEditor.tsx b/packages/sheets-zen-editor/src/views/zen-editor/ZenEditor.tsxdeleted file mode 100644index 77b445f055..0000000000--- a/packages/sheets-zen-editor/src/views/zen-editor/ZenEditor.tsx+++ /dev/null@@ -1,151 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { IDocumentData } from '@univerjs/core';-import { DEFAULT_EMPTY_DOCUMENT_VALUE, DOCS_ZEN_EDITOR_UNIT_ID_KEY, DocumentFlavor, ICommandService } from '@univerjs/core';-import { clsx } from '@univerjs/design';-import { IEditorService } from '@univerjs/docs-ui';-import { CheckMarkIcon, CloseIcon } from '@univerjs/icons';-import { useDependency } from '@univerjs/ui';-import { useEffect, useRef } from 'react';-import { CancelZenEditCommand, ConfirmZenEditCommand } from '../../commands/commands/zen-editor.command';-import { IZenEditorManagerService } from '../../services/zen-editor.service';--const COMPONENT_PREFIX = 'ZEN_EDITOR_PLUGIN_';--export const ZEN_EDITOR_COMPONENT = `${COMPONENT_PREFIX}ZEN_EDITOR_COMPONENT`;--const INITIAL_SNAPSHOT: IDocumentData = {- id: DOCS_ZEN_EDITOR_UNIT_ID_KEY,- body: {- dataStream: `${DEFAULT_EMPTY_DOCUMENT_VALUE}`,- textRuns: [],- tables: [],- customBlocks: [],- paragraphs: [- {- startIndex: 0,- },- ],- sectionBreaks: [{- startIndex: 1,- }],- },- tableSource: {},- documentStyle: {- pageSize: {- width: 595,- height: Number.POSITIVE_INFINITY,- },- documentFlavor: DocumentFlavor.MODERN,- marginTop: 0,- marginBottom: 0,- marginRight: 0,- marginLeft: 0,- renderConfig: {- vertexAngle: 0,- centerAngle: 0,- },- },- drawings: {},- drawingsOrder: [],-};--export function ZenEditor() {- const editorRef = useRef<HTMLDivElement>(null);- const zenEditorService = useDependency(IZenEditorManagerService);- const editorService = useDependency(IEditorService);-- const commandService = useDependency(ICommandService);-- useEffect(() => {- const editorDom = editorRef.current;-- if (!editorDom) {- return;- }-- const registerSubscription = editorService.register({- editorUnitId: DOCS_ZEN_EDITOR_UNIT_ID_KEY,- initialSnapshot: INITIAL_SNAPSHOT,- scrollBar: true,- backScrollOffset: 100,- }, editorDom);-- const resizeObserver = new ResizeObserver(() => {- zenEditorService.setPosition(editorDom.getBoundingClientRect());- });-- resizeObserver.observe(editorDom);-- // Clean up on unmount- return () => {- registerSubscription.dispose();- resizeObserver.unobserve(editorDom);- };- }, []); // Empty dependency array means this effect runs once on mount and clean up on unmount-- function handleCloseBtnClick() {- const editor = editorService.getEditor(DOCS_ZEN_EDITOR_UNIT_ID_KEY);- editor?.blur();- commandService.executeCommand(CancelZenEditCommand.id);- }-- function handleConfirmBtnClick() {- const editor = editorService.getEditor(DOCS_ZEN_EDITOR_UNIT_ID_KEY);- editor?.blur();- commandService.executeCommand(ConfirmZenEditCommand.id);- }-- const containerClassName = 'univer-flex univer-w-7 univer-cursor-pointer univer-items-center univer-justify-center univer-transition-colors';-- return (- <div- className={`- univer-absolute univer-inset-0 univer-size-full univer-bg-white- dark:!univer-bg-gray-800- `}- >- <div- className={`- univer-absolute univer-right-6 univer-top-2 univer-z-10 univer-flex univer-items-center- univer-justify-center- `}- >- <span- className={clsx(containerClassName, `- univer-text-red-500- hover:univer-text-red-600- `)}- onClick={handleCloseBtnClick}- >- <CloseIcon className="univer-size-5" />- </span>-- <span- className={clsx(containerClassName, `- univer-text-green-500- hover:univer-text-green-600- `)}- onClick={handleConfirmBtnClick}- >- <CheckMarkIcon className="univer-size-5" />- </span>- </div>- <div ref={editorRef} className="univer-absolute univer-inset-0 univer-size-full" />- </div>- );-}diff --git a/packages/sheets-zen-editor/src/views/zen-editor/index.ts b/packages/sheets-zen-editor/src/views/zen-editor/index.tsdeleted file mode 100644index 0d7acde3e3..0000000000--- a/packages/sheets-zen-editor/src/views/zen-editor/index.ts+++ /dev/null@@ -1,17 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--export { ZEN_EDITOR_COMPONENT, ZenEditor } from './ZenEditor';diff --git a/packages/sheets-zen-editor/tailwind.config.ts b/packages/sheets-zen-editor/tailwind.config.tsdeleted file mode 100644index 75967f186f..0000000000--- a/packages/sheets-zen-editor/tailwind.config.ts+++ /dev/null@@ -1,27 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { Config } from 'tailwindcss';-import preset from '@univerjs-infra/shared/tailwind';--const config: Config = {- presets: [preset],- content: [- './src/**/*.{js,ts,jsx,tsx}',- ],-};--export default config;diff --git a/packages/sheets-zen-editor/tsconfig.json b/packages/sheets-zen-editor/tsconfig.jsondeleted file mode 100644index d4f9172636..0000000000--- a/packages/sheets-zen-editor/tsconfig.json+++ /dev/null@@ -1,8 +0,0 @@-{- "extends": "@univerjs-infra/shared/tsconfigs/base",- "compilerOptions": {- "rootDir": "src",- "outDir": "lib/types"- },- "include": ["src"]-}diff --git a/packages/sheets-zen-editor/tsconfig.node.json b/packages/sheets-zen-editor/tsconfig.node.jsondeleted file mode 100644index 2abfa07367..0000000000--- a/packages/sheets-zen-editor/tsconfig.node.json+++ /dev/null@@ -1,18 +0,0 @@-{- "extends": "@univerjs-infra/shared/tsconfigs/node",- "compilerOptions": {- "rootDir": "src",- "declaration": true,- "emitDeclarationOnly": true,- "noEmit": false,- "outDir": "lib/types"- },- "include": [- "src"- ],- "exclude": [- "src/**/__tests__/**",- "src/**/*.spec.ts",- "src/**/*.test.ts"- ]-}diff --git a/packages/sheets-zen-editor/vitest.config.ts b/packages/sheets-zen-editor/vitest.config.tsdeleted file mode 100644index af97c6d7a2..0000000000--- a/packages/sheets-zen-editor/vitest.config.ts+++ /dev/null@@ -1,3 +0,0 @@-import createConfig from '@univerjs-infra/shared/vitest';--export default createConfig();diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.tsindex 869f688d4a..952a1671a6 100644--- a/packages/ui/src/index.ts+++ b/packages/ui/src/index.ts@@ -117,8 +117,6 @@ export { DesktopSidebarService } from './services/sidebar/desktop-sidebar.servicexport { useSidebarClick } from './services/sidebar/hooks/use-sidebar-click';export { ILeftSidebarService, ISidebarService } from './services/sidebar/sidebar.service';export { ThemeSwitcherService } from './services/theme-switcher/theme-switcher.service';-export { DesktopZenZoneService } from './services/zen-zone/desktop-zen-zone.service';-export { IZenZoneService } from './services/zen-zone/zen-zone.service';export * from './utils';export { ComponentContainer, type IComponentContainerProps, useComponentsOfPart } from './views/components/ComponentContainer';export type { IConfirmChildrenProps } from './views/components/confirm-part/interface';@@ -138,4 +136,3 @@ export { Ribbon } from './views/components/ribbon/Ribbon';export { ToolbarButton } from './views/components/ribbon/ToolbarButton';export { ToolbarItem } from './views/components/ribbon/ToolbarItem';export { type ISidebarMethodOptions, Sidebar } from './views/components/sidebar/Sidebar';-export { ZenZone } from './views/components/zen-zone/ZenZone';diff --git a/packages/ui/src/mobile-plugin.ts b/packages/ui/src/mobile-plugin.tsindex 4ff08668ed..006120fb9e 100644--- a/packages/ui/src/mobile-plugin.ts+++ b/packages/ui/src/mobile-plugin.ts@@ -55,8 +55,6 @@ import { IShortcutService, ShortcutService } from './services/shortcut/shortcut.import { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';import { ISidebarService } from './services/sidebar/sidebar.service';import { ThemeSwitcherService } from './services/theme-switcher/theme-switcher.service';-import { DesktopZenZoneService } from './services/zen-zone/desktop-zen-zone.service';-import { IZenZoneService } from './services/zen-zone/zen-zone.service';export const DISABLE_AUTO_FOCUS_KEY = 'DISABLE_AUTO_FOCUS';@@ -115,7 +113,6 @@ export class UniverMobileUIPlugin extends Plugin {[IDialogService, { useClass: DesktopDialogService, lazy: true }],[IConfirmService, { useClass: DesktopConfirmService, lazy: true }],[ISidebarService, { useClass: DesktopSidebarService, lazy: true }],- [IZenZoneService, { useClass: DesktopZenZoneService, lazy: true }],[IMessageService, { useClass: DesktopMessageService, lazy: true }],[ILocalStorageService, { useClass: DesktopLocalStorageService, lazy: true }],[IBeforeCloseService, { useClass: DesktopBeforeCloseService }],diff --git a/packages/ui/src/plugin.ts b/packages/ui/src/plugin.tsindex 57c420e81a..84f93bd43e 100644--- a/packages/ui/src/plugin.ts+++ b/packages/ui/src/plugin.ts@@ -55,8 +55,6 @@ import { IShortcutService, ShortcutService } from './services/shortcut/shortcut.import { DesktopSidebarService } from './services/sidebar/desktop-sidebar.service';import { ISidebarService } from './services/sidebar/sidebar.service';import { ThemeSwitcherService } from './services/theme-switcher/theme-switcher.service';-import { DesktopZenZoneService } from './services/zen-zone/desktop-zen-zone.service';-import { IZenZoneService } from './services/zen-zone/zen-zone.service';export const DISABLE_AUTO_FOCUS_KEY = 'DISABLE_AUTO_FOCUS';@@ -115,7 +113,6 @@ export class UniverUIPlugin extends Plugin {[IDialogService, { useClass: DesktopDialogService, lazy: true }],[IConfirmService, { useClass: DesktopConfirmService, lazy: true }],[ISidebarService, { useClass: DesktopSidebarService, lazy: true }],- [IZenZoneService, { useClass: DesktopZenZoneService, lazy: true }],[IMessageService, { useClass: DesktopMessageService, lazy: true }],[ILocalStorageService, { useClass: DesktopLocalStorageService, lazy: true }],[IBeforeCloseService, { useClass: DesktopBeforeCloseService }],diff --git a/packages/ui/src/services/__tests__/misc-services.spec.ts b/packages/ui/src/services/__tests__/misc-services.spec.tsindex 831e66455b..1ab821147f 100644--- a/packages/ui/src/services/__tests__/misc-services.spec.ts+++ b/packages/ui/src/services/__tests__/misc-services.spec.ts@@ -24,7 +24,6 @@ import { isMenuButtonSelectorItem, isMenuSelectorItem, MenuItemType } from '../mimport { CanvasPopupService } from '../popup/canvas-popup.service';import { DesktopSidebarService } from '../sidebar/desktop-sidebar.service';import { ThemeSwitcherService } from '../theme-switcher/theme-switcher.service';-import { DesktopZenZoneService } from '../zen-zone/desktop-zen-zone.service';describe('clipboard capability detection', () => {afterEach(() => {@@ -473,78 +472,3 @@ describe('theme switcher service', () => {expect(styles[0]?.textContent).toContain('#000');});});--describe('zen zone service', () => {- function createComponentManager() {- return {- register: vi.fn(),- delete: vi.fn(),- };- }-- it('should register the component and emit its key through componentKey$', () => {- const manager = createComponentManager();- const service = new DesktopZenZoneService(manager as any);-- const keys: string[] = [];- service.componentKey$.subscribe((k) => keys.push(k));-- const dummyComponent = () => null;- service.set('zen-editor', dummyComponent);-- expect(manager.register).toHaveBeenCalledWith('zen-editor', dummyComponent);- expect(keys).toContain('zen-editor');- });-- it('should transition visible state when opening and closing', () => {- const manager = createComponentManager();- const service = new DesktopZenZoneService(manager as any);- service.set('zen-editor', () => null);-- expect(service.visible).toBe(false);-- service.open();- expect(service.visible).toBe(true);-- service.close();- expect(service.visible).toBe(false);- });-- it('should temporarily hide without affecting the underlying visible state', () => {- const manager = createComponentManager();- const service = new DesktopZenZoneService(manager as any);- service.set('zen-editor', () => null);-- service.open();- service.hide();- expect(service.temporaryHidden).toBe(true);- expect(service.visible).toBe(true);-- service.show();- expect(service.temporaryHidden).toBe(false);- });-- it('should unregister the component when the set disposable is disposed', () => {- const manager = createComponentManager();- const service = new DesktopZenZoneService(manager as any);-- const disposable = service.set('zen-editor', () => null);- disposable.dispose();-- expect(manager.delete).toHaveBeenCalledWith('zen-editor');- });-- it('should emit false through visible$ on dispose', () => {- const manager = createComponentManager();- const service = new DesktopZenZoneService(manager as any);- service.set('zen-editor', () => null);-- const visibleValues: boolean[] = [];- service.visible$.subscribe((v) => visibleValues.push(v));-- service.open();- service.dispose();-- expect(visibleValues.at(-1)).toBe(false);- });-});diff --git a/packages/ui/src/services/zen-zone/desktop-zen-zone.service.ts b/packages/ui/src/services/zen-zone/desktop-zen-zone.service.tsdeleted file mode 100644index 9f4a6b80c9..0000000000--- a/packages/ui/src/services/zen-zone/desktop-zen-zone.service.ts+++ /dev/null@@ -1,80 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { IDisposable } from '@univerjs/core';-import type { ComponentType } from '../../common/component-manager';-import type { IZenZoneService } from './zen-zone.service';--import { Inject, toDisposable } from '@univerjs/core';-import { BehaviorSubject, ReplaySubject } from 'rxjs';-import { ComponentManager } from '../../common/component-manager';--export class DesktopZenZoneService implements IZenZoneService, IDisposable {- readonly visible$ = new BehaviorSubject<boolean>(false);- readonly componentKey$ = new ReplaySubject<string>();-- private readonly _temporaryHidden$ = new BehaviorSubject<boolean>(false);- readonly temporaryHidden$ = this._temporaryHidden$.asObservable();-- private _visible = false;- get visible() {- return this._visible;- }-- get temporaryHidden() {- return this._temporaryHidden$.getValue();- }-- constructor(@Inject(ComponentManager) private readonly _componentManager: ComponentManager) {- // super- }-- dispose(): void {- this.visible$.next(false);- this.visible$.complete();-- this.componentKey$.complete();- }-- hide(): void {- this._temporaryHidden$.next(true);- }-- show(): void {- this._temporaryHidden$.next(false);- }-- set(key: string, component: ComponentType): IDisposable {- this._componentManager.register(key, component);- this.componentKey$.next(key);-- return toDisposable(() => {- this._componentManager.delete(key);- this.visible$.complete();- this.componentKey$.complete();- });- }-- open(): void {- this._visible = true;- this.visible$.next(true);- }-- close() {- this._visible = false;- this.visible$.next(false);- }-}diff --git a/packages/ui/src/services/zen-zone/zen-zone.service.ts b/packages/ui/src/services/zen-zone/zen-zone.service.tsdeleted file mode 100644index e1d76a5c29..0000000000--- a/packages/ui/src/services/zen-zone/zen-zone.service.ts+++ /dev/null@@ -1,46 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import type { IDisposable } from '@univerjs/core';-import type { BehaviorSubject, Observable, ReplaySubject } from 'rxjs';-import type { ComponentType } from '../../common/component-manager';-import { createIdentifier } from '@univerjs/core';--export const IZenZoneService = createIdentifier<IZenZoneService>('univer.zen-zone-service');--export interface IZenZoneService {- readonly visible$: BehaviorSubject<boolean>;- readonly componentKey$: ReplaySubject<string>;- readonly temporaryHidden$: Observable<boolean>;-- readonly visible: boolean;- readonly temporaryHidden: boolean;-- set(key: string, component: ComponentType): IDisposable;-- open(): void;-- close(): void;-- /**- * temporarily hide the zen zone, often- */- hide(): void;- /**- * show the zen zone- */- show(): void;-}diff --git a/packages/ui/src/views/components/zen-zone/ZenZone.tsx b/packages/ui/src/views/components/zen-zone/ZenZone.tsxdeleted file mode 100644index 1c40e8ef07..0000000000--- a/packages/ui/src/views/components/zen-zone/ZenZone.tsx+++ /dev/null@@ -1,67 +0,0 @@-/**- * Copyright 2023-present DreamNum Co., Ltd.- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import { clsx } from '@univerjs/design';-import { useEffect, useMemo, useState } from 'react';-import { ComponentManager } from '../../../common/component-manager';-import { IZenZoneService } from '../../../services/zen-zone/zen-zone.service';-import { useDependency, useObservable } from '../../../utils/di';--export function ZenZone() {- const zenZoneService = useDependency(IZenZoneService);-- const [visible, setVisible] = useState(false);- const [componentKey, setComponentKey] = useState<string>();- const hidden = useObservable(zenZoneService.temporaryHidden$);- const componentManager = useDependency(ComponentManager);-- useEffect(() => {- const subscriptions = [- zenZoneService.visible$.subscribe((visible) => {- setVisible(visible);- }),- zenZoneService.componentKey$.subscribe((componentKey) => {- setComponentKey(componentKey);- }),- ];-- return () => {- subscriptions.forEach((subscription) => {- subscription.unsubscribe();- });- };- }, []);-- const Component = useMemo(() => {- const Component = componentManager.get(componentKey ?? '');- if (Component) {- return Component;- }- }, [componentKey]);-- return (- <section- className={clsx('univer-absolute univer-z-[-1] univer-flex', {- 'univer-animate-in univer-fade-in univer-inset-0 univer-z-[100] univer-bg-gray-100': visible,- 'univer-hidden': hidden,- })}- >- <div className="univer-relative univer-flex-1">- {Component && <Component />}- </div>- </section>- );-}diff --git a/packages/ui/src/views/mobile-workbench/MobileWorkbench.tsx b/packages/ui/src/views/mobile-workbench/MobileWorkbench.tsxindex f997222c73..7645bf0bfb 100644--- a/packages/ui/src/views/mobile-workbench/MobileWorkbench.tsx+++ b/packages/ui/src/views/mobile-workbench/MobileWorkbench.tsx@@ -24,7 +24,6 @@ import { useDependency } from '../../utils/di';import { ComponentContainer, useComponentsOfPart } from '../components/ComponentContainer';import { MobileContextMenu } from '../components/context-menu/MobileContextMenu';import { Sidebar } from '../components/sidebar/Sidebar';-import { ZenZone } from '../components/zen-zone/ZenZone';export interface IUniverAppProps extends IWorkbenchOptions {mountContainer: HTMLElement;@@ -198,7 +197,6 @@ export function MobileWorkbench(props: IUniverAppProps) {<ComponentContainer key="footer" components={footerComponents} /></footer>)}- <ZenZone /></section></div><div dir={direction}>diff --git a/packages/ui/src/views/workbench/Workbench.tsx b/packages/ui/src/views/workbench/Workbench.tsxindex ddb210c475..5da7335b8f 100644--- a/packages/ui/src/views/workbench/Workbench.tsx+++ b/packages/ui/src/views/workbench/Workbench.tsx@@ -28,7 +28,6 @@ import { useDependency } from '../../utils/di';import { ComponentContainer, useComponentsOfPart } from '../components/ComponentContainer';import { DesktopContextMenu } from '../components/context-menu/ContextMenu';import { Sidebar } from '../components/sidebar/Sidebar';-import { ZenZone } from '../components/zen-zone/ZenZone';export interface IUniverWorkbenchProps extends IWorkbenchOptions {mountContainer: HTMLElement;@@ -230,7 +229,6 @@ export function DesktopWorkbenchContent(props: IUniverWorkbenchProps) {<ComponentContainer key="footer" components={footerComponents} sharedProps={{ contextMenu }} /></footer>)}- <ZenZone /></section></div>diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex a944eac315..4dcaa8a2a1 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -289,9 +289,6 @@ importers:'@univerjs/sheets-ui':specifier: workspace:*version: link:../../packages/sheets-ui- '@univerjs/sheets-zen-editor':- specifier: workspace:*- version: link:../../packages/sheets-zen-editor'@univerjs/slides':specifier: workspace:*version: link:../../packages/slides@@ -640,9 +637,6 @@ importers:'@univerjs/sheets-ui':specifier: workspace:*version: link:../packages/sheets-ui- '@univerjs/sheets-zen-editor':- specifier: workspace:*- version: link:../packages/sheets-zen-editor'@univerjs/slides':specifier: workspace:*version: link:../packages/slides@@ -2682,58 +2676,6 @@ importers:specifier: ^4.1.8version: 4.1.8(@types/[email protected])(@vitest/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))- packages/sheets-zen-editor:- dependencies:- '@univerjs/core':- specifier: workspace:*- version: link:../core- '@univerjs/design':- specifier: workspace:*- version: link:../design- '@univerjs/docs':- specifier: workspace:*- version: link:../docs- '@univerjs/docs-ui':- specifier: workspace:*- version: link:../docs-ui- '@univerjs/engine-render':- specifier: workspace:*- version: link:../engine-render- '@univerjs/icons':- specifier: 1.5.0- '@univerjs/sheets':- specifier: workspace:*- version: link:../sheets- '@univerjs/sheets-ui':- specifier: workspace:*- version: link:../sheets-ui- '@univerjs/ui':- specifier: workspace:*- version: link:../ui- devDependencies:- '@univerjs-infra/shared':- specifier: workspace:*- version: link:../../common/shared- postcss:- specifier: ^8.5.15- version: 8.5.15- react:- specifier: 19.2.7- version: 19.2.7- rxjs:- specifier: ^7.8.2- version: 7.8.2- tailwindcss:- specifier: 3.4.18- version: 3.4.18- typescript:- specifier: ^6.0.3- version: 6.0.3- vitest:- specifier: ^4.1.8- version: 4.1.8(@types/[email protected])(@vitest/[email protected])([email protected])([email protected])([email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))-packages/slides:dependencies:'@univerjs/core':