|
|
@@ -1,6 +1,5 @@
|
|
|
import {Modal, TabPaneProps, TabsProps} from 'antd';
|
|
|
-import {ReactNode, useMemo} from 'react';
|
|
|
-import css from './index.module.css';
|
|
|
+import {ReactNode} from 'react';
|
|
|
import {useStore} from 'zustand';
|
|
|
import {tabStore} from '@stores';
|
|
|
import {useContextMenu, ItemParams} from 'react-contexify';
|
|
|
@@ -25,8 +24,6 @@ export type Tab = {
|
|
|
} & Omit<TabPaneProps, 'tab'>;
|
|
|
|
|
|
export function useTabItems() {
|
|
|
- const {host} = location;
|
|
|
-
|
|
|
const {originalTab, dispatch} = useStore(
|
|
|
tabStore,
|
|
|
function (state) {
|
|
|
@@ -38,28 +35,6 @@ export function useTabItems() {
|
|
|
shallowEqual,
|
|
|
);
|
|
|
|
|
|
- const tabs = useMemo(
|
|
|
- function () {
|
|
|
- return originalTab.map<Tab>(function (tab) {
|
|
|
- return {
|
|
|
- ...tab,
|
|
|
- originalTab: tab,
|
|
|
- forceRender: true,
|
|
|
- closable: tab.key !== '-1',
|
|
|
- animated: true,
|
|
|
- children: (
|
|
|
- <iframe
|
|
|
- src={`http://${host}${tab.url}`}
|
|
|
- className={css.iframe}
|
|
|
- data-url={tab.url}
|
|
|
- />
|
|
|
- ),
|
|
|
- };
|
|
|
- });
|
|
|
- },
|
|
|
- [host, originalTab],
|
|
|
- );
|
|
|
-
|
|
|
function onDragEnd({active, over}: DragEndEvent) {
|
|
|
if (!over) return;
|
|
|
|
|
|
@@ -74,7 +49,7 @@ export function useTabItems() {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- return [tabs, onDragEnd] as const;
|
|
|
+ return [originalTab, onDragEnd] as const;
|
|
|
}
|
|
|
|
|
|
export function useTabActive() {
|