8000 fix: replace the Codicon.gear.classNames with codicon string by wewoor · Pull Request #847 · DTStack/molecule · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: replace the Codicon.gear.classNames with codicon string #847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
jobs:
setup:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]

steps:
- name: checkout
uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ coverage
.DS_Store
storybook-static
.yarn-error.log
.yarn
lib
docs/api

Expand Down
29 changes: 29 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.github
.history
.storybook
.vscode
.yarn
coverage
mock
node_modules
scripts
src
stories
test
website

.eslintrc.js
.gitignore
.prettierignore
.prettierrc.json
.stylelintrc.json
.yarnrc
.yarnrc.yml
babel.config.json
CODE_OF_CONDUCT.md
commitlint.config.js
CONTRIBUTING.md
jest.config.js
MIGRATION.md
pnpm-lock.yaml
yarn.lock
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.3.2](https://github.com/DTStack/molecule/compare/v1.2.0...v1.3.2) (2023-04-03)

### Features

- develop auxiliary bar ([#833](https://github.com/DTStack/molecule/issues/833)) ([cfd7c7c](https://github.com/DTStack/molecule/commit/cfd7c7cebbacbbc2893e69b0934b4724eac5b24c))
- develop scrollBar to replace scrollable component ([#826](https://github.com/DTStack/molecule/issues/826)) ([a276038](https://github.com/DTStack/molecule/commit/a27603864143596d4169e670ffe4b387d795de1a))
- support to set the direction of editor group ([#822](https://github.com/DTStack/molecule/issues/822)) ([f0ca348](https://github.com/DTStack/molecule/commit/f0ca348ec82b43fc2dfb3556dcd0ea087b251f94))

### Bug Fixes

- adjust the order of controller ([#831](https://github.com/DTStack/molecule/issues/831)) ([8a63067](https://github.com/DTStack/molecule/commit/8a630677d9a509951109fead67a11f8cb91d90ed))
- can't prevent close tab with confirm ([#828](https://github.com/DTStack/molecule/issues/828)) ([9418d40](https://github.com/DTStack/molecule/commit/9418d40d6767ec05d83f150bb5ede371e9dadd75))
- fix lost open animation of collapse ([#827](https://github.com/DTStack/molecule/issues/827)) ([d1cdbe1](https://github.com/DTStack/molecule/commit/d1cdbe110ea1f82615945789d23585c39adde11a))
- get container after Workbench is mounted ([#848](https://github.com/DTStack/molecule/issues/848)) ([222e536](https://github.com/DTStack/molecule/commit/222e53688cfada84ffe38ef9ecebd3a21cde8655))
- improve the style of edit's input ([#838](https://github.com/DTStack/molecule/issues/838)) ([534b050](https://github.com/DTStack/molecule/commit/534b050d756680b320262eaa1473f05ff7e87082))
- remove contextView warning in console ([#832](https://github.com/DTStack/molecule/issues/832)) ([2cf87db](https://github.com/DTStack/molecule/commit/2cf87db11b6ec9d310d6fae59f4500f91cb69bad))
- update the previewUrl of online-code-formatting ([#844](https://github.com/DTStack/molecule/issues/844)) ([bc31969](https://github.com/DTStack/molecule/commit/bc31969e6100564df349ebf61743583ddb399d68))

## [1.3.0](https://github.com/DTStack/molecule/compare/v1.2.0...v1.3.0) (2022-12-16)

### Features
Expand Down
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
'!src/index.ts',
'!src/extensions/**',
],
transformIgnorePatterns: ['node_modules/(?!(monaco-editor|.*dnd.*)/)'],
transformIgnorePatterns: ['/node_modules/(?!(.*monaco-editor|.*dnd.*)/)'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dtinsight/molecule",
"version": "1.3.0",
"version": "1.3.2",
"description": "A Web IDE UI Framework built with React.js, inspired by VSCode.",
"module": "./esm/index.js",
"typings": "./esm/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion scripts/release.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const pkg = require(pkgPath);
process.exit(1);
}
// use npm pack --dry-run to check publish pack
await $`npm publish`;
await $`npm publish -otp=${await question('Input the OTP: ')}`;
succeeDoneLog();

infoLog(`10. git push`);
Expand Down
8 changes: 8 additions & 0 deletions src/controller/__tests__/layout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ const layoutController = container.resolve(LayoutController);
const layoutService = container.resolve(LayoutService);

describe('The layout controller', () => {
test('Should support to listen to the Workbench did mount event', () => {
const mockFn = jest.fn();
layoutService.onWorkbenchDidMount(mockFn);
layoutController.onWorkbenchDidMount();

expect(mockFn).toBeCalled();
});

test('Should support to execute onPaneSizeChange', () => {
const original = layoutService.setPaneSize;
const mockFn = jest.fn();
Expand Down
6 changes: 6 additions & 0 deletions src/controller/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import 'reflect-metadata';
import { container, singleton } from 'tsyringe';
import { Controller } from 'mo/react/controller';
import { ILayoutService, LayoutService } from 'mo/services';
import { LayoutEvents } from 'mo/model/workbench/layout';

export interface ILayoutController extends Partial<Controller> {
onWorkbenchDidMount?: () => void;
onPaneSizeChange?: (splitPanePos: number[]) => void;
onHorizontalPaneSizeChange?: (horizontalSplitPanePos: number[]) => void;
}
Expand All @@ -26,4 +28,8 @@ export class LayoutController extends Controller implements ILayoutController {
public number[]) => {
this.layoutService.setHorizontalPaneSize(horizontalSplitPanePos);
};

public => {
this.layoutService.emit(LayoutEvents.OnWorkbenchDidMount);
};
}
4 changes: 4 additions & 0 deletions src/model/workbench/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ export enum MenuBarMode {
vertical = 'vertical',
}

export enum LayoutEvents {
>
}

export interface ViewVisibility {
hidden: boolean;
}
Expand Down
3 changes: 1 addition & 2 deletions src/monaco/quickAccessViewAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/com
import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands';
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry';
import { INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification';
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons';
import { TriggerAction } from 'monaco-editor/esm/vs/platform/quickinput/browser/pickerQuickAccess';
import {
MenuId,
Expand Down Expand Up @@ -81,7 +80,7 @@ export class CommandQuickAccessProvider extends AbstractEditorCommandsQuickAcces
...c,
buttons: [
{
iconClass: Codicon.gear.classNames,
iconClass: 'codicon codicon-gear',
tooltip: localize(
'configure keybinding',
'Configure Keybinding'
Expand Down
6 changes: 3 additions & 3 deletions src/provider/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface IConfigProps {
defaultLocale?: string;
}

namespace stanalone {
namespace standalone {
let instance: InstanceService | null = null;

/**
Expand All @@ -37,12 +37,12 @@ namespace stanalone {
}

export default function create(config: IConfigProps) {
return stanalone.create(config);
return standalone.create(config);
}

/**
* Do NOT call it in production, ONLY used for test cases
*/
export function clearInstance() {
stanalone.clearInstance();
standalone.clearInstance();
}
11 changes: 10 additions & 1 deletion src/services/__tests__/layoutService.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ID_APP } from 'mo/common/id';
import { MenuBarMode, Position } from 'mo/model/workbench/layout';
import { LayoutEvents, MenuBarMode, Position } from 'mo/model/workbench/layout';
import 'reflect-metadata';
import { container } from 'tsyringe';
import { LayoutService } from '../workbench';
Expand Down Expand Up @@ -143,5 +143,14 @@ describe('The layout service', () => {
layoutService.setAuxiliaryBar((pre) => !pre);
expect(layoutService.getState().auxiliaryBar.hidden).toBe(true);
});

test('Should support to listen to the Workbench did mount event', () => {
const mockFn = jest.fn();
layoutService.onWorkbenchDidMount(mockFn);

layoutService.emit(LayoutEvents.OnWorkbenchDidMount);

expect(mockFn).toBeCalled();
});
});
});
6 changes: 5 additions & 1 deletion src/services/instanceService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ export default class InstanceService
this.emit(InstanceHookKind.beforeLoad);
molecule.extension.load(others);

molecule.monacoService.initWorkspace(molecule.layout.container!);
molecule.layout.onWorkbenchDidMount(() => {
molecule.monacoService.initWorkspace(
molecule.layout.container!
);
});
this.rendered = true;
}

Expand Down
10 changes: 10 additions & 0 deletions src/services/workbench/layoutService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Position,
LayoutModel,
MenuBarMode,
LayoutEvents,
} from 'mo/model/workbench/layout';
import { MenuBarEvent } from 'mo/model/workbench/menuBar';

Expand Down Expand Up @@ -87,6 +88,11 @@ export interface ILayoutService extends Component<ILayout> {
* Reset all layout data as default value
*/
reset(): void;
/**
* Listen to the workbench did mount event
* @param callback callback function
*/
onWorkbenchDidMount(callback: Function): void;
}

@singleton()
Expand All @@ -101,6 +107,10 @@ export class LayoutService
this.state = container.resolve(LayoutModel);
}

public onWorkbenchDidMount(callback: Function): void {
this.subscribe(LayoutEvents.OnWorkbenchDidMount, callback);
}

public get container() {
// Make sure to get the latest dom element.
this._container = document.getElementById(ID_APP) || document.body;
Expand Down
8 changes: 7 additions & 1 deletion src/workbench/workbench.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'reflect-metadata';
import React from 'react';
import React, { useEffect } from 'react';
import { container } from 'tsyringe';

import {
Expand Down Expand Up @@ -60,6 +60,7 @@ export function WorkbenchView(props: IWorkbench & ILayout & ILayoutController) {
sidebar,
statusBar,
onPaneSizeChange,
onWorkbenchDidMount,
onHorizontalPaneSizeChange,
splitPanePos,
horizontalSplitPanePos,
Expand Down Expand Up @@ -122,6 +123,11 @@ export function WorkbenchView(props: IWorkbench & ILayout & ILayoutController) {
hideStatusBar
);

useEffect(() => {
// call onWorkbenchDidMount after the first render
onWorkbenchDidMount?.();
}, []);

return (
<div id={ID_APP} className={appClassName} tabIndex={0}>
<div className={workbenchFinalClassName}>
Expand Down
38 changes: 28 additions & 10 deletions stories/workbench/0-Workbench.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,35 @@ moInstance.onBeforeInit(() => {
molecule.builtin.inactiveModule('activityBarData');
});

export const IDEDemo = () => moInstance.render(<Workbench />);

IDEDemo.story = {
name: 'Workbench',
export default {
title: 'Workbench',
};

if (module.hot) {
module.hot.accept();
}
export const NormalWorkbench = () => moInstance.render(<Workbench />);

export default {
title: 'Workbench',
component: IDEDemo,
export const EmbeddedWorkbench = () => {
return (
<div
style={{
position: 'absolute',
width: '100%',
height: '100%',
top: 0,
left: 0,
}}
>
<h1 style={{ textAlign: 'center', lineHeight: '40px' }}>
Embedded
</h1>
<div
style={{
position: 'relative',
width: '100%',
height: 'calc(100% - 40px)',
}}
>
{moInstance.render(<Workbench />)}
</div>
</div>
);
};
Loading
0