Skip to content

Commit

Permalink
feat(electron): app tabs dnd (#7684)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 authored and L-Sun committed Aug 5, 2024
1 parent 0594fe4 commit eeae559
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,21 @@ export const PageHeaderMenuButton = ({
const view = useService(ViewService).view;

const openSidePanel = useCallback(
(id: string) => () => {
(id: string) => {
workbench.openSidebar();
view.activeSidebarTab(id);
},
[workbench, view]
);

const openAllFrames = useCallback(() => {
openSidePanel('frame');
}, [openSidePanel]);

const openOutlinePanel = useCallback(() => {
openSidePanel('outline');
}, [openSidePanel]);

const [historyModalOpen, setHistoryModalOpen] = useState(false);
const setOpenHistoryTipsModal = useSetAtom(openHistoryTipsModalAtom);

Expand Down Expand Up @@ -318,7 +326,7 @@ export const PageHeaderMenuButton = ({
</MenuIcon>
}
data-testid="editor-option-toc"
onSelect={openSidePanel('outline')}
onSelect={openOutlinePanel}
style={menuItemStyle}
>
{t['com.affine.header.option.view-toc']()}
Expand All @@ -331,7 +339,7 @@ export const PageHeaderMenuButton = ({
</MenuIcon>
}
data-testid="editor-option-frame"
onSelect={openSidePanel('frame')}
onSelect={openAllFrames}
style={menuItemStyle}
>
{t['com.affine.header.option.view-frame']()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -962,13 +962,6 @@ export const reloadView = async () => {
}
};

export const reloadView = async () => {
const id = WebContentViewsManager.instance.activeWorkbenchId;
if (id) {
await WebContentViewsManager.instance.loadTab(id);
}
};

export const onTabAction = (fn: (event: TabAction) => void) => {
const { unsubscribe } =
WebContentViewsManager.instance.tabAction$.subscribe(fn);
Expand Down

0 comments on commit eeae559

Please sign in to comment.