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.

feat: delete sheet plugin operation (#198)

YuHong6625b61c0656
diff --git a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO1.ts b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO1.ts
index 162b454f44..ef91091c94 100644
--- a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO1.ts
+++ b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO1.ts
@@ -2,16 +2,11 @@ import { BooleanNumber, BorderStyleTypes, IWorkbookConfig, LocaleType, SheetType
export const DEFAULT_WORKBOOK_DATA_DEMO1: IWorkbookConfig = {
id: 'workbook-01',
- theme: 'default',
locale: LocaleType.EN,
creator: 'univer',
name: 'universheet',
- skin: 'default',
- socketUrl: '',
- socketEnable: BooleanNumber.FALSE,
extensions: [],
sheetOrder: ['sheet-0003'],
- pluginMeta: {},
styles: {
'1': {
fs: 30,
diff --git a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO2.ts b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO2.ts
index 5677faad62..cd3bc7ce3e 100644
--- a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO2.ts
+++ b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO2.ts
@@ -2,16 +2,11 @@ import { BooleanNumber, BorderStyleTypes, IWorkbookConfig, LocaleType, SheetType
export const DEFAULT_WORKBOOK_DATA_DEMO2: IWorkbookConfig = {
id: 'workbook-01',
- theme: 'default',
locale: LocaleType.EN,
creator: 'univer',
name: 'universheet',
- skin: 'default',
- socketUrl: '',
- socketEnable: BooleanNumber.FALSE,
extensions: [],
sheetOrder: ['sheet-0002'],
- pluginMeta: {},
styles: {
'1': {
fs: 30,
diff --git a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO3.ts b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO3.ts
index 555a348761..1afcf47aa4 100644
--- a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO3.ts
+++ b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO3.ts
@@ -46,13 +46,9 @@ const richTextDemo: IDocumentData = {
export const DEFAULT_WORKBOOK_DATA_DEMO3: IWorkbookConfig = {
id: 'workbook-01',
- theme: 'default',
locale: LocaleType.EN,
creator: 'univer',
name: 'universheet',
- skin: 'default',
- socketUrl: '',
- socketEnable: BooleanNumber.FALSE,
extensions: [],
sheetOrder: ['sheet-0001'],
pluginMeta: {},
diff --git a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO4.ts b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO4.ts
index c99359a290..eb1e60393e 100644
--- a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO4.ts
+++ b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO4.ts
@@ -48,16 +48,11 @@ const richTextDemo1: IDocumentData = {
export const DEFAULT_WORKBOOK_DATA_DEMO4: IWorkbookConfig = {
id: 'workbook-01',
- theme: 'default',
locale: LocaleType.EN,
creator: 'univer',
name: 'universheet',
- skin: 'default',
- socketUrl: '',
- socketEnable: BooleanNumber.FALSE,
extensions: [],
sheetOrder: ['sheet-0004'],
- pluginMeta: {},
styles: {
'1': {
fs: 30,
diff --git a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO5.ts b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO5.ts
index 7aa6c87069..36a667eb0b 100644
--- a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO5.ts
+++ b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO5.ts
@@ -1,17 +1,12 @@
-import { BooleanNumber, BorderStyleTypes, IWorkbookConfig, LocaleType } from '@univerjs/core';
+import { BorderStyleTypes, IWorkbookConfig, LocaleType } from '@univerjs/core';
export const DEFAULT_WORKBOOK_DATA_DEMO5: IWorkbookConfig = {
id: 'workbook-01',
- theme: 'default',
locale: LocaleType.EN,
creator: 'univer',
name: 'universheet',
- skin: 'default',
- socketUrl: '',
- socketEnable: BooleanNumber.FALSE,
extensions: [],
sheetOrder: ['sheet-0005'],
- pluginMeta: {},
styles: {
idtqdi: {
ht: 2,
diff --git a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO6.ts b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO6.ts
index a3cbc3f163..d9c1c3dca6 100644
--- a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO6.ts
+++ b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO6.ts
@@ -1,17 +1,12 @@
-import { BooleanNumber, BorderStyleTypes, IWorkbookConfig, LocaleType } from '@univerjs/core';
+import { BorderStyleTypes, IWorkbookConfig, LocaleType } from '@univerjs/core';
export const DEFAULT_WORKBOOK_DATA_DEMO6: IWorkbookConfig = {
id: 'workbook-01',
- theme: 'default',
locale: LocaleType.EN,
creator: 'univer',
name: 'universheet',
- skin: 'default',
- socketUrl: '',
- socketEnable: BooleanNumber.FALSE,
extensions: [],
sheetOrder: ['sheet-0006'],
- pluginMeta: {},
styles: {
idtqdi: {
ht: 2,
diff --git a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO7.ts b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO7.ts
index 9c5be422d9..ec74cc1c5d 100644
--- a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO7.ts
+++ b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO7.ts
@@ -1,17 +1,12 @@
-import { BooleanNumber, IWorkbookConfig, LocaleType } from '@univerjs/core';
+import { IWorkbookConfig, LocaleType } from '@univerjs/core';
export const DEFAULT_WORKBOOK_DATA_DEMO7: IWorkbookConfig = {
id: 'workbook-01',
- theme: 'default',
locale: LocaleType.EN,
creator: 'univer',
name: 'universheet',
- skin: 'default',
- socketUrl: '',
- socketEnable: BooleanNumber.FALSE,
extensions: [],
sheetOrder: ['sheet-0012'],
- pluginMeta: {},
styles: {
'1': {
fs: 30,
diff --git a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO8.ts b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO8.ts
index a9ac430402..36e7b2af61 100644
--- a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO8.ts
+++ b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO8.ts
@@ -1,17 +1,12 @@
-import { BooleanNumber, IWorkbookConfig, LocaleType } from '@univerjs/core';
+import { IWorkbookConfig, LocaleType } from '@univerjs/core';
export const DEFAULT_WORKBOOK_DATA_DEMO8: IWorkbookConfig = {
id: 'workbook-01',
- theme: 'default',
locale: LocaleType.EN,
creator: 'univer',
name: 'universheet',
- skin: 'default',
- socketUrl: '',
- socketEnable: BooleanNumber.FALSE,
extensions: [],
sheetOrder: ['sheet-0013'],
- pluginMeta: {},
styles: {
'1': {
fs: 30,
diff --git a/packages/common-plugin-data/src/Sheets/SLIDE_WORKBOOK_DATA.ts b/packages/common-plugin-data/src/Sheets/SLIDE_WORKBOOK_DATA.ts
index 79131d26cc..d69d9ef54d 100644
--- a/packages/common-plugin-data/src/Sheets/SLIDE_WORKBOOK_DATA.ts
+++ b/packages/common-plugin-data/src/Sheets/SLIDE_WORKBOOK_DATA.ts
@@ -4,16 +4,11 @@ import { PAGE5_RICHTEXT_1 } from '../Slides/RichText/PAGE5_RICHTEXT_1';
export const SLIDE_WORKBOOK_DATA: IWorkbookConfig = {
id: 'workbook-01',
- theme: 'default',
locale: LocaleType.EN,
creator: 'univer',
name: 'universheet',
- skin: 'default',
- socketUrl: '',
- socketEnable: BooleanNumber.FALSE,
extensions: [],
sheetOrder: ['sheet-0001'],
- pluginMeta: {},
styles: {
'1': {
vt: 2,
diff --git a/packages/sheets-plugin-operation/README-zh.md b/packages/sheets-plugin-operation/README-zh.md
deleted file mode 100644
index 94e48be24e..0000000000
--- a/packages/sheets-plugin-operation/README-zh.md
+++ /dev/null
@@ -1,98 +0,0 @@
-# style-univer
-
-简体中文 | [English](./README.md)
-
-## 介绍
-
-UniverSheet 官方 UI 组件库
-
-## 特性
-
-- 纯 tsx 组件,可方便集成到 vue/react
-- 按需引入,不用担心影响打包体积
-
-## 用法
-
-### 安装
-
-```shell
-npm i @univerjs/style-univer
-```
-
-### 使用
-
-```js
-import baseUI from '@univerjs/style-univer';
-universheet.install(baseUI);
-universheet.create({
- plugins: ['style-univer'],
-});
-```
-
-## 本地开发
-
-### 环境
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 7
-
-### 安装
-
-```
-npm i
-```
-
-### 开发
-
-```
-# 当前目录 ./packages/style-univer/
-npm run dev
-
-# 或者项目根目录 ./
-npm run dev -w @univerjs/style-univer
-```
-
-### 打包
-
-```
-# 当前目录 ./packages/style-univer/
-npm run build
-
-# 或者根目录 ./
-npm run build -w @univerjs/style-univer
-```
-
-## 组件库文档
-
-使用[Docusaurus 2](https://docusaurus.io/)构建
-
-### 安装
-
-```console
-# 根目录
-npm i
-```
-
-### 开发
-
-```console
-# 当前目录
-npm run start
-
-# 或者根目录
-npm run start -w @univerjs/style-univer
-```
-
-此命令启动本地开发服务器并打开浏览器窗口。 大多数更改都会实时刷新,而无需重新启动服务器。
-
-### 打包
-
-```console
-# 当前目录
-npm run build:doc
-
-# 或者根目录
-npm run build:doc -w @univerjs/style-univer
-```
-
-此命令将静态内容生成到 `build` 目录中,并且可以使用任何静态内容托管服务来提供。
diff --git a/packages/sheets-plugin-operation/README.md b/packages/sheets-plugin-operation/README.md
deleted file mode 100644
index 532bbde9e0..0000000000
--- a/packages/sheets-plugin-operation/README.md
+++ /dev/null
@@ -1,98 +0,0 @@
-# style-univer
-
-English| [简体中文](./README-zh.md)
-
-## Introduction
-
-UniverSheet official UI component library
-
-## Features
-
-- Pure tsx components, which can be easily integrated into vue/react
-- Import on demand, don’t worry about affecting the package size
-
-## Usage
-
-### Install
-
-```shell
-npm i @univerjs/style-univer
-```
-
-### Import
-
-```js
-import baseUI from '@univerjs/style-univer';
-universheet.install(baseUI);
-universheet.create({
- plugins: ['style-univer'],
-});
-```
-
-## Local development
-
-### Requirements
-
-- [Node.js](https://nodejs.org/en/) Version >= 10
-- [npm](https://www.npmjs.com/) Version >= 7
-
-### Installation
-
-```
-npm i
-```
-
-### Development
-
-```
-# Current directory ./packages/style-univer/
-npm run dev
-
-# Or project root directory ./
-npm run dev -w @univerjs/style-univer
-```
-
-### Package
-
-```
-# Current directory ./packages/style-univer/
-npm run build
-
-# Or root directory ./
-npm run build -w @univerjs/style-univer
-```
-
-## Doc Website
-
-This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
-
-### Installation
-
-```console
-# root folder
-npm i
-```
-
-### Development
-
-```console
-# style-univer folder
-npm run start
-
-# or root folder
-npm run start -w @univerjs/style-univer
-```
-
-This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
-
-### Build
-
-```console
-# style-univer folder
-npm run build:doc
-
-# or root folder
-npm run build:doc -w @univerjs/style-univer
-```
-
-This command generates static content into the `build` directory and can be served using any static contents hosting service.
diff --git a/packages/sheets-plugin-operation/esbuild.config.mjs b/packages/sheets-plugin-operation/esbuild.config.mjs
deleted file mode 100644
index c853f3b1a9..0000000000
--- a/packages/sheets-plugin-operation/esbuild.config.mjs
+++ /dev/null
@@ -1,10 +0,0 @@
-import esbuild from 'esbuild';
-
-// eslint-disable-next-line import/no-relative-packages
-import baseConfig from '../../esbuild.config.mjs';
-
-esbuild.build({
- ...baseConfig,
- globalName: 'UniverSheetsPluginOperation',
- outfile: './lib/univer-sheets-plugin-operation.js',
-});
diff --git a/packages/sheets-plugin-operation/index.html b/packages/sheets-plugin-operation/index.html
deleted file mode 100644
index dfd279c1b4..0000000000
--- a/packages/sheets-plugin-operation/index.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-
-<head>
- <meta charset="UTF-8" />
- <link rel="icon" type="image/svg+xml" href="favicon.svg" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- <title>UniverSheet</title>
-</head>
-
-<body>
- <div id="app"></div>
- <div id="universheet-demo-up"></div>
- <div id="universheet-demo-down"></div>
- <script type="module" src="/src/main.tsx"></script>
-</body>
-
-</html>
\ No newline at end of file
diff --git a/packages/sheets-plugin-operation/package.json b/packages/sheets-plugin-operation/package.json
deleted file mode 100644
index 50fe4241d3..0000000000
--- a/packages/sheets-plugin-operation/package.json
+++ /dev/null
@@ -1,61 +0,0 @@
-{
- "name": "@univerjs/sheets-plugin-operation",
- "version": "0.0.1",
- "description": "UniverSheet normal plugin UI manager",
- "keywords": [],
- "author": "DreamNum <[email protected]>",
- "license": "MIT",
- "main": "./src/index.ts",
- "module": "./src/index.ts",
- "types": "./src/Types/index.d.ts",
- "publishConfig": {
- "main": "./lib/univer-sheets-plugin-operation.cjs.js",
- "module": "./lib/univer-sheets-plugin-operation.js",
- "types": "./lib/index.d.ts",
- "exports": {
- ".": {
- "require": "./lib/univer-sheets-plugin-operation.cjs.js",
- "default": "./lib/univer-sheets-plugin-operation.js"
- },
- "./*": "./lib/*"
- },
- "access": "public"
- },
- "exports": {
- ".": "./src/index.ts",
- "./*": "./src/*"
- },
- "directories": {
- "lib": "lib"
- },
- "files": [
- "lib"
- ],
- "private": false,
- "type": "module",
- "scripts": {
- "test": "vitest run",
- "test:watch": "vitest",
- "coverage": "vitest run --coverage",
- "esbuild": "node ./esbuild.config.mjs"
- },
- "dependencies": {
- "@univerjs/base-render": "workspace:^0.0.1",
- "@univerjs/base-sheets": "workspace:^0.0.1",
- "@univerjs/base-ui": "workspace:^0.0.1",
- "@univerjs/common-plugin-data": "workspace:^0.0.1",
- "@univerjs/core": "workspace:^0.0.1",
- "@univerjs/ui-plugin-sheets": "workspace:^0.0.1",
- "@wendellhu/redi": "^0.12.8",
- "react": "^18.2.0",
- "react-dom": "^18.2.0"
- },
- "devDependencies": {
- "@types/react": "^18.2.22",
- "@types/react-dom": "^18.2.7",
- "@vitest/coverage-v8": "^0.34.5",
- "esbuild": "^0.19.3",
- "less": "4.2.0",
- "vitest": "^0.34.5"
- }
-}
diff --git a/packages/sheets-plugin-operation/src/Action/index.ts b/packages/sheets-plugin-operation/src/Action/index.ts
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/packages/sheets-plugin-operation/src/Apply/index.ts b/packages/sheets-plugin-operation/src/Apply/index.ts
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/packages/sheets-plugin-operation/src/Basics/Const/DEFAULT_OPERATION_PLUGIN_DATA.ts b/packages/sheets-plugin-operation/src/Basics/Const/DEFAULT_OPERATION_PLUGIN_DATA.ts
deleted file mode 100644
index c34ec2d53b..0000000000
--- a/packages/sheets-plugin-operation/src/Basics/Const/DEFAULT_OPERATION_PLUGIN_DATA.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { IOperationPluginConfig } from '../Interfaces/IOperationPluginConfig';
-
-export const DEFAULT_OPERATION_PLUGIN_DATA: IOperationPluginConfig = {
- copy: {
- embed: true,
- },
-};
diff --git a/packages/sheets-plugin-operation/src/Basics/Interfaces/IOperationPluginConfig.ts b/packages/sheets-plugin-operation/src/Basics/Interfaces/IOperationPluginConfig.ts
deleted file mode 100644
index 612ffa74f4..0000000000
--- a/packages/sheets-plugin-operation/src/Basics/Interfaces/IOperationPluginConfig.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-export interface ICopyConfig {
- embed: boolean;
-}
-
-export interface IOperationPluginConfig {
- copy: ICopyConfig;
-}
diff --git a/packages/sheets-plugin-operation/src/Basics/Register/CopyExtension.ts b/packages/sheets-plugin-operation/src/Basics/Register/CopyExtension.ts
deleted file mode 100644
index 98e5845137..0000000000
--- a/packages/sheets-plugin-operation/src/Basics/Register/CopyExtension.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-import { BaseCopyExtension, BaseCopyExtensionFactory } from '@univerjs/base-ui';
-
-import { OperationPlugin } from '../../OperationPlugin';
-
-export class CopyExtension extends BaseCopyExtension<OperationPlugin> {
- execute() {
- const value = this._plugin.getUniverCopy().getCopyContent();
- if (!value) return;
- this._data.name = 'table';
- this._data.value = value;
- }
-}
-
-export class CopyExtensionFactory extends BaseCopyExtensionFactory<OperationPlugin> {
- get zIndex(): number {
- return 1;
- }
-
- create(): BaseCopyExtension {
- return new CopyExtension(this._plugin);
- }
-
- // To generate a fixed-format table, you must execute
- check(): false | BaseCopyExtension {
- return this.create();
- }
-}
diff --git a/packages/sheets-plugin-operation/src/Basics/Register/CopyImageExtension.ts b/packages/sheets-plugin-operation/src/Basics/Register/CopyImageExtension.ts
deleted file mode 100644
index 44cd776c2e..0000000000
--- a/packages/sheets-plugin-operation/src/Basics/Register/CopyImageExtension.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { BaseCopyExtension, BaseCopyExtensionFactory } from '@univerjs/base-ui';
-
-import { OperationPlugin } from '../../OperationPlugin';
-
-// TODO 这个模块应该放到图片插件 @jerry
-export class CopyImageExtension extends BaseCopyExtension<OperationPlugin> {
- execute() {
- const value = this._handleImage();
- if (!value) return;
- this._data.name = 'image';
- this._data.value = value;
- }
-
- private _handleImage() {
- // TODO 根据当前选区范围,从图片差距中取出配置 @jerry
- const image = [{ left: 0, right: 0, width: 100, height: 100, url: 'image_url' }];
- return JSON.stringify(image);
- }
-}
-
-export class CopyImageExtensionFactory extends BaseCopyExtensionFactory<OperationPlugin> {
- get zIndex(): number {
- return 2;
- }
-
- create(): BaseCopyExtension {
- return new CopyImageExtension(this._plugin);
- }
-
- check(): false | BaseCopyExtension {
- return this.create();
- }
-}
diff --git a/packages/sheets-plugin-operation/src/Basics/Register/CutExtension.ts b/packages/sheets-plugin-operation/src/Basics/Register/CutExtension.ts
deleted file mode 100644
index b20f7006a3..0000000000
--- a/packages/sheets-plugin-operation/src/Basics/Register/CutExtension.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-// import {
-// BaseCutExtension,
-// BaseCutExtensionFactory,
-// handelExcelToJson,
-// handelTableToJson,
-// handlePlainToJson,
-// handleTableColgroup,
-// handleTableRowGroup,
-// ICutData,
-// } from '@univerjs/base-ui';
-// import { OperationPlugin } from '../../OperationPlugin';
-
-// export class CutExtension extends BaseCutExtension<OperationPlugin> {
-// execute() {
-// let content = this._data.html || this._data.plain;
-
-// let data;
-// let colInfo;
-// let rowInfo;
-// if (content) {
-// // TODO move to CutOfficeExtension
-// if (content.indexOf('xmlns:x="urn:schemas-microsoft-com:office:excel"') > -1) {
-// data = handelExcelToJson(content);
-// colInfo = handleTableColgroup(content);
-// rowInfo = handleTableRowGroup(content);
-// } else if (content.indexOf('<table') > -1 && content.indexOf('<td') > -1) {
-// data = handelTableToJson(content);
-// colInfo = handleTableColgroup(content);
-// rowInfo = handleTableRowGroup(content);
-// } else {
-// data = handlePlainToJson(content);
-// }
-// }
-
-// const actionDataList = this._plugin.getUniverCut().CutTo({
-// data,
-// colInfo,
-// rowInfo,
-// });
-
-// return actionDataList;
-// }
-// }
-
-// export class CutExtensionFactory extends BaseCutExtensionFactory<OperationPlugin> {
-// get zIndex(): number {
-// return 1;
-// }
-
-// create(data: ICutData): BaseCutExtension {
-// return new CutExtension(data, this._plugin);
-// }
-
-// check(data: ICutData): false | BaseCutExtension {
-// const content = data.html || data.plain;
-// if (content && content.indexOf('<table') > -1 && content.indexOf('<td') > -1) {
-// return this.create(data);
-// }
-
-// return false;
-// }
-// }
diff --git a/packages/sheets-plugin-operation/src/Basics/Register/DeleteExtension.ts b/packages/sheets-plugin-operation/src/Basics/Register/DeleteExtension.ts
deleted file mode 100644
index 508049e245..0000000000
--- a/packages/sheets-plugin-operation/src/Basics/Register/DeleteExtension.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-// import {
-// BaseDeleteExtension,
-// BaseDeleteExtensionFactory,
-// handelExcelToJson,
-// handelTableToJson,
-// handlePlainToJson,
-// handleTableColgroup,
-// handleTableRowGroup,
-// IDeleteData,
-// } from '@univerjs/base-ui';
-// import { OperationPlugin } from '../../OperationPlugin';
-
-// export class DeleteExtension extends BaseDeleteExtension<OperationPlugin> {
-// execute() {
-// let content = this._data.html || this._data.plain;
-
-// let data;
-// let colInfo;
-// let rowInfo;
-// if (content) {
-// // TODO move to DeleteOfficeExtension
-// if (content.indexOf('xmlns:x="urn:schemas-microsoft-com:office:excel"') > -1) {
-// data = handelExcelToJson(content);
-// colInfo = handleTableColgroup(content);
-// rowInfo = handleTableRowGroup(content);
-// } else if (content.indexOf('<table') > -1 && content.indexOf('<td') > -1) {
-// data = handelTableToJson(content);
-// colInfo = handleTableColgroup(content);
-// rowInfo = handleTableRowGroup(content);
-// } else {
-// data = handlePlainToJson(content);
-// }
-// }
-
-// const actionDataList = this._plugin.getUniverDelete().DeleteTo({
-// data,
-// colInfo,
-// rowInfo,
-// });
-
-// return actionDataList;
-// }
-// }
-
-// export class DeleteExtensionFactory extends BaseDeleteExtensionFactory<OperationPlugin> {
-// get zIndex(): number {
-// return 1;
-// }
-
-// create(data: IDeleteData): BaseDeleteExtension {
-// return new DeleteExtension(data, this._plugin);
-// }
-
-// check(data: IDeleteData): false | BaseDeleteExtension {
-// const content = data.html || data.plain;
-// if (content && content.indexOf('<table') > -1 && content.indexOf('<td') > -1) {
-// return this.create(data);
-// }
-
-// return false;
-// }
-// }
diff --git a/packages/sheets-plugin-operation/src/Basics/Register/InsertExtension.ts b/packages/sheets-plugin-operation/src/Basics/Register/InsertExtension.ts
deleted file mode 100644
index cb41534ca2..0000000000
--- a/packages/sheets-plugin-operation/src/Basics/Register/InsertExtension.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-// import {
-// BaseInsertExtension,
-// BaseInsertExtensionFactory,
-// handelExcelToJson,
-// handelTableToJson,
-// handlePlainToJson,
-// handleTableColgroup,
-// handleTableRowGroup,
-// IInsertData,
-// } from '@univerjs/base-ui';
-// import { OperationPlugin } from '../../OperationPlugin';
-
-// export class InsertExtension extends BaseInsertExtension<OperationPlugin> {
-// execute() {
-// let content = this._data.html || this._data.plain;
-
-// let data;
-// let colInfo;
-// let rowInfo;
-// if (content) {
-// // TODO move to InsertOfficeExtension
-// if (content.indexOf('xmlns:x="urn:schemas-microsoft-com:office:excel"') > -1) {
-// data = handelExcelToJson(content);
-// colInfo = handleTableColgroup(content);
-// rowInfo = handleTableRowGroup(content);
-// } else if (content.indexOf('<table') > -1 && content.indexOf('<td') > -1) {
-// data = handelTableToJson(content);
-// colInfo = handleTableColgroup(content);
-// rowInfo = handleTableRowGroup(content);
-// } else {
-// data = handlePlainToJson(content);
-// }
-// }
-
-// const actionDataList = this._plugin.getUniverInsert().InsertTo({
-// data,
-// colInfo,
-// rowInfo,
-// });
-
-// return actionDataList;
-// }
-// }
-
-// export class InsertExtensionFactory extends BaseInsertExtensionFactory<OperationPlugin> {
-// get zIndex(): number {
-// return 1;
-// }
-
-// create(data: IInsertData): BaseInsertExtension {
-// return new InsertExtension(data, this._plugin);
-// }
-
-// check(data: IInsertData): false | BaseInsertExtension {
-// const content = data.html || data.plain;
-// if (content && content.indexOf('<table') > -1 && content.indexOf('<td') > -1) {
-// return this.create(data);
-// }
-
-// return false;
-// }
-// }
diff --git a/packages/sheets-plugin-operation/src/Basics/Register/PasteExtension.ts b/packages/sheets-plugin-operation/src/Basics/Register/PasteExtension.ts
deleted file mode 100644
index 93751e0306..0000000000
--- a/packages/sheets-plugin-operation/src/Basics/Register/PasteExtension.ts
+++ /dev/null
@@ -1,65 +0,0 @@
-import {
- BasePasteExtension,
- BasePasteExtensionFactory,
- handelExcelToJson,
- handelTableToJson,
- handlePlainToJson,
- handleTableColgroup,
- handleTableRowGroup,
- IPasteData,
-} from '@univerjs/base-ui';
-
-import { OperationPlugin } from '../../OperationPlugin';
-
-// copy paste delete cut insert // SheetsPluginOperation
-export class PasteExtension extends BasePasteExtension<OperationPlugin> {
- execute() {
- const content = this._data.html || this._data.plain;
-
- let data;
- let colInfo;
- let rowInfo;
- if (content) {
- // TODO move to PasteOfficeExtension @tony
- if (content.indexOf('xmlns:x="urn:schemas-microsoft-com:office:excel"') > -1) {
- data = handelExcelToJson(content);
- colInfo = handleTableColgroup(content);
- rowInfo = handleTableRowGroup(content);
- } else if (content.indexOf('<table') > -1 && content.indexOf('<td') > -1) {
- data = handelTableToJson(content);
- colInfo = handleTableColgroup(content);
- rowInfo = handleTableRowGroup(content);
- } else {
- data = handlePlainToJson(content);
- }
- }
-
- const actionDataList = this._plugin.getUniverPaste().pasteTo({
- data,
- colInfo,
- rowInfo,
- });
-
- return actionDataList;
- }
-}
-
-export class PasteExtensionFactory extends BasePasteExtensionFactory<OperationPlugin> {
- get zIndex(): number {
- return 1;
- }
-
- create(data: IPasteData): BasePasteExtension {
- return new PasteExtension(data, this._plugin);
- }
-
- check(data: IPasteData): false | BasePasteExtension {
- const content = data.html || data.plain;
-
- if (content && content.indexOf('<table') > -1 && content.indexOf('<td') > -1) {
- return this.create(data);
- }
-
- return false;
- }
-}
diff --git a/packages/sheets-plugin-operation/src/Basics/Register/PasteImageExtension.ts b/packages/sheets-plugin-operation/src/Basics/Register/PasteImageExtension.ts
deleted file mode 100644
index ca376951f2..0000000000
--- a/packages/sheets-plugin-operation/src/Basics/Register/PasteImageExtension.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-import { BasePasteExtension, BasePasteExtensionFactory, IPasteData } from '@univerjs/base-ui';
-
-import { OperationPlugin } from '../../OperationPlugin';
-
-// copy paste delete cut insert // TODO 这个模块应该放到图片插件 @jerry
-export class PasteImageExtension extends BasePasteExtension<OperationPlugin> {
- execute() {
- const content = this._data.html || this._data.plain;
- console.info('cc--', content);
- return [];
- }
-}
-
-export class PasteImageExtensionFactory extends BasePasteExtensionFactory<OperationPlugin> {
- get zIndex(): number {
- return 3;
- }
-
- create(data: IPasteData): BasePasteExtension {
- return new PasteImageExtension(data, this._plugin);
- }
-
- check(data: IPasteData): false | BasePasteExtension {
- const content = data.html || data.plain;
-
- // TODO embed="true",直接解析table标签上的配置data-image="[{config}]" @jerry
- // TODO embed="false",识别table标签上的univerId,sheetId,rangeData中的范围是否包含image信息,有则直接从本地取,没有就略过 @jerry
- if (content && content.indexOf('data-image') > -1) {
- return this.create(data);
- }
-
- return false;
- }
-}
diff --git a/packages/sheets-plugin-operation/src/Basics/Register/PasteOfficeExtension.ts b/packages/sheets-plugin-operation/src/Basics/Register/PasteOfficeExtension.ts
deleted file mode 100644
index 613e6571af..0000000000
--- a/packages/sheets-plugin-operation/src/Basics/Register/PasteOfficeExtension.ts
+++ /dev/null
@@ -1,22 +0,0 @@
-import { BasePasteExtension, BasePasteExtensionFactory, IPasteData } from '@univerjs/base-ui';
-
-import { OperationPlugin } from '../../OperationPlugin';
-
-/**
- * TODO
- */
-export class PasteOfficeExtension extends BasePasteExtension<OperationPlugin> {}
-
-export class PasteOfficeExtensionFactory extends BasePasteExtensionFactory<OperationPlugin> {
- get zIndex(): number {
- return 2;
- }
-
- create(data: IPasteData): BasePasteExtension {
- return new PasteOfficeExtension(data, this._plugin);
- }
-
- check(data: IPasteData): false | BasePasteExtension {
- return false;
- }
-}
diff --git a/packages/sheets-plugin-operation/src/Const/PLUGIN_NAME.ts b/packages/sheets-plugin-operation/src/Const/PLUGIN_NAME.ts
deleted file mode 100644
index c35c1e9df7..0000000000
--- a/packages/sheets-plugin-operation/src/Const/PLUGIN_NAME.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const OPERATION_PLUGIN = 'OperationPlugin';
diff --git a/packages/sheets-plugin-operation/src/Const/index.ts b/packages/sheets-plugin-operation/src/Const/index.ts
deleted file mode 100644
index caeb42be51..0000000000
--- a/packages/sheets-plugin-operation/src/Const/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './PLUGIN_NAME';
diff --git a/packages/sheets-plugin-operation/src/Domain/Clipboard.ts b/packages/sheets-plugin-operation/src/Domain/Clipboard.ts
deleted file mode 100644
index 015dac0215..0000000000
--- a/packages/sheets-plugin-operation/src/Domain/Clipboard.ts
+++ /dev/null
@@ -1,113 +0,0 @@
-import { PasteType } from '@univerjs/base-ui';
-import { Nullable } from '@univerjs/core';
-
-export type ClipboardType = {
- type?: 'text/html' | 'text/plain' | 'image/png';
- data: string;
-};
-
-type ReadResultType = {
- type: string;
- result: string;
-};
-
-export class Clipboard {
- static clipboard = window.navigator.clipboard;
-
- static textArea: HTMLTextAreaElement;
-
- static localData: Nullable<string>;
-
- static async writeText(text: string, e?: ClipboardEvent) {
- if (Clipboard.clipboard) {
- return Clipboard.clipboard.writeText(text).then(
- () => true,
- (err) => console.dir(err)
- );
- }
-
- e?.clipboardData?.setData('text/html', text);
- e?.preventDefault();
- }
-
- static async write(data: ClipboardType, e?: ClipboardEvent) {
- if (Clipboard.clipboard) {
- const blob = new Blob([data.data], { type: data.type ?? 'text/html' });
- const clipboardData = [new ClipboardItem({ 'text/html': blob })];
-
- // return Paste.clipboard.write(clipboardData).then(
- // () => true,
- // () => false
- // );
- Clipboard.clipboard.write(clipboardData);
- }
- e?.clipboardData?.setData(data.type ?? 'text/html', data.data);
- e?.preventDefault();
- Clipboard.localData = data.data;
- }
-
- static async readText() {
- if (Clipboard.clipboard) {
- return Clipboard.clipboard.readText().then(
- (text) => text,
- () => null
- );
- }
- if (!Clipboard.textArea) return null;
- return new Promise((resolve, reject) => {
- resolve(Clipboard.textArea.value);
- })
- .then((text) => text)
- .then(() => null);
- }
-
- static async read(e?: ClipboardEvent): Promise<Array<PasteType | null> | null | string> {
- if (e) {
- const result: ReadResultType[] = [];
- const clipboardData = e?.clipboardData;
- const types = clipboardData?.types;
- if (!types) return null;
- for (let i = 0; i < types.length; i++) {
- result.push({
- type: types[i],
- result: clipboardData.getData(types[i]),
- });
- }
- return result;
- }
-
- if (Clipboard.clipboard) {
- const clipboardItems = await Clipboard.clipboard.read();
- const Promises: Array<Promise<PasteType | null>> = [];
- for (const clipboardItem of clipboardItems) {
- for (const type of clipboardItem.types) {
- const blob = await clipboardItem.getType(type);
- const reader = new FileReader();
- if (type === 'image/png') {
- reader.readAsDataURL(blob);
- } else {
- reader.readAsText(blob);
- }
- const promise: Promise<PasteType | null> = new Promise(
- (resolve: (value: PasteType) => void, reject) => {
- reader.onload = (e) => {
- const item: PasteType = { type, result: reader.result };
- resolve(item);
- };
- }
- ).then(
- (res) => res,
- () => null
- );
- Promises.push(promise);
- }
- }
- return Promise.all(Promises);
- }
-
- const result = Clipboard.localData ?? null;
- Clipboard.localData = null;
-
- return result;
- }
-}
diff --git a/packages/sheets-plugin-operation/src/Domain/Copy.ts b/packages/sheets-plugin-operation/src/Domain/Copy.ts
deleted file mode 100644
index f38816d997..0000000000
--- a/packages/sheets-plugin-operation/src/Domain/Copy.ts
+++ /dev/null
@@ -1,409 +0,0 @@
-import { SelectionManagerService } from '@univerjs/base-sheets';
-import { Clipboard } from '@univerjs/base-ui';
-import { handleJsonToDom, handleStyleToString, ICurrentUniverService, IKeyValue, Tools } from '@univerjs/core';
-import { RightMenuItem } from '@univerjs/ui-plugin-sheets';
-import { Inject } from '@wendellhu/redi';
-// import { ClipboardInput } from '../UI/ClipboardInput';
-
-export abstract class Copy {
- // constructor(copyList: RightMenuProps[]) {
- // this._context = context;
- // const SheetPlugin = this._context.getPluginManager().getPluginByName<SheetPlugin>(PLUGIN_NAMES.SPREADSHEET);
-
- // // this._initRegisterComponent(componentList);
- // // SheetPlugin?.addRightMenu(copyList);
- // }
-
- copy(e: Event) {
- e.preventDefault();
- }
-}
-
-export class UniverCopy extends Copy {
- constructor(
- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,
- @Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService
- ) {
- const copyList = [
- {
- label: 'rightClick.copy',
- onClick: () => this.copyTo(),
- },
- {
- customLabel: {
- name: RightMenuItem.name,
- props: {
- label: 'rightClick.copyAs',
- },
- },
- children: [
- {
- label: ['Json', 'rightClick.firstLineTitle'],
- onClick: () => this.copyJsonHead(),
- },
- {
- label: ['Json', 'rightClick.untitled'],
- onClick: () => this.copyJsonNoHead(),
- },
- {
- label: ['rightClick.array1'],
- onClick: () => this.copyArray1(),
- },
- {
- label: ['rightClick.array2'],
- onClick: () => this.copyArray2(),
- },
- ],
- },
- ];
- // super(context, copyList);
- super();
- // super(context, copyList, [ClipboardInput]);
- }
-
- override async copy(e: ClipboardEvent) {
- const table = this.getCopyContent();
- if (table) {
- Clipboard.write(
- {
- data: table,
- },
- e
- );
- }
- }
-
- async copyTo(...arg: any) {
- const table = this.getCopyContent();
- if (table) {
- const isWrite = await Clipboard.write({
- data: table,
- });
- }
- }
-
- //复制为json格式字符串,首行为标题
- async copyJsonHead(...arg: any) {
- const Range = this._getRangeInfo();
- if (!Range) return;
- const { range, rangeData } = Range;
-
- const arr = [];
- if (rangeData.length === 1) {
- const obj: IKeyValue = {};
- for (let i = 0; i < rangeData[0].length; i++) {
- const value = range.getValues()[0][i]?.v;
- if (typeof value === 'string' || typeof value === 'number') {
- obj[value] = '';
- } else {
- obj[''] = '';
- }
- }
- arr.push(obj);
- } else {
- for (let r = 1; r < rangeData.length; r++) {
- const obj: IKeyValue = {};
- for (let c = 0; c < rangeData[0].length; c++) {
- const title = range.getValues()[0][c]?.v;
- const value = range.getValues()[r][c]?.v;
- if (typeof title === 'string' || typeof title === 'number') {
- obj[title] = value;
- } else {
- obj[''] = value;
- }
- }
- arr.push(obj);
- }
- }
-
- const isWrite = await Clipboard.writeText(JSON.stringify(arr));
- }
-
- //复制为json格式字符串,无标题,采用ABCD作为标题
- async copyJsonNoHead(...arg: any) {
- const Range = this._getRangeInfo();
- if (!Range) return;
- const { range, rangeData } = Range;
-
- const arr = [];
- for (let r = 0; r < rangeData.length; r++) {
- const obj: IKeyValue = {};
- for (let c = 0; c < rangeData[0].length; c++) {
- const value = range.getValues()[r][c]?.v;
- obj[Tools.chatAtABC(c + range.getRangeData().startColumn)] = value;
- }
- arr.push(obj);
- }
-
- const isWrite = await Clipboard.writeText(JSON.stringify(arr));
- }
-
- //复制为一维数组
- async copyArray1(...arg: any) {
- const Range = this._getRangeInfo();
- if (!Range) return;
- const { range, rangeData } = Range;
-
- const arr = [];
- for (let r = 0; r < rangeData.length; r++) {
- for (let c = 0; c < rangeData[0].length; c++) {
- const value = range.getValues()[r][c]?.v;
- arr.push(value);
- }
- }
-
- const isWrite = await Clipboard.writeText(JSON.stringify(arr));
- }
-
- //复制为二维数组
- async copyArray2(...arg: any) {
- const Range = this._getRangeInfo();
- if (!Range) return;
- const { range, rangeData } = Range;
-
- const arr = [];
- for (let r = 0; r < rangeData.length; r++) {
- for (let c = 0; c < rangeData[0].length; c++) {
- const value = range.getValues()[r][c]?.v;
- arr.push(value);
- }
- }
-
- const isWrite = await Clipboard.writeText(JSON.stringify(arr));
- }
-
- //复制为多维数组
- async copyArrayMore(e: KeyboardEvent) {
- if (e.key !== 'Enter') return;
- const Range = this._getRangeInfo();
- if (!Range) return;
- const { range, rangeData } = Range;
-
- const arr = [];
- for (let r = 0; r < rangeData.length; r++) {
- for (let c = 0; c < rangeData[0].length; c++) {
- arr.push(rangeData[r][c]);
- }
- }
-
- let row = '0';
- let column = '0';
- const target = e.target as HTMLInputElement;
- const textContent = target?.previousSibling?.textContent;
- if (!textContent) return;
- if (textContent.length > 1) {
- row = target.value;
- const columnItem = target.parentNode?.querySelectorAll('input')[1];
- column = columnItem!.value;
- } else {
- column = target.value;
- const columnItem = target.parentNode?.querySelectorAll('input')[0];
- row = columnItem!.value;
- }
-
- if (row === '' && column === '') {
- const isWrite = await Clipboard.writeText(JSON.stringify(arr));
- return;
- }
-
- if (row === '') {
- row = '1';
- } else {
- row = `${parseInt(row)}`;
- }
-
- if (column === '') {
- column = '1';
- } else {
- column = `${parseInt(column)}`;
- }
-
- if (+row < 1 || +column < 1) {
- return;
- }
-
- const arrLen = arr.length;
- let i = 0;
- const ret = [];
- for (let r = 0; r < +row; r++) {
- const a = [];
- for (let c = 0; c < +column; c++) {
- a.push(arr[i++]);
- if (i >= arrLen) {
- const isWrite = await Clipboard.writeText(JSON.stringify(ret));
- return;
- }
- }
- ret.push(a);
- }
-
- const isWrite = await Clipboard.writeText(JSON.stringify(ret));
- }
-
- /**
- * TODO 加入univerId,sheetId,rangeData等 @tony
- * @returns
- */
- // eslint-disable-next-line max-lines-per-function
- getCopyContent() {
- const { sheet, selections } = this._getSheetInfo();
- if (!selections?.length) return;
- const mergeData = sheet.getMergeData();
- const rowManager = sheet.getRowManager().getRowData();
- const colManager = sheet.getColumnManager().getColumnData();
- const rowIndexArr: number[] = [];
- const colIndexArr: number[] = [];
-
- for (let s = 0; s < selections.length; s++) {
- const range = selections[s];
-
- const r1 = range.startRow;
- const r2 = range.endRow;
- const c1 = range.startColumn;
- const c2 = range.endColumn;
-
- for (let copyR = r1; copyR <= r2; copyR++) {
- const rowItem = rowManager.get(copyR);
-
- if (rowItem && rowItem.hd) {
- continue;
- }
-
- if (!rowIndexArr.includes(copyR)) {
- rowIndexArr.push(copyR);
- }
-
- for (let copyC = c1; copyC <= c2; copyC++) {
- const colItem = colManager.get(copyC);
- if (colItem && colItem.hd) {
- continue;
- }
-
- if (!colIndexArr.includes(copyC)) {
- colIndexArr.push(copyC);
- }
- }
- }
- }
-
- let cpData = '';
- let colGroup = '<colgroup>';
-
- for (let i = 0; i < rowIndexArr.length; i++) {
- const r = rowIndexArr[i];
- cpData += '<tr>';
-
- for (let j = 0; j < colIndexArr.length; j++) {
- const c = colIndexArr[j];
-
- const cellValue = sheet.getRange(r, c).getValue();
- let column = '';
- let style = '';
- let span = '';
-
- if (r === rowIndexArr[0]) {
- const colItem = colManager.get(c);
- if (colItem && colItem.w) {
- colGroup += `<col width="${colItem.w}px"></col>`;
- } else {
- colGroup += '<col width="72px"></col>';
- }
- }
-
- const rowItem = rowManager.get(r);
- if (rowItem && rowItem.h) {
- style += `height:${rowItem.h}px;`;
- } else {
- style += 'height:19px;';
- }
-
- // const colItem = colManager.get(c);
- // if (colItem && colItem.w) {
- // style += `width:${colItem.w}px;`;
- // } else {
- // style += `width:72px;`;
- // }
-
- if (cellValue && cellValue.s) {
- const cellStyle = this._currentUniverService
- .getCurrentUniverSheetInstance()
- .getWorkBook()
- .getStyles()
- .getStyleByCell(cellValue);
- // const cellStyle = this.getContext().getWorkBook().getStyles().get(cellValue.s);
- if (cellStyle) {
- style += handleStyleToString(cellStyle);
- }
- }
-
- const cellRange = this._selectionManagerService.transformCellDataToSelectionData(r, c, mergeData)
- ?.cellRange;
- if (cellRange?.isMerged || (!cellRange?.isMerged && cellRange?.isMergedMainCell)) {
- if (cellRange.isMergedMainCell) {
- span = `rowSpan="${cellRange.endRow - cellRange.startRow + 1}" colSpan="${
- cellRange.endColumn - cellRange.startColumn + 1
- }"`;
- } else {
- continue;
- }
- }
-
- if (style.includes('data-rotate')) {
- const rotate = style.split(';').find((item) => item.includes('data-rotate'));
- const match = rotate?.match(/\d+/g);
- let angle = 0;
- let ver = 0;
- if (match?.length) {
- angle = +match[0];
- ver = +match[1] ?? 0;
- }
- column += `<td ${span} ${
- ver ? `data-vertical=${ver}` : ''
- } style="display:inline-block;transform: rotate(${angle}deg);${style}">`;
- } else {
- column = `<td ${span} style="${style}">`;
- }
-
- let c_value;
-
- if (cellValue) {
- if (cellValue.p) {
- c_value = handleJsonToDom(cellValue.p);
- } else {
- c_value = sheet.getRange(r, c).getDisplayValue();
- if (c_value == null) {
- c_value = '';
- }
- }
- } else {
- c_value = '';
- }
-
- column += c_value;
-
- column += '</td>';
- cpData += column;
- }
-
- cpData += '</tr>';
- }
- colGroup += '</colgroup>';
- const cpTable = `<table data-type="universheet_copy_action_table">${colGroup}${cpData}</table>`;
- return cpTable;
- }
-
- private _getSheetInfo() {
- const sheet = this._currentUniverService.getCurrentUniverSheetInstance().getWorkBook().getActiveSheet();
- const selections = this._selectionManagerService.getRangeDatas();
- return { sheet, selections };
- }
-
- private _getRangeInfo() {
- const { sheet, selections } = this._getSheetInfo();
- if (!selections?.length) return;
- const range = sheet.getRange(selections[0]);
- const rangeData = range.getValues();
- if (!rangeData.length) return;
- return { range, rangeData };
- }
-}
diff --git a/packages/sheets-plugin-operation/src/Domain/Cut.ts b/packages/sheets-plugin-operation/src/Domain/Cut.ts
deleted file mode 100644
index 80cac34fba..0000000000
--- a/packages/sheets-plugin-operation/src/Domain/Cut.ts
+++ /dev/null
@@ -1,403 +0,0 @@
-// import { SheetContext, PLUGIN_NAMES, Tools, handleJsonToDom, handleStyleToString, IKeyValue } from '@univerjs/core';
-// import { SheetPlugin, SelectionModel, SelectionControl } from '@univerjs/base-sheets';
-// import { RightMenuProps } from '@univerjs/ui-plugin-sheets';
-// import { Clipboard } from './Clipboard';
-
-// export abstract class Cut {
-// private _context: SheetContext;
-
-// constructor(context: SheetContext, cutList: RightMenuProps[]) {
-// this._context = context;
-// // const SheetPlugin = this._context.getPluginManager().getPluginByName<SheetPlugin>(PLUGIN_NAMES.SPREADSHEET);
-
-// // SheetPlugin?.addRightMenu(cutList);
-
-// const manager = this._context.getObserverManager();
-// manager.requiredObserver<ClipboardEvent>('onSpreadsheetKeyCopyObservable', PLUGIN_NAMES.SPREADSHEET).add((e) => {
-// this.cut(e);
-// });
-// }
-
-// getContext() {
-// return this._context;
-// }
-
-// cut(e: Event) {
-// e.preventDefault();
-// }
-
-// // private _initRegisterComponent(component: any[]) {
-// // const SheetPlugin = this._context.getPluginManager().getPluginByName<SheetPlugin>(PLUGIN_NAMES.SPREADSHEET)!;
-// // for (let i = 0; i < component.length; i++) {
-// // SheetPlugin.registerComponent(OPERATION_PLUGIN + component[i].name, component[i]);
-// // }
-// // }
-// }
-
-// export class UniverCopy extends Cut {
-// constructor(context: SheetContext) {
-// const cotList = [
-// {
-// locale: ['rightClick.cut'],
-// onClick: (...arg: any) => this.copyTo(...arg),
-// },
-// ];
-// super(context, cotList);
-// }
-
-// async copy(e: ClipboardEvent) {
-// const table = this._getCopyContent();
-// if (table) {
-// Clipboard.write(
-// {
-// data: table,
-// },
-// e
-// );
-// }
-// }
-
-// async copyTo(...arg: any) {
-// arg[1].ref.hideSelect();
-
-// const table = this._getCopyContent();
-// if (table) {
-// const isWrite = await Clipboard.write({
-// data: table,
-// });
-// }
-// }
-
-// //复制为json格式字符串,首行为标题
-// async copyJsonHead(...arg: any) {
-// arg[1].ref.hideSelect();
-// arg[1].ref.getParent().hideSelect();
-
-// const Range = this._getRangeInfo();
-// if (!Range) return;
-// const { range, rangeData } = Range;
-
-// let arr = [];
-// if (rangeData.length === 1) {
-// let obj: IKeyValue = {};
-// for (let i = 0; i < rangeData[0].length; i++) {
-// const value = range.getValues()[0][i]?.v;
-// if (typeof value === 'string' || typeof value === 'number') {
-// obj[value] = '';
-// } else {
-// obj[''] = '';
-// }
-// }
-// arr.push(obj);
-// } else {
-// for (let r = 1; r < rangeData.length; r++) {
-// let obj: IKeyValue = {};
-// for (let c = 0; c < rangeData[0].length; c++) {
-// const title = range.getValues()[0][c]?.v;
-// const value = range.getValues()[r][c]?.v;
-// if (typeof title === 'string' || typeof title === 'number') {
-// obj[title] = value;
-// } else {
-// obj[''] = value;
-// }
-// }
-// arr.push(obj);
-// }
-// }
-
-// const isWrite = await Clipboard.writeText(JSON.stringify(arr));
-// }
-
-// //复制为json格式字符串,无标题,采用ABCD作为标题
-// async copyJsonNoHead(...arg: any) {
-// arg[1].ref.hideSelect();
-// arg[1].ref.getParent().hideSelect();
-
-// const Range = this._getRangeInfo();
-// if (!Range) return;
-// const { range, rangeData } = Range;
-
-// let arr = [];
-// for (let r = 0; r < rangeData.length; r++) {
-// let obj: IKeyValue = {};
-// for (let c = 0; c < rangeData[0].length; c++) {
-// const value = range.getValues()[r][c]?.v;
-// obj[Tools.chatAtABC(c + range.getRangeData().startColumn)] = value;
-// }
-// arr.push(obj);
-// }
-
-// const isWrite = await Clipboard.writeText(JSON.stringify(arr));
-// }
-
-// //复制为一维数组
-// async copyArray1(...arg: any) {
-// arg[1].ref.hideSelect();
-// arg[1].ref.getParent().hideSelect();
-
-// const Range = this._getRangeInfo();
-// if (!Range) return;
-// const { range, rangeData } = Range;
-
-// let arr = [];
-// for (let r = 0; r < rangeData.length; r++) {
-// for (let c = 0; c < rangeData[0].length; c++) {
-// const value = range.getValues()[r][c]?.v;
-// arr.push(value);
-// }
-// }
-
-// const isWrite = await Clipboard.writeText(JSON.stringify(arr));
-// }
-
-// //复制为二维数组
-// async copyArray2(...arg: any) {
-// arg[1].ref.hideSelect();
-// arg[1].ref.getParent().hideSelect();
-
-// const Range = this._getRangeInfo();
-// if (!Range) return;
-// const { range, rangeData } = Range;
-
-// let arr = [];
-// for (let r = 0; r < rangeData.length; r++) {
-// for (let c = 0; c < rangeData[0].length; c++) {
-// const value = range.getValues()[r][c]?.v;
-// arr.push(value);
-// }
-// }
-
-// const isWrite = await Clipboard.writeText(JSON.stringify(arr));
-// }
-
-// //复制为多维数组
-// async copyArrayMore(e: KeyboardEvent) {
-// if (e.key !== 'Enter') return;
-// const Range = this._getRangeInfo();
-// if (!Range) return;
-// const { range, rangeData } = Range;
-
-// let arr = [];
-// for (let r = 0; r < rangeData.length; r++) {
-// for (let c = 0; c < rangeData[0].length; c++) {
-// arr.push(rangeData[r][c]);
-// }
-// }
-
-// let row = '0';
-// let column = '0';
-// const target = e.target as HTMLInputElement;
-// const textContent = target?.previousSibling?.textContent;
-// if (!textContent) return;
-// if (textContent.length > 1) {
-// row = target.value;
-// const columnItem = target.parentNode?.querySelectorAll('input')[1];
-// column = columnItem!.value;
-// } else {
-// column = target.value;
-// const columnItem = target.parentNode?.querySelectorAll('input')[0];
-// row = columnItem!.value;
-// }
-
-// if (row === '' && column === '') {
-// const isWrite = await Clipboard.writeText(JSON.stringify(arr));
-// return;
-// }
-
-// if (row === '') {
-// row = '1';
-// } else {
-// row = `${parseInt(row)}`;
-// }
-
-// if (column === '') {
-// column = '1';
-// } else {
-// column = `${parseInt(column)}`;
-// }
-
-// if (+row < 1 || +column < 1) {
-// return;
-// }
-
-// let arrLen = arr.length;
-// let i = 0;
-// let ret = [];
-// for (let r = 0; r < +row; r++) {
-// let a = [];
-// for (let c = 0; c < +column; c++) {
-// a.push(arr[i++]);
-// if (i >= arrLen) {
-// const isWrite = await Clipboard.writeText(JSON.stringify(ret));
-// return;
-// }
-// }
-// ret.push(a);
-// }
-
-// const isWrite = await Clipboard.writeText(JSON.stringify(ret));
-// }
-
-// private _getSheetInfo() {
-// const sheet = this.getContext().getWorkBook().getActiveSheet();
-// const SheetPlugin = this.getContext().getPluginManager().getPluginByName<SheetPlugin>(PLUGIN_NAMES.SPREADSHEET);
-// const spreadsheet = SheetPlugin?.getMainComponent();
-// const controls = SheetPlugin?.getSelectionManager().getCurrentControls();
-// const selections: any = controls?.map((control: SelectionControl) => {
-// const model: SelectionModel = control.model;
-// return {
-// startRow: model.startRow,
-// startColumn: model.startColumn,
-// endRow: model.endRow,
-// endColumn: model.endColumn,
-// };
-// });
-// return { sheet, spreadsheet, selections };
-// }
-
-// private _getRangeInfo() {
-// const { sheet, selections } = this._getSheetInfo();
-// if (!selections.length) return;
-// const range = sheet.getRange(selections[0]);
-// const rangeData = range.getValues();
-// if (!rangeData.length) return;
-// return { range, rangeData };
-// }
-
-// private _getCopyContent() {
-// const { sheet, spreadsheet, selections } = this._getSheetInfo();
-// if (selections.length > 1) return;
-
-// const rowManager: any = sheet.getRowManager().getRowData();
-// const colManager: any = sheet.getColumnManager().getColumnData();
-// let rowIndexArr: number[] = [];
-// let colIndexArr: number[] = [];
-
-// for (let s = 0; s < selections.length; s++) {
-// let range = selections[s];
-
-// let r1 = range.startRow;
-// let r2 = range.endRow;
-// let c1 = range.startColumn;
-// let c2 = range.endColumn;
-
-// for (let copyR = r1; copyR <= r2; copyR++) {
-// const rowItem = rowManager.get(copyR);
-// if (rowItem && rowItem.hd) {
-// continue;
-// }
-
-// if (!rowIndexArr.includes(copyR)) {
-// rowIndexArr.push(copyR);
-// }
-
-// for (let copyC = c1; copyC <= c2; copyC++) {
-// const colItem = colManager.get(copyC);
-// if (colItem && colItem.hd) {
-// continue;
-// }
-
-// if (!colIndexArr.includes(copyC)) {
-// colIndexArr.push(copyC);
-// }
-// }
-// }
-// }
-
-// let cpData = '';
-// let colGroup = '';
-
-// for (let i = 0; i < rowIndexArr.length; i++) {
-// let r = rowIndexArr[i];
-// cpData += '<tr>';
-
-// for (let j = 0; j < colIndexArr.length; j++) {
-// let c = colIndexArr[j];
-
-// let cellValue = sheet.getRange(r, c).getValue();
-// let column = '';
-// let style = '';
-// let span = '';
-
-// if (r === rowIndexArr[0]) {
-// const colItem = colManager.get(c);
-// if (colItem && colItem.w) {
-// `<colgroup width="${colItem.w}px"></colgroup>`;
-// } else {
-// colGroup += '<colgroup width="72px"></colgroup>';
-// }
-// }
-
-// const rowItem = rowManager.get(r);
-// if (rowItem && rowItem.h) {
-// style += `height:${rowItem.h}px;`;
-// } else {
-// style += 'height:19px;';
-// }
-
-// const colItem = colManager.get(c);
-// if (colItem && colItem.w) {
-// style += `width:${colItem.w}px;`;
-// } else {
-// style += `width:72px;`;
-// }
-
-// if (cellValue && cellValue.s) {
-// const cellStyle = this.getContext().getWorkBook().getStyles().get(cellValue.s);
-// if (cellStyle) {
-// style += handleStyleToString(cellStyle);
-// }
-// }
-
-// const cellInfo = spreadsheet?.getCellByIndex(r, c);
-// if (cellInfo?.isMerged || (!cellInfo?.isMerged && cellInfo?.isMergedMainCell)) {
-// if (cellInfo.isMergedMainCell) {
-// span = `rowSpan="${cellInfo.mergeInfo.endRow - cellInfo.mergeInfo.startRow + 1}" colSpan="${
-// cellInfo.mergeInfo.endColumn - cellInfo.mergeInfo.startColumn + 1
-// }"`;
-// } else {
-// continue;
-// }
-// }
-
-// if (style.includes('data-rotate')) {
-// let rotate = style.split(';').find((item) => item.includes('data-rotate'));
-// const match = rotate?.match(/\d+/g);
-// let angle = 0;
-// let ver = 0;
-// if (match?.length) {
-// angle = +match[0];
-// ver = +match[1] ?? 0;
-// }
-// column += `<td ${span} ${ver ? `data-vertical=${ver}` : ''} style="display:inline-block;transform: rotate(${angle}deg);${style}">`;
-// } else {
-// column = `<td ${span} style="${style}">`;
-// }
-
-// let c_value;
-
-// if (cellValue) {
-// if (cellValue.p) {
-// c_value = handleJsonToDom(cellValue.p);
-// } else {
-// c_value = sheet.getRange(r, c).getDisplayValue();
-// if (c_value == null) {
-// c_value = '';
-// }
-// }
-// } else {
-// c_value = '';
-// }
-
-// column += c_value;
-
-// column += '</td>';
-// cpData += column;
-// }
-
-// cpData += '</tr>';
-// }
-// let cpTable = `<table data-type="universheet_copy_action_table">${colGroup}${cpData}</table>`;
-// return cpTable;
-// }
-// }
diff --git a/packages/sheets-plugin-operation/src/Domain/Paste.ts b/packages/sheets-plugin-operation/src/Domain/Paste.ts
deleted file mode 100644
index ac941d6afc..0000000000
--- a/packages/sheets-plugin-operation/src/Domain/Paste.ts
+++ /dev/null
@@ -1,179 +0,0 @@
-import { SelectionManagerService } from '@univerjs/base-sheets';
-import {
- ICurrentUniverService,
- Nullable,
- // RemoveMergeAction,
- // SetRowHeightAction,
-} from '@univerjs/core';
-import { Inject } from '@wendellhu/redi';
-
-export interface PasteInfo {
- data: Nullable<Array<[]>>;
- colInfo: Nullable<number[]>;
- rowInfo: Nullable<number[]>;
-}
-
-export abstract class Paste {
- // constructor(pasteList: RightMenuProps[]) { }
-
- paste(e: Event) {}
-}
-
-export class UniverPaste extends Paste {
- constructor(
- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,
- @Inject(SelectionManagerService) private readonly _selectionManagerService: SelectionManagerService
- ) {
- const pasteList = [
- {
- label: 'rightClick.paste',
- onClick: () => {
- // this.pasteTo();
- },
- },
- ];
- // super(pasteList);
- super();
- }
-
- // pasteTo(info: PasteInfo): IActionData[] {
- // let actionDataList: IActionData[] = [];
- // const { data, colInfo, rowInfo } = info;
- // // const data = await this.pasteResolver(e);
- // // if (data.length === 0) return;
- // if (!data || !data.length) return [];
- // const sheet = this._currentUniverService.getCurrentUniverSheetInstance().getWorkBook().getActiveSheet();
- // if (!sheet) return [];
- // const sheetId = sheet.getSheetId();
-
- // const selections = this._selectionManagerService.getRangeDatas();
-
- // if (!selections?.length) {
- // return [];
- // }
-
- // if (selections.length > 1) {
- // return [];
- // }
-
- // const selection = selections[0];
-
- // const copyH = data.length;
- // const copyC = data[0].length;
-
- // const minH = selection.startRow; //应用范围首尾行
- // const maxH = minH + copyH - 1;
- // const minC = selection.startColumn; //应用范围首尾列
- // const maxC = minC + copyC - 1;
- // const isMerge = sheet.getMerges().getByRowColumn(minH, maxH, minC, maxC);
- // if (isMerge) {
- // // const prompt = this.getContext()
- // // .getUniver()
- // // .getGlobalContext()
- // // .getPluginManager()
- // // .getRequirePluginByName<SheetUIPlugin>(SHEET_UI_PLUGIN_NAME)
- // // .getSlot(SHEET_UI_PLUGIN_NAME + Prompt.name);
- // // prompt.props.title = 'info.tooltip';
- // // prompt.props.content = 'info.notChangeMerge';
- // // prompt.showModal(true);
-
- // return [];
- // }
- // // 最终渲染数据
- // const tableData = handleTableMergeData(data, selection);
- // const mergeData = tableData.mergeData;
- // for (let i = 0; i < mergeData.length; i++) {
- // // sheet.getMerges().add(mergeData[i]);
-
- // // Don't trigger the API, return to the ExtensionManager after collection and trigger it in one Command, which is convenient for undo
- // const mergeActionDataList = this._getMergeActionData(sheetId, mergeData[i]);
- // actionDataList = actionDataList.concat(mergeActionDataList);
- // }
- // // sheet.getRange(minH, minC, maxH, maxC).setRangeDatas(tableData.data);
- // const rangeActionData = this._getRangeActionData(sheetId, minH, minC, maxH, maxC, tableData.data);
- // actionDataList.push(rangeActionData);
-
- // const columnWidthActionDataList = this._getColumnWidthActionData(sheetId, colInfo, minC);
- // actionDataList = actionDataList.concat(columnWidthActionDataList);
-
- // const rowHeightActionDataList = this._getRowHeightActionData(sheetId, rowInfo, minH);
- // actionDataList = actionDataList.concat(rowHeightActionDataList);
-
- // // TODO
- // // const selectionActionData = this._getSelectionActionData(sheetId);
- // // selectionActionData && actionDataList.push(selectionActionData)
-
- // return actionDataList;
- // }
-
- // private _getMergeActionData(sheetId: string, mergeData: ISelectionRange) {
- // const removeAction: IRemoveMergeActionData = {
- // actionName: RemoveMergeAction.NAME,
- // sheetId,
- // rectangles: [mergeData],
- // };
- // const appendAction: IAddMergeActionData = {
- // actionName: AddMergeAction.NAME,
- // sheetId,
- // rectangles: [mergeData],
- // };
- // return [removeAction, appendAction];
- // }
-
- // private _getRangeActionData(sheetId: string, startRow: number, startColumn: number, endRow: number, endColumn: number, values: ICellData[][]) {
- // const cellValue = new ObjectMatrix<ICellData>();
- // for (let r = 0; r <= endRow - startRow; r++) {
- // for (let c = 0; c <= endColumn - startColumn; c++) {
- // cellValue.setValue(r + startRow, c + startColumn, values[r][c]);
- // }
- // }
-
- // const setValue: ISetRangeDataActionData = {
- // sheetId,
- // actionName: ACTION_NAMES.SET_RANGE_DATA_ACTION,
- // cellValue: cellValue.getData(),
- // };
-
- // return setValue;
- // }
-
- // private _getColumnWidthActionData(sheetId: string, colInfo: Nullable<number[]>, minC: number) {
- // const actionDataList: ISetColumnWidthActionData[] = [];
- // if (colInfo && colInfo.length) {
- // for (let i = 0; i < colInfo.length; i++) {
- // const columnIndex = minC + i;
- // const columnWidth = [colInfo[i]];
- // const setColumnWidth: ISetColumnWidthActionData = {
- // sheetId,
- // actionName: ACTION_NAMES.SET_COLUMN_WIDTH_ACTION,
- // columnIndex,
- // columnWidth,
- // };
-
- // actionDataList.push(setColumnWidth);
- // }
- // }
-
- // return actionDataList;
- // }
-
- // private _getRowHeightActionData(sheetId: string, rowInfo: Nullable<number[]>, minH: number) {
- // const actionDataList: ISetRowHeightActionData[] = [];
-
- // if (rowInfo && rowInfo.length) {
- // for (let i = 0; i < rowInfo.length; i++) {
- // const rowIndex = minH + i;
- // const rowHeight = [rowInfo[i]];
- // const setRowHeight: ISetRowHeightActionData = {
- // sheetId,
- // actionName: SetRowHeightAction.NAME,
- // rowIndex,
- // rowHeight,
- // };
- // actionDataList.push(setRowHeight);
- // }
- // }
-
- // return actionDataList;
- // }
-}
diff --git a/packages/sheets-plugin-operation/src/Domain/index.ts b/packages/sheets-plugin-operation/src/Domain/index.ts
deleted file mode 100644
index 414c62bc48..0000000000
--- a/packages/sheets-plugin-operation/src/Domain/index.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export * from './Clipboard';
-export * from './Copy';
-export * from './Paste';
diff --git a/packages/sheets-plugin-operation/src/Enum/index.ts b/packages/sheets-plugin-operation/src/Enum/index.ts
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/packages/sheets-plugin-operation/src/IData.ts b/packages/sheets-plugin-operation/src/IData.ts
deleted file mode 100644
index acff9a5ed1..0000000000
--- a/packages/sheets-plugin-operation/src/IData.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { OperationPlugin } from './OperationPlugin';
-
-export type IConfig = {};
-
-// Types for props
-export type IProps = { config: IConfig; super: OperationPlugin };
diff --git a/packages/sheets-plugin-operation/src/IData/index.ts b/packages/sheets-plugin-operation/src/IData/index.ts
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/packages/sheets-plugin-operation/src/Locale/en.ts b/packages/sheets-plugin-operation/src/Locale/en.ts
deleted file mode 100644
index ff8b4c5632..0000000000
--- a/packages/sheets-plugin-operation/src/Locale/en.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default {};
diff --git a/packages/sheets-plugin-operation/src/Locale/index.ts b/packages/sheets-plugin-operation/src/Locale/index.ts
deleted file mode 100644
index 42a991e0fe..0000000000
--- a/packages/sheets-plugin-operation/src/Locale/index.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import en from './en';
-import zh from './zh';
-
-export { en, zh };
diff --git a/packages/sheets-plugin-operation/src/Locale/zh.ts b/packages/sheets-plugin-operation/src/Locale/zh.ts
deleted file mode 100644
index ff8b4c5632..0000000000
--- a/packages/sheets-plugin-operation/src/Locale/zh.ts
+++ /dev/null
@@ -1 +0,0 @@
-export default {};
diff --git a/packages/sheets-plugin-operation/src/OperationPlugin.ts b/packages/sheets-plugin-operation/src/OperationPlugin.ts
deleted file mode 100644
index 2ef29f4496..0000000000
--- a/packages/sheets-plugin-operation/src/OperationPlugin.ts
+++ /dev/null
@@ -1,134 +0,0 @@
-import { LocaleService, Plugin, PluginType } from '@univerjs/core';
-import { Dependency, Inject, Injector } from '@wendellhu/redi';
-
-import { DEFAULT_OPERATION_PLUGIN_DATA } from './Basics/Const/DEFAULT_OPERATION_PLUGIN_DATA';
-import { IOperationPluginConfig } from './Basics/Interfaces/IOperationPluginConfig';
-import { CopyExtensionFactory } from './Basics/Register/CopyExtension';
-import { CopyImageExtensionFactory } from './Basics/Register/CopyImageExtension';
-import { PasteExtensionFactory } from './Basics/Register/PasteExtension';
-import { PasteImageExtensionFactory } from './Basics/Register/PasteImageExtension';
-import { PasteOfficeExtensionFactory } from './Basics/Register/PasteOfficeExtension';
-import { OPERATION_PLUGIN } from './Const';
-import { Copy, Paste, UniverCopy, UniverPaste } from './Domain';
-import { en } from './Locale';
-
-interface CopyResolver {
- name: string;
- resolver: Copy;
-}
-
-interface PasteResolver {
- name: string;
- resolver: Paste;
-}
-
-export class OperationPlugin extends Plugin {
- static override type = PluginType.Sheet;
-
- private _config: IOperationPluginConfig;
-
- private _copyResolvers: CopyResolver[] = [];
-
- private _pasteResolvers: PasteResolver[] = [];
-
- private _univerPaste: UniverPaste;
-
- private _univerCopy: UniverCopy;
-
- private _pasteExtensionFactory: PasteExtensionFactory;
-
- private _pasteOfficeExtensionFactory: PasteOfficeExtensionFactory;
-
- private _pasteImageExtensionFactory: PasteImageExtensionFactory;
-
- private _copyExtensionFactory: CopyExtensionFactory;
-
- private _copyImageExtensionFactory: CopyImageExtensionFactory;
-
- constructor(
- config: Partial<IOperationPluginConfig>,
- @Inject(LocaleService) private readonly _localeService: LocaleService,
- @Inject(Injector) override readonly _injector: Injector
- ) {
- super(OPERATION_PLUGIN);
- this._config = Object.assign(DEFAULT_OPERATION_PLUGIN_DATA, config);
- this.initializeDependencies(_injector);
- }
-
- getConfig(): IOperationPluginConfig {
- return this._config;
- }
-
- initialize() {
- this._localeService.getLocale().load({
- en,
- });
-
- this.registerExtension();
- this._univerPaste = this._injector.get(UniverPaste);
- this._univerCopy = this._injector.get(UniverCopy);
- }
-
- registerExtension() {
- // TODO copy paste service?
- // const pasteRegister = this._registerManager.getPasteExtensionManager().getRegister();
- // this._pasteExtensionFactory = new PasteExtensionFactory(this);
- // pasteRegister.add(this._pasteExtensionFactory);
- // this._pasteOfficeExtensionFactory = new PasteOfficeExtensionFactory(this);
- // pasteRegister.add(this._pasteOfficeExtensionFactory);
- // this._pasteImageExtensionFactory = new PasteImageExtensionFactory(this);
- // pasteRegister.add(this._pasteImageExtensionFactory);
- // const copyRegister = this._registerManager.getCopyExtensionManager().getRegister();
- // this._copyExtensionFactory = new CopyExtensionFactory(this);
- // copyRegister.add(this._copyExtensionFactory);
- // this._copyImageExtensionFactory = new CopyImageExtensionFactory(this);
- // copyRegister.add(this._copyImageExtensionFactory);
- }
-
- // installTo(universheetInstance: UniverSheet) {
- // universheetInstance.installPlugin(this);
- // }
-
- override onDestroy(): void {
- // TODO copy paste service?
- // const pasteRegister = this._registerManager.getPasteExtensionManager().getRegister();
- // pasteRegister.delete(this._pasteExtensionFactory);
- // pasteRegister.delete(this._pasteOfficeExtensionFactory);
- // pasteRegister.delete(this._pasteImageExtensionFactory);
- // const copyRegister = this._registerManager.getCopyExtensionManager().getRegister();
- // copyRegister.delete(this._copyExtensionFactory);
- // copyRegister.delete(this._copyImageExtensionFactory);
- }
-
- override onRendered(): void {
- this.initialize();
- }
-
- getUniverPaste() {
- return this._univerPaste;
- }
-
- getUniverCopy() {
- return this._univerCopy;
- }
-
- initializeDependencies(injector: Injector) {
- const dependencies: Dependency[] = [[UniverPaste], [UniverCopy]];
-
- dependencies.forEach((d) => {
- injector.add(d);
- });
- }
-
- // installCopyResolver(resolver: CopyResolver) {
- // const index = this._copyResolvers.findIndex((item) => item.name === resolver.name);
- // if (index > -1) return false;
- // this._copyResolvers.push(resolver);
- // }
-
- // installPasteResolver(resolver: PasteResolver) {
- // const index = this._pasteResolvers.findIndex((item) => item.name === resolver.name);
- // if (index > -1) return false;
- // this._pasteResolvers.push(resolver);
- // }
-}
diff --git a/packages/sheets-plugin-operation/src/Types/index.d.ts b/packages/sheets-plugin-operation/src/Types/index.d.ts
deleted file mode 100644
index 050c6e21a7..0000000000
--- a/packages/sheets-plugin-operation/src/Types/index.d.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from '../index';
-declare module '@univerjs/sheets-plugin-operation' {}
diff --git a/packages/sheets-plugin-operation/src/UI/ClipboardInput.tsx b/packages/sheets-plugin-operation/src/UI/ClipboardInput.tsx
deleted file mode 100644
index 2a2ffaa254..0000000000
--- a/packages/sheets-plugin-operation/src/UI/ClipboardInput.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import { Input } from '@univerjs/base-ui';
-import { Component } from 'react';
-
-interface IProps {
- prefix?: string;
- placeholder1?: string;
- suffix?: string;
- placeholder2?: string;
-}
-
-export class ClipboardInput extends Component<IProps> {
- render() {
- const { prefix, placeholder1, suffix, placeholder2 } = this.props;
-
- return (
- <div>
- {prefix}
- <Input type="number" placeholder={placeholder1}></Input>
- {suffix || '×'}
- {placeholder2 ? <Input type="number" placeholder={placeholder2}></Input> : ''}
- </div>
- );
- }
-}
diff --git a/packages/sheets-plugin-operation/src/Util/Util.ts b/packages/sheets-plugin-operation/src/Util/Util.ts
deleted file mode 100644
index b8487f17ba..0000000000
--- a/packages/sheets-plugin-operation/src/Util/Util.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-// import { IKeyValue } from '@univerjs/core';
-
-// export function getObjType(obj: any) {
-// const toString = Object.prototype.toString;
-
-// const map: IKeyValue = {
-// '[object Boolean]': 'boolean',
-// '[object Number]': 'number',
-// '[object String]': 'string',
-// '[object Function]': 'function',
-// '[object Array]': 'array',
-// '[object Date]': 'date',
-// '[object RegExp]': 'regExp',
-// '[object Undefined]': 'undefined',
-// '[object Null]': 'null',
-// '[object Object]': 'object',
-// };
-
-// return map[toString.call(obj)];
-// }
diff --git a/packages/sheets-plugin-operation/src/index.ts b/packages/sheets-plugin-operation/src/index.ts
deleted file mode 100644
index 5b9be99605..0000000000
--- a/packages/sheets-plugin-operation/src/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-export * from './Locale';
-export * from './OperationPlugin';
diff --git a/packages/sheets-plugin-operation/tsconfig.json b/packages/sheets-plugin-operation/tsconfig.json
deleted file mode 100644
index 55a9dcacca..0000000000
--- a/packages/sheets-plugin-operation/tsconfig.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "extends": "../../tsconfig.json",
- "compilerOptions": {
- "rootDir": "./",
- "outDir": "lib",
- "baseUrl": "./",
- "esModuleInterop": true, // auto allowSyntheticDefaultImports true
- "strictPropertyInitialization": false
- },
- "include": [
- "src/**/*",
- "test/**/*.test.(ts|tsx|js)"
- ]
-}
\ No newline at end of file