Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion .husky/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#!/bin/sh

pnpm run lint-fix
pnpm run lint-fix

# 将已暂存且被 lint-fix 修改过的文件重新加入暂存区
STAGED=$(git diff --cached --name-only --diff-filter=d)
CHANGED=$(git diff --name-only)

for file in $CHANGED; do
case "$STAGED" in
*"$file"*) git add "$file" ;;
esac
done
Empty file modified .husky/pre-push
100644 → 100755
Empty file.
16 changes: 10 additions & 6 deletions src/pages/components/layout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ const importByUrls = async (urls: string[]): Promise<TImportStat | undefined> =>
return stat;
};

const getSafePopupParent = (p: Element) => {
p = (p.closest("button")?.parentNode as Element) || p; // 確保 ancestor 沒有 button 元素
p = (p.closest("span")?.parentNode as Element) || p; // 確保 ancestor 沒有 span 元素
p = (p.closest(".arco-collapse-item-content")?.parentNode as Element) || p; // 確保 ancestor 沒有 .arco-collapse-item-content 元素
p = (p.closest("aside")?.parentNode as Element) || p; // 確保 ancestor 沒有 aside 元素
return p;
};

// --- 子组件:提取拖拽遮罩以优化性能 ---
const DropzoneOverlay: React.FC<{ active: boolean; text: string }> = React.memo(({ active, text }) => {
if (!active) return null;
Expand Down Expand Up @@ -297,16 +305,12 @@ const MainLayout: React.FC<{
componentConfig={{
Select: {
getPopupContainer: (node) => {
return node;
return getSafePopupParent(node as Element);
},
},
}}
getPopupContainer={(node) => {
let p = node.parentNode as Element;
p = (p.closest("button")?.parentNode as Element) || p; // 確保 ancestor 沒有 button 元素
p = (p.closest("span")?.parentNode as Element) || p; // 確保 ancestor 沒有 span 元素
p = (p.closest("aside")?.parentNode as Element) || p; // 確保 ancestor 沒有 aside 元素
return p;
return getSafePopupParent(node.parentNode as Element);
}}
>
{contextHolder}
Expand Down
1 change: 1 addition & 0 deletions src/pages/options/routes/Logger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
onQueryLog();
setInit(2);
}
}, [init]);

Check warning on line 78 in src/pages/options/routes/Logger.tsx

View workflow job for this annotation

GitHub Actions / Run tests

React Hook useEffect has missing dependencies: 'defaultQuery' and 'onQueryLog'. Either include them or remove the dependency array

useEffect(() => {
loggerDAO.queryLogs(startTime * 1000, endTime * 1000).then((l) => {
Expand Down Expand Up @@ -104,7 +104,7 @@
setInit(1);
}
});
}, [startTime, endTime]);

Check warning on line 107 in src/pages/options/routes/Logger.tsx

View workflow job for this annotation

GitHub Actions / Run tests

React Hook useEffect has missing dependencies: 'init', 'labels', and 'loggerDAO'. Either include them or remove the dependency array

return (
<>
Expand Down Expand Up @@ -133,6 +133,7 @@
style={{ width: 400 }}
showTime
shortcutsPlacementLeft
getPopupContainer={() => document.body}
value={[startTime * 1000, endTime * 1000]}
onChange={(_, time) => {
setStartTime(time[0].unix());
Expand Down
Loading