This commit is contained in:
Rizky 2024-07-27 18:38:38 +07:00
parent f3c34088e3
commit c639a13fec
3 changed files with 23 additions and 25 deletions

View File

@ -2,7 +2,8 @@ import { getBackendOptions } from "@minoru/react-dnd-treeview";
import { DndProvider } from "react-dnd"; import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend"; import { HTML5Backend } from "react-dnd-html5-backend";
import { useGlobal, useLocal } from "web-utils"; import { useGlobal, useLocal } from "web-utils";
import { EDGlobal } from "./logic/ed-global"; import { active, EDGlobal } from "./logic/ed-global";
import { treeRebuild } from "./logic/tree/build";
import { EdApi } from "./panel/header/left/api"; import { EdApi } from "./panel/header/left/api";
import { EdSiteJS } from "./panel/header/left/js"; import { EdSiteJS } from "./panel/header/left/js";
import { EdSitePicker } from "./panel/header/left/site-picker"; import { EdSitePicker } from "./panel/header/left/site-picker";
@ -10,7 +11,6 @@ import { EdTreeBody } from "./panel/tree/body";
import { EdPageHistoryBtn } from "./panel/tree/history-btn"; import { EdPageHistoryBtn } from "./panel/tree/history-btn";
import { EdPageHistoryList } from "./panel/tree/history-list"; import { EdPageHistoryList } from "./panel/tree/history-list";
import { EdTreeSearch } from "./panel/tree/search"; import { EdTreeSearch } from "./panel/tree/search";
import { treeRebuild } from "./logic/tree/build";
export const EdLeft = () => { export const EdLeft = () => {
const p = useGlobal(EDGlobal, "EDITOR"); const p = useGlobal(EDGlobal, "EDITOR");
@ -84,6 +84,15 @@ export const EdLeft = () => {
ref={(ref) => { ref={(ref) => {
if (ref) local.tree = ref; if (ref) local.tree = ref;
}} }}
onPointerMove={() => {
active.hover.tree = true;
}}
onPointerOut={() => {
active.hover.tree = false;
}}
onPointerLeave={() => {
active.hover.tree = false;
}}
> >
{p.page.history.show ? ( {p.page.history.show ? (
<EdPageHistoryList /> <EdPageHistoryList />

View File

@ -35,18 +35,7 @@ export const EdTreeBody = () => {
if (tree.length === 0) if (tree.length === 0)
return ( return (
<div <div className="flex py-[100px] select-none justify-center flex-1">
className="flex py-[100px] select-none justify-center flex-1"
onPointerMove={() => {
active.hover.tree = true;
}}
onPointerOut={() => {
active.hover.tree = false;
}}
onPointerLeave={() => {
active.hover.tree = false;
}}
>
<div className="flex flex-col items-center"> <div className="flex flex-col items-center">
<img <img
draggable={false} draggable={false}

View File

@ -2,16 +2,16 @@ import { active } from "../../logic/ed-global";
export const scrollTreeActiveItem = () => { export const scrollTreeActiveItem = () => {
setTimeout(() => { setTimeout(() => {
let i = 0; // let i = 0;
const ival = setInterval(() => { // const ival = setInterval(() => {
const div = document.querySelector( const div = document.querySelector(
`.tree-${active.item_id}` `.tree-${active.item_id}`
) as HTMLDivElement; ) as HTMLDivElement;
if (div) { if (div) {
if (!active.hover.tree) div.scrollIntoView(); if (!active.hover.tree) div.scrollIntoView();
} }
if (i > 7) clearInterval(ival); // if (i > 7) clearInterval(ival);
i++; // i++;
}, 30); // }, 30);
}, 100); }, 100);
}; };