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
feat(example): add doc uniscript example (#1495)
Dushusired01f9256cd7
diff --git a/examples/esbuild.config.mjs b/examples/esbuild.config.mjsindex 519a500fb6..55bb9e667f 100644--- a/examples/esbuild.config.mjs+++ b/examples/esbuild.config.mjs@@ -72,14 +72,18 @@ const ctx = await esbuild[args.watch ? 'context' : 'build']({// sheets-multi'./src/sheets-multi/main.tsx',+ // sheets-uniscript+ './src/sheets-uniscript/main.ts',+// docs'./src/docs/main.ts',+ // docs-uniscript+ './src/docs-uniscript/main.ts',+// slides'./src/slides/main.ts',- // uniscript- './src/uniscript/main.ts',],outdir: './local',diff --git a/examples/package.json b/examples/package.jsonindex 134201ea23..3afb499e97 100644--- a/examples/package.json+++ b/examples/package.json@@ -16,6 +16,7 @@"@univerjs/docs-ui": "workspace:*","@univerjs/engine-formula": "workspace:*","@univerjs/engine-render": "workspace:*",+ "@univerjs/facade": "workspace:*","@univerjs/find-replace": "workspace:*","@univerjs/icons": "^0.1.39","@univerjs/rpc": "workspace:*",diff --git a/examples/public/uniscript/index.html b/examples/public/docs-uniscript/index.htmlsimilarity index 94%rename from examples/public/uniscript/index.htmlrename to examples/public/docs-uniscript/index.htmlindex 746774a132..ceca80978c 100644--- a/examples/public/uniscript/index.html+++ b/examples/public/docs-uniscript/index.html@@ -3,7 +3,7 @@<head><meta charset="utf-8" /><meta content="width=device-width, initial-scale=1" name="viewport" />- <title>Uniscript</title>+ <title>Univer Docs Uniscript</title><link rel="icon" type="image/x-icon" href="../favicon.svg" /><link rel="stylesheet" href="./main.css" />diff --git a/examples/public/sheets-multi/index.html b/examples/public/sheets-multi/index.htmlindex 9091cac93b..f25beb52d4 100644--- a/examples/public/sheets-multi/index.html+++ b/examples/public/sheets-multi/index.html@@ -3,7 +3,7 @@<head><meta charset="utf-8" /><meta content="width=device-width, initial-scale=1" name="viewport" />- <title>Univer Sheet</title>+ <title>Univer Sheets Multi Instance</title><link rel="icon" type="image/x-icon" href="../favicon.svg" /><link rel="stylesheet" href="./main.css" />diff --git a/examples/public/sheets-uniscript/index.html b/examples/public/sheets-uniscript/index.htmlnew file mode 100644index 0000000000..d46fc63434--- /dev/null+++ b/examples/public/sheets-uniscript/index.html@@ -0,0 +1,31 @@+<!doctype html>+<html lang="en">+ <head>+ <meta charset="utf-8" />+ <meta content="width=device-width, initial-scale=1" name="viewport" />+ <title>Univer Sheets Uniscript</title>++ <link rel="icon" type="image/x-icon" href="../favicon.svg" />+ <link rel="stylesheet" href="./main.css" />+ <style>+ html,+ body {+ height: 100%;+ margin: 0;+ }+ </style>++ <script>+ new EventSource('/esbuild').addEventListener('change', () => {+ console.info('reload--');+ location.reload();+ });+ </script>+ </head>++ <body style="overflow: hidden">+ <div id="app" style="height: 100%"></div>++ <script src="./main.js"></script>+ </body>+</html>diff --git a/examples/public/sheets/index.html b/examples/public/sheets/index.htmlindex 4005a1fcee..c228b9f521 100644--- a/examples/public/sheets/index.html+++ b/examples/public/sheets/index.html@@ -3,7 +3,7 @@<head><meta charset="utf-8" /><meta content="width=device-width, initial-scale=1" name="viewport" />- <title>Univer Sheet</title>+ <title>Univer Sheets</title><link rel="icon" type="image/x-icon" href="../favicon.svg" /><link rel="stylesheet" href="./main.css" />diff --git a/examples/src/docs-uniscript/main.ts b/examples/src/docs-uniscript/main.tsnew file mode 100644index 0000000000..8e4cfbf64c--- /dev/null+++ b/examples/src/docs-uniscript/main.ts@@ -0,0 +1,74 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * 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 { LocaleType, LogLevel, Univer } from '@univerjs/core';+import { defaultTheme } from '@univerjs/design';+import { UniverDocsPlugin } from '@univerjs/docs';+import { UniverDocsUIPlugin } from '@univerjs/docs-ui';+import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula';+import { UniverRenderEnginePlugin } from '@univerjs/engine-render';+import { UniverUIPlugin } from '@univerjs/ui';+import { UniverUniscriptPlugin } from '@univerjs/uniscript';++import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui';+import { UniverSheetsPlugin } from '@univerjs/sheets';+import { DEFAULT_DOCUMENT_DATA_CN } from '../data';++// univer+const univer = new Univer({+ theme: defaultTheme,+ locale: LocaleType.ZH_CN,+ logLevel: LogLevel.VERBOSE,+});++// core plugins++univer.registerPlugin(UniverRenderEnginePlugin);+univer.registerPlugin(UniverFormulaEnginePlugin);+univer.registerPlugin(UniverUIPlugin, {+ container: 'app',+ header: true,+ toolbar: true,+});++univer.registerPlugin(UniverDocsPlugin, {+ standalone: true,+});+univer.registerPlugin(UniverDocsUIPlugin);++univer.registerPlugin(UniverSheetsPlugin);+univer.registerPlugin(UniverSheetsUIPlugin);++univer.registerPlugin(UniverUniscriptPlugin, {+ getWorkerUrl(moduleID: string, label: string) {+ if (label === 'typescript' || label === 'javascript') {+ return './vs/language/typescript/ts.worker.js';+ }++ return './vs/editor/editor.worker.js';+ },+});++// create univer doc instance+univer.createUniverDoc(DEFAULT_DOCUMENT_DATA_CN);++declare global {+ interface Window {+ univer?: Univer;+ }+}++window.univer = univer;diff --git a/examples/src/main.tsx b/examples/src/main.tsxindex a4cf2bdb22..53a48b4ea2 100644--- a/examples/src/main.tsx+++ b/examples/src/main.tsx@@ -51,12 +51,17 @@ function Examples() {{' '}</a><a className={styles.btn} href="./sheets-multi/">- <span> Univer Multi Instance</span>+ <span> Univer Sheets Multi Instance</span><div className={styles.btnBg}>→</div>{' '}</a>- <a className={styles.btn} href="./uniscript/">- <span> Uniscript</span>+ <a className={styles.btn} href="./sheets-uniscript/">+ <span> Univer Sheets Uniscript</span>+ <div className={styles.btnBg}>→</div>+ {' '}+ </a>+ <a className={styles.btn} href="./docs-uniscript/">+ <span> Univer Docs Uniscript</span><div className={styles.btnBg}>→</div>{' '}</a>diff --git a/examples/src/uniscript/change-font-style.js b/examples/src/sheets-uniscript/change-font-style.jssimilarity index 100%rename from examples/src/uniscript/change-font-style.jsrename to examples/src/sheets-uniscript/change-font-style.jsdiff --git a/examples/src/uniscript/china-id-validation.js b/examples/src/sheets-uniscript/china-id-validation.jssimilarity index 100%rename from examples/src/uniscript/china-id-validation.jsrename to examples/src/sheets-uniscript/china-id-validation.jsdiff --git a/examples/src/uniscript/data.csv b/examples/src/sheets-uniscript/data.csvsimilarity index 100%rename from examples/src/uniscript/data.csvrename to examples/src/sheets-uniscript/data.csvdiff --git a/examples/src/uniscript/draw-univer-logo.js b/examples/src/sheets-uniscript/draw-univer-logo.jssimilarity index 100%rename from examples/src/uniscript/draw-univer-logo.jsrename to examples/src/sheets-uniscript/draw-univer-logo.jsdiff --git a/examples/src/uniscript/main.ts b/examples/src/sheets-uniscript/main.tssimilarity index 100%rename from examples/src/uniscript/main.tsrename to examples/src/sheets-uniscript/main.tsdiff --git a/packages/facade/package.json b/packages/facade/package.jsonindex fd38d2a70a..427f5d8548 100644--- a/packages/facade/package.json+++ b/packages/facade/package.json@@ -62,6 +62,8 @@},"peerDependencies": {"@univerjs/core": "workspace:*",+ "@univerjs/docs": "workspace:*",+ "@univerjs/engine-render": "workspace:*","@univerjs/network": "workspace:*","@univerjs/sheets": "workspace:*","@univerjs/sheets-formula": "workspace:*",@@ -72,7 +74,9 @@"dependencies": {},"devDependencies": {"@univerjs/core": "workspace:*",+ "@univerjs/docs": "workspace:*","@univerjs/engine-formula": "workspace:*",+ "@univerjs/engine-render": "workspace:*","@univerjs/network": "workspace:*","@univerjs/shared": "workspace:*","@univerjs/sheets": "workspace:*",diff --git a/packages/facade/src/apis/docs/__tests__/create-test-bed.ts b/packages/facade/src/apis/docs/__tests__/create-test-bed.tsnew file mode 100644index 0000000000..b28e572d1d--- /dev/null+++ b/packages/facade/src/apis/docs/__tests__/create-test-bed.ts@@ -0,0 +1,111 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * 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, IDocumentData } from '@univerjs/core';+import {+ ILogService,+ IUniverInstanceService,+ LocaleService,+ LogLevel,+ Plugin,+ PluginType,+ Univer,+} from '@univerjs/core';+import {+ enUS,+ zhCN,+} from '@univerjs/sheets-formula';+import type { Dependency } from '@wendellhu/redi';+import { Inject, Injector } from '@wendellhu/redi';++import { DocStateChangeManagerService, DocViewModelManagerService, IMEInputManagerService, TextSelectionManagerService } from '@univerjs/docs';++import { ITextSelectionRenderManager, TextSelectionRenderManager } from '@univerjs/engine-render';+import { FUniver } from '../../facade';++function getTestDocumentDataDemo(): IDocumentData {+ return {+ id: 'test',+ body: {+ dataStream: 'Hello,\r\n',+ },+ documentStyle: {+ pageSize: {+ width: 594.3,+ height: 840.51,+ },+ marginTop: 72,+ marginBottom: 72,+ marginRight: 90,+ marginLeft: 90,+ },+ };+}++export interface ITestBed {+ univer: Univer;+ get: Injector['get'];+ doc: DocumentDataModel;+ univerAPI: FUniver;+}++export function createTestBed(documentConfig?: IDocumentData, dependencies?: Dependency[]): ITestBed {+ const univer = new Univer();+ const injector = univer.__getInjector();++ class TestSpyPlugin extends Plugin {+ static override type = PluginType.Univer;++ constructor(+ _config: undefined,+ @Inject(Injector) override readonly _injector: Injector+ ) {+ super('test-plugin');++ this._injector = _injector;+ }++ override onStarting(injector: Injector): void {+ injector.add([TextSelectionManagerService]);+ injector.add([DocViewModelManagerService]);+ injector.add([DocStateChangeManagerService]);+ injector.add([IMEInputManagerService]);+ injector.add([ITextSelectionRenderManager, { useClass: TextSelectionRenderManager }]);++ dependencies?.forEach((d) => injector.add(d));+ }+ }++ injector.get(LocaleService).load({ zhCN, enUS });++ univer.registerPlugin(TestSpyPlugin);+ const doc = univer.createUniverDoc(documentConfig || getTestDocumentDataDemo());++ const univerInstanceService = injector.get(IUniverInstanceService);+ univerInstanceService.focusUniverInstance('test');+ const logService = injector.get(ILogService);++ logService.setLogLevel(LogLevel.SILENT); // change this to `LogLevel.VERBOSE` to debug tests via logs++ const univerAPI = FUniver.newAPI(injector);++ return {+ univer,+ get: injector.get.bind(injector),+ doc,+ univerAPI,+ };+}diff --git a/packages/facade/src/apis/docs/__tests__/f-document.spec.ts b/packages/facade/src/apis/docs/__tests__/f-document.spec.tsnew file mode 100644index 0000000000..5faa498f35--- /dev/null+++ b/packages/facade/src/apis/docs/__tests__/f-document.spec.ts@@ -0,0 +1,49 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * 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 type { Injector } from '@wendellhu/redi';+import { beforeEach, describe, expect, it } from 'vitest';++import { InsertCommand, RichTextEditingMutation } from '@univerjs/docs';+import type { FUniver } from '../../facade';+import { createTestBed } from './create-test-bed';++describe('Test FDocument', () => {+ let get: Injector['get'];+ let commandService: ICommandService;+ let univerAPI: FUniver;++ beforeEach(() => {+ const testBed = createTestBed();+ get = testBed.get;+ univerAPI = testBed.univerAPI;++ commandService = get(ICommandService);+ commandService.registerCommand(InsertCommand);+ commandService.registerCommand(RichTextEditingMutation as any);+ });++ it('Document appendText', async () => {+ const activeDoc = univerAPI.getActiveDocument();++ expect(await activeDoc?.appendText('Univer')).toBeTruthy();++ const dataStream = activeDoc?.getSnapshot().body?.dataStream;++ expect(dataStream?.substring(0, dataStream.length - 2)).toEqual('Hello,Univer');+ });+});diff --git a/packages/facade/src/apis/docs/f-document.ts b/packages/facade/src/apis/docs/f-document.tsnew file mode 100644index 0000000000..a77b1e6bbc--- /dev/null+++ b/packages/facade/src/apis/docs/f-document.ts@@ -0,0 +1,102 @@+/**+ * Copyright 2023-present DreamNum Inc.+ *+ * 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, IDocumentData } from '@univerjs/core';+import {+ ICommandService,+ IUniverInstanceService,+ RedoCommand,+ UndoCommand,+} from '@univerjs/core';+import { InsertCommand } from '@univerjs/docs';++export class FDocument {+ readonly id: string;++ constructor(+ private readonly _documentDataModel: DocumentDataModel,+ @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,+ @ICommandService private readonly _commandService: ICommandService+ ) {+ this.id = this._documentDataModel.getUnitId();+ }++ getId(): string {+ return this._documentDataModel.getUnitId();+ }++ getName(): string {+ return this.getSnapshot().title || '';+ }++ getSnapshot(): IDocumentData {+ return this._documentDataModel.getSnapshot();+ }++ undo(): Promise<boolean> {+ this._univerInstanceService.focusUniverInstance(this.id);+ return this._commandService.executeCommand(UndoCommand.id);+ }++ redo(): Promise<boolean> {+ this._univerInstanceService.focusUniverInstance(this.id);+ return this._commandService.executeCommand(RedoCommand.id);+ }++ /**+ * Adds the specified text to the end of this text region.+ * @param text+ */+ appendText(text: string): Promise<boolean> {+ const unitId = this.id;++ const { body } = this.getSnapshot();++ if (!body) {+ throw new Error('The document body is empty');+ }++ const lastPosition = body.dataStream.length - 2;++ const activeRange = {+ startOffset: lastPosition,+ endOffset: lastPosition,+ collapsed: true,+ segmentId: '',+ };++ const { startOffset, segmentId } = activeRange;++ const len = text.length;++ const textRanges = [+ {+ startOffset: startOffset + len,+ endOffset: startOffset + len,+ },+ ];++ return this._commandService.executeCommand(InsertCommand.id, {+ unitId,+ body: {+ dataStream: text,+ },+ range: activeRange,+ textRanges,+ segmentId,+ });+ }+}diff --git a/packages/facade/src/apis/facade.ts b/packages/facade/src/apis/facade.tsindex 4ed893a939..ac81c74a59 100644--- a/packages/facade/src/apis/facade.ts+++ b/packages/facade/src/apis/facade.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import type { CommandListener, IExecutionOptions, IWorkbookData } from '@univerjs/core';+import type { CommandListener, IDocumentData, IExecutionOptions, IWorkbookData } from '@univerjs/core';import {BorderStyleTypes,ICommandService,@@ -25,11 +25,12 @@ import {} from '@univerjs/core';import { ISocketService, WebSocketService } from '@univerjs/network';import type { IRegisterFunctionParams, IUnregisterFunctionParams } from '@univerjs/sheets-formula';-import { IRegisterFunctionService } from '@univerjs/sheets-formula';+import { IRegisterFunctionService, RegisterFunctionService } from '@univerjs/sheets-formula';import type { IDisposable } from '@wendellhu/redi';import { Inject, Injector, Quantity } from '@wendellhu/redi';-import { FWorkbook } from './sheet/f-workbook';+import { FWorkbook } from './sheets/f-workbook';+import { FDocument } from './docs/f-document';export class FUniver {/**@@ -53,7 +54,6 @@ export class FUniver {@Inject(Injector) private readonly _injector: Injector,@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,@ICommandService private readonly _commandService: ICommandService,- @IRegisterFunctionService private readonly _registerFunctionService: IRegisterFunctionService,@ISocketService private readonly _ws: ISocketService) {}@@ -67,6 +67,16 @@ export class FUniver {return this._injector.createInstance(FWorkbook, workbook);}+ /**+ * Create a new document and get the API handler of that document.+ * @param data the snapshot of the document.+ * @returns Document API instance.+ */+ createUniverDoc(data: Partial<IDocumentData>): FDocument {+ const document = this._univerInstanceService.createDoc(data);+ return this._injector.createInstance(FDocument, document);+ }+/*** Get the spreadsheet API handler by the spreadsheet id.* @param id the spreadsheet id.@@ -81,6 +91,20 @@ export class FUniver {return this._injector.createInstance(FWorkbook, workbook);}+ /**+ * Get the document API handler by the document id.+ * @param id the document id.+ * @returns Document API instance.+ */+ getUniverDoc(id: string): FDocument | null {+ const document = this._univerInstanceService.getUniverDocInstance(id);+ if (!document) {+ return null;+ }++ return this._injector.createInstance(FDocument, document);+ }+/*** Get the currently focused Univer spreadsheet.* @returns the currently focused Univer spreadsheet.@@ -94,20 +118,49 @@ export class FUniver {return this._injector.createInstance(FWorkbook, workbook);}+ /**+ * Get the currently focused Univer document.+ * @returns the currently focused Univer document.+ */+ getActiveDocument(): FDocument | null {+ const document = this._univerInstanceService.getCurrentUniverDocInstance();+ if (!document) {+ return null;+ }++ return this._injector.createInstance(FDocument, document);+ }+/*** Register a function to the spreadsheet.* @param config*/registerFunction(config: IRegisterFunctionParams) {- this._registerFunctionService.registerFunctions(config);+ let registerFunctionService = this._injector.get(IRegisterFunctionService);++ if (!registerFunctionService) {+ this._injector.add([IRegisterFunctionService, { useClass: RegisterFunctionService }]);+ registerFunctionService = this._injector.get(IRegisterFunctionService);+ }++ registerFunctionService.registerFunctions(config);}/*** Unregister a function from the spreadsheet.+ *+ * TODO@Dushusir: remove unregister,use IDisposable* @param config*/unregisterFunction(config: IUnregisterFunctionParams) {- this._registerFunctionService.unregisterFunctions(config);+ let registerFunctionService = this._injector.get(IRegisterFunctionService);++ if (!registerFunctionService) {+ this._injector.add([IRegisterFunctionService, { useClass: RegisterFunctionService }]);+ registerFunctionService = this._injector.get(IRegisterFunctionService);+ }++ registerFunctionService.unregisterFunctions(config);}// #regiondiff --git a/packages/facade/src/apis/sheet/__tests__/create-test-bed.ts b/packages/facade/src/apis/sheets/__tests__/create-test-bed.tssimilarity index 100%rename from packages/facade/src/apis/sheet/__tests__/create-test-bed.tsrename to packages/facade/src/apis/sheets/__tests__/create-test-bed.tsdiff --git a/packages/facade/src/apis/sheet/__tests__/f-range.spec.ts b/packages/facade/src/apis/sheets/__tests__/f-range.spec.tssimilarity index 100%rename from packages/facade/src/apis/sheet/__tests__/f-range.spec.tsrename to packages/facade/src/apis/sheets/__tests__/f-range.spec.tsdiff --git a/packages/facade/src/apis/sheet/__tests__/utils.spec.ts b/packages/facade/src/apis/sheets/__tests__/utils.spec.tssimilarity index 100%rename from packages/facade/src/apis/sheet/__tests__/utils.spec.tsrename to packages/facade/src/apis/sheets/__tests__/utils.spec.tsdiff --git a/packages/facade/src/apis/sheet/f-range.ts b/packages/facade/src/apis/sheets/f-range.tssimilarity index 100%rename from packages/facade/src/apis/sheet/f-range.tsrename to packages/facade/src/apis/sheets/f-range.tsdiff --git a/packages/facade/src/apis/sheet/f-selection.ts b/packages/facade/src/apis/sheets/f-selection.tssimilarity index 100%rename from packages/facade/src/apis/sheet/f-selection.tsrename to packages/facade/src/apis/sheets/f-selection.tsdiff --git a/packages/facade/src/apis/sheet/f-workbook.ts b/packages/facade/src/apis/sheets/f-workbook.tssimilarity index 100%rename from packages/facade/src/apis/sheet/f-workbook.tsrename to packages/facade/src/apis/sheets/f-workbook.tsdiff --git a/packages/facade/src/apis/sheet/f-worksheet.ts b/packages/facade/src/apis/sheets/f-worksheet.tssimilarity index 100%rename from packages/facade/src/apis/sheet/f-worksheet.tsrename to packages/facade/src/apis/sheets/f-worksheet.tsdiff --git a/packages/facade/src/apis/sheet/utils.ts b/packages/facade/src/apis/sheets/utils.tssimilarity index 100%rename from packages/facade/src/apis/sheet/utils.tsrename to packages/facade/src/apis/sheets/utils.tsdiff --git a/packages/facade/src/index.ts b/packages/facade/src/index.tsindex b365b6aa01..dd8dc6bfec 100644--- a/packages/facade/src/index.ts+++ b/packages/facade/src/index.ts@@ -14,9 +14,9 @@* limitations under the License.*/-export type { FontLine, FontStyle, FontWeight } from './apis/sheet/f-range';+export type { FontLine, FontStyle, FontWeight } from './apis/sheets/f-range';export { FUniver } from './apis/facade';-export { FRange } from './apis/sheet/f-range';-export { FSelection } from './apis/sheet/f-selection';-export { FWorkbook } from './apis/sheet/f-workbook';-export { FWorksheet } from './apis/sheet/f-worksheet';+export { FRange } from './apis/sheets/f-range';+export { FSelection } from './apis/sheets/f-selection';+export { FWorkbook } from './apis/sheets/f-workbook';+export { FWorksheet } from './apis/sheets/f-worksheet';diff --git a/packages/uniscript/src/controllers/menu.ts b/packages/uniscript/src/controllers/menu.tsindex 6f468b694f..b8458f7d85 100644--- a/packages/uniscript/src/controllers/menu.ts+++ b/packages/uniscript/src/controllers/menu.ts@@ -14,10 +14,8 @@* limitations under the License.*/-import { UniverInstanceType } from '@univerjs/core';-import { getCurrentSheetDisabled$ } from '@univerjs/sheets';import type { IMenuButtonItem } from '@univerjs/ui';-import { getMenuHiddenObservable, MenuItemType, MenuPosition } from '@univerjs/ui';+import { MenuItemType, MenuPosition } from '@univerjs/ui';import type { IAccessor } from '@wendellhu/redi';import { ToggleScriptPanelOperation } from '../commands/operations/panel.operation';@@ -30,7 +28,8 @@ export function UniscriptMenuItemFactory(accessor: IAccessor): IMenuButtonItem {icon: 'CodeSingle',type: MenuItemType.BUTTON,positions: [MenuPosition.TOOLBAR_START],- hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),- disabled$: getCurrentSheetDisabled$(accessor),+ // FIXME hidden$ and disabled$ are not correctly in doc+ // hidden$: getMenuHiddenObservable(accessor, UniverInstanceType.SHEET),+ // disabled$: getCurrentSheetDisabled$(accessor),};}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 224ffd9946..a639ed84b8 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -198,6 +198,9 @@ importers:'@univerjs/engine-render':specifier: workspace:*version: link:../packages/engine-render+ '@univerjs/facade':+ specifier: workspace:*+ version: link:../packages/facade'@univerjs/find-replace':specifier: workspace:*version: link:../packages/find-replace@@ -579,9 +582,15 @@ importers:'@univerjs/core':specifier: workspace:*version: link:../core+ '@univerjs/docs':+ specifier: workspace:*+ version: link:../docs'@univerjs/engine-formula':specifier: workspace:*version: link:../engine-formula+ '@univerjs/engine-render':+ specifier: workspace:*+ version: link:../engine-render'@univerjs/network':specifier: workspace:*version: link:../network