Skip to content

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.

Merge branch 'dev' of https://github.com/dream-num/univer into dev

tonytonychopper123e6bf16be2a73
diff --cc packages/base-sheets/src/Controller/ToolBarController.ts
index 9d198cd860,5e007dba77..78929e7cb5
--- a/packages/base-sheets/src/Controller/ToolBarController.ts
+++ b/packages/base-sheets/src/Controller/ToolBarController.ts
@@@ -208,10 -211,10 +208,9 @@@ export class ToolBarController
type: 1,
tooltipLocale: 'toolbar.fontSize',
label: String(DEFAULT_STYLES.fs),
- show: config.fontSize,
name: 'fontSize',
+ show: toolbarConfig.fontSize,
onClick: (fontSize: number) => {
- console.dir(fontSize);
- debugger;
this._plugin.getObserver('onAfterChangeFontSizeObservable')?.notifyObservers(fontSize);
},
onKeyUp: (fontSize: number) => {
diff --cc packages/base-sheets/src/SheetPlugin.tsx
index ff36b17467,0778f29c01..dfee6d35c3
--- a/packages/base-sheets/src/SheetPlugin.tsx
+++ b/packages/base-sheets/src/SheetPlugin.tsx
@@@ -1,6 -1,18 +1,18 @@@
-import { getRefElement, IMainProps, isElement, ISlotProps, RefObject, render } from '@univer/base-component';
+import { getRefElement, isElement, ISlotProps, RefObject, render } from '@univer/base-component';
import { Engine, RenderEngine } from '@univer/base-render';
- import { AsyncFunction, SheetContext, IWorkbookConfig, Plugin, PLUGIN_NAMES, Tools } from '@univer/core';
+ import {
+ AsyncFunction,
+ SheetContext,
+ IWorkbookConfig,
+ Plugin,
+ PLUGIN_NAMES,
+ Tools,
+ CommandManager,
+ IActionObserverProps,
+ SheetActionBase,
+ ACTION_NAMES,
+ ISetNamedRangeActionData,
+ } from '@univer/core';
import { install, SheetPluginObserve, uninstall } from './Basics/Observer';
import { RightMenuProps } from './Model/RightMenuModel';
@@@ -197,7 -230,41 +214,20 @@@ export class SheetPlugin extends Plugin
onMounted(ctx: SheetContext): void {
install(this);
- // this.initialize(ctx);
-
- // When executing setContainer, occasionally ContentRef has not been mounted, because the didmount mount of preact is asynchronous, so let's judge here, if there is no DOM, we will execute our mount through the hook of the completion of the mount Rendering logic.
-
- // if (!this.getContentRef().current) {
- // this.context
- // .getObserverManager()
- // .getObserver('onSheetContainerDidMountObservable', 'workbook')
- // ?.add((e) => {
- // this._initializeRender(ctx);
- // });
-
this.initialize(ctx);
- // return;
- // }
-
- // this._initializeRender(ctx);
+
+ CommandManager.getActionObservers().add((actionObs: IActionObserverProps): void => {
+ const currentUnitId = this.getContext().getWorkBook().getUnitId();
+ const action = actionObs.action as SheetActionBase<ISetNamedRangeActionData, ISetNamedRangeActionData>;
+ const actionData = action.getDoActionData();
+ const actionUnitId = action.getWorkSheet().getContext().getWorkBook().getUnitId();
+
+ if (currentUnitId !== actionUnitId) return;
+
+ if (actionData.actionName === ACTION_NAMES.SET_NAMED_RANGE_ACTION) {
+ const namedRange = actionData.namedRange;
+ }
+ });
}
get config() {
@@@ -217,8 -284,29 +247,17 @@@
onDestroy(): void {
super.onDestroy();
uninstall(this);
+
+ const actionRegister = this.context.getCommandManager().getActionExtensionManager().getRegister();
+ actionRegister.delete(this._namedRangeActionExtensionFactory);
+ }
+
+ registerExtension() {
+ const actionRegister = this.context.getCommandManager().getActionExtensionManager().getRegister();
+ this._namedRangeActionExtensionFactory = new NamedRangeInsertRowActionExtensionFactory(this);
+ actionRegister.add(this._namedRangeActionExtensionFactory);
}
- getSplitLeftRef(): RefObject<HTMLDivElement> {
- return this._splitLeftRef;
- }
-
- // getContentRef(): RefObject<HTMLDivElement | Component> {
- // return this._contentRef;
- // }
-
- getContentRef(): RefObject<HTMLDivElement> {
- return this._contentRef;
- }
-
addButton(item: IToolBarItemProps): void {
this._addButtonFunc(item);
}