diff --git a/packages-experimental/uni-docs-ui/src/controllers/menu.ts b/packages-experimental/uni-docs-ui/src/controllers/menu.ts index 0ba28f54b159..833ecf881357 100644 --- a/packages-experimental/uni-docs-ui/src/controllers/menu.ts +++ b/packages-experimental/uni-docs-ui/src/controllers/menu.ts @@ -214,15 +214,15 @@ function getTableDisabledObservable(accessor: IAccessor): Observable { } const textRange = textRanges[0]; - const { collapsed, anchorNodePosition } = textRange; + const { collapsed, startNodePosition } = textRange; if (!collapsed) { subscriber.next(true); return; } - if (anchorNodePosition != null) { - const { path } = anchorNodePosition; + if (startNodePosition != null) { + const { path } = startNodePosition; // TODO: Not support insert table in table cell now. if (path.indexOf('cells') !== -1) { diff --git a/packages/debugger/package.json b/packages/debugger/package.json index bced96ac48fa..d1e9b470e2b1 100644 --- a/packages/debugger/package.json +++ b/packages/debugger/package.json @@ -58,7 +58,6 @@ "@univerjs/core": "workspace:*", "@univerjs/design": "workspace:*", "@univerjs/engine-render": "workspace:*", - "@univerjs/protocol": "0.1.39-alpha.15", "@univerjs/sheets": "workspace:*", "@univerjs/sheets-drawing-ui": "workspace:*", "@univerjs/ui": "workspace:*", 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 27e3e02d0162..b6b4f2bcdd68 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 b1e1176a6591..e84e367fa916 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/commands/util.ts b/packages/docs-ui/src/commands/util.ts index dc2f27cb0f69..0d846af52596 100644 --- a/packages/docs-ui/src/commands/util.ts +++ b/packages/docs-ui/src/commands/util.ts @@ -16,7 +16,7 @@ import { IRenderManagerService } from '@univerjs/engine-render'; import type { DocumentDataModel, IAccessor } from '@univerjs/core'; -import { DocSkeletonManagerService } from '../../../docs/src/services/doc-skeleton-manager.service'; +import { DocSkeletonManagerService } from '@univerjs/docs'; /** * Get the skeleton of the command's target. diff --git a/packages/docs-ui/src/controllers/app-ui-controller.ts b/packages/docs-ui/src/controllers/app-ui-controller.ts index 6bf95df72321..d83dd7f3ca6a 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 c71c5d22e6e7..acba681f1c34 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 93cfcf7f1a3d..bd220d88ed1d 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/controllers/render-controllers/doc-ime-input.controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-ime-input.controller.ts index 3b1a9e2ada0c..2281de03a73b 100644 --- a/packages/docs-ui/src/controllers/render-controllers/doc-ime-input.controller.ts +++ b/packages/docs-ui/src/controllers/render-controllers/doc-ime-input.controller.ts @@ -26,8 +26,8 @@ import type { IRenderContext, IRenderModule } from '@univerjs/engine-render'; import { IRenderManagerService } from '@univerjs/engine-render'; import type { Subscription } from 'rxjs'; +import { DocSkeletonManagerService } from '@univerjs/docs'; import { IMEInputCommand } from '../../commands/commands/ime-input.command'; -import { DocSkeletonManagerService } from '../../../../docs/src/services/doc-skeleton-manager.service'; import { DocIMEInputManagerService } from '../../services/doc-ime-input-manager.service'; import type { IEditorInputConfig } from '../../services/selection/doc-selection-render.service'; import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service'; diff --git a/packages/docs-ui/src/docs-ui-plugin.ts b/packages/docs-ui/src/docs-ui-plugin.ts index 859fe8b8792a..903a063583df 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 cabe94f1406b..5d2f4fb2810e 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 1ef10cde8405..03a72534c94b 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/docs/package.json b/packages/docs/package.json index 9a288f5de625..4d07dc6da5f6 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -61,7 +61,6 @@ }, "peerDependencies": { "@univerjs/core": "workspace:*", - "@univerjs/docs": "workspace:*", "@univerjs/engine-render": "workspace:*", "rxjs": ">=7.0.0" }, diff --git a/packages/docs/tsconfig.json b/packages/docs/tsconfig.json index 47818c63ee9e..d676ad2a20dc 100644 --- a/packages/docs/tsconfig.json +++ b/packages/docs/tsconfig.json @@ -4,5 +4,6 @@ "rootDir": "src", "outDir": "lib/types" }, - "references": [{ "path": "./tsconfig.node.json" }] + "references": [{ "path": "./tsconfig.node.json" }], + "include": ["src"] } diff --git a/packages/facade/package.json b/packages/facade/package.json index d7d08bd610d9..646884fdd6f8 100644 --- a/packages/facade/package.json +++ b/packages/facade/package.json @@ -62,7 +62,7 @@ "peerDependencies": { "@univerjs/core": "workspace:*", "@univerjs/data-validation": "workspace:*", - "@univerjs/docs": "workspace:*", + "@univerjs/docs-ui": "workspace:*", "@univerjs/engine-formula": "workspace:*", "@univerjs/engine-render": "workspace:*", "@univerjs/network": "workspace:*", diff --git a/packages/facade/src/apis/sheets/f-workbook.ts b/packages/facade/src/apis/sheets/f-workbook.ts index 2d30fcb7c79a..87f115d2d188 100644 --- a/packages/facade/src/apis/sheets/f-workbook.ts +++ b/packages/facade/src/apis/sheets/f-workbook.ts @@ -38,10 +38,10 @@ import type { ICanvasFloatDom } from '@univerjs/sheets-drawing-ui'; import type { IAddSheetDataValidationCommandParams, IDataValidationResCache, IRemoveSheetAllDataValidationCommandParams, IRemoveSheetDataValidationCommandParams, IUpdateSheetDataValidationOptionsCommandParams, IUpdateSheetDataValidationRangeCommandParams, IUpdateSheetDataValidationSettingCommandParams } from '@univerjs/sheets-data-validation'; import { AddSheetDataValidationCommand, DataValidationModel, RemoveSheetAllDataValidationCommand, RemoveSheetDataValidationCommand, SheetsDataValidationValidatorService, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand } from '@univerjs/sheets-data-validation'; import type { IRuleChange, IValidStatusChange } from '@univerjs/data-validation'; -import type { IUpdateCommandParams } from '@univerjs/docs'; import type { CommentUpdate, IAddCommentCommandParams, IDeleteCommentCommandParams } from '@univerjs/thread-comment'; import { AddCommentCommand, DeleteCommentCommand, DeleteCommentTreeCommand, ThreadCommentModel, UpdateCommentCommand } from '@univerjs/thread-comment'; import { filter } from 'rxjs'; +import type { IUpdateCommandParams } from '@univerjs/docs-ui'; import type { IFComponentKey } from './utils'; import { FWorksheet } from './f-worksheet'; import { FRange } from './f-range'; diff --git a/packages/sheets-data-validation/package.json b/packages/sheets-data-validation/package.json index 7aeab901e78a..bfde56013e51 100644 --- a/packages/sheets-data-validation/package.json +++ b/packages/sheets-data-validation/package.json @@ -66,6 +66,7 @@ "@univerjs/data-validation": "workspace:*", "@univerjs/design": "workspace:*", "@univerjs/docs": "workspace:*", + "@univerjs/docs-ui": "workspace:*", "@univerjs/engine-formula": "workspace:*", "@univerjs/engine-render": "workspace:*", "@univerjs/sheets": "workspace:*", @@ -86,6 +87,7 @@ "@univerjs/data-validation": "workspace:*", "@univerjs/design": "workspace:*", "@univerjs/docs": "workspace:*", + "@univerjs/docs-ui": "workspace:*", "@univerjs/engine-formula": "workspace:*", "@univerjs/engine-render": "workspace:*", "@univerjs/shared": "workspace:*", diff --git a/packages/sheets-ui/src/controllers/sheet-ui.controller.ts b/packages/sheets-ui/src/controllers/sheet-ui.controller.ts index 0c22593572fc..06044cefd1e4 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'; diff --git a/packages/telemetry/package.json b/packages/telemetry/package.json index b172567dcd82..ed09b0a9015e 100644 --- a/packages/telemetry/package.json +++ b/packages/telemetry/package.json @@ -56,10 +56,7 @@ "build": "tsc && vite build" }, "peerDependencies": { - "@univerjs/core": "workspace:*", - "@univerjs/docs": "workspace:*", - "@univerjs/docs-ui": "workspace:*", - "rxjs": ">=7.0.0" + "@univerjs/core": "workspace:*" }, "devDependencies": { "@univerjs/core": "workspace:*", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9a4664014294..b343fbf509b5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -810,9 +810,6 @@ importers: '@univerjs/design': specifier: workspace:* version: link:../design - '@univerjs/protocol': - specifier: 0.1.39-alpha.15 - version: 0.1.39-alpha.15(@grpc/grpc-js@1.10.9)(rxjs@7.8.1) react: specifier: ^16.9.0 || ^17.0.0 || ^18.0.0 version: 18.3.1 @@ -962,10 +959,6 @@ importers: version: 2.0.5(@types/node@22.5.2)(happy-dom@15.0.0)(jsdom@24.1.1)(less@4.2.0)(sass@1.77.5)(terser@5.31.6) packages/docs: - dependencies: - '@univerjs/docs': - specifier: workspace:* - version: 'link:' devDependencies: '@univerjs/core': specifier: workspace:* @@ -1876,6 +1869,9 @@ importers: '@univerjs/docs': specifier: workspace:* version: link:../docs + '@univerjs/docs-ui': + specifier: workspace:* + version: link:../docs-ui '@univerjs/engine-formula': specifier: workspace:* version: link:../engine-formula