From 60ca259eca0a0afeef36b7ba94c5a27283448a54 Mon Sep 17 00:00:00 2001 From: jocs Date: Fri, 6 Sep 2024 16:03:13 +0800 Subject: [PATCH] fix: rebase dev --- .../src/commands/commands/add-link.command.ts | 4 +- .../hyper-link-event.render-controller.ts | 6 +- .../src/controllers/app-ui-controller.ts | 7 +- .../src/controllers/doc-ui.controller.ts | 2 +- .../docs-ui/src/controllers/menu.schema.ts | 71 +++++++------------ packages/docs-ui/src/docs-ui-plugin.ts | 9 +-- packages/docs-ui/src/index.ts | 1 - .../services/clipboard/clipboard.service.ts | 4 +- .../src/controllers/sheet-ui.controller.ts | 2 +- 9 files changed, 38 insertions(+), 68 deletions(-) diff --git a/packages/docs-hyper-link-ui/src/commands/commands/add-link.command.ts b/packages/docs-hyper-link-ui/src/commands/commands/add-link.command.ts index 27e3e02d016..b6b4f2bcdd6 100644 --- a/packages/docs-hyper-link-ui/src/commands/commands/add-link.command.ts +++ b/packages/docs-hyper-link-ui/src/commands/commands/add-link.command.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { CommandType, CustomRangeType, generateRandomId, type ICommand, ICommandService, sequenceExecute } from '@univerjs/core'; +import { CommandType, CustomRangeType, generateRandomId, type ICommand, ICommandService } from '@univerjs/core'; import { addCustomRangeBySelectionFactory } from '@univerjs/docs-ui'; export interface IAddDocHyperLinkCommandParams { @@ -30,7 +30,7 @@ export const AddDocHyperLinkCommand: ICommand = { return false; } - const { payload, unitId } = params; + const { payload } = params; const commandService = accessor.get(ICommandService); const id = generateRandomId(); const doMutation = addCustomRangeBySelectionFactory( diff --git a/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.ts b/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.ts index b1e1176a659..e84e367fa91 100644 --- a/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.ts +++ b/packages/docs-hyper-link-ui/src/controllers/render-controllers/hyper-link-event.render-controller.ts @@ -18,7 +18,7 @@ import type { DocumentDataModel } from '@univerjs/core'; import { CustomRangeType, Disposable, ICommandService, Inject } from '@univerjs/core'; import { DocEventManagerService } from '@univerjs/docs-ui'; import type { IRenderContext, IRenderModule } from '@univerjs/engine-render'; -import { DocSkeletonManagerService, TextSelectionManagerService } from '@univerjs/docs'; +import { DocSelectionManagerService, DocSkeletonManagerService } from '@univerjs/docs'; import { ClickDocHyperLinkOperation, ToggleDocHyperLinkInfoPopupOperation } from '../../commands/operations/popup.operation'; import { DocHyperLinkPopupService } from '../../services/hyper-link-popup.service'; @@ -33,7 +33,7 @@ export class DocHyperLinkEventRenderController extends Disposable implements IRe @ICommandService private readonly _commandService: ICommandService, @Inject(DocHyperLinkPopupService) private readonly _hyperLinkPopupService: DocHyperLinkPopupService, @Inject(DocSkeletonManagerService) private readonly _docSkeletonManagerService: DocSkeletonManagerService, - @Inject(TextSelectionManagerService) private readonly _textSelectionManagerService: TextSelectionManagerService + @Inject(DocSelectionManagerService) private readonly _docSelectionManagerService: DocSelectionManagerService ) { super(); @@ -53,7 +53,7 @@ export class DocHyperLinkEventRenderController extends Disposable implements IRe this.disposeWithMe( this._docEventManagerService.hoverCustomRanges$.subscribe((ranges) => { const link = ranges.find((range) => range.range.rangeType === CustomRangeType.HYPERLINK); - const activeRanges = this._textSelectionManagerService.getCurrentTextRanges(); + const activeRanges = this._docSelectionManagerService.getCurrentTextRanges(); const currentSegmentId = activeRanges?.[0].segmentId; if ((link?.segmentId ?? '') !== currentSegmentId) { this._hideInfoPopup(); diff --git a/packages/docs-ui/src/controllers/app-ui-controller.ts b/packages/docs-ui/src/controllers/app-ui-controller.ts index 6bf95df7232..d83dd7f3ca6 100644 --- a/packages/docs-ui/src/controllers/app-ui-controller.ts +++ b/packages/docs-ui/src/controllers/app-ui-controller.ts @@ -14,20 +14,17 @@ * limitations under the License. */ -import { Inject, Injector, LocaleService, RxDisposable } from '@univerjs/core'; +import { Inject, Injector, RxDisposable } from '@univerjs/core'; -import type { IUniverDocsUIConfig } from '../basics'; import { DocContainerUIController } from './doc-container-ui-controller'; export class AppUIController extends RxDisposable { private _docContainerController: DocContainerUIController; constructor( - _config: IUniverDocsUIConfig, - @Inject(LocaleService) private readonly _localeService: LocaleService, @Inject(Injector) private readonly _injector: Injector ) { super(); - this._docContainerController = this._injector.createInstance(DocContainerUIController, _config); + this._docContainerController = this._injector.createInstance(DocContainerUIController); } } diff --git a/packages/docs-ui/src/controllers/doc-ui.controller.ts b/packages/docs-ui/src/controllers/doc-ui.controller.ts index c71c5d22e6e..acba681f1c3 100644 --- a/packages/docs-ui/src/controllers/doc-ui.controller.ts +++ b/packages/docs-ui/src/controllers/doc-ui.controller.ts @@ -26,7 +26,7 @@ import { OnLifecycle, UniverInstanceType, } from '@univerjs/core'; -import { BuiltInUIPart, ComponentManager, ILayoutService, IShortcutService, IUIPartsService } from '@univerjs/ui'; +import { BuiltInUIPart, ComponentManager, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui'; import { IRenderManagerService } from '@univerjs/engine-render'; import { TodoList } from '@univerjs/icons'; diff --git a/packages/docs-ui/src/controllers/menu.schema.ts b/packages/docs-ui/src/controllers/menu.schema.ts index 93cfcf7f1a3..bd220d88ed1 100644 --- a/packages/docs-ui/src/controllers/menu.schema.ts +++ b/packages/docs-ui/src/controllers/menu.schema.ts @@ -16,38 +16,35 @@ import type { MenuSchemaType } from '@univerjs/ui'; import { ContextMenuGroup, ContextMenuPosition, RibbonStartGroup } from '@univerjs/ui'; -import { - AlignCenterCommand, - AlignJustifyCommand, - AlignLeftCommand, - AlignRightCommand, - BulletListCommand, - CheckListCommand, - DeleteLeftCommand, - DocTableDeleteColumnsCommand, - DocTableDeleteRowsCommand, - DocTableDeleteTableCommand, - DocTableInsertColumnLeftCommand, - DocTableInsertColumnRightCommand, - DocTableInsertRowAboveCommand, - DocTableInsertRowBellowCommand, - OrderListCommand, - ResetInlineFormatTextBackgroundColorCommand, - SetInlineFormatBoldCommand, - SetInlineFormatFontFamilyCommand, - SetInlineFormatFontSizeCommand, - SetInlineFormatItalicCommand, - SetInlineFormatStrikethroughCommand, - SetInlineFormatSubscriptCommand, - SetInlineFormatSuperscriptCommand, - SetInlineFormatTextBackgroundColorCommand, - SetInlineFormatTextColorCommand, - SetInlineFormatUnderlineCommand, -} from '@univerjs/docs'; import { DocCreateTableOperation } from '../commands/operations/doc-create-table.operation'; import { OpenHeaderFooterPanelCommand } from '../commands/commands/doc-header-footer.command'; import { DocCopyCommand, DocCutCommand, DocPasteCommand } from '../commands/commands/clipboard.command'; import { DocParagraphSettingPanelOperation } from '../commands/operations/doc-paragraph-setting-panel.operation'; +import { ResetInlineFormatTextBackgroundColorCommand, SetInlineFormatBoldCommand, SetInlineFormatFontFamilyCommand, SetInlineFormatFontSizeCommand, SetInlineFormatItalicCommand, SetInlineFormatStrikethroughCommand, SetInlineFormatSubscriptCommand, SetInlineFormatSuperscriptCommand, SetInlineFormatTextBackgroundColorCommand, SetInlineFormatTextColorCommand, SetInlineFormatUnderlineCommand } from '../commands/commands/inline-format.command'; + +import { BulletListCommand, CheckListCommand, OrderListCommand } from '../commands/commands/list.command'; +import { AlignCenterCommand, AlignJustifyCommand, AlignLeftCommand, AlignRightCommand } from '../commands/commands/paragraph-align.command'; +import { DeleteLeftCommand } from '../commands/commands/delete.command'; +import { DocTableInsertColumnLeftCommand, DocTableInsertColumnRightCommand, DocTableInsertRowAboveCommand, DocTableInsertRowBellowCommand } from '../commands/commands/table/doc-table-insert.command'; +import { DocTableDeleteColumnsCommand, DocTableDeleteRowsCommand, DocTableDeleteTableCommand } from '../commands/commands/table/doc-table-delete.command'; +import { + CopyMenuFactory, + CutMenuFactory, + DeleteColumnsMenuItemFactory, + DeleteMenuFactory, + DeleteRowsMenuItemFactory, + DeleteTableMenuItemFactory, + InsertColumnLeftMenuItemFactory, + InsertColumnRightMenuItemFactory, + InsertRowAfterMenuItemFactory, + InsertRowBeforeMenuItemFactory, + ParagraphSettingMenuFactory, + PasteMenuFactory, + TABLE_DELETE_MENU_ID, + TABLE_INSERT_MENU_ID, + TableDeleteMenuItemFactory, + TableInsertMenuItemFactory, +} from './menu/context-menu'; import { AlignCenterMenuItemFactory, AlignJustifyMenuItemFactory, @@ -72,24 +69,6 @@ import { TextColorSelectorMenuItemFactory, UnderlineMenuItemFactory, } from './menu/menu'; -import { - CopyMenuFactory, - CutMenuFactory, - DeleteColumnsMenuItemFactory, - DeleteMenuFactory, - DeleteRowsMenuItemFactory, - DeleteTableMenuItemFactory, - InsertColumnLeftMenuItemFactory, - InsertColumnRightMenuItemFactory, - InsertRowAfterMenuItemFactory, - InsertRowBeforeMenuItemFactory, - ParagraphSettingMenuFactory, - PasteMenuFactory, - TABLE_DELETE_MENU_ID, - TABLE_INSERT_MENU_ID, - TableDeleteMenuItemFactory, - TableInsertMenuItemFactory, -} from './menu/context-menu'; export const menuSchema: MenuSchemaType = { [RibbonStartGroup.FORMAT]: { diff --git a/packages/docs-ui/src/docs-ui-plugin.ts b/packages/docs-ui/src/docs-ui-plugin.ts index 859fe8b8792..903a063583d 100644 --- a/packages/docs-ui/src/docs-ui-plugin.ts +++ b/packages/docs-ui/src/docs-ui-plugin.ts @@ -22,8 +22,7 @@ import { ICommandService, Injector, IUniverInstanceService, mergeOverrideWithDependencies, - Plugin, - Tools, UniverInstanceType, + Plugin, UniverInstanceType, } from '@univerjs/core'; import { IEditorService, IShortcutService } from '@univerjs/ui'; import { IRenderManagerService } from '@univerjs/engine-render'; @@ -89,7 +88,6 @@ import { CutContentCommand, InnerPasteCommand } from './commands/commands/clipbo import { CoverContentCommand, ReplaceContentCommand } from './commands/commands/replace-content.command'; import { SetDocZoomRatioCommand } from './commands/commands/set-doc-zoom-ratio.command'; import { SelectAllOperation } from './commands/operations/select-all.operation'; -import { DocCustomRangeService } from './services/doc-custom-range.service'; import { DocAutoFormatService } from './services/doc-auto-format.service'; import { DocStateChangeManagerService } from './services/doc-state-change-manager.service'; import { DocInputController } from './controllers/render-controllers/doc-input.controller'; @@ -223,11 +221,11 @@ export class UniverDocsUIPlugin extends Plugin { [DocClipboardController], [DocEditorBridgeController], // Controller - [DocUIController, { useFactory: () => this._injector.createInstance(DocUIController, this._config) }], + [DocUIController], [DocAutoFormatController], [DocTableController], [DocMoveCursorController], - [AppUIController, { useFactory: () => this._injector.createInstance(AppUIController, this._config) }], + [AppUIController], [DocParagraphSettingController], // Services @@ -235,7 +233,6 @@ export class UniverDocsUIPlugin extends Plugin { [DocCanvasPopManagerService], [DocsRenderService], [DocStateChangeManagerService], - [DocCustomRangeService], [DocAutoFormatService], ]; diff --git a/packages/docs-ui/src/index.ts b/packages/docs-ui/src/index.ts index cabe94f1406..5d2f4fb2810 100644 --- a/packages/docs-ui/src/index.ts +++ b/packages/docs-ui/src/index.ts @@ -53,7 +53,6 @@ export { isInSameTableCell, isValidRectRange, NodePositionConvertToRectRange } f export { DocSelectionRenderService } from './services/selection/doc-selection-render.service'; export { DocStateChangeManagerService } from './services/doc-state-change-manager.service'; -export { DocCustomRangeService, type ICustomRangeHook } from './services/doc-custom-range.service'; export { DocIMEInputManagerService } from './services/doc-ime-input-manager.service'; export { getParagraphsInRange, getParagraphsInRanges } from './commands/commands/list.command'; diff --git a/packages/docs-ui/src/services/clipboard/clipboard.service.ts b/packages/docs-ui/src/services/clipboard/clipboard.service.ts index 1ef10cde840..03a72534c94 100644 --- a/packages/docs-ui/src/services/clipboard/clipboard.service.ts +++ b/packages/docs-ui/src/services/clipboard/clipboard.service.ts @@ -23,7 +23,6 @@ import { DocSelectionManagerService } from '@univerjs/docs'; import { getCursorWhenDelete } from '../../commands/commands/delete.command'; import { CutContentCommand, InnerPasteCommand } from '../../commands/commands/clipboard.inner.command'; import { getDeleteSelection } from '../../basics/selection'; -import { DocCustomRangeService } from '../doc-custom-range.service'; import { copyCustomRange } from '../../basics/custom-range'; import { copyContentCache, extractId, genId } from './copy-content-cache'; import { HtmlToUDMService } from './html-to-udm/converter'; @@ -97,8 +96,7 @@ export class DocClipboardService extends Disposable implements IDocClipboardServ @ILogService private readonly _logService: ILogService, @ICommandService private readonly _commandService: ICommandService, @IClipboardInterfaceService private readonly _clipboardInterfaceService: IClipboardInterfaceService, - @Inject(DocSelectionManagerService) private readonly _docSelectionManagerService: DocSelectionManagerService, - @Inject(DocCustomRangeService) private readonly _docCustomRangeService: DocCustomRangeService + @Inject(DocSelectionManagerService) private readonly _docSelectionManagerService: DocSelectionManagerService ) { super(); } diff --git a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts index 0c22593572f..06044cefd1e 100644 --- a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts +++ b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts @@ -23,7 +23,7 @@ import { SetStrikeThroughCommand, SetUnderlineCommand, } from '@univerjs/sheets'; -import { BuiltInUIPart, ComponentManager, ILayoutService, IShortcutService, IUIPartsService } from '@univerjs/ui'; +import { BuiltInUIPart, ComponentManager, ILayoutService, IMenuManagerService, IShortcutService, IUIPartsService } from '@univerjs/ui'; import { IRenderManagerService } from '@univerjs/engine-render'; import { DocSelectionRenderService } from '@univerjs/docs-ui';