Skip to content

Commit

Permalink
fix: improve interface name
Browse files Browse the repository at this point in the history
  • Loading branch information
mortalYoung committed Jul 15, 2021
1 parent a225911 commit 0f6058a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/controller/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
EDITOR_MENU_CLOSE_TO_RIGHT,
EDITOR_MENU_CLOSE_TO_LEFT,
EDITOR_MENU_CLOSE_ALL,
EditorActionsProps,
IEditorActionsProps,
EDITOR_MENU_SHOW_OPENEDITORS,
EDITOR_MENU_SPILIT,
} from 'mo/model/workbench/editor';
Expand Down Expand Up @@ -50,7 +50,7 @@ export interface IEditorController {
) => void;
onMoveTab?: <T = any>(updateTabs: IEditorTab<T>[], group: number) => void;
onSelectTab?: (tabId: string, group: number) => void;
onClickActions: (action: EditorActionsProps) => void;
onClickActions: (action: IEditorActionsProps) => void;
onUpdateEditorIns?: (editorInstance: any, groupId: number) => void;
onPaneSizeChange?: (newSize: number) => void;
}
Expand Down Expand Up @@ -193,7 +193,7 @@ export class EditorController extends Controller implements IEditorController {
});
};

public onClickActions = (action: EditorActionsProps) => {
public onClickActions = (action: IEditorActionsProps) => {
const { current } = this.editorService.getState();
if (!current) return;

Expand Down
12 changes: 6 additions & 6 deletions src/model/workbench/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface BuiltInEditorTabDataType {
modified?: boolean;
}

export interface EditorActionsProps extends IMenuItemProps {
export interface IEditorActionsProps extends IMenuItemProps {
id: string;
/**
* Mark the action placed in More menus or outer
Expand All @@ -36,7 +36,7 @@ export interface IEditorTab<T = BuiltInEditorTabDataType> extends ITabProps<T> {
breadcrumb?: IBreadcrumbItemProps[];
}
export interface IEditorAction {
actions?: EditorActionsProps[];
actions?: IEditorActionsProps[];
menu?: IMenuItemProps[];
}
export interface IEditorGroup<E = any, T = any> extends ITabsProps<T> {
Expand All @@ -45,7 +45,7 @@ export interface IEditorGroup<E = any, T = any> extends ITabsProps<T> {
* Current editor group tab
*/
tab?: IEditorTab<T>;
actions?: EditorActionsProps[];
actions?: IEditorActionsProps[];
menu?: IMenuItemProps[];
editorInstance?: E;
}
Expand Down Expand Up @@ -76,7 +76,7 @@ export function getBaseMenu() {
];
}

export function getEditorInitialActions(): EditorActionsProps[] {
export function getEditorInitialActions(): IEditorActionsProps[] {
return [
{
id: EDITOR_MENU_SPILIT,
Expand Down Expand Up @@ -118,15 +118,15 @@ export class EditorGroupModel<E = any, T = any> implements IEditorGroup<E, T> {
id: number;
tab: IEditorTab<T>;
data: IEditorTab<T>[];
actions: EditorActionsProps[];
actions: IEditorActionsProps[];
menu: IMenuItemProps[];
editorInstance: E | undefined;

constructor(
id: number,
tab: IEditorTab<T>,
data: IEditorTab<T>[],
actions: EditorActionsProps[] = getEditorInitialActions(),
actions: IEditorActionsProps[] = getEditorInitialActions(),
menu: IMenuItemProps[] = getEditorInitialMenu(),
editorInstance?: E
) {
Expand Down
12 changes: 4 additions & 8 deletions src/services/workbench/editorService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
IEditorTab,
EditorEvent,
getEditorInitialActions,
EditorActionsProps,
IEditorActionsProps,
} from 'mo/model';
import { searchById } from '../helper';
import { editor as monacoEditor, Uri } from 'mo/monaco';
Expand Down Expand Up @@ -74,7 +74,7 @@ export interface IEditorService extends Component<IEditor> {
/**
* Set default actions when create a new group
*/
setDefaultActions(actions: EditorActionsProps[]): void;
setDefaultActions(actions: IEditorActionsProps[]): void;
/**
* Update actions in specific group
*/
Expand All @@ -90,7 +90,7 @@ export class EditorService
extends Component<IEditor>
implements IEditorService {
protected state: IEditor;
protected defaultActions: EditorActionsProps[];
protected defaultActions: IEditorActionsProps[];
constructor() {
super();
this.state = container.resolve(EditorModel);
Expand All @@ -109,11 +109,7 @@ export class EditorService
return groups.some((group) => this.getTabById(tabId, group));
}

public updateGroupActions(actions: IMenuItemProps[]): void {
this.groupActions = actions;
}

public setDefaultActions(actions: EditorActionsProps[]): void {
public setDefaultActions(actions: IEditorActionsProps[]): void {
this.defaultActions = actions;
}

Expand Down
8 changes: 4 additions & 4 deletions src/workbench/editor/action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { memo } from 'react';
import { Icon } from 'mo/components/icon';
import { Menu } from 'mo/components/menu';
import { DropDown, DropDownRef } from 'mo/components/dropdown';
import { EditorActionsProps, IEditorAction } from 'mo/model';
import { IEditorActionsProps, IEditorAction } from 'mo/model';
import {
groupActionItemDisabledClassName,
groupActionsClassName,
Expand All @@ -18,9 +18,9 @@ export interface IEditorActionProps extends IEditorAction {

const MAX_ACTIONS_LENGTH = 6;

function splitActions(actions: EditorActionsProps[]) {
const outerActions: EditorActionsProps[] = [];
const ellipsisActions: EditorActionsProps[] = [];
function splitActions(actions: IEditorActionsProps[]) {
const outerActions: IEditorActionsProps[] = [];
const ellipsisActions: IEditorActionsProps[] = [];

actions.forEach((action) => {
if (action.place === 'outer') {
Expand Down

0 comments on commit 0f6058a

Please sign in to comment.