Skip to content

Commit

Permalink
fix: rebase dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Jocs committed Sep 6, 2024
1 parent a0f3bbb commit 60ca259
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -30,7 +30,7 @@ export const AddDocHyperLinkCommand: ICommand<IAddDocHyperLinkCommandParams> = {
return false;
}

const { payload, unitId } = params;
const { payload } = params;
const commandService = accessor.get(ICommandService);
const id = generateRandomId();
const doMutation = addCustomRangeBySelectionFactory(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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();

Expand All @@ -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();
Expand Down
7 changes: 2 additions & 5 deletions packages/docs-ui/src/controllers/app-ui-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
2 changes: 1 addition & 1 deletion packages/docs-ui/src/controllers/doc-ui.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
71 changes: 25 additions & 46 deletions packages/docs-ui/src/controllers/menu.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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]: {
Expand Down
9 changes: 3 additions & 6 deletions packages/docs-ui/src/docs-ui-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -223,19 +221,18 @@ 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
[IDocClipboardService, { useClass: DocClipboardService }],
[DocCanvasPopManagerService],
[DocsRenderService],
[DocStateChangeManagerService],
[DocCustomRangeService],
[DocAutoFormatService],
];

Expand Down
1 change: 0 additions & 1 deletion packages/docs-ui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 1 addition & 3 deletions packages/docs-ui/src/services/clipboard/clipboard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/sheets-ui/src/controllers/sheet-ui.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 60ca259

Please sign in to comment.