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 9, 2024
1 parent 9b42945 commit 430390e
Show file tree
Hide file tree
Showing 23 changed files with 53 additions and 162 deletions.
6 changes: 3 additions & 3 deletions packages-experimental/uni-docs-ui/src/controllers/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,15 @@ function getTableDisabledObservable(accessor: IAccessor): Observable<boolean> {
}

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) {
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,6 @@ import type { IInnerCutCommandParams, IInnerPasteCommandParams } from '../clipbo
import { CutContentCommand, InnerPasteCommand } from '../clipboard.inner.command';
import { createCommandTestBed } from './create-command-test-bed';

// vi.mock('@univerjs/engine-render', async () => {
// const actual = await vi.importActual('@univerjs/engine-render');
// const { ITextSelectionRenderManager, TextSelectionRenderManager } = await import(
// './mock-text-selection-render-manager'
// );

// return {
// ...actual,
// ITextSelectionRenderManager,
// TextSelectionRenderManager,
// };
// });

function getDocumentData() {
const TEST_DOCUMENT_DATA_EN: IDocumentData = {
id: 'test-doc',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,6 @@ import {
} from '../inline-format.command';
import { createCommandTestBed } from './create-command-test-bed';

// vi.mock('@univerjs/engine-render', async () => {
// const actual = await vi.importActual('@univerjs/engine-render');
// const { ITextSelectionRenderManager, TextSelectionRenderManager } = await import(
// './mock-text-selection-render-manager'
// );

// return {
// ...actual,
// ITextSelectionRenderManager,
// TextSelectionRenderManager,
// };
// });

describe('Test inline format commands', () => {
let univer: Univer;
let get: Injector['get'];
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,6 @@ import { DocSelectionManagerService, RichTextEditingMutation, SetTextSelectionsO
import { CoverContentCommand, ReplaceContentCommand } from '../replace-content.command';
import { createCommandTestBed } from './create-command-test-bed';

// vi.mock('@univerjs/engine-render', async () => {
// const actual = await vi.importActual('@univerjs/engine-render');
// const { ITextSelectionRenderManager, TextSelectionRenderManager } = await import(
// './mock-text-selection-render-manager'
// );

// return {
// ...actual,
// ITextSelectionRenderManager,
// TextSelectionRenderManager,
// };
// });

function getDocumentData() {
const TEST_DOCUMENT_DATA_EN: IDocumentData = {
id: 'test-doc',
Expand Down
2 changes: 1 addition & 1 deletion packages/docs-ui/src/commands/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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
Original file line number Diff line number Diff line change
Expand Up @@ -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';
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
1 change: 0 additions & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
},
"peerDependencies": {
"@univerjs/core": "workspace:*",
"@univerjs/docs": "workspace:*",
"@univerjs/engine-render": "workspace:*",
"rxjs": ">=7.0.0"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/docs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"rootDir": "src",
"outDir": "lib/types"
},
"references": [{ "path": "./tsconfig.node.json" }]
"references": [{ "path": "./tsconfig.node.json" }],
"include": ["src"]
}
2 changes: 1 addition & 1 deletion packages/facade/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*",
Expand Down
Loading

0 comments on commit 430390e

Please sign in to comment.