From e3a0040020ad20aba85bab7267bc890ec92945ba Mon Sep 17 00:00:00 2001 From: Jason Date: Mon, 11 Dec 2023 21:36:38 +0800 Subject: [PATCH] code format&style fix --- src/_node/apis.ts | 2 +- src/_node/file/actions.ts | 3 +- src/_node/file/constants.ts | 1 - src/_node/file/index.ts | 1 - src/_node/file/types.ts | 3 +- src/_node/helpers.ts | 8 +- src/_node/node/actions.ts | 24 +++--- src/_node/node/helpers.ts | 3 +- src/_node/node/types.ts | 11 ++- src/_redux/global/constants.ts | 1 - src/_redux/global/index.ts | 1 - src/_redux/main/constants.ts | 1 - src/_redux/main/context.ts | 2 +- src/_redux/main/fileTree/slice.ts | 2 +- src/_redux/main/index.ts | 1 - src/_redux/main/nodeTree/constants.ts | 1 - src/_redux/main/nodeTree/event/slice.ts | 2 +- src/_redux/main/nodeTree/index.ts | 1 - src/_redux/main/processor/constants.ts | 1 - src/_redux/main/processor/index.ts | 1 - src/_redux/main/stageView/constants.ts | 1 - src/_redux/main/stageView/index.ts | 1 - src/_redux/main/types.ts | 5 +- src/components/common/loader/Loader.tsx | 3 +- .../main/actionsPanel/ActionsPanel.tsx | 3 +- .../navigatorPanel/NavigatorPanel.tsx | 2 +- .../components/AdditionalPanel.tsx | 2 +- .../components/DefaultPanel.tsx | 2 +- .../components/ProjectPanel.tsx | 2 +- .../navigatorPanel/helpers/helpers.ts | 9 +-- .../navigatorPanel/hooks/useFavicon.ts | 2 +- .../hooks/useNavigatorPanelHandlers.ts | 5 +- .../nodeTreeView/NodeTreeView.tsx | 6 +- .../nodeTreeView/hooks/useCmdk.ts | 4 +- .../hooks/useNodeActionsHandlers.ts | 8 +- .../nodeTreeView/hooks/useNodeTreeCallback.ts | 6 +- .../nodeTreeView/hooks/useNodeViewState.ts | 3 - .../nodeTreeComponents/NodeIcon.tsx | 1 + .../workspaceTreeView/WorkspaceTreeView.tsx | 6 +- .../workspaceTreeView/helpers/renameNode.ts | 2 +- .../helpers/validateAndMoveNode.ts | 2 +- .../workspaceTreeView/hooks/useCmdk.ts | 2 +- .../hooks/useFileOperations.ts | 2 +- .../hooks/useNodeActionsHandler.ts | 10 +-- .../hooks/useNodeViewState.ts | 2 +- src/components/main/codeView/CodeView.tsx | 2 +- .../main/codeView/hooks/useEditor.ts | 9 +-- .../main/stageView/iFrame/IFrame.tsx | 9 ++- .../main/stageView/iFrame/helpers.ts | 5 +- .../main/stageView/iFrame/hooks/useCmdk.ts | 5 +- .../stageView/iFrame/hooks/useMouseEvents.ts | 15 ++-- .../stageView/iFrame/hooks/useSyncNode.ts | 11 +-- src/pages/main/MainPage.tsx | 76 +++++++++++-------- src/pages/main/helper.ts | 10 +-- src/pages/main/processor/Processor.tsx | 10 ++- src/pages/main/processor/helpers.ts | 5 +- .../main/processor/hooks/useFileTreeEvent.ts | 1 + src/pages/main/processor/hooks/useHms.ts | 6 +- .../main/processor/hooks/useNodeTreeEvent.ts | 8 +- src/pages/main/processor/index.ts | 1 + src/services/htmlapi.ts | 3 +- 61 files changed, 178 insertions(+), 159 deletions(-) delete mode 100644 src/_node/file/constants.ts delete mode 100644 src/_redux/global/constants.ts delete mode 100644 src/_redux/main/constants.ts delete mode 100644 src/_redux/main/nodeTree/constants.ts delete mode 100644 src/_redux/main/processor/constants.ts delete mode 100644 src/_redux/main/stageView/constants.ts diff --git a/src/_node/apis.ts b/src/_node/apis.ts index fc78f36d..3b20c020 100644 --- a/src/_node/apis.ts +++ b/src/_node/apis.ts @@ -1,4 +1,4 @@ -import { doFileActions, doNodeActions } from "."; +import { doFileActions, doNodeActions } from "./"; export const callNodeApi = doNodeActions; export const callFileApi = doFileActions; diff --git a/src/_node/file/actions.ts b/src/_node/file/actions.ts index eaf5343d..e91e2974 100644 --- a/src/_node/file/actions.ts +++ b/src/_node/file/actions.ts @@ -1,5 +1,6 @@ import { LogAllow } from "@_constants/global"; -import { TFileApiPayload, TNodeApiPayload } from ".."; + +import { TFileApiPayload } from "../"; const add = () => {}; const remove = () => {}; diff --git a/src/_node/file/constants.ts b/src/_node/file/constants.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/src/_node/file/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/src/_node/file/index.ts b/src/_node/file/index.ts index d0fae368..ce5429ab 100644 --- a/src/_node/file/index.ts +++ b/src/_node/file/index.ts @@ -1,5 +1,4 @@ export * from "./types"; -export * from "./constants"; export * from "./apis"; export * from "./helpers"; export * from "./actions"; diff --git a/src/_node/file/types.ts b/src/_node/file/types.ts index a91947c7..60d1589e 100644 --- a/src/_node/file/types.ts +++ b/src/_node/file/types.ts @@ -1,5 +1,7 @@ import JSZip from "jszip"; +import { TOsType } from "@_redux/global"; + import { TBasicNodeData, TNode, @@ -7,7 +9,6 @@ import { TNodeTreeData, TNodeUid, } from "../"; -import { TOsType } from "@_redux/global"; export type TFileNode = TNode & { data: TFileNodeData; diff --git a/src/_node/helpers.ts b/src/_node/helpers.ts index a470256c..001c21ff 100644 --- a/src/_node/helpers.ts +++ b/src/_node/helpers.ts @@ -1,8 +1,10 @@ -import { RootNodeUid } from "@_constants/main"; +import { + AddNodeActionPrefix, + RenameNodeActionPrefix, + RootNodeUid, +} from "@_constants/main"; import { THtmlReferenceData } from "@_types/main"; -import { AddNodeActionPrefix, RenameNodeActionPrefix } from "@_constants/main"; - import { THtmlNodeData } from "./node"; import { TBasicNodeData, diff --git a/src/_node/node/actions.ts b/src/_node/node/actions.ts index b88ab8da..884e5a0b 100644 --- a/src/_node/node/actions.ts +++ b/src/_node/node/actions.ts @@ -1,27 +1,29 @@ -import { editor, Range } from "monaco-editor"; -import { - getNodeChildIndex, - TNodeApiPayload, - TNodeReferenceData, - TNodeTreeData, - TNodeUid, -} from ".."; import { html_beautify } from "js-beautify"; +import { editor, Range } from "monaco-editor"; + import { sortUidsByMaxEndIndex, sortUidsByMinStartIndex, } from "@_components/main/actionsPanel/nodeTreeView/helpers"; +import { LogAllow } from "@_constants/global"; import { AddNodeActionPrefix, DefaultTabSize, NodePathSplitter, RenameNodeActionPrefix, } from "@_constants/main"; -import { THtmlReferenceData } from "@_types/main"; -import { LogAllow } from "@_constants/global"; -import { copyCode, pasteCode, replaceContent } from "./helpers"; import { getValidNodeTree } from "@_pages/main/processor/helpers"; import { setNeedToSelectNodePaths } from "@_redux/main/nodeTree"; +import { THtmlReferenceData } from "@_types/main"; + +import { + getNodeChildIndex, + TNodeApiPayload, + TNodeReferenceData, + TNodeTreeData, + TNodeUid, +} from "../"; +import { copyCode, pasteCode, replaceContent } from "./helpers"; const add = ({ actionName, diff --git a/src/_node/node/helpers.ts b/src/_node/node/helpers.ts index c6f7e780..b0450edf 100644 --- a/src/_node/node/helpers.ts +++ b/src/_node/node/helpers.ts @@ -1,5 +1,6 @@ import { editor, Range } from "monaco-editor"; -import { TNodeTreeData, TNodeUid } from ".."; + +import { TNodeTreeData, TNodeUid } from "../"; export const copyCode = ({ nodeTree, diff --git a/src/_node/node/types.ts b/src/_node/node/types.ts index 55ccb421..10a673d4 100644 --- a/src/_node/node/types.ts +++ b/src/_node/node/types.ts @@ -1,13 +1,16 @@ +import { Dispatch } from "react"; + +import { editor } from "monaco-editor"; + import { TOsType } from "@_redux/global"; +import { AnyAction } from "@reduxjs/toolkit"; + import { TNodeActionType, TNodeReferenceData, TNodeTreeData, TNodeUid, -} from ".."; -import { editor } from "monaco-editor"; -import { Dispatch } from "react"; -import { AnyAction } from "@reduxjs/toolkit"; +} from "../"; export type TNodeApiPayloadBase = { dispatch: Dispatch; diff --git a/src/_redux/global/constants.ts b/src/_redux/global/constants.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/src/_redux/global/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/src/_redux/global/index.ts b/src/_redux/global/index.ts index d9281948..5a9b1dba 100644 --- a/src/_redux/global/index.ts +++ b/src/_redux/global/index.ts @@ -1,3 +1,2 @@ export * from "./types"; -export * from "./constants"; export * from "./slice"; diff --git a/src/_redux/main/constants.ts b/src/_redux/main/constants.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/src/_redux/main/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/src/_redux/main/context.ts b/src/_redux/main/context.ts index 9ef91b9c..1596752c 100644 --- a/src/_redux/main/context.ts +++ b/src/_redux/main/context.ts @@ -1,4 +1,4 @@ -import { Context, createContext, useRef } from "react"; +import { Context, createContext } from "react"; import { TMainContext } from "./types"; diff --git a/src/_redux/main/fileTree/slice.ts b/src/_redux/main/fileTree/slice.ts index afd54718..efc7da8e 100644 --- a/src/_redux/main/fileTree/slice.ts +++ b/src/_redux/main/fileTree/slice.ts @@ -1,4 +1,4 @@ -import { TFileNode, TFileNodeData, TFileNodeTreeData } from "@_node/index"; +import { TFileNode, TFileNodeTreeData } from "@_node/index"; import { TNodeUid } from "@_node/types"; import { createSlice, PayloadAction } from "@reduxjs/toolkit"; diff --git a/src/_redux/main/index.ts b/src/_redux/main/index.ts index fb4e9bec..0f743bbc 100644 --- a/src/_redux/main/index.ts +++ b/src/_redux/main/index.ts @@ -1,4 +1,3 @@ export * from "./types"; -export * from "./constants"; export * from "./slice"; export * from "./context"; diff --git a/src/_redux/main/nodeTree/constants.ts b/src/_redux/main/nodeTree/constants.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/src/_redux/main/nodeTree/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/src/_redux/main/nodeTree/event/slice.ts b/src/_redux/main/nodeTree/event/slice.ts index 1581c5c0..63beae08 100644 --- a/src/_redux/main/nodeTree/event/slice.ts +++ b/src/_redux/main/nodeTree/event/slice.ts @@ -1,7 +1,7 @@ import undoable from "redux-undo"; import { TNodeUid } from "@_node/types"; -import { createSlice, current, PayloadAction } from "@reduxjs/toolkit"; +import { createSlice, PayloadAction } from "@reduxjs/toolkit"; import { NodeTree_Event_ClearActionType, diff --git a/src/_redux/main/nodeTree/index.ts b/src/_redux/main/nodeTree/index.ts index f201a875..8db21402 100644 --- a/src/_redux/main/nodeTree/index.ts +++ b/src/_redux/main/nodeTree/index.ts @@ -1,4 +1,3 @@ export * from "./types"; -export * from "./constants"; export * from "./slice"; export * from "./event"; diff --git a/src/_redux/main/processor/constants.ts b/src/_redux/main/processor/constants.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/src/_redux/main/processor/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/src/_redux/main/processor/index.ts b/src/_redux/main/processor/index.ts index d9281948..5a9b1dba 100644 --- a/src/_redux/main/processor/index.ts +++ b/src/_redux/main/processor/index.ts @@ -1,3 +1,2 @@ export * from "./types"; -export * from "./constants"; export * from "./slice"; diff --git a/src/_redux/main/stageView/constants.ts b/src/_redux/main/stageView/constants.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/src/_redux/main/stageView/constants.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/src/_redux/main/stageView/index.ts b/src/_redux/main/stageView/index.ts index d9281948..5a9b1dba 100644 --- a/src/_redux/main/stageView/index.ts +++ b/src/_redux/main/stageView/index.ts @@ -1,3 +1,2 @@ export * from "./types"; -export * from "./constants"; export * from "./slice"; diff --git a/src/_redux/main/types.ts b/src/_redux/main/types.ts index b53cfb65..44ee9047 100644 --- a/src/_redux/main/types.ts +++ b/src/_redux/main/types.ts @@ -1,17 +1,16 @@ +import { MutableRefObject } from "react"; + import { editor } from "monaco-editor"; import { TFileHandlerCollection } from "@_node/file"; import { TNodeUid } from "@_node/types"; import { TCmdkReferenceData, - TCodeChange, TFilesReferenceData, THtmlReferenceData, } from "@_types/main"; import { TProjectContext } from "./fileTree"; -import { StageViewSyncConfigs } from "./stageView"; -import { MutableRefObject } from "react"; export type TEventHistoryInfo = { future: number; diff --git a/src/components/common/loader/Loader.tsx b/src/components/common/loader/Loader.tsx index 4a1729aa..ff9a99b5 100644 --- a/src/components/common/loader/Loader.tsx +++ b/src/components/common/loader/Loader.tsx @@ -2,9 +2,10 @@ import React, { useEffect, useState } from "react"; import LoadingBar from "react-top-loading-bar"; -import { LoaderProps } from "./types"; import { useAppState } from "@_redux/useAppState"; +import { LoaderProps } from "./types"; + export const Loader = ({ show }: LoaderProps) => { const { theme } = useAppState(); diff --git a/src/components/main/actionsPanel/ActionsPanel.tsx b/src/components/main/actionsPanel/ActionsPanel.tsx index e9fd4fd5..ddeb6524 100644 --- a/src/components/main/actionsPanel/ActionsPanel.tsx +++ b/src/components/main/actionsPanel/ActionsPanel.tsx @@ -1,11 +1,12 @@ import React, { useMemo } from "react"; +import { useAppState } from "@_redux/useAppState"; + import NavigatorPanel from "./navigatorPanel"; import NodeTreeView from "./nodeTreeView"; import SettingsPanel from "./settingsPanel"; import { ActionsPanelProps } from "./types"; import WorkspaceTreeView from "./workspaceTreeView"; -import { useAppState } from "@_redux/useAppState"; export default function ActionsPanel({ ...props }: ActionsPanelProps) { const { showActionsPanel } = useAppState(); diff --git a/src/components/main/actionsPanel/navigatorPanel/NavigatorPanel.tsx b/src/components/main/actionsPanel/navigatorPanel/NavigatorPanel.tsx index ddb64fdc..aa514dae 100644 --- a/src/components/main/actionsPanel/navigatorPanel/NavigatorPanel.tsx +++ b/src/components/main/actionsPanel/navigatorPanel/NavigatorPanel.tsx @@ -1,6 +1,7 @@ import React, { useContext, useEffect, useMemo, useRef, useState } from "react"; import { MainContext } from "@_redux/main"; +import { useAppState } from "@_redux/useAppState"; import { AdditionalPanel, DefaultPanel, ProjectPanel } from "./components"; import { @@ -11,7 +12,6 @@ import { } from "./constants"; import { useFavicon, useNavigatorPanelHandlers } from "./hooks"; import { NavigatorPanelProps } from "./types"; -import { useAppState } from "@_redux/useAppState"; export default function NavigatorPanel(props: NavigatorPanelProps) { const { diff --git a/src/components/main/actionsPanel/navigatorPanel/components/AdditionalPanel.tsx b/src/components/main/actionsPanel/navigatorPanel/components/AdditionalPanel.tsx index 09b73c00..68cab886 100644 --- a/src/components/main/actionsPanel/navigatorPanel/components/AdditionalPanel.tsx +++ b/src/components/main/actionsPanel/navigatorPanel/components/AdditionalPanel.tsx @@ -4,10 +4,10 @@ import cx from "classnames"; import { SVGIcon } from "@_components/common"; import { TProject } from "@_redux/main/fileTree"; +import { useAppState } from "@_redux/useAppState"; import { isSelected } from "../helpers"; import { useNavigatorPanelHandlers } from "../hooks"; -import { useAppState } from "@_redux/useAppState"; interface AdditionalPanelProps { navigatorPanel: HTMLDivElement | null; diff --git a/src/components/main/actionsPanel/navigatorPanel/components/DefaultPanel.tsx b/src/components/main/actionsPanel/navigatorPanel/components/DefaultPanel.tsx index 447a08a7..e8f9299b 100644 --- a/src/components/main/actionsPanel/navigatorPanel/components/DefaultPanel.tsx +++ b/src/components/main/actionsPanel/navigatorPanel/components/DefaultPanel.tsx @@ -3,10 +3,10 @@ import React, { useContext, useMemo } from "react"; import { SVGIconI } from "@_components/common"; import { RootNodeUid } from "@_constants/main"; import { MainContext } from "@_redux/main"; +import { useAppState } from "@_redux/useAppState"; import { getFileExtension, getFileNameFromPath, isHomeIcon } from "../helpers"; import { useNavigatorPanelHandlers } from "../hooks"; -import { useAppState } from "@_redux/useAppState"; export const DefaultPanel = () => { const { project, fileTree, currentFileUid } = useAppState(); diff --git a/src/components/main/actionsPanel/navigatorPanel/components/ProjectPanel.tsx b/src/components/main/actionsPanel/navigatorPanel/components/ProjectPanel.tsx index 540b1520..049f424e 100644 --- a/src/components/main/actionsPanel/navigatorPanel/components/ProjectPanel.tsx +++ b/src/components/main/actionsPanel/navigatorPanel/components/ProjectPanel.tsx @@ -1,9 +1,9 @@ import React, { FC } from "react"; import { SVGIconI } from "@_components/common"; +import { useAppState } from "@_redux/useAppState"; import { useNavigatorPanelHandlers } from "../hooks"; -import { useAppState } from "@_redux/useAppState"; export const ProjectPanel: FC<{ unsavedProject: boolean }> = ({ unsavedProject, diff --git a/src/components/main/actionsPanel/navigatorPanel/helpers/helpers.ts b/src/components/main/actionsPanel/navigatorPanel/helpers/helpers.ts index 2281bc1c..60beba03 100644 --- a/src/components/main/actionsPanel/navigatorPanel/helpers/helpers.ts +++ b/src/components/main/actionsPanel/navigatorPanel/helpers/helpers.ts @@ -1,14 +1,7 @@ -import { RootNodeUid } from "@_constants/main"; import { TFileNode, TFileNodeData } from "@_node/file"; import { THtmlNodeData } from "@_node/node"; -import { TNode, TNodeTreeData, TNodeUid } from "@_node/types"; +import { TNode, TNodeTreeData } from "@_node/types"; import { TProject, TWorkspace } from "@_redux/main/fileTree"; -import { setSelectedNodeUids } from "@_redux/main/nodeTree"; -import { - ActionCreatorWithPayload, - AnyAction, - Dispatch, -} from "@reduxjs/toolkit"; export const isHomeIcon = (node: TNode) => node.data.type == "html" && diff --git a/src/components/main/actionsPanel/navigatorPanel/hooks/useFavicon.ts b/src/components/main/actionsPanel/navigatorPanel/hooks/useFavicon.ts index a923a70d..c41337e0 100644 --- a/src/components/main/actionsPanel/navigatorPanel/hooks/useFavicon.ts +++ b/src/components/main/actionsPanel/navigatorPanel/hooks/useFavicon.ts @@ -4,9 +4,9 @@ import { useDispatch } from "react-redux"; import { RootNodeUid } from "@_constants/main"; import { setWorkspace } from "@_redux/main/fileTree"; +import { useAppState } from "@_redux/useAppState"; import { setWorkspaceFavicon } from "../helpers/"; -import { useAppState } from "@_redux/useAppState"; export const useFavicon = ( setFaviconFallback: React.Dispatch>, diff --git a/src/components/main/actionsPanel/navigatorPanel/hooks/useNavigatorPanelHandlers.ts b/src/components/main/actionsPanel/navigatorPanel/hooks/useNavigatorPanelHandlers.ts index 5aa957bd..f439e508 100644 --- a/src/components/main/actionsPanel/navigatorPanel/hooks/useNavigatorPanelHandlers.ts +++ b/src/components/main/actionsPanel/navigatorPanel/hooks/useNavigatorPanelHandlers.ts @@ -2,15 +2,16 @@ import { useCallback, useContext } from "react"; import { getMany } from "idb-keyval"; import { useDispatch } from "react-redux"; + +import { LogAllow } from "@_constants/global"; +import { isUnsavedProject } from "@_node/file/helpers"; import { MainContext } from "@_redux/main"; import { TProject } from "@_redux/main/fileTree"; import { setActivePanel, setNavigatorDropdownType, } from "@_redux/main/processor"; -import { isUnsavedProject } from "@_node/file/helpers"; import { useAppState } from "@_redux/useAppState"; -import { LogAllow } from "@_constants/global"; export const useNavigatorPanelHandlers = () => { const dispatch = useDispatch(); diff --git a/src/components/main/actionsPanel/nodeTreeView/NodeTreeView.tsx b/src/components/main/actionsPanel/nodeTreeView/NodeTreeView.tsx index 699185cd..9be075cb 100644 --- a/src/components/main/actionsPanel/nodeTreeView/NodeTreeView.tsx +++ b/src/components/main/actionsPanel/nodeTreeView/NodeTreeView.tsx @@ -7,6 +7,7 @@ import React, { } from "react"; import cx from "classnames"; +import { debounce } from "lodash"; import { useDispatch } from "react-redux"; import { TreeView } from "@_components/common"; @@ -15,6 +16,7 @@ import { RootNodeUid, ShortDelay } from "@_constants/main"; import { StageNodeIdAttr } from "@_node/file/handlers/constants"; import { TFileNodeData, THtmlNodeData } from "@_node/index"; import { TNode, TNodeUid } from "@_node/types"; +import { scrollToElement } from "@_pages/main/helper"; import { MainContext } from "@_redux/main"; import { expandFileTreeNodes, @@ -25,6 +27,7 @@ import { setActivePanel, setNavigatorDropdownType, } from "@_redux/main/processor"; +import { useAppState } from "@_redux/useAppState"; import { getCommandKey } from "@_services/global"; import { addClass, removeClass } from "@_services/main"; import { THtmlElementsReference } from "@_types/main"; @@ -36,10 +39,7 @@ import { Container } from "./nodeTreeComponents/Container"; import { DragBetweenLine } from "./nodeTreeComponents/DragBetweenLine"; import { ItemArrow } from "./nodeTreeComponents/ItemArrow"; import { ItemTitle } from "./nodeTreeComponents/ItemTitle"; -import { useAppState } from "@_redux/useAppState"; import { NodeIcon } from "./nodeTreeComponents/NodeIcon"; -import { debounce } from "lodash"; -import { scrollToElement } from "@_pages/main/helper"; const AutoExpandDelayOnDnD = 1 * 1000; diff --git a/src/components/main/actionsPanel/nodeTreeView/hooks/useCmdk.ts b/src/components/main/actionsPanel/nodeTreeView/hooks/useCmdk.ts index b31b8ea6..0c7137e4 100644 --- a/src/components/main/actionsPanel/nodeTreeView/hooks/useCmdk.ts +++ b/src/components/main/actionsPanel/nodeTreeView/hooks/useCmdk.ts @@ -1,10 +1,10 @@ import { useContext, useEffect } from "react"; +import { isAddNodeAction, isRenameNodeAction } from "@_node/helpers"; import { MainContext } from "@_redux/main"; +import { useAppState } from "@_redux/useAppState"; import { useNodeActionsHandlers } from "./useNodeActionsHandlers"; -import { useAppState } from "@_redux/useAppState"; -import { isAddNodeAction, isRenameNodeAction } from "@_node/helpers"; export const useCmdk = () => { const { activePanel, currentCommand } = useAppState(); diff --git a/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeActionsHandlers.ts b/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeActionsHandlers.ts index 7692b78b..7ba2d666 100644 --- a/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeActionsHandlers.ts +++ b/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeActionsHandlers.ts @@ -1,12 +1,12 @@ import { useCallback, useContext } from "react"; -import { MainContext } from "@_redux/main"; -import { useAppState } from "@_redux/useAppState"; +import { useDispatch } from "react-redux"; + import { LogAllow } from "@_constants/global"; import { callNodeApi } from "@_node/apis"; - import { TNodeUid } from "@_node/types"; -import { useDispatch } from "react-redux"; +import { MainContext } from "@_redux/main"; +import { useAppState } from "@_redux/useAppState"; export const useNodeActionsHandlers = () => { const dispatch = useDispatch(); diff --git a/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeTreeCallback.ts b/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeTreeCallback.ts index 1925d9cc..f6d3f37e 100644 --- a/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeTreeCallback.ts +++ b/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeTreeCallback.ts @@ -2,13 +2,13 @@ import { useContext } from "react"; import { DraggingPosition, TreeItem, TreeItemIndex } from "react-complex-tree"; +import { getValidNodeUids } from "@_node/helpers"; import { TNodeUid } from "@_node/types"; import { MainContext } from "@_redux/main"; +import { useAppState } from "@_redux/useAppState"; -import { useNodeViewState } from "./useNodeViewState"; import { useNodeActionsHandlers } from "./useNodeActionsHandlers"; -import { useAppState } from "@_redux/useAppState"; -import { getValidNodeUids } from "@_node/helpers"; +import { useNodeViewState } from "./useNodeViewState"; export const useNodeTreeCallback = ( focusItemValue: TNodeUid | null, diff --git a/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeViewState.ts b/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeViewState.ts index 09b47fed..a7376f8f 100644 --- a/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeViewState.ts +++ b/src/components/main/actionsPanel/nodeTreeView/hooks/useNodeViewState.ts @@ -5,15 +5,12 @@ import { useDispatch } from "react-redux"; import { getValidNodeUids } from "@_node/helpers"; import { TNodeUid } from "@_node/types"; import { MainContext } from "@_redux/main"; -import { selectFileTreeNodes, setCurrentFileUid } from "@_redux/main/fileTree"; import { collapseNodeTreeNodes, expandNodeTreeNodes, - setCurrentFileContent, setSelectedNodeUids, } from "@_redux/main/nodeTree"; import { useAppState } from "@_redux/useAppState"; -import { TFileNodeData } from "@_node/index"; export function useNodeViewState() { const dispatch = useDispatch(); diff --git a/src/components/main/actionsPanel/nodeTreeView/nodeTreeComponents/NodeIcon.tsx b/src/components/main/actionsPanel/nodeTreeView/nodeTreeComponents/NodeIcon.tsx index 1f156444..c82453a9 100644 --- a/src/components/main/actionsPanel/nodeTreeView/nodeTreeComponents/NodeIcon.tsx +++ b/src/components/main/actionsPanel/nodeTreeView/nodeTreeComponents/NodeIcon.tsx @@ -1,4 +1,5 @@ import React from "react"; + import { SVGIconI } from "@_components/common"; import { THtmlElementsReference } from "@_types/main"; diff --git a/src/components/main/actionsPanel/workspaceTreeView/WorkspaceTreeView.tsx b/src/components/main/actionsPanel/workspaceTreeView/WorkspaceTreeView.tsx index 5c18bc4f..911aca8e 100644 --- a/src/components/main/actionsPanel/workspaceTreeView/WorkspaceTreeView.tsx +++ b/src/components/main/actionsPanel/workspaceTreeView/WorkspaceTreeView.tsx @@ -7,6 +7,7 @@ import React, { } from "react"; import cx from "classnames"; +import { debounce } from "lodash"; import { DraggingPositionItem } from "react-complex-tree"; import { useDispatch } from "react-redux"; @@ -15,10 +16,12 @@ import { TreeViewData } from "@_components/common/treeView/types"; import { AddFileActionPrefix, RootNodeUid, ShortDelay } from "@_constants/main"; import { _path, getNormalizedPath, TFileNodeData } from "@_node/file"; import { TNode, TNodeUid } from "@_node/types"; +import { scrollToElement } from "@_pages/main/helper"; import { MainContext } from "@_redux/main"; import { setHoveredFileUid } from "@_redux/main/fileTree"; import { FileTree_Event_ClearActionType } from "@_redux/main/fileTree/event"; import { setActivePanel, setDidRedo, setDidUndo } from "@_redux/main/processor"; +import { useAppState } from "@_redux/useAppState"; import { addClass, generateQuerySelector, removeClass } from "@_services/main"; import { TFilesReference } from "@_types/main"; @@ -31,9 +34,6 @@ import { useTemporaryNodes, } from "./hooks"; import { Container, ItemArrow } from "./workSpaceTreeComponents"; -import { useAppState } from "@_redux/useAppState"; -import { debounce } from "lodash"; -import { scrollToElement } from "@_pages/main/helper"; const AutoExpandDelay = 1 * 1000; export default function WorkspaceTreeView() { diff --git a/src/components/main/actionsPanel/workspaceTreeView/helpers/renameNode.ts b/src/components/main/actionsPanel/workspaceTreeView/helpers/renameNode.ts index e1e276f4..b9a813f1 100644 --- a/src/components/main/actionsPanel/workspaceTreeView/helpers/renameNode.ts +++ b/src/components/main/actionsPanel/workspaceTreeView/helpers/renameNode.ts @@ -10,11 +10,11 @@ import { updateFileTreeViewState, } from "@_redux/main/fileTree"; import { setFileAction, TFileAction } from "@_redux/main/fileTree/event"; +import { useAppState } from "@_redux/useAppState"; import { verifyFileHandlerPermission } from "@_services/main"; import { useInvalidNodes } from "../hooks"; import { moveActions } from "./moveActions"; -import { useAppState } from "@_redux/useAppState"; export const renameNode = async ( ext: string, diff --git a/src/components/main/actionsPanel/workspaceTreeView/helpers/validateAndMoveNode.ts b/src/components/main/actionsPanel/workspaceTreeView/helpers/validateAndMoveNode.ts index d4464c6b..3cd57327 100644 --- a/src/components/main/actionsPanel/workspaceTreeView/helpers/validateAndMoveNode.ts +++ b/src/components/main/actionsPanel/workspaceTreeView/helpers/validateAndMoveNode.ts @@ -3,12 +3,12 @@ import { useContext } from "react"; import { TFileNodeData } from "@_node/file"; import { TNodeUid } from "@_node/types"; import { MainContext } from "@_redux/main"; +import { useAppState } from "@_redux/useAppState"; import { verifyFileHandlerPermission } from "@_services/main"; import { useInvalidNodes } from "../hooks"; import { generateNewNameMoveNode } from "./generateNewNameMoveNode"; import { moveActions } from "./moveActions"; -import { useAppState } from "@_redux/useAppState"; export const validateAndMoveNode = async ( uid: string, diff --git a/src/components/main/actionsPanel/workspaceTreeView/hooks/useCmdk.ts b/src/components/main/actionsPanel/workspaceTreeView/hooks/useCmdk.ts index d74ec1df..0253fad5 100644 --- a/src/components/main/actionsPanel/workspaceTreeView/hooks/useCmdk.ts +++ b/src/components/main/actionsPanel/workspaceTreeView/hooks/useCmdk.ts @@ -4,11 +4,11 @@ import { useDispatch } from "react-redux"; import { AddFileActionPrefix } from "@_constants/main"; import { setClipboardData } from "@_redux/main/processor"; +import { useAppState } from "@_redux/useAppState"; import { TFileNodeType } from "@_types/main"; import { useInvalidNodes } from "./useInvalidNodes"; import { useNodeActionsHandler } from "./useNodeActionsHandler"; -import { useAppState } from "@_redux/useAppState"; export const useCmdk = (openFileUid: React.MutableRefObject) => { const dispatch = useDispatch(); diff --git a/src/components/main/actionsPanel/workspaceTreeView/hooks/useFileOperations.ts b/src/components/main/actionsPanel/workspaceTreeView/hooks/useFileOperations.ts index bc1c1bd9..a9ee2f31 100644 --- a/src/components/main/actionsPanel/workspaceTreeView/hooks/useFileOperations.ts +++ b/src/components/main/actionsPanel/workspaceTreeView/hooks/useFileOperations.ts @@ -3,6 +3,7 @@ import { useCallback, useContext } from "react"; import { TFileNodeData } from "@_node/file"; import { TNodeUid } from "@_node/types"; import { MainContext } from "@_redux/main"; +import { useAppState } from "@_redux/useAppState"; import { verifyFileHandlerPermission } from "@_services/main"; import { TFileNodeType } from "@_types/main"; @@ -13,7 +14,6 @@ import { } from "../helpers"; import { useInvalidNodes } from "./useInvalidNodes"; import { useTemporaryNodes } from "./useTemporaryNodes"; -import { useAppState } from "@_redux/useAppState"; export const useFileOperations = () => { const { project, fileTree } = useAppState(); diff --git a/src/components/main/actionsPanel/workspaceTreeView/hooks/useNodeActionsHandler.ts b/src/components/main/actionsPanel/workspaceTreeView/hooks/useNodeActionsHandler.ts index 71dc66b7..99861b08 100644 --- a/src/components/main/actionsPanel/workspaceTreeView/hooks/useNodeActionsHandler.ts +++ b/src/components/main/actionsPanel/workspaceTreeView/hooks/useNodeActionsHandler.ts @@ -12,6 +12,7 @@ import { } from "@_node/file"; import { getValidNodeUids } from "@_node/helpers"; import { TNode, TNodeTreeData, TNodeUid } from "@_node/types"; +import { clearFileSession } from "@_pages/main/helper"; import { MainContext } from "@_redux/main"; import { expandFileTreeNodes, @@ -20,15 +21,12 @@ import { setPrevRenderableFileUid, } from "@_redux/main/fileTree"; import { setFileAction, TFileAction } from "@_redux/main/fileTree/event"; -import { clearNodeTreeViewState } from "@_redux/main/nodeTree"; -import { - NodeTree_Event_ClearActionType, - setCurrentFileContent, -} from "@_redux/main/nodeTree/event"; +import { setCurrentFileContent } from "@_redux/main/nodeTree/event"; import { setNavigatorDropdownType, setShowCodeView, } from "@_redux/main/processor"; +import { useAppState } from "@_redux/useAppState"; import { verifyFileHandlerPermission } from "@_services/main"; import { TFileNodeType } from "@_types/main"; @@ -41,8 +39,6 @@ import { } from "../helpers"; import { useInvalidNodes } from "./useInvalidNodes"; import { useTemporaryNodes } from "./useTemporaryNodes"; -import { useAppState } from "@_redux/useAppState"; -import { clearFileSession } from "@_pages/main/helper"; export const useNodeActionsHandler = ( openFileUid: React.MutableRefObject, diff --git a/src/components/main/actionsPanel/workspaceTreeView/hooks/useNodeViewState.ts b/src/components/main/actionsPanel/workspaceTreeView/hooks/useNodeViewState.ts index 41ba4ccc..9a3995f0 100644 --- a/src/components/main/actionsPanel/workspaceTreeView/hooks/useNodeViewState.ts +++ b/src/components/main/actionsPanel/workspaceTreeView/hooks/useNodeViewState.ts @@ -11,9 +11,9 @@ import { focusFileTreeNode, selectFileTreeNodes, } from "@_redux/main/fileTree"; +import { useAppState } from "@_redux/useAppState"; import { useInvalidNodes } from "./"; -import { useAppState } from "@_redux/useAppState"; export const useNodeViewState = () => { const dispatch = useDispatch(); diff --git a/src/components/main/codeView/CodeView.tsx b/src/components/main/codeView/CodeView.tsx index 1a842e2f..da603c84 100644 --- a/src/components/main/codeView/CodeView.tsx +++ b/src/components/main/codeView/CodeView.tsx @@ -13,12 +13,12 @@ import { RootNodeUid } from "@_constants/main"; import { TFileNodeData, TNodeUid } from "@_node/index"; import { MainContext } from "@_redux/main"; import { setSelectedNodeUids } from "@_redux/main/nodeTree"; +import { setActivePanel } from "@_redux/main/processor"; import { useAppState } from "@_redux/useAppState"; import { Editor, loader } from "@monaco-editor/react"; import { useCmdk, useEditor } from "./hooks"; import { CodeViewProps } from "./types"; -import { setActivePanel } from "@_redux/main/processor"; loader.config({ monaco }); diff --git a/src/components/main/codeView/hooks/useEditor.ts b/src/components/main/codeView/hooks/useEditor.ts index dd090a92..904ba9a7 100644 --- a/src/components/main/codeView/hooks/useEditor.ts +++ b/src/components/main/codeView/hooks/useEditor.ts @@ -1,5 +1,6 @@ import { useCallback, useContext, useEffect, useMemo, useState } from "react"; +import { debounce } from "lodash"; import { editor, KeyCode, KeyMod } from "monaco-editor"; import { useDispatch } from "react-redux"; @@ -9,17 +10,15 @@ import { DefaultTabSize, RootNodeUid, } from "@_constants/main"; - import { getSubNodeUidsByBfs } from "@_node/helpers"; import { TNodeTreeData, TNodeUid } from "@_node/types"; import { MainContext } from "@_redux/main"; import { setCodeViewTabSize } from "@_redux/main/codeView"; +import { setCurrentFileContent } from "@_redux/main/nodeTree"; +import { useAppState } from "@_redux/useAppState"; -import { TCodeSelection } from "../types"; import { getCodeViewTheme, getLanguageFromExtension } from "../helpers"; -import { useAppState } from "@_redux/useAppState"; -import { setCurrentFileContent } from "@_redux/main/nodeTree"; -import { debounce } from "lodash"; +import { TCodeSelection } from "../types"; const useEditor = () => { const dispatch = useDispatch(); diff --git a/src/components/main/stageView/iFrame/IFrame.tsx b/src/components/main/stageView/iFrame/IFrame.tsx index cc90017a..8d0b15bf 100644 --- a/src/components/main/stageView/iFrame/IFrame.tsx +++ b/src/components/main/stageView/iFrame/IFrame.tsx @@ -1,19 +1,20 @@ import React, { useContext, useEffect, useMemo, useRef, useState } from "react"; import { useDispatch } from "react-redux"; + +import { LogAllow } from "@_constants/global"; import { PreserveRnbwNode } from "@_node/file/handlers/constants"; import { TNodeUid } from "@_node/types"; +import { MainContext } from "@_redux/main"; import { setIframeLoading, setNeedToReloadIframe, } from "@_redux/main/stageView"; - -import { useCmdk, useMouseEvents, useSyncNode } from "./hooks"; import { useAppState } from "@_redux/useAppState"; + import { jss, styles } from "./constants"; -import { LogAllow } from "@_constants/global"; import { markSelectedElements } from "./helpers"; -import { MainContext } from "@_redux/main"; +import { useCmdk, useMouseEvents, useSyncNode } from "./hooks"; export const IFrame = () => { const dispatch = useDispatch(); diff --git a/src/components/main/stageView/iFrame/helpers.ts b/src/components/main/stageView/iFrame/helpers.ts index 28d77171..16dbad3b 100644 --- a/src/components/main/stageView/iFrame/helpers.ts +++ b/src/components/main/stageView/iFrame/helpers.ts @@ -1,11 +1,12 @@ +import { editor } from "monaco-editor"; + import { + callNodeApi, StageNodeIdAttr, TNodeTreeData, TNodeUid, - callNodeApi, } from "@_node/index"; import { AnyAction, Dispatch } from "@reduxjs/toolkit"; -import { editor } from "monaco-editor"; export const getValidElementWithUid = ( ele: HTMLElement, diff --git a/src/components/main/stageView/iFrame/hooks/useCmdk.ts b/src/components/main/stageView/iFrame/hooks/useCmdk.ts index 65da3c1c..c8d8c156 100644 --- a/src/components/main/stageView/iFrame/hooks/useCmdk.ts +++ b/src/components/main/stageView/iFrame/hooks/useCmdk.ts @@ -3,12 +3,13 @@ import { useCallback, useContext } from "react"; import { useDispatch } from "react-redux"; import { LogAllow } from "@_constants/global"; +import { TNodeTreeData, TNodeUid } from "@_node/types"; import { MainContext } from "@_redux/main"; import { setCurrentCommand } from "@_redux/main/cmdk"; +import { useAppState } from "@_redux/useAppState"; import { getCommandKey } from "@_services/global"; import { TCmdkKeyMap } from "@_types/main"; -import { useAppState } from "@_redux/useAppState"; -import { TNodeTreeData, TNodeUid } from "@_node/types"; + import { editHtmlContent } from "../helpers"; interface IUseCmdkProps { diff --git a/src/components/main/stageView/iFrame/hooks/useMouseEvents.ts b/src/components/main/stageView/iFrame/hooks/useMouseEvents.ts index 782ff3bb..0b990832 100644 --- a/src/components/main/stageView/iFrame/hooks/useMouseEvents.ts +++ b/src/components/main/stageView/iFrame/hooks/useMouseEvents.ts @@ -1,21 +1,24 @@ import { useCallback, useContext } from "react"; + +import { debounce } from "lodash"; import { useDispatch } from "react-redux"; + +import { LogAllow } from "@_constants/global"; +import { ShortDelay } from "@_constants/main"; import { StageNodeIdAttr } from "@_node/file"; import { getValidNodeUids } from "@_node/helpers"; +import { THtmlNodeData } from "@_node/node"; import { TNodeTreeData, TNodeUid } from "@_node/types"; +import { MainContext } from "@_redux/main"; import { setHoveredNodeUid } from "@_redux/main/nodeTree"; import { setSelectedNodeUids } from "@_redux/main/nodeTree/event"; +import { setActivePanel } from "@_redux/main/processor"; + import { editHtmlContent, getValidElementWithUid, selectAllText, } from "../helpers"; -import { THtmlNodeData } from "@_node/node"; -import { setActivePanel } from "@_redux/main/processor"; -import { MainContext } from "@_redux/main"; -import { LogAllow } from "@_constants/global"; -import { ShortDelay } from "@_constants/main"; -import { debounce } from "lodash"; interface IUseMouseEventsProps { iframeRefRef: React.MutableRefObject; diff --git a/src/components/main/stageView/iFrame/hooks/useSyncNode.ts b/src/components/main/stageView/iFrame/hooks/useSyncNode.ts index 6141544c..972dbf61 100644 --- a/src/components/main/stageView/iFrame/hooks/useSyncNode.ts +++ b/src/components/main/stageView/iFrame/hooks/useSyncNode.ts @@ -1,18 +1,19 @@ -import { useCallback, useEffect, useMemo, useRef } from "react"; +import { useCallback, useEffect, useRef } from "react"; +import { debounce } from "lodash"; + +import { ShortDelay } from "@_constants/main"; import { StageNodeIdAttr } from "@_node/file/handlers/constants"; import { TNodeTreeData, TNodeUid } from "@_node/types"; - +import { scrollToElement } from "@_pages/main/helper"; import { useAppState } from "@_redux/useAppState"; + import { markHoverdElement, markSelectedElements, unmarkHoverdElement, unmarkSelectedElements, } from "../helpers"; -import { debounce } from "lodash"; -import { scrollToElement } from "@_pages/main/helper"; -import { ShortDelay } from "@_constants/main"; export const useSyncNode = (iframeRef: HTMLIFrameElement | null) => { const { diff --git a/src/pages/main/MainPage.tsx b/src/pages/main/MainPage.tsx index f18b51e4..9a1e3ceb 100644 --- a/src/pages/main/MainPage.tsx +++ b/src/pages/main/MainPage.tsx @@ -4,24 +4,34 @@ import React, { useMemo, useRef, useState, -} from "react"; - -import cx from "classnames"; -import { Command } from "cmdk"; -import { CustomDirectoryPickerOptions } from "file-system-access/lib/showDirectoryPicker"; -import { delMany, getMany, setMany } from "idb-keyval"; -import { editor } from "monaco-editor"; -import { useDispatch } from "react-redux"; - -import { SVGIcon } from "@_components/common"; -import { ActionsPanel, CodeView, StageView } from "@_components/main"; -import { LogAllow } from "@_constants/global"; +} from 'react'; + +import cx from 'classnames'; +import { Command } from 'cmdk'; +import { + CustomDirectoryPickerOptions, +} from 'file-system-access/lib/showDirectoryPicker'; +import { + delMany, + getMany, + setMany, +} from 'idb-keyval'; +import { editor } from 'monaco-editor'; +import { useDispatch } from 'react-redux'; + +import { SVGIcon } from '@_components/common'; +import { + ActionsPanel, + CodeView, + StageView, +} from '@_components/main'; +import { LogAllow } from '@_constants/global'; import { AddActionPrefix, DefaultProjectPath, RecentProjectCount, RenameActionPrefix, -} from "@_constants/main"; +} from '@_constants/main'; import { buildNohostIDB, confirmFileChanges, @@ -31,16 +41,19 @@ import { loadLocalProject, TFileHandlerCollection, TFileNodeData, -} from "@_node/file"; -import { setOsType, setTheme } from "@_redux/global"; -import { MainContext } from "@_redux/main"; +} from '@_node/file'; +import { + setOsType, + setTheme, +} from '@_redux/global'; +import { MainContext } from '@_redux/main'; import { setCmdkOpen, setCmdkPages, setCmdkSearchContent, setCurrentCmdkPage, setCurrentCommand, -} from "@_redux/main/cmdk"; +} from '@_redux/main/cmdk'; import { setDoingFileAction, setFileTree, @@ -49,32 +62,32 @@ import { setWorkspace, TProject, TProjectContext, -} from "@_redux/main/fileTree"; +} from '@_redux/main/fileTree'; import { FileTree_Event_RedoActionType, FileTree_Event_UndoActionType, setFileAction, -} from "@_redux/main/fileTree/event"; +} from '@_redux/main/fileTree/event'; import { NodeTree_Event_RedoActionType, NodeTree_Event_UndoActionType, -} from "@_redux/main/nodeTree/event"; +} from '@_redux/main/nodeTree/event'; import { setDidRedo, setDidUndo, setNavigatorDropdownType, setShowActionsPanel, setShowCodeView, -} from "@_redux/main/processor"; -import { useAppState } from "@_redux/useAppState"; +} from '@_redux/main/processor'; +import { useAppState } from '@_redux/useAppState'; // @ts-ignore -import cmdkRefActions from "@_ref/cmdk.ref/Actions.csv"; +import cmdkRefActions from '@_ref/cmdk.ref/Actions.csv'; // @ts-ignore -import cmdkRefJumpstart from "@_ref/cmdk.ref/Jumpstart.csv"; +import cmdkRefJumpstart from '@_ref/cmdk.ref/Jumpstart.csv'; // @ts-ignore -import filesRef from "@_ref/rfrncs/Files.csv"; +import filesRef from '@_ref/rfrncs/Files.csv'; // @ts-ignore -import htmlRefElements from "@_ref/rfrncs/HTML Elements.csv"; +import htmlRefElements from '@_ref/rfrncs/HTML Elements.csv'; import { TCmdkContext, TCmdkContextScope, @@ -88,16 +101,19 @@ import { THtmlElementsReferenceData, THtmlReferenceData, TSession, -} from "@_types/main"; +} from '@_types/main'; -import { getCommandKey, isChromeOrEdge } from "../../services/global"; +import { + getCommandKey, + isChromeOrEdge, +} from '../../services/global'; import { addDefaultCmdkActions, clearProjectSession, elementsCmdk, fileCmdk, -} from "./helper"; -import Processor from "./processor"; +} from './helper'; +import Processor from './processor'; export default function MainPage() { // ***************************************** Reducer Begin ***************************************** diff --git a/src/pages/main/helper.ts b/src/pages/main/helper.ts index fea6b453..1a9295ca 100644 --- a/src/pages/main/helper.ts +++ b/src/pages/main/helper.ts @@ -1,3 +1,8 @@ +import { Dispatch } from "react"; + +import { RootNodeUid } from "@_constants/main"; +import { _path } from "@_node/file"; +import { TNodeUid } from "@_node/types"; import { clearFileTreeViewState, setCurrentFileUid, @@ -19,12 +24,7 @@ import { } from "@_redux/main/nodeTree/event"; import { setIframeSrc } from "@_redux/main/stageView"; import { TCmdkReferenceData, TFilesReference } from "@_types/main"; -import { Dispatch } from "react"; import { AnyAction } from "@reduxjs/toolkit"; -import { RootNodeUid, ShortDelay } from "@_constants/main"; - -import { _path } from "@_node/file"; -import { TNodeUid } from "@_node/types"; export const addDefaultCmdkActions = ( cmdkReferenceData: TCmdkReferenceData, diff --git a/src/pages/main/processor/Processor.tsx b/src/pages/main/processor/Processor.tsx index a757428b..89ff67ce 100644 --- a/src/pages/main/processor/Processor.tsx +++ b/src/pages/main/processor/Processor.tsx @@ -1,7 +1,11 @@ import React from "react"; -import { useFileTreeEvent, useHms } from "./hooks"; -import { useNodeTreeEvent } from "./hooks"; -import { useSaveCommand } from "./hooks"; + +import { + useFileTreeEvent, + useHms, + useNodeTreeEvent, + useSaveCommand, +} from "./hooks"; const Processor = () => { useHms(); diff --git a/src/pages/main/processor/helpers.ts b/src/pages/main/processor/helpers.ts index 57ced9ad..e1a018b9 100644 --- a/src/pages/main/processor/helpers.ts +++ b/src/pages/main/processor/helpers.ts @@ -1,3 +1,5 @@ +import { Dispatch } from "react"; + import { NodePathSplitter, RootNodeUid, @@ -13,8 +15,7 @@ import { import { getNodeChildIndex, getSubNodeUidsByBfs } from "@_node/helpers"; import { THtmlNodeData } from "@_node/node"; import { TNode, TNodeTreeData, TNodeUid } from "@_node/types"; -import { TProject, setFileTreeNodes } from "@_redux/main/fileTree"; -import { Dispatch } from "react"; +import { setFileTreeNodes, TProject } from "@_redux/main/fileTree"; import { AnyAction } from "@reduxjs/toolkit"; export const saveFileContent = async ( diff --git a/src/pages/main/processor/hooks/useFileTreeEvent.ts b/src/pages/main/processor/hooks/useFileTreeEvent.ts index 73cfb3c8..921d830d 100644 --- a/src/pages/main/processor/hooks/useFileTreeEvent.ts +++ b/src/pages/main/processor/hooks/useFileTreeEvent.ts @@ -1,4 +1,5 @@ import { useEffect } from "react"; + import { useAppState } from "@_redux/useAppState"; export const useFileTreeEvent = () => { diff --git a/src/pages/main/processor/hooks/useHms.ts b/src/pages/main/processor/hooks/useHms.ts index ffe7fc62..fdcc5c57 100644 --- a/src/pages/main/processor/hooks/useHms.ts +++ b/src/pages/main/processor/hooks/useHms.ts @@ -1,8 +1,10 @@ -import { setDidRedo, setDidUndo } from "@_redux/main/processor"; -import { useAppState } from "@_redux/useAppState"; import { useEffect } from "react"; + import { useDispatch } from "react-redux"; +import { setDidRedo, setDidUndo } from "@_redux/main/processor"; +import { useAppState } from "@_redux/useAppState"; + export const useHms = () => { const dispatch = useDispatch(); const { didUndo, didRedo } = useAppState(); diff --git a/src/pages/main/processor/hooks/useNodeTreeEvent.ts b/src/pages/main/processor/hooks/useNodeTreeEvent.ts index 1a282cb0..1ae2ec56 100644 --- a/src/pages/main/processor/hooks/useNodeTreeEvent.ts +++ b/src/pages/main/processor/hooks/useNodeTreeEvent.ts @@ -3,6 +3,7 @@ import { useContext, useEffect, useRef } from "react"; import morphdom from "morphdom"; import { useDispatch } from "react-redux"; +import { markSelectedElements } from "@_components/main/stageView/iFrame/helpers"; import { LogAllow } from "@_constants/global"; import { parseFile, @@ -10,7 +11,10 @@ import { StageNodeIdAttr, writeFile, } from "@_node/file"; +import { getNodeUidsFromPaths } from "@_node/helpers"; +import { TNodeUid } from "@_node/types"; import { MainContext } from "@_redux/main"; +import { setCurrentCommand } from "@_redux/main/cmdk"; import { setDoingFileAction, setFileTreeNodes, @@ -37,10 +41,6 @@ import { getValidNodeTree, markChangedFolders, } from "../helpers"; -import { setCurrentCommand } from "@_redux/main/cmdk"; -import { getNodeUidsFromPaths } from "@_node/helpers"; -import { TNodeUid } from "@_node/types"; -import { markSelectedElements } from "@_components/main/stageView/iFrame/helpers"; export const useNodeTreeEvent = () => { const dispatch = useDispatch(); diff --git a/src/pages/main/processor/index.ts b/src/pages/main/processor/index.ts index 6cef5140..277da62b 100644 --- a/src/pages/main/processor/index.ts +++ b/src/pages/main/processor/index.ts @@ -1,2 +1,3 @@ import Processor from "./Processor"; + export default Processor; diff --git a/src/services/htmlapi.ts b/src/services/htmlapi.ts index 07f18ef2..0a11f9a1 100644 --- a/src/services/htmlapi.ts +++ b/src/services/htmlapi.ts @@ -1,6 +1,7 @@ -import { THtmlDomNode } from "@_node/node"; import * as monaco from "monaco-editor/esm/vs/editor/editor.api"; +import { THtmlDomNode } from "@_node/node"; + export const getPositionFromIndex = ( editor: monaco.editor.IStandaloneCodeEditor, startIndex: number,