|
|
@@ -1,6 +1,6 @@
|
|
|
import molecule from "@dtinsight/molecule";
|
|
|
-import {ColorThemeMode, IActivityMenuItemProps} from "@dtinsight/molecule/esm/model";
|
|
|
-import {DRAWER_MENU_ENUM, ID_COLLECTIONS} from "../constant";
|
|
|
+import {ColorThemeMode, IActivityMenuItemProps, IEditorGroup} from "@dtinsight/molecule/esm/model";
|
|
|
+import {DRAWER_MENU_ENUM, ID_COLLECTIONS, OPEN_IN_NEW_GROUP, QUESTION_LIST_PANEL} from "../constant";
|
|
|
import {UniqueId} from "@dtinsight/molecule/esm/common/types";
|
|
|
import {IExtension} from "@dtinsight/molecule/esm/model/extension";
|
|
|
import LogPane from "@/components/logPane";
|
|
|
@@ -9,12 +9,14 @@ import {jumpToLogin} from "@/services/auth";
|
|
|
import Api from "@/api";
|
|
|
import {history} from "umi";
|
|
|
import notification from "@/components/notification";
|
|
|
-import {deleteCookie, getQuestion, goToLogin, updateAccountContext} from "@/utils";
|
|
|
+import {deleteCookie, getQuestion, goToLogin, randomId, updateAccountContext} from "@/utils";
|
|
|
import {loadUser} from "@/redux/action/action";
|
|
|
import {QuickTogglePanelAction} from "@dtinsight/molecule/esm/monaco/quickTogglePanelAction";
|
|
|
import {Button} from "antd";
|
|
|
import {jumpToCoder} from "@/services/exam";
|
|
|
import classNames from "classnames";
|
|
|
+import {transformToEditorTab} from "@/common";
|
|
|
+import {QuestionList} from "@/components/questionListPanel";
|
|
|
|
|
|
function loadStyles(url: string) {
|
|
|
const link = document.createElement('link');
|
|
|
@@ -109,11 +111,17 @@ function initMenuBar() {
|
|
|
}
|
|
|
|
|
|
function initExpandCollapse() {
|
|
|
- const { SAMPLE_FOLDER_PANEL_ID, EDITOR_PANEL_ID } = molecule.builtin.getConstants();
|
|
|
- molecule.explorer.setExpandedPanels([EDITOR_PANEL_ID!, SAMPLE_FOLDER_PANEL_ID!]);
|
|
|
+ const { SAMPLE_FOLDER_PANEL_ID } = molecule.builtin.getConstants();
|
|
|
+ molecule.explorer.setExpandedPanels([SAMPLE_FOLDER_PANEL_ID!, QUESTION_LIST_PANEL.id]);
|
|
|
}
|
|
|
|
|
|
function initExplorer() {
|
|
|
+ molecule.explorer.addPanel({
|
|
|
+ ...QUESTION_LIST_PANEL,
|
|
|
+ renderPanel:() => (
|
|
|
+ <QuestionList store={store}/>
|
|
|
+ ),
|
|
|
+ })
|
|
|
const explorerData = molecule.explorer.getState().data?.concat() || [];
|
|
|
const { SAMPLE_FOLDER_PANEL_ID, EDITOR_PANEL_ID } = molecule.builtin.getConstants();
|
|
|
const folderTreePane = explorerData.find((item) => item.id === SAMPLE_FOLDER_PANEL_ID);
|
|
|
@@ -142,12 +150,32 @@ function initExplorer() {
|
|
|
molecule.editorTree.onCloseSaved((groupId) => {
|
|
|
molecule.editor.closeAll(groupId);
|
|
|
});
|
|
|
- molecule.folderTree.setFileContextMenu([])
|
|
|
+ molecule.folderTree.setFileContextMenu([OPEN_IN_NEW_GROUP])
|
|
|
+ molecule.folderTree.onContextMenu((contextMenu, treeNode) => {
|
|
|
+ switch (contextMenu.id) {
|
|
|
+ case OPEN_IN_NEW_GROUP.id: {
|
|
|
+ const { groups = [] } = molecule.editor.getState();
|
|
|
+ const id = randomId();
|
|
|
+ const initialTab = Object.assign({}, transformToEditorTab(treeNode!));
|
|
|
+ const newGroup: IEditorGroup = Object.assign({})
|
|
|
+ newGroup.data = [initialTab];
|
|
|
+ newGroup.tab = initialTab;
|
|
|
+ newGroup.activeTab = initialTab.id;
|
|
|
+ newGroup.id = id;
|
|
|
+ molecule.editor.setState({
|
|
|
+ current: newGroup,
|
|
|
+ groups: [...groups, newGroup]
|
|
|
+ })
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ })
|
|
|
molecule.folderTree.setFolderContextMenu([])
|
|
|
const folderTreeState = molecule.folderTree.getState()
|
|
|
const folderTree = folderTreeState?.folderTree
|
|
|
if (folderTree && folderTreeState && folderTree.contextMenu) folderTree.contextMenu = []
|
|
|
- console.log(molecule.folderTree.getState())
|
|
|
}
|
|
|
|
|
|
function initializeEntry() {
|