Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
refactor(doc): remove redundant files and migrate to new arch (#110)
Wenzhao Hud5f9a5718ae6
diff --git a/.prettierrc.js b/.prettierrc.jsindex d0951d14a6..6d1a9e66d9 100644--- a/.prettierrc.js+++ b/.prettierrc.js@@ -1,8 +1,8 @@module.exports = {- printWidth: 180,+ printWidth: 180, // TODO: change this to 120semi: true,singleQuote: true,tabWidth: 4,trailingComma: 'es5',endOfLine: 'lf',-};\ No newline at end of file+};diff --git a/.vscode/launch.json b/.vscode/launch.jsonindex 12f9e45a95..63d329f8a8 100644--- a/.vscode/launch.json+++ b/.vscode/launch.json@@ -4,14 +4,55 @@// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387"version": "0.2.0","configurations": [+ {+ "name": "Launch Doc (Chrome)",+ "request": "launch",+ "type": "chrome",+ "url": "http://localhost:3002",+ "webRoot": "${workspaceFolder}/examples/univer-doc-ts/local/",+ "presentation": {+ "group": "0_example",+ "order": 1+ }+ },+ {+ "name": "Launch Doc (Edge)",+ "request": "launch",+ "type": "msedge",+ "url": "http://localhost:3002",+ "webRoot": "${workspaceFolder}/examples/univer-doc-ts/local/",+ "presentation": {+ "group": "0_example",+ "order": 2+ }+ },+ {+ "name": "Launch Sheet (Chrome)",+ "request": "launch",+ "type": "chrome",+ "url": "http://localhost:3002",+ "webRoot": "${workspaceFolder}/examples/univer-sheet-ts/local/",+ "presentation": {+ "group": "0_example",+ "order": 3+ }+ },+ {+ "name": "Launch Sheet (Edge)",+ "request": "launch",+ "type": "msedge",+ "url": "http://localhost:3002",+ "webRoot": "${workspaceFolder}/examples/univer-sheet-ts/local/",+ "presentation": {+ "group": "0_example",+ "order": 4+ }+ },{"type": "node","name": "vscode-jest-tests","request": "launch",- "args": [- "--runInBand",- "--watchAll=false"- ],+ "args": ["--runInBand", "--watchAll=false"],"cwd": "${workspaceFolder}","console": "integratedTerminal","internalConsoleOptions": "neverOpen",@@ -22,4 +63,4 @@}}]-}\ No newline at end of file+}diff --git a/examples/univer-doc-ts/src/main.tsx b/examples/univer-doc-ts/src/main.tsxindex ef6ed16f24..c6e18d40de 100644--- a/examples/univer-doc-ts/src/main.tsx+++ b/examples/univer-doc-ts/src/main.tsx@@ -1,8 +1,7 @@-import { LocaleType, Univer } from '@univerjs/core';-import { RenderEngine } from '@univerjs/base-render';-import { DocPlugin } from '@univerjs/base-docs';+import { RenderEngine } from '@univerjs/base-render';import { DEFAULT_DOCUMENT_DATA_EN } from '@univerjs/common-plugin-data';+import { LocaleType, Univer } from '@univerjs/core';import { DocUIPlugin } from '@univerjs/ui-plugin-docs';const univer = new Univer({diff --git a/packages/base-docs/src/Basics/Observer.ts b/packages/base-docs/src/Basics/Observer.tsindex e4f996dd2d..5e140bbbc0 100644--- a/packages/base-docs/src/Basics/Observer.ts+++ b/packages/base-docs/src/Basics/Observer.ts@@ -1,81 +1,83 @@-import { IKeyboardEvent } from '@univerjs/base-render';-import { Observable, Plugin } from '@univerjs/core';--export type DocPluginObserve = {- onAfterChangeFontFamilyObservable: Observable<string>;- onAfterChangeFontSizeObservable: Observable<number>;- onAfterChangeFontWeightObservable: Observable<boolean>;- onAfterChangeFontItalicObservable: Observable<boolean>;- onAfterChangeFontStrikethroughObservable: Observable<boolean>;- onAfterChangeFontUnderlineObservable: Observable<boolean>;- onAfterChangeFontBackgroundObservable: Observable<string>;- onAfterChangeFontColorObservable: Observable<string>;-- onChangeCurrentSheetObserver: Observable<string>;-- // ready to move to core as onKeyDownObservable- onSpreadsheetKeyDownObservable: Observable<IKeyboardEvent>;- onSpreadsheetKeyUpObservable: Observable<IKeyboardEvent>;- onSpreadsheetKeyCopyObservable: Observable<IKeyboardEvent>;- onSpreadsheetKeyPasteObservable: Observable<IKeyboardEvent>;- onSpreadsheetKeyCutObservable: Observable<IKeyboardEvent>;- onSpreadsheetKeyCompositionStartObservable: Observable<IKeyboardEvent>;- onSpreadsheetKeyCompositionUpdateObservable: Observable<IKeyboardEvent>;- onSpreadsheetKeyCompositionEndObservable: Observable<IKeyboardEvent>;-};--export function uninstall(plugin: Plugin) {- plugin.deleteObserve('onAfterChangeFontFamilyObservable');- plugin.deleteObserve('onAfterChangeFontSizeObservable');- plugin.deleteObserve('onAfterChangeFontWeightObservable');- plugin.deleteObserve('onAfterChangeFontItalicObservable');- plugin.deleteObserve('onAfterChangeFontStrikethroughObservable');- plugin.deleteObserve('onAfterChangeFontUnderlineObservable');- plugin.deleteObserve('onAfterChangeFontBackgroundObservable');- plugin.deleteObserve('onAfterChangeFontColorObservable');-- plugin.deleteObserve('onChangeCurrentSheetObserver');-- plugin.deleteObserve('onSpreadsheetKeyDownObservable');- plugin.deleteObserve('onSpreadsheetKeyUpObservable');- plugin.deleteObserve('onSpreadsheetKeyCopyObservable');- plugin.deleteObserve('onSpreadsheetKeyPasteObservable');- plugin.deleteObserve('onSpreadsheetKeyCutObservable');- plugin.deleteObserve('onSpreadsheetKeyCompositionStartObservable');- plugin.deleteObserve('onSpreadsheetKeyCompositionUpdateObservable');- plugin.deleteObserve('onSpreadsheetKeyCompositionEndObservable');-}--export function install(plugin: Plugin) {- plugin.pushToObserve('onAfterChangeFontFamilyObservable');- plugin.pushToObserve('onAfterChangeFontSizeObservable');- plugin.pushToObserve('onAfterChangeFontWeightObservable');- plugin.pushToObserve('onAfterChangeFontItalicObservable');- plugin.pushToObserve('onAfterChangeFontStrikethroughObservable');- plugin.pushToObserve('onAfterChangeFontUnderlineObservable');- plugin.pushToObserve('onAfterChangeFontBackgroundObservable');- plugin.pushToObserve('onAfterChangeFontColorObservable');-- plugin.pushToObserve('onDragAndDropStartObserver');- plugin.pushToObserve('onDragAndDroppingObserver');- plugin.pushToObserve('onDragAndDropEndEndObserver');- plugin.pushToObserve('onFillStartObserver');- plugin.pushToObserve('onFillingObserver');- plugin.pushToObserve('onFillEndObserver');-- plugin.pushToObserve('onChangeCurrentSheetObserver');-- plugin.pushToObserve('onSheetBarDidMountObservable');- plugin.pushToObserve('onCountBarDidMountObservable');- plugin.pushToObserve('onInfoBarDidMountObservable');- plugin.pushToObserve('onRightMenuDidMountObservable');-- plugin.pushToObserve('onSpreadsheetKeyDownObservable');- plugin.pushToObserve('onSpreadsheetKeyUpObservable');- plugin.pushToObserve('onSpreadsheetKeyCopyObservable');- plugin.pushToObserve('onSpreadsheetKeyPasteObservable');- plugin.pushToObserve('onSpreadsheetKeyCutObservable');- plugin.pushToObserve('onSpreadsheetKeyCompositionStartObservable');- plugin.pushToObserve('onSpreadsheetKeyCompositionUpdateObservable');- plugin.pushToObserve('onSpreadsheetKeyCompositionEndObservable');-}+import { IKeyboardEvent } from '@univerjs/base-render';+import { Observable, Plugin } from '@univerjs/core';++export type DocPluginObserve = {+ onAfterChangeFontFamilyObservable: Observable<string>;+ onAfterChangeFontSizeObservable: Observable<number>;+ onAfterChangeFontWeightObservable: Observable<boolean>;+ onAfterChangeFontItalicObservable: Observable<boolean>;+ onAfterChangeFontStrikethroughObservable: Observable<boolean>;+ onAfterChangeFontUnderlineObservable: Observable<boolean>;+ onAfterChangeFontBackgroundObservable: Observable<string>;+ onAfterChangeFontColorObservable: Observable<string>;++ onChangeCurrentSheetObserver: Observable<string>;++ // ready to move to core as onKeyDownObservable+ onSpreadsheetKeyDownObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyUpObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyCopyObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyPasteObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyCutObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyCompositionStartObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyCompositionUpdateObservable: Observable<IKeyboardEvent>;+ onSpreadsheetKeyCompositionEndObservable: Observable<IKeyboardEvent>;+};++/** @deprecated */+export function uninstall(plugin: Plugin) {+ plugin.deleteObserve('onAfterChangeFontFamilyObservable');+ plugin.deleteObserve('onAfterChangeFontSizeObservable');+ plugin.deleteObserve('onAfterChangeFontWeightObservable');+ plugin.deleteObserve('onAfterChangeFontItalicObservable');+ plugin.deleteObserve('onAfterChangeFontStrikethroughObservable');+ plugin.deleteObserve('onAfterChangeFontUnderlineObservable');+ plugin.deleteObserve('onAfterChangeFontBackgroundObservable');+ plugin.deleteObserve('onAfterChangeFontColorObservable');++ plugin.deleteObserve('onChangeCurrentSheetObserver');++ plugin.deleteObserve('onSpreadsheetKeyDownObservable');+ plugin.deleteObserve('onSpreadsheetKeyUpObservable');+ plugin.deleteObserve('onSpreadsheetKeyCopyObservable');+ plugin.deleteObserve('onSpreadsheetKeyPasteObservable');+ plugin.deleteObserve('onSpreadsheetKeyCutObservable');+ plugin.deleteObserve('onSpreadsheetKeyCompositionStartObservable');+ plugin.deleteObserve('onSpreadsheetKeyCompositionUpdateObservable');+ plugin.deleteObserve('onSpreadsheetKeyCompositionEndObservable');+}++/** @deprecated */+export function install(plugin: Plugin) {+ plugin.pushToObserve('onAfterChangeFontFamilyObservable');+ plugin.pushToObserve('onAfterChangeFontSizeObservable');+ plugin.pushToObserve('onAfterChangeFontWeightObservable');+ plugin.pushToObserve('onAfterChangeFontItalicObservable');+ plugin.pushToObserve('onAfterChangeFontStrikethroughObservable');+ plugin.pushToObserve('onAfterChangeFontUnderlineObservable');+ plugin.pushToObserve('onAfterChangeFontBackgroundObservable');+ plugin.pushToObserve('onAfterChangeFontColorObservable');++ plugin.pushToObserve('onDragAndDropStartObserver');+ plugin.pushToObserve('onDragAndDroppingObserver');+ plugin.pushToObserve('onDragAndDropEndEndObserver');+ plugin.pushToObserve('onFillStartObserver');+ plugin.pushToObserve('onFillingObserver');+ plugin.pushToObserve('onFillEndObserver');++ plugin.pushToObserve('onChangeCurrentSheetObserver');++ plugin.pushToObserve('onSheetBarDidMountObservable');+ plugin.pushToObserve('onCountBarDidMountObservable');+ plugin.pushToObserve('onInfoBarDidMountObservable');+ plugin.pushToObserve('onRightMenuDidMountObservable');++ plugin.pushToObserve('onSpreadsheetKeyDownObservable');+ plugin.pushToObserve('onSpreadsheetKeyUpObservable');+ plugin.pushToObserve('onSpreadsheetKeyCopyObservable');+ plugin.pushToObserve('onSpreadsheetKeyPasteObservable');+ plugin.pushToObserve('onSpreadsheetKeyCutObservable');+ plugin.pushToObserve('onSpreadsheetKeyCompositionStartObservable');+ plugin.pushToObserve('onSpreadsheetKeyCompositionUpdateObservable');+ plugin.pushToObserve('onSpreadsheetKeyCompositionEndObservable');+}diff --git a/packages/base-docs/src/Controller/DocumentController.ts b/packages/base-docs/src/Controller/DocumentController.tsindex 6b29a22ff0..f6619d5d2b 100644--- a/packages/base-docs/src/Controller/DocumentController.ts+++ b/packages/base-docs/src/Controller/DocumentController.ts@@ -1,4 +1,5 @@-import { Injector, Inject } from '@wendellhu/redi';+import { Inject, Injector } from '@wendellhu/redi';+import { InputController } from './InputController';export class DocumentController {@@ -6,5 +7,6 @@ export class DocumentController {constructor(@Inject(Injector) private readonly _injector: Injector) {this._inputController = this._injector.createInstance(InputController);+ this._injector.add([InputController, this._inputController]);}}diff --git a/packages/base-docs/src/Controller/InfoBarController.ts b/packages/base-docs/src/Controller/InfoBarController.tsdeleted file mode 100644index ea549276d5..0000000000--- a/packages/base-docs/src/Controller/InfoBarController.ts+++ /dev/null@@ -1,16 +0,0 @@-type IProps = {- locale?: string;- label?: string;- onBlur?: (e: FocusEvent) => void;-};--export interface BaseInfoBarProps {- back: IProps;- update: IProps;- save: IProps;- rename: IProps;- sheet: IProps;-}--export class InfoBarController {-}\ No newline at end of filediff --git a/packages/base-docs/src/Controller/InputController.ts b/packages/base-docs/src/Controller/InputController.tsindex e9ea9d19ab..01285fdbb3 100644--- a/packages/base-docs/src/Controller/InputController.ts+++ b/packages/base-docs/src/Controller/InputController.ts@@ -1,35 +1,24 @@import {Documents,+ getParagraphBySpan,+ hasListSpan,IDocumentSkeletonLine,IDocumentSkeletonSpan,IEditorInputConfig,INodePosition,INodeSearch,- TextSelection,- getParagraphBySpan,- hasListSpan,isFirstSpan,isIndentBySpan,isPlaceholderOrSpace,isSameLine,+ TextSelection,} from '@univerjs/base-render';-import { DataStreamTreeTokenType, DocumentModel, ICurrentUniverService, IParagraph, Nullable, Observable, UpdateDocsAttributeType } from '@univerjs/core';+import { DataStreamTreeTokenType, Direction, DocumentModel, ICurrentUniverService, IParagraph, Nullable, Observable, UpdateDocsAttributeType } from '@univerjs/core';import { Inject } from '@wendellhu/redi';+import { CanvasView } from '../View/Render/CanvasView';import { DocsView } from '../View/Render/Views';-enum KeyboardKeyType {- Backspace = 'Backspace',- Delete = 'Delete',- Enter = 'Enter',- Copy = 'c',- Paste = 'v',- ArrowUp = 'ArrowUp',- ArrowDown = 'ArrowDown',- ArrowLeft = 'ArrowLeft',- ArrowRight = 'ArrowRight',-}-export class InputController {private _previousIMEContent: string = '';@@ -41,267 +30,232 @@ export class InputController {this._initialize();}- private _initialize() {- const docsView = this._canvasView.getDocsView() as DocsView;- const events = docsView.getDocs().getEditorInputEvent();-- const docsModel = this._currentUniverService.getCurrentUniverDocInstance().getDocument();-- if (!events) {- return;+ // eslint-disable-next-line @typescript-eslint/member-ordering+ moveCursor(_docModel: DocumentModel, direction: Direction) {+ const documents = (this._canvasView.getDocsView() as DocsView).getDocs();+ const activeSelection = documents.getActiveSelection();+ if (!activeSelection) {+ return false;}- const { onInputObservable, onCompositionstartObservable, onCompositionupdateObservable, onCompositionendObservable, onKeydownObservable, onSelectionStartObservable } =- events;- this._initialKeydown(onKeydownObservable, docsModel);+ const startNodePosition = activeSelection.getStart();+ const preSpan = documents.findSpanByPosition(startNodePosition);- this._initialInput(onInputObservable, docsModel);+ // TODO@DR-Univer: 这里的代码重复的部分比较多+ if (direction === Direction.DOWN || direction === Direction.UP) {+ const newPos = this._getTopOrBottomPosition(documents as Documents, preSpan, direction === Direction.DOWN);+ if (newPos == null) {+ return;+ }- this._initialComposition(onCompositionstartObservable, onCompositionupdateObservable, onCompositionendObservable, docsModel);+ const selectionRemain = documents.remainActiveSelection() as TextSelection | undefined;+ if (selectionRemain == null) {+ return;+ }- onSelectionStartObservable.add((nodePosition) => {- this._currentNodePosition = nodePosition;- });- }+ this._syncSelection(documents as Documents, selectionRemain, newPos, true);+ } else if (direction === Direction.LEFT) {+ const activeRange = activeSelection.getRange();+ const cursorStart = activeRange.cursorStart;+ let cursor = cursorStart;+ let span: Nullable<IDocumentSkeletonSpan>;+ let isBack = false;+ if (isFirstSpan(preSpan)) {+ span = documents.findNodeByCharIndex(cursor);- // eslint-disable-next-line max-lines-per-function- private _initialKeydown(onKeydownObservable: Observable<IEditorInputConfig>, docsModel: DocumentModel) {- // eslint-disable-next-line max-lines-per-function- onKeydownObservable.add((config) => {- const { event, document, activeSelection, selectionList } = config;- const e = event as KeyboardEvent;+ if (preSpan === span) {+ isBack = true;+ }- const isCtrl = e.ctrlKey;+ while (isPlaceholderOrSpace(span)) {+ span = documents.findNodeByCharIndex(--cursor);+ }+ } else {+ span = documents.findNodeByCharIndex(--cursor);+ }- const activeRange = activeSelection?.getRange();+ const selectionRemain = documents.remainActiveSelection() as TextSelection | undefined;+ this._adjustSelection(documents, selectionRemain, span, isBack, true);+ } else {+ const activeRange = activeSelection.getRange();+ const cursorStart = activeRange.cursorStart;+ const isStartBack = activeRange.isStartBack;+ let cursor = cursorStart;+ if (isStartBack === true) {+ cursor -= 1;+ }- const startNodePosition = activeSelection?.getStart();+ let span = documents.findNodeByCharIndex(++cursor);- const segmentId = activeSelection?.segmentId;+ const originCursor = cursor;- const skeleton = document.getSkeleton();+ while (isPlaceholderOrSpace(span)) {+ span = documents.findNodeByCharIndex(++cursor);+ }- if (!skeleton || !activeRange) {+ let isBack = false;+ if (isFirstSpan(span) && preSpan !== span) {+ isBack = true;+ } else {+ span = documents.findNodeByCharIndex(originCursor);+ }++ if (span == null) {return;}+ const selectionRemain = documents.remainActiveSelection() as TextSelection | undefined;+ this._adjustSelection(documents, selectionRemain, span, isBack, true);+ }+ }- const { cursorStart, cursorEnd, isCollapse, isEndBack, isStartBack } = activeRange;+ // eslint-disable-next-line max-lines-per-function+ deleteLeft() {+ const document = (this._canvasView.getDocsView() as DocsView).getDocs();+ const activeSelection = document.getActiveSelection();+ if (!activeSelection) {+ return;+ }- if (e.key === KeyboardKeyType.Backspace) {- const preSpan = document.findSpanByPosition(startNodePosition);+ const skeleton = document.getSkeleton();+ const docsModel = this._currentUniverService.getCurrentUniverDocInstance().getDocument();+ const startNodePosition = activeSelection.getStart();+ const preSpan = document.findSpanByPosition(startNodePosition);- const preIsBullet = hasListSpan(preSpan);+ const preIsBullet = hasListSpan(preSpan);- const preIsIndent = isIndentBySpan(preSpan, docsModel.body);+ const preIsIndent = isIndentBySpan(preSpan, docsModel.body);- let cursor = cursorStart;+ const activeRange = activeSelection.getRange();+ const cursorStart = activeRange.cursorStart;+ const isStartBack = activeRange.isStartBack;+ const isCollapse = activeRange.isCollapse;+ const segmentId = activeSelection.segmentId;+ let cursor = cursorStart;- if (isStartBack === true) {- cursor -= 1;- }+ if (isStartBack === true) {+ cursor -= 1;+ }- if (isCollapse === false) {- cursor += 1;- }+ if (isCollapse === false) {+ cursor += 1;+ }- let span = document.findNodeByCharIndex(cursor);-- const selectionRemain = document.remainActiveSelection() as TextSelection | undefined;-- // const content = document.findNodeByCharIndex(cursor - 1)?.content || '';- const isUpdateParagraph = isFirstSpan(preSpan) && span !== preSpan && (preIsBullet === true || preIsIndent === true);- if (isUpdateParagraph) {- const paragraph = getParagraphBySpan(preSpan, docsModel.body);-- if (paragraph == null) {- return;- }-- const paragraphIndex = paragraph?.startIndex;-- const updateParagraph: IParagraph = { startIndex: 0 };-- const paragraphStyle = paragraph.paragraphStyle;- if (preIsBullet === true) {- const paragraphStyle = paragraph.paragraphStyle;- if (paragraphStyle) {- updateParagraph.paragraphStyle = paragraphStyle;- }- } else if (preIsIndent === true) {- const bullet = paragraph.bullet;- if (bullet) {- updateParagraph.bullet = bullet;- }- if (paragraphStyle != null) {- updateParagraph.paragraphStyle = { ...paragraphStyle };- delete updateParagraph.paragraphStyle.hanging;- delete updateParagraph.paragraphStyle.indentStart;- }- }-- docsModel.update(- { dataStream: '', paragraphs: [{ ...updateParagraph }] },- {- cursorStart: paragraphIndex,- cursorEnd: paragraphIndex,- isEndBack: false,- isStartBack: false,- isCollapse: true,- },- UpdateDocsAttributeType.REPLACE,- segmentId- );- } else {- const endNodePosition = activeSelection?.getEnd();- if (endNodePosition != null) {- const endSpan = document.findSpanByPosition(endNodePosition);- if (hasListSpan(endSpan) && !isSameLine(preSpan, endSpan)) {- activeRange.cursorEnd -= 1;- }- }- docsModel.delete(activeRange, segmentId);- }+ let span = document.findNodeByCharIndex(cursor);- skeleton.calculate();+ const selectionRemain = document.remainActiveSelection() as TextSelection | undefined;- let isBack = false;+ // const content = document.findNodeByCharIndex(cursor - 1)?.content || '';+ const isUpdateParagraph = isFirstSpan(preSpan) && span !== preSpan && (preIsBullet === true || preIsIndent === true);+ if (isUpdateParagraph) {+ const paragraph = getParagraphBySpan(preSpan, docsModel.body);- if (isUpdateParagraph) {- isBack = true;- cursor++;- } else if (isFirstSpan(span)) {- isBack = true;- } else {- cursor--;- }- span = document.findNodeByCharIndex(cursor);+ if (paragraph == null) {+ return;+ }- this._adjustSelection(document as Documents, selectionRemain, span, isBack);+ const paragraphIndex = paragraph?.startIndex;- this._resetIME();- } else if (e.key === KeyboardKeyType.Enter) {- // split paragraph- let cursor = cursorStart;+ const updateParagraph: IParagraph = { startIndex: 0 };- if (isStartBack === false) {- cursor += 1;+ const paragraphStyle = paragraph.paragraphStyle;+ if (preIsBullet === true) {+ const paragraphStyle = paragraph.paragraphStyle;+ if (paragraphStyle) {+ updateParagraph.paragraphStyle = paragraphStyle;}-- const selectionRemain = document.remainActiveSelection() as TextSelection | undefined;-- docsModel.insert(- {- dataStream: DataStreamTreeTokenType.PARAGRAPH,- paragraphs: this._generateParagraph(DataStreamTreeTokenType.PARAGRAPH),- },- activeRange,- segmentId- );-- skeleton.calculate();-- const span = document.findNodeByCharIndex(++cursor);-- this._adjustSelection(document as Documents, selectionRemain, span, true);- } else if (e.key === KeyboardKeyType.ArrowUp) {- const preSpan = document.findSpanByPosition(startNodePosition);- // let cursor = cursorStart;- // if (isStartBack === true) {- // cursor -= 1;- // }- // const span = document.findNodeByCharIndex(cursor);- const newPos = this._getTopOrBottomPosition(document as Documents, preSpan, false);- if (newPos == null) {- return;+ } else if (preIsIndent === true) {+ const bullet = paragraph.bullet;+ if (bullet) {+ updateParagraph.bullet = bullet;}- const selectionRemain = document.remainActiveSelection() as TextSelection | undefined;-- if (selectionRemain == null) {- return;+ if (paragraphStyle != null) {+ updateParagraph.paragraphStyle = { ...paragraphStyle };+ delete updateParagraph.paragraphStyle.hanging;+ delete updateParagraph.paragraphStyle.indentStart;}+ }- this._syncSelection(document as Documents, selectionRemain, newPos, true);- // this._adjustSelection(document as Documents, selectionRemain, newSpan, false, true);- } else if (e.key === KeyboardKeyType.ArrowDown) {- const preSpan = document.findSpanByPosition(startNodePosition);- // let cursor = cursorStart;- // if (isStartBack === true) {- // cursor -= 1;- // }-- // const span = document.findNodeByCharIndex(cursor);- const newPos = this._getTopOrBottomPosition(document as Documents, preSpan, true);- if (newPos == null) {- return;- }- const selectionRemain = document.remainActiveSelection() as TextSelection | undefined;- if (selectionRemain == null) {- return;- }- this._syncSelection(document as Documents, selectionRemain, newPos, true);- // this._adjustSelection(document as Documents, selectionRemain, newSpan, false, true);- } else if (e.key === KeyboardKeyType.ArrowLeft) {- let cursor = cursorStart;- if (isStartBack === true) {- cursor -= 1;+ docsModel.update(+ { dataStream: '', paragraphs: [{ ...updateParagraph }] },+ {+ cursorStart: paragraphIndex,+ cursorEnd: paragraphIndex,+ isEndBack: false,+ isStartBack: false,+ isCollapse: true,+ },+ UpdateDocsAttributeType.REPLACE,+ segmentId+ );+ } else {+ const endNodePosition = activeSelection?.getEnd();+ if (endNodePosition != null) {+ const endSpan = document.findSpanByPosition(endNodePosition);+ if (hasListSpan(endSpan) && !isSameLine(preSpan, endSpan)) {+ activeRange.cursorEnd -= 1;}+ }+ docsModel.delete(activeRange, segmentId);+ }- const preSpan = document.findSpanByPosition(startNodePosition);- let span: Nullable<IDocumentSkeletonSpan>;- let isBack = false;- if (isFirstSpan(preSpan)) {- span = document.findNodeByCharIndex(cursor);-- if (preSpan === span) {- isBack = true;- }-- while (isPlaceholderOrSpace(span)) {- span = document.findNodeByCharIndex(--cursor);- }- } else {- span = document.findNodeByCharIndex(--cursor);- }+ skeleton.calculate();- if (span == null) {- return;- }- const selectionRemain = document.remainActiveSelection() as TextSelection | undefined;- this._adjustSelection(document as Documents, selectionRemain, span, isBack, true);- } else if (e.key === KeyboardKeyType.ArrowRight) {- const preSpan = document.findSpanByPosition(startNodePosition);-- let cursor = cursorStart;- if (isStartBack === true) {- cursor -= 1;- }+ let isBack = false;- let span = document.findNodeByCharIndex(++cursor);+ if (isUpdateParagraph) {+ isBack = true;+ cursor++;+ } else if (isFirstSpan(span)) {+ isBack = true;+ } else {+ cursor--;+ }+ span = document.findNodeByCharIndex(cursor);- const originCursor = cursor;+ this._adjustSelection(document as Documents, selectionRemain, span, isBack);- while (isPlaceholderOrSpace(span)) {- span = document.findNodeByCharIndex(++cursor);- }+ //+ this._resetIME();+ }- let isBack = false;- if (isFirstSpan(span) && preSpan !== span) {- isBack = true;- } else {- span = document.findNodeByCharIndex(originCursor);- }+ breakLine() {+ const document = (this._canvasView.getDocsView() as DocsView).getDocs();+ const activeSelection = document.getActiveSelection();+ if (!activeSelection) {+ return;+ }- if (span == null) {- return;- }- const selectionRemain = document.remainActiveSelection() as TextSelection | undefined;- this._adjustSelection(document as Documents, selectionRemain, span, isBack, true);- } else if (e.key === KeyboardKeyType.Copy && isCtrl) {- // copy handler- } else if (e.key === KeyboardKeyType.Paste && isCtrl) {- // paste handler- }- });+ const skeleton = document.getSkeleton();+ const docsModel = this._currentUniverService.getCurrentUniverDocInstance().getDocument();+ const startNodePosition = activeSelection.getStart();++ const activeRange = activeSelection.getRange();+ const cursorStart = activeRange.cursorStart;+ const isStartBack = activeRange.isStartBack;+ const segmentId = activeSelection.segmentId;+ // split paragraph+ let cursor = cursorStart;++ if (isStartBack === false) {+ cursor += 1;+ }++ const selectionRemain = document.remainActiveSelection() as TextSelection | undefined;++ docsModel.insert(+ {+ dataStream: DataStreamTreeTokenType.PARAGRAPH,+ paragraphs: this._generateParagraph(DataStreamTreeTokenType.PARAGRAPH),+ },+ activeRange,+ segmentId+ );++ skeleton?.calculate();++ const span = document.findNodeByCharIndex(++cursor);++ this._adjustSelection(document as Documents, selectionRemain, span, true);}private _initialInput(onInputObservable: Observable<IEditorInputConfig>, docsModel: DocumentModel) {@@ -679,4 +633,24 @@ export class InputController {document.syncSelection();}++ private _initialize() {+ const docsView = this._canvasView.getDocsView() as DocsView;+ const events = docsView.getDocs().getEditorInputEvent();++ const docsModel = this._currentUniverService.getCurrentUniverDocInstance().getDocument();++ if (!events) {+ return;+ }+ const { onInputObservable, onCompositionstartObservable, onCompositionupdateObservable, onCompositionendObservable, onSelectionStartObservable } = events;++ this._initialInput(onInputObservable, docsModel);++ this._initialComposition(onCompositionstartObservable, onCompositionupdateObservable, onCompositionendObservable, docsModel);++ onSelectionStartObservable.add((nodePosition) => {+ this._currentNodePosition = nodePosition;+ });+ }}diff --git a/packages/base-docs/src/Controller/ToolbarController.ts b/packages/base-docs/src/Controller/ToolbarController.tsdeleted file mode 100644index b064420723..0000000000--- a/packages/base-docs/src/Controller/ToolbarController.ts+++ /dev/null@@ -1 +0,0 @@-export class ToolbarController {}\ No newline at end of filediff --git a/packages/base-docs/src/DocPlugin.ts b/packages/base-docs/src/DocPlugin.tsindex 9fdaa64b6a..d2794dd44d 100644--- a/packages/base-docs/src/DocPlugin.ts+++ b/packages/base-docs/src/DocPlugin.ts@@ -1,17 +1,20 @@-import { Dependency, Inject, Injector } from '@wendellhu/redi';-import { LocaleService, ObserverManager, Plugin, PluginType, PLUGIN_NAMES, UIObserver } from '@univerjs/core';import { Engine } from '@univerjs/base-render';-import { zh, en } from './Locale';+import { DesktopPlatformService, DesktopShortcutService, IPlatformService, IShortcutService } from '@univerjs/base-ui';+import { ICommandService, LocaleService, ObserverManager, Plugin, PLUGIN_NAMES, PluginType, UIObserver } from '@univerjs/core';+import { Dependency, Inject, Injector } from '@wendellhu/redi';+import { DocPluginObserve, install } from './Basics/Observer';-import { ToolbarController } from './Controller/ToolbarController';+import { BreakLineCommand, DeleteLeftCommand } from './commands/commands/core-editing.command';+import { MoveCursorOperation } from './commands/operations/cursor.operation';import { DocumentController } from './Controller/DocumentController';-import { InfoBarController } from './Controller/InfoBarController';-import { CanvasView } from './View/Render/CanvasView';+import { en, zh } from './Locale';+import { BreakLineShortcut, DeleteLeftShortcut } from './shortcuts/core-editing.shortcut';+import { MoveCursorDownShortcut, MoveCursorLeftShortcut, MoveCursorRightShortcut, MoveCursorUpShortcut } from './shortcuts/cursor.shortcut';import { CANVAS_VIEW_KEY } from './View/Render';+import { CanvasView } from './View/Render/CanvasView';import { DocsView } from './View/Render/Views';-import { IDocPluginConfigBase } from './Interface';-export interface IDocPluginConfig extends IDocPluginConfigBase {}+export interface IDocPluginConfig {}const DEFAULT_DOCUMENT_PLUGIN_DATA = {};@@ -20,14 +23,10 @@ export class DocPlugin extends Plugin<DocPluginObserve> {private _config: IDocPluginConfig;- private _infoBarControl: InfoBarController;-private _canvasView: CanvasView;private _canvasEngine: Engine;- private _toolbarControl: ToolbarController;-private _documentController: DocumentController;constructor(@@ -50,6 +49,14 @@ export class DocPlugin extends Plugin<DocPluginObserve> {install(this);+ [MoveCursorOperation, DeleteLeftCommand, BreakLineCommand].forEach((command) => {+ this._injector.get(ICommandService).registerCommand(command);+ });++ [MoveCursorUpShortcut, MoveCursorDownShortcut, MoveCursorRightShortcut, MoveCursorLeftShortcut, DeleteLeftShortcut, BreakLineShortcut].forEach((shortcut) => {+ this._injector.get(IShortcutService).registerShortcut(shortcut);+ });+this.listenEventManager();}@@ -59,8 +66,6 @@ export class DocPlugin extends Plugin<DocPluginObserve> {}initController() {- this._toolbarControl = new ToolbarController();- this._infoBarControl = new InfoBarController();this._documentController = new DocumentController(this._injector);}@@ -69,6 +74,8 @@ export class DocPlugin extends Plugin<DocPluginObserve> {}listenEventManager() {+ // FIXME@wzhudev: this looks strange to be. It should not rely on the event created by a upper layer plugin.+ // Instead, upper layer plugin should call it.this._getCoreObserver<boolean>('onUIDidMountObservable').add(() => {this.initializeAfterUI();});@@ -78,42 +85,62 @@ export class DocPlugin extends Plugin<DocPluginObserve> {return this._config;}+ /**+ * @deprecated use DI to get underlying dependencies+ * @returns+ */getCanvasEngine() {return this._canvasEngine;}+ /**+ * @deprecated use DI to get underlying dependencies+ * @returns+ */getCanvasView() {return this._canvasView;}+ /**+ * @deprecated use DI to get underlying dependencies+ * @returns+ */getMainScene() {return this._canvasEngine.getScene(CANVAS_VIEW_KEY.MAIN_SCENE);}+ /**+ * @deprecated use DI to get underlying dependencies+ * @returns+ */getDocsView() {return this.getCanvasView().getDocsView();}+ /**+ * @deprecated use DI to get underlying dependencies+ * @returns+ */getMainComponent() {return (this.getDocsView() as DocsView).getDocs();}+ /**+ * @deprecated use DI to get underlying dependencies+ * @returns+ */getInputEvent() {return this.getMainComponent().getEditorInputEvent();}+ /**+ * @deprecated use DI to get underlying dependencies+ * @returns+ */getDocumentController() {return this._documentController;}- getToolbarControl() {- return this._toolbarControl;- }-- getInfoBarControl() {- return this._infoBarControl;- }-override onMounted(): void {this.initialize();}@@ -126,7 +153,7 @@ export class DocPlugin extends Plugin<DocPluginObserve> {}private _initializeDependencies(docInjector: Injector) {- const dependencies: Dependency[] = [[CanvasView]];+ const dependencies: Dependency[] = [[CanvasView], [IShortcutService, { useClass: DesktopShortcutService }], [IPlatformService, { useClass: DesktopPlatformService }]];dependencies.forEach((d) => {docInjector.add(d);diff --git a/packages/base-docs/src/Interface/DocPluginConfig.ts b/packages/base-docs/src/Interface/DocPluginConfig.tsdeleted file mode 100644index b7542483af..0000000000--- a/packages/base-docs/src/Interface/DocPluginConfig.ts+++ /dev/null@@ -1 +0,0 @@-export interface IDocPluginConfigBase {}diff --git a/packages/base-docs/src/Interface/index.ts b/packages/base-docs/src/Interface/index.tsdeleted file mode 100644index 671565ae07..0000000000--- a/packages/base-docs/src/Interface/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './DocPluginConfig';diff --git a/packages/base-docs/src/Model/InfoBarModel.ts b/packages/base-docs/src/Model/InfoBarModel.tsdeleted file mode 100644index e9d969cf44..0000000000--- a/packages/base-docs/src/Model/InfoBarModel.ts+++ /dev/null@@ -1,11 +0,0 @@-export class InfoBarModel {- constructor(private _name: string) {}-- get name(): string {- return this._name;- }-- setName(name: string) {- this._name = name;- }-}diff --git a/packages/base-docs/src/Model/ToolbarModel.ts b/packages/base-docs/src/Model/ToolbarModel.tsdeleted file mode 100644index 016858899e..0000000000--- a/packages/base-docs/src/Model/ToolbarModel.ts+++ /dev/null@@ -1,91 +0,0 @@-// import { BaseSelectChildrenProps, BaseSelectProps } from '../View/UI/Common/Select/Select';-// import { BaseTextButtonProps } from '../View/UI/Common/TextButton/TextButton';--// export interface IShowToolbarConfig {-// undoRedo?: boolean; // Undo redo-// paintFormat?: boolean; // Format brush-// currencyFormat?: boolean; // currency format-// percentageFormat?: boolean; // Percentage format-// numberDecrease?: boolean; // 'Decrease the number of decimal places'-// numberIncrease?: boolean; // 'Increase the number of decimal places-// moreFormats?: boolean; // 'More Formats'-// font?: boolean; // 'font'-// fontSize?: boolean; // 'Font size'-// bold?: boolean; // 'Bold (Ctrl+B)'-// italic?: boolean; // 'Italic (Ctrl+I)'-// strikethrough?: boolean; // 'Strikethrough (Alt+Shift+5)'-// underline?: boolean; // 'Underline (Alt+Shift+6)'-// textColor?: boolean; // 'Text color'-// fillColor?: boolean; // 'Cell color'-// border?: boolean; // 'border'-// mergeCell?: boolean; // 'Merge cells'-// horizontalAlignMode?: boolean; // 'Horizontal alignment'-// verticalAlignMode?: boolean; // 'Vertical alignment'-// textWrapMode?: boolean; // 'Wrap mode'-// textRotateMode?: boolean; // 'Text Rotation Mode'--// image?: boolean; // 'Insert picture'-// link?: boolean; // 'Insert link'-// chart?: boolean; // 'chart' (the icon is hidden, but if the chart plugin is configured, you can still create a new chart by right click)-// comment?: boolean; // 'comment'-// pivotTable?: boolean; // 'PivotTable'-// function?: boolean; // 'formula'-// frozenMode?: boolean; // 'freeze mode'-// sortAndFilter?: boolean; // 'Sort and filter'-// conditionalFormat?: boolean; // 'Conditional Format'-// dataValidation?: boolean; // 'Data Validation'-// splitColumn?: boolean; // 'Split column'-// screenshot?: boolean; // 'screenshot'-// findAndReplace?: boolean; // 'Find and Replace'-// protection?: boolean; // 'Worksheet protection'-// print?: boolean; // 'Print'-// }--// enum ToolbarType {-// SELECT,-// BUTTON,-// }--// // 继承基础下拉属性,添加国际化-// export interface BaseToolbarSelectChildrenProps extends BaseSelectChildrenProps {-// locale?: string;-// suffixLocale?: string;-// children?: BaseToolbarSelectChildrenProps[];-// }--// interface BaseToolbarSelectProps extends BaseSelectProps {-// locale?: string;-// suffixLocale?: string;-// children?: BaseToolbarSelectChildrenProps[];-// }--// export interface IToolbarItemProps extends BaseToolbarSelectProps, BaseTextButtonProps {-// show?: boolean; //是否显示按钮-// toolbarType?: ToolbarType;-// locale?: string; //label国际化-// tooltipLocale?: string; //tooltip国际化-// tooltip?: string; //tooltip文字-// border?: boolean;-// }--// export class ToolbarModel {-// private _config: IShowToolbarConfig[];--// private _toolList: IToolbarItemProps[];--// get config(): IShowToolbarConfig[] {-// return this._config;-// }--// get toolList(): IToolbarItemProps[] {-// return this._toolList;-// }--// set config(value: IShowToolbarConfig[]) {-// this._config = value;-// }--// set toolList(value: IToolbarItemProps[]) {-// this._toolList = value;-// }-// }diff --git a/packages/base-docs/src/View/Render/CanvasView.ts b/packages/base-docs/src/View/Render/CanvasView.tsindex 53ef5fcf90..edd0dbb7d4 100644--- a/packages/base-docs/src/View/Render/CanvasView.ts+++ b/packages/base-docs/src/View/Render/CanvasView.ts@@ -1,9 +1,10 @@-import { Inject, Injector } from '@wendellhu/redi';+import './Views';+import { Engine, EVENT_TYPE, IRenderingEngine, IWheelEvent, Layer, Scene, ScrollBar, Viewport } from '@univerjs/base-render';import { EventState, sortRules } from '@univerjs/core';+import { Inject, Injector } from '@wendellhu/redi';-import { BaseView, CanvasViewRegistry, CANVAS_VIEW_KEY } from './BaseView';-import './Views';+import { BaseView, CANVAS_VIEW_KEY, CanvasViewRegistry } from './BaseView';export class CanvasView {private _scene: Scene;diff --git a/packages/base-docs/src/View/Render/Views/DocsView.ts b/packages/base-docs/src/View/Render/Views/DocsView.tsindex 6ddaca0009..20eeb19943 100644--- a/packages/base-docs/src/View/Render/Views/DocsView.ts+++ b/packages/base-docs/src/View/Render/Views/DocsView.ts@@ -1,7 +1,8 @@import { Documents, DocumentSkeleton, IDocumentSkeletonDrawing, Picture, Scene } from '@univerjs/base-render';-import { CommandManager, DocumentModel, ICurrentUniverService, LocaleService } from '@univerjs/core';+import { DocumentModel, ICurrentUniverService, LocaleService } from '@univerjs/core';import { Inject, Injector } from '@wendellhu/redi';-import { BaseView, CanvasViewRegistry, CANVAS_VIEW_KEY } from '../BaseView';++import { BaseView, CANVAS_VIEW_KEY, CanvasViewRegistry } from '../BaseView';export enum DOCS_VIEW_KEY {MAIN = '__DocsRender__',@@ -16,11 +17,7 @@ export class DocsView extends BaseView {private _documents: Documents;- constructor(- @Inject(CommandManager) private readonly _commandManager: CommandManager,- @ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService,- @Inject(LocaleService) private readonly _localeService: LocaleService- ) {+ constructor(@ICurrentUniverService private readonly _currentUniverService: ICurrentUniverService, @Inject(LocaleService) private readonly _localeService: LocaleService) {super();}diff --git a/packages/base-docs/src/commands/commands/core-editing.command.ts b/packages/base-docs/src/commands/commands/core-editing.command.tsnew file mode 100644index 0000000000..0b72fcfc19--- /dev/null+++ b/packages/base-docs/src/commands/commands/core-editing.command.ts@@ -0,0 +1,23 @@+import { CommandType, ICommand } from '@univerjs/core';++import { InputController } from '../../Controller/InputController';++export const DeleteLeftCommand: ICommand = {+ id: 'doc.command.delete-left',+ type: CommandType.COMMAND,+ handler: async (accessor) => {+ const inputController = accessor.get(InputController);+ inputController.deleteLeft();+ return true;+ },+};++export const BreakLineCommand: ICommand = {+ id: 'doc.command.break-line',+ type: CommandType.COMMAND,+ handler: async (accessor) => {+ const inputController = accessor.get(InputController);+ inputController.breakLine();+ return true;+ },+};diff --git a/packages/base-docs/src/Controller/index.ts b/packages/base-docs/src/commands/commands/delete.command.tssimilarity index 100%rename from packages/base-docs/src/Controller/index.tsrename to packages/base-docs/src/commands/commands/delete.command.tsdiff --git a/packages/base-docs/src/commands/commands/insert.command.ts b/packages/base-docs/src/commands/commands/insert.command.tsnew file mode 100644index 0000000000..9d56ebc157--- /dev/null+++ b/packages/base-docs/src/commands/commands/insert.command.ts@@ -0,0 +1,11 @@+import { CommandType, ICommand } from '@univerjs/core';++export const InsertCommand: ICommand = {+ id: 'doc.command.insert',+ type: CommandType.COMMAND,+ handler: async (accessor) => {+ // TODO+ const a = 0;+ return true;+ },+};diff --git a/packages/base-docs/src/Model/index.ts b/packages/base-docs/src/commands/commands/replace.command.tssimilarity index 100%rename from packages/base-docs/src/Model/index.tsrename to packages/base-docs/src/commands/commands/replace.command.tsdiff --git a/packages/ui-plugin-docs/src/Service/index.ts b/packages/base-docs/src/commands/mutations/insert.mutation.tssimilarity index 100%rename from packages/ui-plugin-docs/src/Service/index.tsrename to packages/base-docs/src/commands/mutations/insert.mutation.tsdiff --git a/packages/base-docs/src/commands/operations/cursor.operation.ts b/packages/base-docs/src/commands/operations/cursor.operation.tsnew file mode 100644index 0000000000..76fe957f1e--- /dev/null+++ b/packages/base-docs/src/commands/operations/cursor.operation.ts@@ -0,0 +1,29 @@+import { CommandType, Direction, ICurrentUniverService, IOperation } from '@univerjs/core';++import { InputController } from '../../Controller/InputController';++export interface IMoveCursorOperationParams {+ direction: Direction;+}++// TODO@wzhudev: it should be moved to a command then trigger the operation.++/**+ * The operation to move cursor in the current document.+ */+export const MoveCursorOperation: IOperation<IMoveCursorOperationParams> = {+ id: 'doc.operation.move-cursor',+ type: CommandType.OPERATION,+ handler: async (accessor, params) => {+ if (!params) {+ return false;+ }++ const currentUniverService = accessor.get(ICurrentUniverService);+ const inputController = accessor.get(InputController);++ inputController.moveCursor(currentUniverService.getCurrentUniverDocInstance().getDocument(), params.direction);++ return true;+ },+};diff --git a/packages/base-docs/src/services/doc-editing/doc-editing-service.ts b/packages/base-docs/src/services/doc-editing/doc-editing-service.tsnew file mode 100644index 0000000000..7e3c0512d0--- /dev/null+++ b/packages/base-docs/src/services/doc-editing/doc-editing-service.ts@@ -0,0 +1,4 @@+/**+ * This services provides methods to edit the content of the document.+ */+export class DocEditingService {}diff --git a/packages/base-docs/src/services/selection-manager/selection-manager.service.ts b/packages/base-docs/src/services/selection-manager/selection-manager.service.tsnew file mode 100644index 0000000000..71da739f61--- /dev/null+++ b/packages/base-docs/src/services/selection-manager/selection-manager.service.ts@@ -0,0 +1,7 @@+import { createIdentifier } from '@wendellhu/redi';++export interface ISelectionManagerService {}++export const ISelectionManagerService = createIdentifier<ISelectionManagerService>('doc.selection-manager-service');++export class SelectionManagerService implements ISelectionManagerService {}diff --git a/packages/base-docs/src/shortcuts/core-editing.shortcut.ts b/packages/base-docs/src/shortcuts/core-editing.shortcut.tsnew file mode 100644index 0000000000..3b6c24852f--- /dev/null+++ b/packages/base-docs/src/shortcuts/core-editing.shortcut.ts@@ -0,0 +1,13 @@+import { IShortcutItem, KeyCode } from '@univerjs/base-ui';++import { BreakLineCommand, DeleteLeftCommand } from '../commands/commands/core-editing.command';++export const BreakLineShortcut: IShortcutItem = {+ id: BreakLineCommand.id,+ binding: KeyCode.ENTER,+};++export const DeleteLeftShortcut: IShortcutItem = {+ id: DeleteLeftCommand.id,+ binding: KeyCode.BACKSPACE,+};diff --git a/packages/base-docs/src/shortcuts/cursor.shortcut.ts b/packages/base-docs/src/shortcuts/cursor.shortcut.tsnew file mode 100644index 0000000000..e891ffd198--- /dev/null+++ b/packages/base-docs/src/shortcuts/cursor.shortcut.ts@@ -0,0 +1,36 @@+import { IShortcutItem, KeyCode } from '@univerjs/base-ui';+import { Direction } from '@univerjs/core';++import { MoveCursorOperation } from '../commands/operations/cursor.operation';++export const MoveCursorUpShortcut: IShortcutItem = {+ id: MoveCursorOperation.id,+ binding: KeyCode.ARROW_UP,+ staticParameters: {+ direction: Direction.UP,+ },+};++export const MoveCursorDownShortcut: IShortcutItem = {+ id: MoveCursorOperation.id,+ binding: KeyCode.ARROW_DOWN,+ staticParameters: {+ direction: Direction.DOWN,+ },+};++export const MoveCursorLeftShortcut: IShortcutItem = {+ id: MoveCursorOperation.id,+ binding: KeyCode.ARROW_LEFT,+ staticParameters: {+ direction: Direction.LEFT,+ },+};++export const MoveCursorRightShortcut: IShortcutItem = {+ id: MoveCursorOperation.id,+ binding: KeyCode.ARROW_RIGHT,+ staticParameters: {+ direction: Direction.RIGHT,+ },+};diff --git a/packages/base-render/README.md b/packages/base-render/README.mdindex cf9696e7c0..372370144b 100644--- a/packages/base-render/README.md+++ b/packages/base-render/README.md@@ -5,10 +5,13 @@Univer base render## Usage+### Installation+```shellnpm i @univerjs/base-render```### API-Check [Univer](https://github.com/dream-num/univer/)\ No newline at end of file++Check [Univer](https://github.com/dream-num/univer/)diff --git a/packages/base-render/src/Component/Docs/Document.Editor.ts b/packages/base-render/src/Component/Docs/Document.Editor.tsindex f797dcb687..47e4610af4 100644--- a/packages/base-render/src/Component/Docs/Document.Editor.ts+++ b/packages/base-render/src/Component/Docs/Document.Editor.ts@@ -1,18 +1,17 @@import { DataStreamTreeTokenType, Nullable, Observable, Observer } from '@univerjs/core';-import { IDocumentSkeletonCached } from '../../Basics/IDocumentSkeletonCached';+import { CURSOR_TYPE } from '../../Basics/Const';+import { IDocumentSkeletonCached } from '../../Basics/IDocumentSkeletonCached';import { IMouseEvent, IPointerEvent } from '../../Basics/IEvents';+import { INodeInfo, INodePosition } from '../../Basics/Interfaces';import { getOffsetRectForDom, transformBoundingCoord } from '../../Basics/Position';-import { ScrollTimer } from '../../ScrollTimer';--import { DocComponent } from './DocComponent';-import { TextSelection } from './Common/TextSelection';-import { IScrollObserverParam, Viewport } from '../../Viewport';+import { getCurrentScrollXY } from '../../Basics/ScrollXY';import { checkStyle, injectStyle } from '../../Basics/Tools';-import { Vector2 } from '../../Basics/Vector2';-import { getCurrentScrollXY } from '../../Basics/ScrollXY';-import { INodeInfo, INodePosition } from '../../Basics/Interfaces';+import { ScrollTimer } from '../../ScrollTimer';+import { IScrollObserverParam, Viewport } from '../../Viewport';+import { TextSelection } from './Common/TextSelection';+import { DocComponent } from './DocComponent';export interface IEditorInputConfig {event: Event | CompositionEvent | KeyboardEvent;@@ -214,15 +213,15 @@ export class DocsEditor {this._input.contentEditable = 'true';this._input.style.cssText = `- position: absolute;- overflow: hidden;- opacity: 1;- background: #000;- color: transparent;- outline: none;- z-index: -2;- caret-color: transparent;- white-space: pre-wrap;+ position: absolute;+ overflow: hidden;+ opacity: 1;+ background: #000;+ color: transparent;+ outline: none;+ z-index: -2;+ caret-color: transparent;+ white-space: pre-wrap;user-select: text;`;}@@ -249,7 +248,7 @@ export class DocsEditor {0% {opacity: 1;}-+13% {opacity: 0;}@@ -261,7 +260,7 @@ export class DocsEditor {63% {opacity: 1;}-+100% {opacity: 1;}@@ -272,7 +271,7 @@ export class DocsEditor {0% {opacity: 1;}-+13% {opacity: 0;}@@ -284,7 +283,7 @@ export class DocsEditor {63% {opacity: 1;}-+100% {opacity: 1;}@@ -552,6 +551,7 @@ export class DocsEditor {// eslint-disable-next-line max-lines-per-functionprivate _attachInputEvent() {+ // NOTE@wzhudev: keydown is probably unnecessarythis._input.addEventListener('keydown', (e) => {if (this._isIMEInputApply) {return;diff --git a/packages/base-render/src/Component/Docs/Document.ts b/packages/base-render/src/Component/Docs/Document.tsindex 7c9a4763a9..e8969f3959 100644--- a/packages/base-render/src/Component/Docs/Document.ts+++ b/packages/base-render/src/Component/Docs/Document.ts@@ -1,18 +1,20 @@+import './Extensions';+import { BooleanNumber, HorizontalAlign, Nullable, Observable, Observer, VerticalAlign, WrapStrategy } from '@univerjs/core';-import { DocComponent } from './DocComponent';++import { calculateRectRotate, getRotateOffsetAndFarthestHypotenuse } from '../../Basics/Draw';import { IDocumentSkeletonCached, IDocumentSkeletonPage, LineType, PageLayoutType } from '../../Basics/IDocumentSkeletonCached';+import { INodeInfo } from '../../Basics/Interfaces';+import { degToRad, fixLineWidthByScale, getScale } from '../../Basics/Tools';import { IBoundRect, Vector2 } from '../../Basics/Vector2';+import { Scene } from '../../Scene';import { DocumentsSpanAndLineExtensionRegistry, IExtensionConfig } from '../Extension';-import { DocumentSkeleton } from './DocSkeleton';-import { DOCS_EXTENSION_TYPE } from './DocExtension';-import './Extensions';-import { calculateRectRotate, getRotateOffsetAndFarthestHypotenuse } from '../../Basics/Draw';-import { fixLineWidthByScale, getScale, degToRad } from '../../Basics/Tools';-import { DocsEditor } from './Document.Editor';import { Liquid } from './Common/Liquid';-import { Scene } from '../../Scene';import { TextSelection } from './Common/TextSelection';-import { INodeInfo } from '../../Basics/Interfaces';+import { DocComponent } from './DocComponent';+import { DOCS_EXTENSION_TYPE } from './DocExtension';+import { DocumentSkeleton } from './DocSkeleton';+import { DocsEditor } from './Document.Editor';export interface IDocumentsConfig {pageMarginLeft?: number;@@ -88,6 +90,14 @@ export class Documents extends DocComponent {return new Documents(oKey, documentSkeleton, config);}+ getActiveSelection() {+ return this._editor.getActiveTextSelection();+ }++ getSelection() {+ return this._editor.getTextSelectionList();+ }+calculatePagePosition() {const scene = this.getScene() as Scene;diff --git a/packages/base-sheets/src/Commands/Commands/set-selections.command.ts b/packages/base-sheets/src/Commands/Commands/set-selections.command.tsindex 27d075d625..0341448592 100644--- a/packages/base-sheets/src/Commands/Commands/set-selections.command.ts+++ b/packages/base-sheets/src/Commands/Commands/set-selections.command.ts@@ -72,4 +72,4 @@ export const ExpandSelectionCommand: ICommand<IExpandSelectionCommandParams> = {id: 'sheet.command.expand-selection',type: CommandType.COMMAND,handler: async (accessor, params) => true,-};\ No newline at end of file+};diff --git a/packages/core/src/Basics/Univer.ts b/packages/core/src/Basics/Univer.tsindex 831547dcb7..bbb318565e 100644--- a/packages/core/src/Basics/Univer.ts+++ b/packages/core/src/Basics/Univer.ts@@ -200,6 +200,7 @@ export class Univer {plugins.forEach((p) => {doc.addPlugin(p.plugin as unknown as PluginCtor<any>, p.options);});+ doc.mount();}private initializePluginsForSlide(slide: UniverSlide): void {diff --git a/packages/core/src/Basics/UniverDoc.ts b/packages/core/src/Basics/UniverDoc.tsindex 06a43e388d..025ea122d9 100644--- a/packages/core/src/Basics/UniverDoc.ts+++ b/packages/core/src/Basics/UniverDoc.ts@@ -1,8 +1,9 @@import { Ctor, Dependency, Injector, Optional } from '@wendellhu/redi';import { DocumentModel } from '../Docs';-import { IDocumentData } from '../Types/Interfaces';import { Plugin, PluginCtor, PluginStore } from '../Plugin';+import { CommandService, ICommandService } from '../services/command/command.service';+import { IDocumentData } from '../Types/Interfaces';/*** Externally provided UniverDoc root instance@@ -36,13 +37,21 @@ export class UniverDoc {addPlugin<T extends Plugin>(pluginCtor: PluginCtor<T>, options: any): void {const pluginInstance: Plugin = this._injector.createInstance(pluginCtor as unknown as Ctor<any>, options);+ // FIXME: onCreate onMounted should be executed after all plugins have been addedpluginInstance.onCreate();pluginInstance.onMounted();this._pluginStore.addPlugin(pluginInstance);}+ mount(): void {+ this._pluginStore.forEachPlugin((plugin) => {+ plugin.onCreate();+ plugin.onMounted();+ });+ }+private _initializeDependencies(parentInjector?: Injector): Injector {- const dependencies: Dependency[] = [];+ const dependencies: Dependency[] = [[ICommandService, { useClass: CommandService }]];return parentInjector ? parentInjector.createChild(dependencies) : new Injector(dependencies);}-}\ No newline at end of file+}diff --git a/packages/core/src/Docs/Action/ActionDataInterface.ts b/packages/core/src/Docs/Action/ActionDataInterface.tsindex 4105e07172..85bbe1d40e 100644--- a/packages/core/src/Docs/Action/ActionDataInterface.ts+++ b/packages/core/src/Docs/Action/ActionDataInterface.ts@@ -1,7 +1,7 @@import { IDocActionData } from '../../Command/DocActionBase';-import { IDocumentBody } from '../../Types/Interfaces/IDocumentData';import { Nullable } from '../../Shared';import { UpdateDocsAttributeType } from '../../Shared/CommandEnum';+import { IDocumentBody } from '../../Types/Interfaces/IDocumentData';export enum UpdateAttributeType {TEXT_RUN,diff --git a/packages/core/src/Docs/Action/DeleteAction.ts b/packages/core/src/Docs/Action/DeleteAction.tsindex dcad53badd..c30674e218 100644--- a/packages/core/src/Docs/Action/DeleteAction.ts+++ b/packages/core/src/Docs/Action/DeleteAction.ts@@ -1,6 +1,5 @@-import { DocActionBase } from '../../Command/DocActionBase';import { ActionObservers, ActionType, CommandManager, CommandUnit, CommonParameter } from '../../Command';-+import { DocActionBase } from '../../Command/DocActionBase';import { DOC_ACTION_NAMES } from '../../Types/Const/DOC_ACTION_NAMES';import { IDocumentBody } from '../../Types/Interfaces';import { DeleteApply } from '../Apply/DeleteApply';diff --git a/packages/core/src/Docs/Action/InsertAction.ts b/packages/core/src/Docs/Action/InsertAction.tsindex 2eddfb0c32..a6138fb2dd 100644--- a/packages/core/src/Docs/Action/InsertAction.ts+++ b/packages/core/src/Docs/Action/InsertAction.ts@@ -1,9 +1,9 @@-import { DocActionBase } from '../../Command/DocActionBase';import { ActionObservers, ActionType, CommandManager, CommandUnit, CommonParameter } from '../../Command';+import { DocActionBase } from '../../Command/DocActionBase';import { DOC_ACTION_NAMES } from '../../Types/Const/DOC_ACTION_NAMES';-import { InsertApply } from '../Apply/InsertApply';import { DeleteApply } from '../Apply/DeleteApply';-import { IInsertActionData, IDeleteActionData } from './ActionDataInterface';+import { InsertApply } from '../Apply/InsertApply';+import { IDeleteActionData, IInsertActionData } from './ActionDataInterface';export class InsertAction extends DocActionBase<IInsertActionData, IDeleteActionData> {static NAME = 'InsertAction';diff --git a/packages/core/src/Docs/Action/RetainAction.ts b/packages/core/src/Docs/Action/RetainAction.tsindex c9d754ebd2..9fce2742e0 100644--- a/packages/core/src/Docs/Action/RetainAction.ts+++ b/packages/core/src/Docs/Action/RetainAction.ts@@ -1,10 +1,10 @@-import { DocActionBase } from '../../Command/DocActionBase';import { ActionObservers, CommandManager, CommandUnit, CommonParameter } from '../../Command';-import { IRetainActionData } from './ActionDataInterface';+import { DocActionBase } from '../../Command/DocActionBase';+import { Nullable } from '../../Shared';import { UpdateDocsAttributeType } from '../../Shared/CommandEnum';-import { UpdateAttributeApply } from '../Apply/UpdateAttributeApply';import { IDocumentBody } from '../../Types/Interfaces';-import { Nullable } from '../../Shared';+import { UpdateAttributeApply } from '../Apply/UpdateAttributeApply';+import { IRetainActionData } from './ActionDataInterface';export class RetainAction extends DocActionBase<IRetainActionData, IRetainActionData> {static NAME = 'RetainAction';diff --git a/packages/core/src/Docs/Action/UpdateDocumentAction.ts b/packages/core/src/Docs/Action/UpdateDocumentAction.tsindex d4e67c8e2d..9ea45fa329 100644--- a/packages/core/src/Docs/Action/UpdateDocumentAction.ts+++ b/packages/core/src/Docs/Action/UpdateDocumentAction.ts@@ -1,5 +1,5 @@-import { DocActionBase } from '../../Command/DocActionBase';import { ActionObservers, CommandManager, CommandUnit } from '../../Command';+import { DocActionBase } from '../../Command/DocActionBase';import { IUpdateDocumentActionData } from './ActionDataInterface';export class UpdateDocumentAction extends DocActionBase<IUpdateDocumentActionData, IUpdateDocumentActionData> {diff --git a/packages/core/src/Docs/Action/index.ts b/packages/core/src/Docs/Action/index.tsindex b811604f2c..09cbdf6011 100644--- a/packages/core/src/Docs/Action/index.ts+++ b/packages/core/src/Docs/Action/index.ts@@ -1,4 +1,4 @@-export * from './InsertAction';export * from './DeleteAction';-export * from './UpdateDocumentAction';+export * from './InsertAction';export * from './RetainAction';+export * from './UpdateDocumentAction';diff --git a/packages/core/src/Docs/Apply/Common.ts b/packages/core/src/Docs/Apply/Common.tsindex 0c4682b662..dbef4c0bae 100644--- a/packages/core/src/Docs/Apply/Common.ts+++ b/packages/core/src/Docs/Apply/Common.ts@@ -1,8 +1,8 @@-import { ICustomBlock, ICustomRange, IDocumentBody, IParagraph, ISectionBreak, ITable, ITextRun } from '../../Types/Interfaces/IDocumentData';-import { Nullable } from '../../Shared/Types';-import { horizontalLineSegmentsSubtraction } from '../../Shared/DocTool';import { isSameStyleTextRun } from '../../Shared/Compare';+import { horizontalLineSegmentsSubtraction } from '../../Shared/DocTool';import { sortRulesFactory } from '../../Shared/SortRules';+import { Nullable } from '../../Shared/Types';+import { ICustomBlock, ICustomRange, IDocumentBody, IParagraph, ISectionBreak, ITable, ITextRun } from '../../Types/Interfaces/IDocumentData';import { DataStreamTreeTokenType } from '../Domain/Types';export function insertTextRuns(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number) {diff --git a/packages/core/src/Docs/Apply/InsertApply.ts b/packages/core/src/Docs/Apply/InsertApply.tsindex 025c54b999..de71deff87 100644--- a/packages/core/src/Docs/Apply/InsertApply.ts+++ b/packages/core/src/Docs/Apply/InsertApply.ts@@ -1,7 +1,7 @@-import { IDocumentBody } from '../../Types/Interfaces/IDocumentData';-import { DocumentModel } from '../Domain/DocumentModel';import { getDocsUpdateBody } from '../../Shared/Common';import { insertTextToContent } from '../../Shared/DocTool';+import { IDocumentBody } from '../../Types/Interfaces/IDocumentData';+import { DocumentModel } from '../Domain/DocumentModel';import { insertCustomBlocks, insertCustomRanges, insertParagraphs, insertSectionBreaks, insertTables, insertTextRuns } from './Common';export function InsertApply(document: DocumentModel, insertBody: IDocumentBody, textLength: number, currentIndex: number, segmentId?: string) {@@ -23,7 +23,7 @@ export function InsertApply(document: DocumentModel, insertBody: IDocumentBody,updateAttributeByInsert(body, insertBody, textLength, currentIndex);- console.log('插入的model打印', bodyModel, body);+ console.log('插入的model打印', bodyModel, body, textLength);}function updateAttributeByInsert(body: IDocumentBody, insertBody: IDocumentBody, textLength: number, currentIndex: number) {diff --git a/packages/core/src/Plugin/Plugin.ts b/packages/core/src/Plugin/Plugin.tsindex dd605863c3..698bf81f54 100644--- a/packages/core/src/Plugin/Plugin.ts+++ b/packages/core/src/Plugin/Plugin.ts@@ -107,6 +107,10 @@ export class PluginStore {this.plugins.length = 0;return plugins;}++ forEachPlugin(callback: (plugin: Plugin) => void): void {+ this.plugins.forEach(callback);+ }}/**@@ -127,4 +131,4 @@ export class PluginRegistry {getRegisterPlugins(type: PluginType): [IPluginRegistryItem] {return this.pluginsRegisteredByBusiness.get(type) || ([] as unknown[] as [IPluginRegistryItem]);}-}\ No newline at end of file+}diff --git a/packages/core/src/services/command/command.service.ts b/packages/core/src/services/command/command.service.tsindex 4e34a9cd98..6c1a07bef2 100644--- a/packages/core/src/services/command/command.service.ts+++ b/packages/core/src/services/command/command.service.ts@@ -243,6 +243,8 @@ export class CommandService implements ICommandService {} catch (e) {result = false;this._commandExecutingLevel = 0;++ throw e;}// TODO: remove from old command managerdiff --git a/packages/ui-plugin-docs/src/Controller/AppUIController.ts b/packages/ui-plugin-docs/src/Controller/AppUIController.tsindex a43f0922c4..28cd28e476 100644--- a/packages/ui-plugin-docs/src/Controller/AppUIController.ts+++ b/packages/ui-plugin-docs/src/Controller/AppUIController.ts@@ -48,4 +48,4 @@ export class AppUIController {getDocContainerController() {return this._docContainerController;}-}\ No newline at end of file+}diff --git a/packages/ui-plugin-docs/src/Controller/DocContainerUIController.ts b/packages/ui-plugin-docs/src/Controller/DocContainerUIController.tsindex 6673f7acad..37a183b29c 100644--- a/packages/ui-plugin-docs/src/Controller/DocContainerUIController.ts+++ b/packages/ui-plugin-docs/src/Controller/DocContainerUIController.ts@@ -5,16 +5,10 @@ import { Inject, Injector, SkipSelf } from '@wendellhu/redi';import { IDocUIPluginConfig } from '../Basics';import { DocContainer } from '../View';-import { InfoBarUIController } from './InfoBarUIController';-import { ToolbarUIController } from './ToolbarUIController';export class DocContainerUIController {private _docContainer: DocContainer;- private _toolbarController: ToolbarUIController;-- private _infoBarController: InfoBarUIController;-constructor(private readonly _config: IDocUIPluginConfig,@SkipSelf() @Inject(ObserverManager) private readonly _globalObserverManager: ObserverManager,@@ -22,12 +16,7 @@ export class DocContainerUIController {@Inject(Injector) private readonly _injector: Injector,@Inject(ObserverManager) private readonly _observerManager: ObserverManager,@IRenderingEngine private readonly _renderingEngine: Engine- ) {- this._initialize();-- this._toolbarController = this._injector.createInstance(ToolbarUIController, this._config.layout?.toolbarConfig || {});- this._infoBarController = new InfoBarUIController();- }+ ) {}getUIConfig() {const config = {@@ -35,16 +24,6 @@ export class DocContainerUIController {config: this._config,changeLocale: this.changeLocale,getComponent: this.getComponent,- // 其余组件的props- methods: {- toolbar: {- getComponent: this._toolbarController.getComponent,- },- infoBar: {- getComponent: this._infoBarController.getComponent,- // renameSheet: this._infoBarController.renameSheet,- },- },};return config;}@@ -60,7 +39,7 @@ export class DocContainerUIController {window.addEventListener('resize', () => {engine.resize();- })+ });setTimeout(() => {engine.resize();@@ -68,8 +47,6 @@ export class DocContainerUIController {this._observerManager.requiredObserver<DocContainer>('onUIDidMount')?.notifyObservers(this._docContainer);this._globalObserverManager.requiredObserver<boolean>('onUIDidMountObservable', 'core').notifyObservers(true);-- this._initDocContainer();};/**@@ -88,25 +65,13 @@ export class DocContainerUIController {return this._docContainer.getContentRef();}- getToolbarController() {- return this._toolbarController;- }-UIDidMount(cb: Function) {if (this._docContainer) {return cb(this._docContainer);}-- this._plugin.getObserver('onUIDidMount')?.add(() => cb(this._docContainer));}getDocContainer() {return this._docContainer;}-- private _initialize() {}-- private _initDocContainer() {- // handle drag event- }-}\ No newline at end of file+}diff --git a/packages/ui-plugin-docs/src/Controller/InfoBarUIController.ts b/packages/ui-plugin-docs/src/Controller/InfoBarUIController.tsdeleted file mode 100644index ea046f9aaa..0000000000--- a/packages/ui-plugin-docs/src/Controller/InfoBarUIController.ts+++ /dev/null@@ -1,65 +0,0 @@-import { DocUIPlugin } from '../DocUIPlugin';-import { InfoBarModel } from '../Model';-import { InfoBar } from '../View/InfoBar';--type IProps = {- label?: string;- onBlur?: (e: FocusEvent) => void;-};--export interface BaseInfoBarProps {- back: IProps;- rename: IProps;- save: IProps;- sheet: IProps;- update: IProps;-}--export class InfoBarUIController {- private _infoBarModel: InfoBarModel;-- private _infoBar: InfoBar;-- private _infoList: BaseInfoBarProps;-- getComponent = (ref: InfoBar) => {- this._infoBar = ref;- this._refreshComponent();- this.resetInfoList(this._infoList);- };-- resetInfoList(list: BaseInfoBarProps) {- this._infoBar.setInfoList(list);- }-- setSheetName(e: FocusEvent) {- const target = e.target as HTMLInputElement;- const name = target.value;- this._infoBarModel.setName(name);- }-- private _refreshComponent(): void {- const name = 'UniverDoc';- this._infoBarModel = new InfoBarModel(name);- this._infoList = {- back: {- label: 'info.return',- },- rename: {- label: 'info.tips',- },- update: {- label: 'info.detailUpdate',- },- save: {- label: 'info.detailSave',- },- sheet: {- label: name,- onBlur: (e) => {- this.setSheetName(e);- },- },- };- }-}\ No newline at end of filediff --git a/packages/ui-plugin-docs/src/Controller/ToolbarUIController.ts b/packages/ui-plugin-docs/src/Controller/ToolbarUIController.tsdeleted file mode 100644index b04d843845..0000000000--- a/packages/ui-plugin-docs/src/Controller/ToolbarUIController.ts+++ /dev/null@@ -1,489 +0,0 @@-import { BaseSelectChildrenProps, BaseSelectProps, ColorPicker, ComponentChildren, ComponentManager, ICustomComponent } from '@univerjs/base-ui';-import { DEFAULT_STYLES, HorizontalAlign, ObserverManager, Tools, UIObserver, VerticalAlign, WrapStrategy } from '@univerjs/core';-import { Inject } from '@wendellhu/redi';--import { DefaultToolbarConfig, DocToolbarConfig, DOC_UI_PLUGIN_NAME } from '../Basics';-import { Toolbar } from '../View';-import { ColorSelect } from '../View/Common';-import { FONT_FAMILY_CHILDREN, FONT_SIZE_CHILDREN, HORIZONTAL_ALIGN_CHILDREN, VERTICAL_ALIGN_CHILDREN, TEXT_WRAP_CHILDREN, TEXT_ROTATE_CHILDREN } from '../View/Toolbar/Const';--import styles from '../View/Toolbar/index.module.less';--export interface BaseToolbarSelectProps extends BaseSelectProps {- children?: BaseSelectChildrenProps[];-}--enum ToolbarType {- SELECT,- BUTTON,-}--export interface IToolbarItemProps extends BaseToolbarSelectProps {- active?: boolean;- unActive?: boolean; //button不需保持状态- show?: boolean; //是否显示按钮- toolbarType?: ToolbarType;- tooltip?: string; //tooltip文字- border?: boolean;- suffix?: ComponentChildren;-}--export class ToolbarUIController {- private _toolbar: Toolbar;-- private _toolList: IToolbarItemProps[];-- private _config: DocToolbarConfig;-- private _colorSelect1: ColorSelect;-- private _textColor: string = '#000';-- private _colorSelect2: ColorSelect;-- private _background: string = '#fff';-- // eslint-disable-next-line max-lines-per-function- constructor(- config: DocToolbarConfig,- @Inject(ComponentManager) private readonly _componentManager: ComponentManager,- @Inject(ObserverManager) private readonly _observerManager: ObserverManager- ) {- this._config = Tools.deepMerge({}, DefaultToolbarConfig, config);-- this._toolList = [- {- toolbarType: 1,- tooltip: 'toolbar.undo',- name: 'undo',- label: {- name: 'ForwardIcon',- },- show: this._config.undo,- onClick: () => {- this.setUndo();- this.hideTooltip();- },- },- {- toolbarType: 1,- tooltip: 'toolbar.redo',- label: {- name: 'BackIcon',- },- name: 'redo',- show: this._config.redo,- onClick: () => {- this.setRedo();- this.hideTooltip();- },- },- {- type: 0,- tooltip: 'toolbar.font',- className: styles.selectLabelString,- name: 'font',- show: this._config.font,- border: true,- onMainClick: () => {- this.hideTooltip();- },- onClick: (fontFamily: string) => {- this.setFontFamily(fontFamily);- },- children: FONT_FAMILY_CHILDREN,- },- {- type: 1,- tooltip: 'toolbar.fontSize',- label: String(DEFAULT_STYLES.fs),- name: 'fontSize',- show: this._config.fontSize,- onClick: (fontSize: number) => {- this.setFontSize(fontSize);- },- onMainClick: () => {- this.hideTooltip();- },- onPressEnter: (fontSize: number) => {- this.setFontSize(fontSize);- this.hideTooltip();- },- children: FONT_SIZE_CHILDREN,- },- {- toolbarType: 1,- tooltip: 'toolbar.bold',- label: {- name: 'BoldIcon',- },- unActive: false,- name: 'bold',- show: this._config.bold,- onClick: (e, isBold: boolean) => {- this.setFontWeight(isBold);- this.hideTooltip();- },- },- {- toolbarType: 1,- tooltip: 'toolbar.italic',- label: {- name: 'ItalicIcon',- },- unActive: false,- name: 'italic',- show: this._config.italic,- onClick: (e, isItalic: boolean) => {- this.setFontStyle(isItalic);- this.hideTooltip();- },- },- {- toolbarType: 1,- tooltip: 'toolbar.strikethrough',- label: {- name: 'DeleteLineIcon',- },- unActive: false,- name: 'strikethrough',- show: this._config.strikethrough,- onClick: (e, isStrikethrough: boolean) => {- this.hideTooltip();- const strikethroughItem = this._toolList.find((item) => item.name === 'strikethrough');- if (!strikethroughItem) return;- strikethroughItem.active = isStrikethrough;- this.setStrikeThrough(isStrikethrough);- },- },- {- toolbarType: 1,- tooltip: 'toolbar.underline',- label: {- name: 'UnderLineIcon',- },- unActive: false,- name: 'underline',- show: this._config.underline,- onClick: (e, isUnderLine: boolean) => {- this.hideTooltip();- const underlineItem = this._toolList.find((item) => item.name === 'underline');- if (!underlineItem) return;- underlineItem.active = isUnderLine;- this.setUnderline(isUnderLine);- },- },- {- type: 5,- tooltip: 'toolbar.textColor.main',- label: {- name: DOC_UI_PLUGIN_NAME + ColorSelect.name,- props: {- getComponent: (ref: ColorSelect) => {- this._colorSelect1 = ref;- },- color: '#000',- label: {- name: 'TextColorIcon',- },- },- },- onClick: () => {- this.hideTooltip();- const textColor = this._toolList.find((item) => item.name === 'textColor');- if (!textColor) return;- if (!textColor.label) return;- if (!(textColor.label as ICustomComponent).props?.color) return;- (textColor.label as ICustomComponent).props!.color = this._textColor;- this.changeColor(this._textColor);- },- hideSelectedIcon: true,- className: styles.selectColorPickerParent,- children: [- {- label: 'toolbar.resetColor',- },- {- label: {- name: DOC_UI_PLUGIN_NAME + ColorPicker.name,- props: {- onClick: (color: string, e: MouseEvent) => {- this._colorSelect1.setColor(color);- this._textColor = color;- },- },- },- className: styles.selectColorPicker,- },- ],- name: 'textColor',- show: this._config.textColor,- },- {- type: 5,- tooltip: 'toolbar.fillColor.main',- label: {- name: DOC_UI_PLUGIN_NAME + ColorSelect.name,- props: {- getComponent: (ref: ColorSelect) => {- this._colorSelect2 = ref;- },- color: '#fff',- label: {- name: 'FillColorIcon',- },- },- },- onClick: () => {- this.hideTooltip();- const fillColor = this._toolList.find((item) => item.name === 'fillColor');- if (!fillColor) return;- if (!fillColor.label) return;- if (!(fillColor.label as ICustomComponent).props?.color) return;- (fillColor.label as ICustomComponent).props!.color = this._background;- this.setBackground(this._background);- },- hideSelectedIcon: true,- className: styles.selectColorPickerParent,- children: [- {- label: 'toolbar.resetColor',- },- {- label: {- name: DOC_UI_PLUGIN_NAME + ColorPicker.name,- props: {- onClick: (color: string, e: MouseEvent) => {- this._colorSelect2.setColor(color);- this._background = color;- },- },- },- className: styles.selectColorPicker,- },- ],- name: 'fillColor',- show: this._config.fillColor,- },- {- type: 3,- tooltip: 'toolbar.horizontalAlignMode.main',- className: styles.selectDoubleString,- display: 1,- name: 'horizontalAlignMode',- show: this._config.horizontalAlignMode,- onClick: (value: HorizontalAlign) => {- this.setHorizontalAlignment(value);- this.hideTooltip();- },- children: HORIZONTAL_ALIGN_CHILDREN,- },- {- type: 3,- tooltip: 'toolbar.verticalAlignMode.main',- className: styles.selectDoubleString,- display: 1,- name: 'verticalAlignMode',- show: this._config.verticalAlignMode,- onClick: (value: VerticalAlign) => {- this.setVerticalAlignment(value);- this.hideTooltip();- },- children: VERTICAL_ALIGN_CHILDREN,- },- {- type: 3,- className: styles.selectDoubleString,- tooltip: 'toolbar.textWrapMode.main',- display: 1,- name: 'textWrapMode',- show: this._config.textWrapMode,- onClick: (value: WrapStrategy) => {- this.setWrapStrategy(value);- this.hideTooltip();- },- children: TEXT_WRAP_CHILDREN,- },- {- type: 3,- className: styles.selectDoubleString,- name: 'textRotateMode',- tooltip: 'toolbar.textRotateMode.main',- display: 1,- show: this._config.textRotateMode,- onClick: (value: number | string) => {- this.setTextRotation(value);- this.hideTooltip();- },- children: TEXT_ROTATE_CHILDREN,- },- ];-- this._initialize();- }-- // 获取Toolbar组件- getComponent = (ref: Toolbar) => {- this._toolbar = ref;- this.setToolbar();- };-- // 增加toolbar配置- addToolbarConfig(config: IToolbarItemProps) {- const index = this._toolList.findIndex((item) => item.name === config.name);- if (index > -1) return;- this._toolList.push(config);- }-- // 删除toolbar配置- deleteToolbarConfig(name: string) {- const index = this._toolList.findIndex((item) => item.name === name);- if (index > -1) {- this._toolList.splice(index, 1);- }- }-- // 刷新toolbar- setToolbar() {- this._toolbar?.setToolbar(this._toolList);- }-- setUIObserve<T>(msg: UIObserver<T>) {- this._observerManager.requiredObserver<UIObserver<T>>('onUIChangeObservable', 'core').notifyObservers(msg);- }-- changeColor(color: string) {- const strikethroughItem = this._toolList.find((item) => item.name === 'strikethrough');- const underlineItem = this._toolList.find((item) => item.name === 'underline');- this.setFontColor(color);- if (underlineItem) {- this.setUnderline(underlineItem.active ?? false);- }- if (strikethroughItem) {- this.setStrikeThrough(strikethroughItem.active ?? false);- }- }-- setUndo() {- const msg = {- name: 'undo',- };- this.setUIObserve(msg);- }-- setRedo() {- const msg = {- name: 'redo',- };- this.setUIObserve(msg);- }-- setFontFamily(fontFamily: string) {- const msg = {- name: 'fontFamily',- value: fontFamily,- };- this.setUIObserve(msg);- }-- setFontSize(fontSize: number) {- const msg = {- name: 'fontSize',- value: fontSize,- };- this.setUIObserve<number>(msg);- }-- setFontWeight(isBold: boolean) {- const msg = {- name: 'fontWeight',- value: isBold,- };- this.setUIObserve<boolean>(msg);- }-- setFontStyle(isItalic: boolean) {- const msg = {- name: 'fontStyle',- value: isItalic,- };- this.setUIObserve<boolean>(msg);- }-- setStrikeThrough(isStrikethrough: boolean) {- const msg = {- name: 'strikeThrough',- value: isStrikethrough,- };- this.setUIObserve<boolean>(msg);- }-- setUnderline(isUnderLine: boolean) {- const msg = {- name: 'underLine',- value: isUnderLine,- };- this.setUIObserve<boolean>(msg);- }-- setFontColor(color: string) {- const msg = {- name: 'fontColor',- value: color,- };- this.setUIObserve(msg);- }-- setBackground(color: string) {- const msg = {- name: 'background',- value: color,- };- this.setUIObserve(msg);- }-- setTextRotation(value: string | number) {- const msg = {- name: 'textRotation',- value,- };- this.setUIObserve(msg);- }-- setWrapStrategy(value: WrapStrategy) {- const msg = {- name: 'wrapStrategy',- value,- };- this.setUIObserve<number>(msg);- }-- setVerticalAlignment(value: VerticalAlign) {- const msg = {- name: 'verticalAlignment',- value,- };- this.setUIObserve<number>(msg);- }-- setHorizontalAlignment(value: HorizontalAlign) {- const msg = {- name: 'horizontalAlignment',- value,- };- this.setUIObserve<number>(msg);- }-- hideTooltip() {- const dom = this._toolbar.base as HTMLDivElement;- const tooltip = dom.querySelectorAll(`.${styles.tooltipTitle}.${styles.bottom}`);- tooltip.forEach((item) => {- (item as HTMLSpanElement).style.display = 'none';- });- }-- private _initialize() {- this._componentManager.register(DOC_UI_PLUGIN_NAME + ColorSelect.name, ColorSelect);- this._componentManager.register(DOC_UI_PLUGIN_NAME + ColorPicker.name, ColorPicker);- }-}\ No newline at end of filediff --git a/packages/ui-plugin-docs/src/Controller/index.ts b/packages/ui-plugin-docs/src/Controller/index.tsindex 4d272a0de3..5be26088c2 100644--- a/packages/ui-plugin-docs/src/Controller/index.ts+++ b/packages/ui-plugin-docs/src/Controller/index.ts@@ -1,4 +1,2 @@export * from './AppUIController';-export * from './ToolbarUIController';export * from './DocContainerUIController';-export * from './InfoBarUIController';diff --git a/packages/ui-plugin-docs/src/DocUIPlugin.ts b/packages/ui-plugin-docs/src/DocUIPlugin.tsindex 15ad838172..975d0bc1b0 100644--- a/packages/ui-plugin-docs/src/DocUIPlugin.ts+++ b/packages/ui-plugin-docs/src/DocUIPlugin.ts@@ -1,12 +1,11 @@-import { Dependency, Inject, Injector } from '@wendellhu/redi';-import { Plugin, PLUGIN_NAMES, Tools, PluginType, LocaleService, CommandManager } from '@univerjs/core';-import { RenderEngine } from '@univerjs/base-render';import { ComponentManager, RegisterManager } from '@univerjs/base-ui';+import { LocaleService, Plugin, PluginType, Tools } from '@univerjs/core';+import { Dependency, Inject, Injector } from '@wendellhu/redi';-import { zh, en } from './Locale';-import { DOC_UI_PLUGIN_NAME } from './Basics/Const/PLUGIN_NAME';import { DefaultDocUiConfig, IDocUIPluginConfig, installObserver } from './Basics';+import { DOC_UI_PLUGIN_NAME } from './Basics/Const/PLUGIN_NAME';import { AppUIController } from './Controller';+import { en, zh } from './Locale';export class DocUIPlugin extends Plugin<any> {static override type = PluginType.Doc;@@ -25,6 +24,7 @@ export class DocUIPlugin extends Plugin<any> {super(DOC_UI_PLUGIN_NAME);this._config = Tools.deepMerge({}, DefaultDocUiConfig, this._config);+ this._initializeDependencies(_injector);}initialize(): void {@@ -33,22 +33,8 @@ export class DocUIPlugin extends Plugin<any> {zh,});- const dependencies: Dependency[] = [- [ComponentManager],- [- AppUIController,- {- useFactory: () => this._injector.createInstance(AppUIController, this._config),- },- ],- ];-installObserver(this);- dependencies.forEach((d) => {- this._injector.add(d);- });-this._componentManager = this._injector.get(ComponentManager);this._appUIController = this._injector.get(AppUIController);}@@ -76,4 +62,19 @@ export class DocUIPlugin extends Plugin<any> {override onDestroy(): void {}-}\ No newline at end of file+ private _initializeDependencies(injector: Injector) {+ const dependencies: Dependency[] = [+ [ComponentManager],+ [+ AppUIController,+ {+ useFactory: () => this._injector.createInstance(AppUIController, this._config),+ },+ ],+ ];++ dependencies.forEach((d) => {+ injector.add(d);+ });+ }+}diff --git a/packages/ui-plugin-docs/src/Model/InfoBarModel.ts b/packages/ui-plugin-docs/src/Model/InfoBarModel.tsdeleted file mode 100644index e9d969cf44..0000000000--- a/packages/ui-plugin-docs/src/Model/InfoBarModel.ts+++ /dev/null@@ -1,11 +0,0 @@-export class InfoBarModel {- constructor(private _name: string) {}-- get name(): string {- return this._name;- }-- setName(name: string) {- this._name = name;- }-}diff --git a/packages/ui-plugin-docs/src/Model/index.ts b/packages/ui-plugin-docs/src/Model/index.tsdeleted file mode 100644index 769508d212..0000000000--- a/packages/ui-plugin-docs/src/Model/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './InfoBarModel';diff --git a/packages/ui-plugin-docs/src/View/DocContainer/DocContainer.tsx b/packages/ui-plugin-docs/src/View/DocContainer/DocContainer.tsxindex 10001f7b18..7c23ebf120 100644--- a/packages/ui-plugin-docs/src/View/DocContainer/DocContainer.tsx+++ b/packages/ui-plugin-docs/src/View/DocContainer/DocContainer.tsx@@ -1,12 +1,11 @@-import { BaseComponentProps, Container, Content, Footer, Header, Layout, Sider } from '@univerjs/base-ui';-import { Component, createRef } from 'preact';+import { BaseComponentProps, Container, Content, Footer, Layout, Sider } from '@univerjs/base-ui';import defaultSkin from '@univerjs/base-ui/Basics/CSS/Skin/default.module.less';import { Tools } from '@univerjs/core';import cssVars from 'css-vars-ponyfill';-import style from './index.module.less';+import { Component, createRef } from 'preact';+import { IDocUIPluginConfig } from '../../Basics';-import { Toolbar } from '../Toolbar';-import { InfoBar } from '../InfoBar';+import style from './index.module.less';export interface BaseDocContainerProps extends BaseComponentProps {config: IDocUIPluginConfig;@@ -201,10 +200,6 @@ export class DocContainer extends Component<BaseDocContainerProps> {<Layout><Sider style={{ display: config.outerLeft ? 'block' : 'none' }}></Sider><Layout className={style.mainContent} style={{ position: 'relative' }}>- <Header style={{ display: config.header ? 'block' : 'none' }}>- {config.infoBar && <InfoBar {...methods.infoBar}></InfoBar>}- {config.toolbar && <Toolbar {...methods.toolbar}></Toolbar>}- </Header><Layout><Siderstyle={{diff --git a/packages/ui-plugin-docs/src/View/InfoBar/InfoBar.tsx b/packages/ui-plugin-docs/src/View/InfoBar/InfoBar.tsxdeleted file mode 100644index c462f39ddf..0000000000--- a/packages/ui-plugin-docs/src/View/InfoBar/InfoBar.tsx+++ /dev/null@@ -1,67 +0,0 @@-import { BaseComponentProps, Container, Input, Tooltip, CustomLabel } from '@univerjs/base-ui';-import { Component } from 'preact';-import { Nullable } from '@univerjs/core';-import { BaseInfoBarProps } from '../../Controller/InfoBarUIController';-import styles from './index.module.less';--interface IState {- infoList: Nullable<BaseInfoBarProps>;-}--interface IProps extends BaseComponentProps {- renameSheet: () => void;-}--export class InfoBar extends Component<IProps, IState> {- constructor(props: IProps) {- super(props);- this.initialize();- }-- initialize() {- this.state = {- infoList: null,- };- }-- componentDidMount() {- this.props.getComponent?.(this);- }-- setInfoList(list: BaseInfoBarProps) {- this.setState({- infoList: list,- });- }-- render() {- const { renameSheet } = this.props;- if (!this.state.infoList) return;-- const { back, sheet, update, save, rename } = this.state.infoList;-- return (- <Container className={styles.infoDetail}>- {/* <div style={{ marginRight: '18px' }}>- <Tooltip title={back.label} placement={'bottom'}>- <Button className={styles.infoReturn} type="text">- <DropDownIcon rotate={90} />- </Button>- </Tooltip>- </div> */}- {/* <LogoIcon style={{ width: '152px', height: '32px' }} /> */}- <div className={styles.sheetName}>- <Tooltip title={rename.label} placement={'bottom'}>- <Input bordered={false} value={sheet.label} onBlur={renameSheet} />- </Tooltip>- </div>- <div className={styles.infoDetailUpdate}>- <CustomLabel label={update.label} />- </div>- <div className={styles.infoDetailSave}>- <CustomLabel label={save.label} />- </div>- </Container>- );- }-}diff --git a/packages/ui-plugin-docs/src/View/InfoBar/index.module.less b/packages/ui-plugin-docs/src/View/InfoBar/index.module.lessdeleted file mode 100644index bb3e266e29..0000000000--- a/packages/ui-plugin-docs/src/View/InfoBar/index.module.less+++ /dev/null@@ -1,44 +0,0 @@-.info-detail {- position: relative;- left: 0;- top: 0;- margin: 0;- padding: 0 17px;- height: 56px;- display: flex;- align-items: center;- background: var(--bg);- box-shadow: 0 -1px 0 0 var(--gray-16);- border-bottom: 1px solid var(--border-color-base);-- .info-return {- font-size: 16px;- padding: 0 5px;- font-size: 14px;- }-- .univericon.univericon-logo {- margin-left: 18px;-- svg {- width: 100%;- height: 100%;- }- }-- .sheet-name {- margin: 0 auto;- }-- .info-detail-update {- color: var(--gray-17);- font-size: 12px;- margin-left: 15px;- }-- .info-detail-save {- color: var(--gray-7);- font-size: 12px;- margin: 0 5px;- }-}diff --git a/packages/ui-plugin-docs/src/View/InfoBar/index.ts b/packages/ui-plugin-docs/src/View/InfoBar/index.tsdeleted file mode 100644index 345955a1ce..0000000000--- a/packages/ui-plugin-docs/src/View/InfoBar/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './InfoBar';diff --git a/packages/ui-plugin-docs/src/View/InfoBar/infobar-zh.md b/packages/ui-plugin-docs/src/View/InfoBar/infobar-zh.mddeleted file mode 100644index 89972db6ef..0000000000--- a/packages/ui-plugin-docs/src/View/InfoBar/infobar-zh.md+++ /dev/null@@ -1,10 +0,0 @@-----category: Components-type: 通用-title: InfoBar-cover: ''------## 介绍--最顶部的栏目,包含 logo/项目名diff --git a/packages/ui-plugin-docs/src/View/Toolbar/Const.ts b/packages/ui-plugin-docs/src/View/Toolbar/Const.tsdeleted file mode 100644index db573b0f9d..0000000000--- a/packages/ui-plugin-docs/src/View/Toolbar/Const.ts+++ /dev/null@@ -1,434 +0,0 @@-import { BorderStyleTypes } from '@univerjs/core';--export const FONT_SIZE_CHILDREN = [- {- label: '9',- value: 9,- },- {- label: '10',- value: 10,- },- {- label: '11',- value: 11,- },- {- label: '12',- value: 12,- },- {- label: '14',- value: 14,- },- {- label: '16',- value: 16,- },- {- label: '18',- value: 18,- },- {- label: '20',- value: 20,- },-- {- label: '22',- value: 22,- },- {- label: '24',- value: 24,- },- {- label: '26',- value: 26,- },- {- label: '28',- value: 28,- },- {- label: '36',- value: 36,- },- {- label: '48',- value: 48,- },- {- label: '72',- value: 72,- },-];--export const FONT_FAMILY_CHILDREN = [- {- label: 'fontFamily.TimesNewRoman',- style: { 'font-family': 'Times New Roman' },- value: 'Times New Roman',- selected: true,- },- {- label: 'fontFamily.Arial',- style: { 'font-family': 'Arial' },- value: 'Arial',- },- {- label: 'fontFamily.Tahoma',- style: { 'font-family': 'Tahoma' },- value: 'Tahoma',- },- {- label: 'fontFamily.Verdana',- style: { 'font-family': 'Verdana' },- value: 'Verdana',- },- {- label: 'fontFamily.MicrosoftAccorblack',- style: { 'font-family': '微软雅黑' },- value: '微软雅黑',- },- {- label: 'fontFamily.SimSun',- style: { 'font-family': '宋体' },- value: '宋体',- },- {- label: 'fontFamily.SimHei',- style: { 'font-family': '黑体' },- value: '黑体',- },- {- label: 'fontFamily.Kaiti',- style: { 'font-family': '楷体' },- value: '楷体',- },- {- label: 'fontFamily.FangSong',- style: { 'font-family': '仿宋' },- value: '仿宋',- },- {- label: 'fontFamily.NSimSun',- style: { 'font-family': '新宋体' },- value: '新宋体',- },- {- label: 'fontFamily.STXinwei',- style: { 'font-family': '华文新魏' },- value: '华文新魏',- },- {- label: 'fontFamily.STXingkai',- style: { 'font-family': '华文行楷' },- value: '华文行楷',- },- {- label: 'fontFamily.STLiti',- style: { 'font-family': '华文隶书' },- value: '华文隶书',- },- {- label: 'fontFamily.HanaleiFill',- style: { 'font-family': 'HanaleiFill' },- value: 'HanaleiFill',- },- {- label: 'fontFamily.Anton',- style: { 'font-family': 'Anton' },- value: 'Anton',- },- {- label: 'fontFamily.Pacifico',- style: { 'font-family': 'Pacifico' },- value: 'Pacifico',- },-];--export const BORDER_LINE_CHILDREN = [- {- label: 'borderLine.borderTop',- suffix: {- name: 'TopBorderIcon',- },- value: 'top',- },- {- label: 'borderLine.borderBottom',- suffix: {- name: 'BottomBorderIcon',- },- value: 'bottom',- },- {- label: 'borderLine.borderLeft',- suffix: {- name: 'LeftBorderIcon',- },- value: 'left',- },- {- label: 'borderLine.borderRight',- suffix: {- name: 'RightBorderIcon',- },- value: 'right',- border: true,- },- {- label: 'borderLine.borderNone',- suffix: {- name: 'NoneBorderIcon',- },- value: 'none',- },- {- label: 'borderLine.borderAll',- suffix: {- name: 'FullBorderIcon',- },- value: 'all',- selected: true,- },- {- label: 'borderLine.borderOutside',- suffix: {- name: 'OuterBorderIcon',- },- value: 'outside',- },- {- label: 'borderLine.borderInside',- suffix: {- name: 'InnerBorderIcon',- },- value: 'inside',- },- {- label: 'borderLine.borderHorizontal',- suffix: {- name: 'StripingBorderIcon',- },- value: 'horizontal',- },- {- label: 'borderLine.borderVertical',- suffix: {- name: 'VerticalBorderIcon',- },- value: 'vertical',- },-];--export const BORDER_SIZE_CHILDREN = [- {- label: 'borderLine.borderNone',- value: BorderStyleTypes.NONE,- },- {- label: {- name: 'BorderThin',- },- value: BorderStyleTypes.THIN,- },- {- label: {- name: 'BorderHair',- },- value: BorderStyleTypes.HAIR,- },- {- label: {- name: 'BorderDotted',- },- value: BorderStyleTypes.DOTTED,- },- {- label: {- name: 'BorderDashed',- },- value: BorderStyleTypes.DASHED,- },- {- label: {- name: 'BorderDashDot',- },- value: BorderStyleTypes.DOTTED,- },- {- label: {- name: 'BorderDashDotDot',- },- value: BorderStyleTypes.DASH_DOT_DOT,- },- {- label: {- name: 'BorderMedium',- },- value: BorderStyleTypes.MEDIUM,- },- {- label: {- name: 'BorderMediumDashed',- },- value: BorderStyleTypes.MEDIUM_DASHED,- },- {- label: {- name: 'BorderMediumDashDot',- },- value: BorderStyleTypes.MEDIUM_DASH_DOT,- },- {- label: {- name: 'BorderMediumDashDotDot',- },- value: BorderStyleTypes.MEDIUM_DASH_DOT_DOT,- },- {- label: {- name: 'BorderThick',- },- value: BorderStyleTypes.THICK,- },-];--export const MERGE_CHILDREN = [- {- label: 'merge.all',- value: 'all',- },- {- label: 'merge.vertical',- value: 'vertical',- },- {- label: 'merge.horizontal',- value: 'horizontal',- },- {- label: 'merge.cancel',- value: 'cancel',- },-];--export const HORIZONTAL_ALIGN_CHILDREN = [- {- label: 'align.left',- suffix: {- name: 'LeftAlignIcon',- },- value: 1,- },- {- label: 'align.center',- selected: true,- suffix: {- name: 'CenterAlignIcon',- },- value: 2,- },- {- label: 'align.right',- suffix: {- name: 'RightAlignIcon',- },- value: 3,- },-];--export const VERTICAL_ALIGN_CHILDREN = [- {- label: 'align.top',- suffix: {- name: 'TopVerticalIcon',- },- value: 1,- },- {- label: 'align.middle',- suffix: {- name: 'CenterVerticalIcon',- },- value: 2,- },- {- label: 'align.bottom',- suffix: {- name: 'BottomVerticalIcon',- },- value: 3,- },-];--export const TEXT_WRAP_CHILDREN = [- {- label: 'textWrap.overflow',- suffix: {- name: 'OverflowIcon',- },- value: 1,- },- {- label: 'textWrap.wrap',- suffix: {- name: 'BrIcon',- },- value: 3,- },- {- label: 'textWrap.clip',- suffix: {- name: 'CutIcon',- },- value: 2,- },-];--export const TEXT_ROTATE_CHILDREN = [- {- label: 'textRotate.none',- suffix: {- name: 'TextRotateIcon',- },- value: 0,- },- {- label: 'textRotate.angleUp',- suffix: {- name: 'TextRotateAngleUpIcon',- },- value: -45,- },- {- label: 'textRotate.angleDown',- suffix: {- name: 'TextRotateAngleDownIcon',- },- value: 45,- },- {- label: 'textRotate.vertical',- suffix: {- name: 'TextRotateVerticalIcon',- },- value: 'v',- },- {- label: 'textRotate.rotationUp',- suffix: {- name: 'TextRotateRotationUpIcon',- },- value: -90,- },- {- label: 'textRotate.rotationDown',- suffix: {- name: 'TextRotateRotationDownIcon',- },- value: 90,- },-];diff --git a/packages/ui-plugin-docs/src/View/Toolbar/DataBar.tsx b/packages/ui-plugin-docs/src/View/Toolbar/DataBar.tsxdeleted file mode 100644index f0f4350aa8..0000000000--- a/packages/ui-plugin-docs/src/View/Toolbar/DataBar.tsx+++ /dev/null@@ -1,22 +0,0 @@-type BarProps = {- list: Array<Record<string, string>>;- img: string;- onClick?: (item: {}, index: number) => void;-};--export const DataBar = (props: BarProps) => {- const { list, img, onClick } = props;- const background = `url(${img}) no-repeat`;-- let handleClick = (item: {}, index: number) => {- onClick?.call(this, item, index);- };-- return (- <div style="display: flex;">- {list.map((item, index) => (- <div onClick={() => handleClick(item, index)} style={{ width: '28px', height: '26px', background, backgroundPosition: `${item.x} ${item.y}` }}></div>- ))}- </div>- );-};diff --git a/packages/ui-plugin-docs/src/View/Toolbar/Toolbar-zh.md b/packages/ui-plugin-docs/src/View/Toolbar/Toolbar-zh.mddeleted file mode 100644index 3d310b457f..0000000000--- a/packages/ui-plugin-docs/src/View/Toolbar/Toolbar-zh.md+++ /dev/null@@ -1,92 +0,0 @@-----category: Components-type: 定制-title: Toolbar-subtitle: 工具栏-cover: ''------## 介绍--工具栏--## API--工具栏的属性说明如下:--| 属性 | 说明 | 类型 | 默认值 |-| ---------- | --------------------- | --------------------------- | -------------------------- |-| style | 自定义 css 央样式对象 | `JSX.CSSProperties` | - |-| config | 配置项 | `IShowToolbarConfig` | `IShowToolbarConfig` |-| forwardRef | preact refs 引用 | `RefObject<HTMLDivElement>` | - |-| func | 回调挂载 | `object` | `{ addButton: Function; }` |--`IShowToolbarConfig`包含以下配置,默认都为 `true`,可以指定想隐藏的工具栏按钮为`false`--```json-{- "undoRedo": false, //撤销重做,注意撤消重做是两个按钮,由这一个配置决定显示还是隐藏- "paintFormat": false, //格式刷- "currencyFormat": false, //货币格式- "percentageFormat": false, //百分比格式- "numberDecrease": false, // '减少小数位数'- "numberIncrease": false, // '增加小数位数- "moreFormats": false, // '更多格式'- "font": false, // '字体'- "fontSize": false, // '字号大小'- "bold": false, // '粗体 (Ctrl+B)'- "italic": false, // '斜体 (Ctrl+I)'- "strikethrough": false, // '删除线 (Alt+Shift+5)'- "underline": false, // '下划线 (Alt+Shift+6)'- "textColor": false, // '文本颜色'- "fillColor": false, // '单元格颜色'- "border": false, // '边框'- "mergeCell": false, // '合并单元格'- "horizontalAlignMode": false, // '水平对齐方式'- "verticalAlignMode": false, // '垂直对齐方式'- "textWrapMode": false, // '换行方式'- "textRotateMode": false // '文本旋转方式'-}-```--以下这些配置已经分配到各个插件中了--```json-{- "link": false, // '插入链接'- "image": false, // '插入图片'- "chart": false, // '图表'- "comment": false, //'批注'- "pivotTable": false, //'数据透视表'- "function": false, // '公式'- "frozenMode": false, // '冻结方式'- "sort": false, // '排序'- "filter": false, // '筛选'- "conditionalalFormat": false, // '条件格式'- "dataValidation": false, // '数据验证'- "splitColumn": false, // '分列'- "screenshot": false, // '截图'- "findAndReplace": false, // '查找替换'- "protection": false, // '工作表保护'- "print": false // '打印'-}-```--## 案例--```jsx-import { Toolbar } from '@univerjs/style-univer';--const SheetContainer = () => {- return (- <Toolbar- style={{- display: layout.toolbar ? 'block' : 'none',- }}- config={layout.toolbarConfig!}- func={{ addButton }}- ref={this.toolbarRef}- ></Toolbar>- );-};-```diff --git a/packages/ui-plugin-docs/src/View/Toolbar/Toolbar.md b/packages/ui-plugin-docs/src/View/Toolbar/Toolbar.mddeleted file mode 100644index e69de29bb2..0000000000diff --git a/packages/ui-plugin-docs/src/View/Toolbar/Toolbar.tsx b/packages/ui-plugin-docs/src/View/Toolbar/Toolbar.tsxdeleted file mode 100644index e1985f8834..0000000000--- a/packages/ui-plugin-docs/src/View/Toolbar/Toolbar.tsx+++ /dev/null@@ -1,249 +0,0 @@-import { AppContext, BaseComponentProps, Button, Container, debounce, Select, Tooltip, CustomLabel } from '@univerjs/base-ui';-import { Component, createRef } from 'preact';-import { DocUIPlugin } from '../..';-import { DOC_UI_PLUGIN_NAME } from '../../Basics';-import { IToolbarItemProps } from '../../Controller';-import styles from './index.module.less';--interface IProps extends BaseComponentProps {- style?: JSX.CSSProperties;- toolList: IToolbarItemProps[];-}--interface IState {- toolList: IToolbarItemProps[];- moreToolList: IToolbarItemProps[];- defaultToolList: IToolbarItemProps[];- showMore: boolean;- toolbarListWidths: number[];-}--export class Toolbar extends Component<IProps, IState> {- static override contextType = AppContext;-- toolbarRef = createRef();-- moreBtnRef = createRef();-- moreToolRef = createRef();-- SelectRef = createRef();-- clientWidth = 0;-- /**- * Gets the distance of each button from the parent element- */- debounceSetToolbarListWidth = debounce(() => {- this.setToolbarListWidth();- }, 50);-- constructor(props: IProps) {- super(props);- this.initialize();- }-- initialize() {- this.state = {- // Button contains main button and drop down arrow, translation file contains main and right- showMore: false,- toolList: [],- defaultToolList: [],- moreToolList: [],- toolbarListWidths: [],- };- }-- /**- * show more tool buttons- *- * TODO : 点击其他地方需要隐藏more buttons- */- showMore = () => {- const showMore = this.state.showMore;- this.setState({ showMore: !showMore });-- if (!showMore) {- document.addEventListener('click', this.hide, true);- }- };-- hide = (e: Event) => {- if (this.moreToolRef.current.contains(e.target)) return;- e.stopImmediatePropagation();- this.setState({ showMore: false });- document.removeEventListener('click', this.hide, true);- };-- setToolbarListWidth = () => {- if (!this.clientWidth) {- this.clientWidth = document.documentElement.clientWidth;- }- const list = this.toolbarRef.current.querySelectorAll(`.${styles.toolbarWarp} > div`);- const moreButtonWidth = this.moreBtnRef.current.clientWidth;- let width = 60 + moreButtonWidth;- let index = null;-- const clientWidth = document.documentElement.clientWidth;- if (clientWidth <= this.clientWidth) {- // 向左resize- this.clientWidth = clientWidth;- for (let i = 0; i < list.length; i++) {- width += list[i].clientWidth + 6;-- if (width > clientWidth) {- index = i;- break;- }- }- if (index !== null) {- this.setState(- {- defaultToolList: this.state.toolList.slice(0, index),- moreToolList: index ? this.state.toolList.slice(index) : [],- },- () => {- this.resetUl();- this.forceUpdate();- }- );- }- } else {- // 向右resize- this.clientWidth = clientWidth;- if (this.state.moreToolList.length) {- let toolWidth = 30 + moreButtonWidth;- for (let i = 0; i < list.length; i++) {- toolWidth += list[i].clientWidth + 6;- }-- const moreList = this.moreToolRef.current.querySelectorAll(`.${styles.moreTool} > div`);- let moreIndex = null;- let last = false; //最后一个元素-- for (let i = 0; i < moreList.length; i++) {- toolWidth += moreList[i].clientWidth + 6;-- if (toolWidth > clientWidth) {- moreIndex = i;- break;- } else if (i === moreList.length - 1) {- moreIndex = i;- last = true;- }- }-- if (moreIndex !== null) {- this.setState(- {- defaultToolList: this.state.defaultToolList.concat(this.state.moreToolList.slice(0, last ? moreIndex + 1 : moreIndex)),- moreToolList: last ? [] : this.state.moreToolList.slice(moreIndex),- },- () => {- this.resetUl();- this.forceUpdate();- }- );- }- }- }- };-- setToolbar = (toolList: any[]) => {- this.setState(- {- toolList,- defaultToolList: toolList,- },- () => {- this.setToolbarListWidth();- }- );- };-- resetUl = () => {- const wrapper = this.getContext().getPluginManager().getPluginByName<DocUIPlugin>(DOC_UI_PLUGIN_NAME)?.getAppUIController().getDocContainerController().getContentRef()- .current!;- const height = `${(wrapper as HTMLDivElement).offsetHeight}px`;- const ul = this.toolbarRef.current.querySelectorAll('ul');- for (let i = 0; i < ul.length; i++) {- ul[i].style.maxHeight = height;- }- };-- override componentDidMount() {- this.props.getComponent?.(this);- window.addEventListener('resize', this.debounceSetToolbarListWidth);- }-- override componentWillUnmount() {- window.removeEventListener('resize', this.debounceSetToolbarListWidth);- }-- // 渲染dom- getToolbarList(list: IToolbarItemProps[]) {- return list.map((item) => {- if (item.toolbarType) {- if (item.show) {- return (- <Tooltip title={item.tooltip} placement={'bottom'}>- <Button unActive={item.unActive} className={styles.textButton} type="text" active={item.active} onClick={item.onClick}>- <CustomLabel label={item.label} />- </Button>- </Tooltip>- );- }- } else {- if (item.show) {- return (- <Select- tooltip={item.tooltip}- type={item.type}- display={item.display}- children={item.children}- label={item.label}- suffix={item.suffix}- onClick={item.onClick}- onPressEnter={item.onPressEnter}- onMainClick={item.onMainClick}- defaultColor={item.defaultColor}- hideSelectedIcon={item.hideSelectedIcon}- className={item.className}- ></Select>- );- }- }- return null;- });- }-- render() {- const { defaultToolList, moreToolList, showMore } = this.state;-- return (- <Container style={{ position: 'relative' }}>- <div className={`${styles.toolbarWarp} ${styles.toolbar}`} ref={this.toolbarRef}>- {this.getToolbarList(defaultToolList)}-- <div ref={this.moreBtnRef} className={styles.moreButton} style={{ visibility: moreToolList.length ? 'visible' : 'hidden' }}>- <Tooltip title={(<CustomLabel label="toolbar.toolMoreTip" />) as unknown as string} placement={'bottom'}>- <Button type="text" onClick={this.showMore}>- <div style={{ fontSize: '14px' }}>- <CustomLabel label="toolbar.toolMore" />- </div>- </Button>- </Tooltip>- </div>- </div>-- {moreToolList.length ? (- <div style={{ visibility: showMore ? 'visible' : 'hidden' }} className={`${styles.moreTool} ${styles.toolbar}`} ref={this.moreToolRef}>- {this.getToolbarList(moreToolList)}- </div>- ) : (- ''- )}- </Container>- );- }-}diff --git a/packages/ui-plugin-docs/src/View/Toolbar/index.less b/packages/ui-plugin-docs/src/View/Toolbar/index.lessdeleted file mode 100644index 04f1f4201e..0000000000--- a/packages/ui-plugin-docs/src/View/Toolbar/index.less+++ /dev/null@@ -1,310 +0,0 @@-.universheet-wa-editor.toolbar {- height: 32px;- background: var(--bg);- position: relative;- padding: 5px 0 3px 15px;- border-bottom: 1px solid var(--bg);- white-space: nowrap;- transition: all 0.2s;- box-sizing: initial;-- span[role='img'] {- font-size: 24px;- display: inline-block;- }-- span[role='img'].univericon-nextIcon {- font-size: 13px;- }-- span[role='img'].univericon-rightIcon {- font-size: 13px;- }-- .universheet-toolbar-left-skin {- width: 15px;- position: absolute;- left: 0;- top: 1px;- bottom: 1px;- }-- .universheet-inline-block {- display: inline-block;- }-- .universheet-flex {- display: flex;- }-- .universheet-toolbar-button,- .universheet-toolbar-menu-button {- vertical-align: middle;-- &:hover {- background: rgba(0, 0, 0, 0.06);- }-- button {- min-width: 26px;- height: 26px;- padding: 0;- border: none;- .toolbar-button();-- span {- height: 100%;- vertical-align: text-bottom;- }- }- }-- .universheet-toolbar-button-outer-box,- .universheet-toolbar-menu-button-outer-box {- .outer-inner-box();- }-- .universheet-toolbar-select {- position: relative;- }-- .universheet-toolbar-button-inner-box,- .universheet-toolbar-menu-button-inner-box {- padding: 0 2px;- padding: 0;- text-align: center;- height: 26px;- min-width: 26px;- font-size: 12px;- }-- .universheet-toolbar-menu-button-caption {- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;- margin-left: 1px;- text-align: center;- height: 100%;- }-- .universheet-toolbar-menu-button-text {- width: 55px !important;- }-- .universheet-toolbar-separator {- line-height: normal;- list-style: none;- outline: 0;- overflow: hidden;- padding: 0;- text-decoration: none;- width: 0;- height: 20px;- vertical-align: top;- border-left: 1px solid #e0e0e0;- margin: 5px 1px;- }-- .universheet-toolbar-combo-button {- font-weight: 700;- vertical-align: inherit;- margin: 0 1px;- .toolbar-button();- }-- .universheet-toolbar-combo-button-inner-box,- .universheet-toolbar-combo-button-outer-box {- .outer-inner-box();- }-- .universheet-toolbar-zoom-combobox .universheet-toolbar-combo-button-caption {- width: 36px !important;- }-- .universheet-toolbar-combo-button-caption {- padding: 0;- margin: 0 0 0 -3px;- }-- .universheet-toolbar-textinput {- -webkit-border-radius: 1px;- -moz-border-radius: 1px;- border-radius: 1px;- border: 1px solid #d9d9d9;- border-top: 1px solid silver;- font-size: 13px;- height: 25px;- padding: 1px 0 1px 8px;- }-- .universheet-toolbar-combo-button-input {- background: 0 0;- border: 1px solid transparent !important;- color: var(--text-color);- font-family: Arial, sans-serif !important;- font-size: 11px !important;- font-weight: 700 !important;- height: 20px !important;- overflow: hidden !important;- color: rgba(0, 0, 0, 0.7);- height: 22px !important;- width: 22px;- }-- .universheet-cols-menu {- .menu-button();- width: 252px;- left: 0;- top: 26px;- display: none;- }-- .universheet-cols-menu .universheet-cols-menuitem-hover,- .universheet-cols-menu .universheet-cols-menuitem:hover {- background-color: #efefef;- }-- .universheet-cols-menu .universheet-cols-menuitem {- position: relative;- color: var(--text-color);- cursor: pointer;- list-style: none;- margin: 0;- padding: 1px 6em 1px 20px;- white-space: nowrap;- padding-left: 8px;- vertical-align: middle;- padding-right: 24px;- user-select: none;- line-height: 16px;- }-- .universheet-submenu-arrow {- -webkit-transition: all 218ms;- -moz-transition: all 218ms;- -o-transition: all 218ms;- transition: all 218ms;- font-size: 12px;- left: auto;- right: 15px;- top: 50%;- transform: translateY(-50%);- padding-right: 0;- position: absolute;- text-align: right;- opacity: 0.5;- color: #000;- user-select: none;- font-family: Arial;- }-- .universheet-toolbar-dblbutton {- .universheet-toolbar-next-button {- border-left: 1px solid transparent;- position: relative;-- .universheet-next-menu {- position: absolute;- z-index: 2;- background-color: #fff;- box-shadow: var(--box-shadow-base);- font-size: 12px;- width: fit-content;-- .univer-menu-item > div {- width: 100%;- display: flex;- justify-content: space-between;- box-sizing: border-box;- padding: 0 5px 0 0;-- .universheet-next-menu-icon {- width: 25px;-- & ~ div {- flex: 1;- display: flex;- justify-content: space-between;- align-items: center;- }- }- }-- svg {- font-size: 24px;- vertical-align: top;- }- }-- svg {- font-size: 12px;- vertical-align: middle;- }- }-- .universheet-color-bottom {- width: 10px;- margin: 0 auto;- outline: 2px solid;- position: relative;- bottom: 7px;- }-- button.univer-btn {- min-width: 15px;-- &:active {- background: transparent !important;- }- }-- :hover .universheet-toolbar-next-button {- border-left: 1px solid #e0e0e0;- }- }-}--// 重复样式-.outer-inner-box() {- border: 0;- vertical-align: top;- margin: 0;- padding: 0;-}--.toolbar-button() {- -webkit-border-radius: 2px;- -moz-border-radius: 2px;- border-radius: 2px;- -webkit-user-select: none;- -moz-user-select: none;- -ms-user-select: none;- background: 0;- border: 1px solid transparent;- outline: 0;- padding: 0;- list-style: none;- font-size: 11px;- text-decoration: none;- cursor: default;- height: 26px;- line-height: 26px;- color: var(--text-color);-}--.menu-button() {- border-radius: 0;- box-shadow: 0 2px 4px rgb(0 0 0 / 20%);- transition: opacity 218ms;- background: #fff;- border: 1px solid rgba(0, 0, 0, 0.2);- cursor: default;- font-size: 13px;- margin: 0;- outline: 0;- padding: 6px 0;- position: absolute;- z-index: 2;- box-sizing: border-box;- user-select: none;-}diff --git a/packages/ui-plugin-docs/src/View/Toolbar/index.module.less b/packages/ui-plugin-docs/src/View/Toolbar/index.module.lessdeleted file mode 100644index e99f17bd85..0000000000--- a/packages/ui-plugin-docs/src/View/Toolbar/index.module.less+++ /dev/null@@ -1,176 +0,0 @@-.toolbar-warp {- max-height: fit-content;- width: 100%;- overflow: unset;- box-sizing: border-box;- font-size: var(--font-size);- background-color: var(--bg);- position: relative;- display: flex;- align-items: center;- border-bottom: 1px solid var(--border-color-base);-- .single-button {- &.more-hide {- display: none;- }-- &.more-show {- display: block;- }- }-}--.toolbar {- max-width: 100%;- color: var(--text-color);- padding: 0 15px;- height: 40px;- position: relative;- display: flex;- align-items: center;-- >div {- height: 26px;- display: inline-block;- vertical-align: middle;- margin: 0 3px;- cursor: pointer;-- &.select-button:hover {- background-color: #efefef;- }- }-- .cols-menu {- overflow-y: auto;- }-- .select-label-string {- .drop-content {- >div {- overflow: hidden;- text-overflow: ellipsis;- white-space: nowrap;- width: 90px;- }- }- }-- .select-double-string {- .drop-content {- >div {- width: 24px;- }- }- }-- .select-color-picker-parent {- .select-item-content {- width: 100%;- }-- .select-color-picker {- cursor: default;-- &:hover {- background: var(--bg);- }-- .select-item {- padding: 0;- }-- .color-picker-outer {- box-shadow: none;- }- }- }-- .select-line-bold-parent {- .select-item-content {- width: 100%;- }- }-- .select-single {- height: 26px;- line-height: 26px;- }-- .select-input {- height: 26px;- line-height: 26px;- }-- .select-double {- height: 26px;- line-height: 26px;- }-- button {- padding: 0;- height: 26px;- }-- span[role='img'].univericon-nextIcon {- font-size: 12px;- }-- .text-button {- span[role="img"] {- font-size: 24px;- }-- button {- padding: 0 5px;- }- }--}--.more-button {- position: absolute;- right: 15px;- top: 50%;- transform: translateY(-50%);- .button();-- &.more-show {- display: block;- }-}--.more-tool {- // height: 40px;- // display: none;- // align-items: center;- padding: 0 10px;- background-color: var(--bg);- box-shadow: var(--box-shadow-base);- position: absolute;- right: 2em;- top: 40px;- z-index: 2;-- &.more-show {- display: flex;- }-- button {- .button();- }-}--.button() {- padding: 0px;- line-height: 1;-}--.tooltip-title {- opacity: 1;-}--.bottom {- display: none;-}\ No newline at end of filediff --git a/packages/ui-plugin-docs/src/View/Toolbar/index.ts b/packages/ui-plugin-docs/src/View/Toolbar/index.tsdeleted file mode 100644index 7c6430332b..0000000000--- a/packages/ui-plugin-docs/src/View/Toolbar/index.ts+++ /dev/null@@ -1 +0,0 @@-export * from './Toolbar';diff --git a/packages/ui-plugin-docs/src/View/index.tsx b/packages/ui-plugin-docs/src/View/index.tsxindex e318d14674..6b567ebafd 100644--- a/packages/ui-plugin-docs/src/View/index.tsx+++ b/packages/ui-plugin-docs/src/View/index.tsx@@ -1,5 +1,6 @@import { isElement } from '@univerjs/base-ui';import { render } from 'preact';+import { App, BaseUIProps } from './App';interface BaseDicUIConfig extends BaseUIProps {@@ -39,4 +40,3 @@ export class UI {}export * from './DocContainer';-export * from './Toolbar';