Skip to content

Commit

Permalink
feat: upgrade the molecule to latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
wewoor committed Jan 6, 2023
1 parent e1d3d01 commit 377590d
Show file tree
Hide file tree
Showing 4 changed files with 304 additions and 641 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@babel/preset-env": "^7.12.16",
"@babel/preset-react": "^7.12.13",
"@babel/preset-typescript": "^7.12.16",
"@dtinsight/molecule": "^0.9.0-beta.1",
"@dtinsight/molecule": "^1.3.0",
"@jcubic/lips": "^1.0.0-beta.14",
"@types/tape": "^4.13.0",
"babel-loader": "^8.2.2",
Expand Down
12 changes: 6 additions & 6 deletions web/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { MoleculeProvider, Workbench } from '@dtinsight/molecule';
import { create, Workbench } from '@dtinsight/molecule';
import '@dtinsight/molecule/esm/style/mo.css';
import { ExtendsWorkbench } from './extensions/workbench';

Expand Down Expand Up @@ -35,10 +35,10 @@ window.MonacoEnvironment = {
}
};

const App = () => (
<MoleculeProvider extensions={[ExtendsWorkbench]}>
<Workbench />
</MoleculeProvider>
);
const moInstance = create({
extensions: [ExtendsWorkbench]
});

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

ReactDOM.render(<App />, document.getElementById('root'));
18 changes: 8 additions & 10 deletions web/extensions/workbench/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ export default class Sidebar extends React.Component {
}, 200);

convertMsgToProblemItem = (tab: IEditorTab, code, msgs = []): IProblemsItem => {
const rootId = Number(tab.id);
const rootId = tab.id;
const rootName = `${tab.name || ''}`;
const languageProblems: IProblemsItem = {
id: rootId,
name: rootName,
isLeaf: false,
value: {
code: rootName,
message: '',
Expand All @@ -67,15 +68,16 @@ export default class Sidebar extends React.Component {

languageProblems.children = msgs.map((msg: any, index: number) => {
return {
id: rootId + index,
name: code || '',
id: `${rootId}-${index}`,
name: msg.code || '',
isLeaf: true,
value: {
code: '',
code: msg.code,
message: msg.message,
startLineNumber: Number(msg.startLine),
startColumn: Number(msg.startCol),
endLineNumber: Number(msg.endLine),
endColumn: Number(msg.endLine),
endColumn: Number(msg.endCol),
status: MarkerSeverity.Error
},
children: []
Expand Down Expand Up @@ -129,11 +131,7 @@ export default class Sidebar extends React.Component {

renderColorThemes() {
const options = languages.map((language: string) => {
return (
<Option key={language} value={language}>
{language}
</Option>
);
return <Option value={language}>{language}</Option>;
});
return (
<Select
Expand Down
Loading

0 comments on commit 377590d

Please sign in to comment.