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.

chore: remove doc cut icon and determine the validity of the range API (#6285)

wpxp123456cfb10c28aae0
diff --git a/packages/docs-ui/src/controllers/doc-ui.controller.ts b/packages/docs-ui/src/controllers/doc-ui.controller.ts
index a34f94d99c..fa4be8823e 100644
--- a/packages/docs-ui/src/controllers/doc-ui.controller.ts
+++ b/packages/docs-ui/src/controllers/doc-ui.controller.ts
@@ -24,7 +24,7 @@ import {
UniverInstanceType,
} from '@univerjs/core';
import { IRenderManagerService } from '@univerjs/engine-render';
-import { CutIcon, DeleteIcon, DocSettingIcon, TodoListDoubleIcon } from '@univerjs/icons';
+import { DeleteIcon, DocSettingIcon, TodoListDoubleIcon } from '@univerjs/icons';
import { BuiltInUIPart, ComponentManager, connectInjector, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui';
import { CoreHeaderFooterCommand, OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command';
import { SidebarDocHeaderFooterPanelOperation } from '../commands/operations/doc-header-footer-panel.operation';
@@ -74,7 +74,6 @@ export class DocUIController extends Disposable {
[ORDER_LIST_TYPE_COMPONENT, OrderListTypePicker],
['TodoListDoubleIcon', TodoListDoubleIcon],
['doc.paragraph.menu', ParagraphMenu],
- ['CutIcon', CutIcon],
['DeleteIcon', DeleteIcon],
[PAGE_SETTING_COMPONENT_ID, PageSettings],
['DocumentSettingIcon', DocSettingIcon],
diff --git a/packages/sheets/src/facade/f-range.ts b/packages/sheets/src/facade/f-range.ts
index 170b69eeff..a0dc8e0bd5 100644
--- a/packages/sheets/src/facade/f-range.ts
+++ b/packages/sheets/src/facade/f-range.ts
@@ -59,6 +59,17 @@ export class FRange extends FBaseInitialable {
) {
super(_injector);
+ const maxRows = this._worksheet.getRowCount();
+ const maxColumns = this._worksheet.getColumnCount();
+ if (
+ this._range.startRow < 0 ||
+ this._range.startColumn < 0 ||
+ this._range.endRow >= maxRows ||
+ this._range.endColumn >= maxColumns
+ ) {
+ throw new Error(`Range is out of bounds. Max rows: ${maxRows}, Max columns: ${maxColumns}, Given range: ${JSON.stringify(this._range)}`);
+ }
+
this._runInitializers(
this._injector,
this._workbook,