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 committed Aug 2, 2024
1 parent 4719ffa commit bfff10e
Show file tree
Hide file tree
Showing 13 changed files with 567 additions and 188 deletions.
26 changes: 0 additions & 26 deletions packages/frontend/component/src/theme/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -275,32 +275,6 @@ affine-block-hub {
}
}

button,
input,
select,
textarea
/* [role='button'] */ {
-webkit-app-region: no-drag;
}

#webpack-dev-server-client-overlay {
-webkit-app-region: no-drag;
}

html[data-active='false'] {
opacity: 0;
transition: opacity 0.2s 0.1s;
}

html[data-active='true']:has([data-blur-background='true']) {
opacity: 1;
transition: opacity 0.2s;
}

html[data-active='false'] * {
-webkit-app-region: no-drag !important;
}

html,
body {
height: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,63 @@ export class AppTabsHeaderService extends Service {
[]
);

showContextMenu = async (workbenchId: string, viewIdx: number) => {
await apis?.ui.showTabContextMenu(workbenchId, viewIdx);
};
showContextMenu = apis?.ui.showTabContextMenu;

activateView = async (workbenchId: string, viewIdx: number) => {
await apis?.ui.activateView(workbenchId, viewIdx);
};
activateView = apis?.ui.activateView;

closeTab = apis?.ui.closeTab;

closeTab = async (workbenchId: string) => {
await apis?.ui.closeTab(workbenchId);
onAddTab = apis?.ui.addTab;

onAddDocTab = async (
docId: string,
targetTabId?: string,
edge?: 'left' | 'right'
) => {
await apis?.ui.addTab({
view: {
path: {
pathname: '/' + docId,
},
},
target: targetTabId,
edge,
});
};

onAddTab = async () => {
await apis?.ui.addTab();
onAddTagTab = async (
tagId: string,
targetTabId?: string,
edge?: 'left' | 'right'
) => {
await apis?.ui.addTab({
view: {
path: {
pathname: '/tag/' + tagId,
},
},
target: targetTabId,
edge,
});
};

onToggleRightSidebar = async () => {
await apis?.ui.toggleRightSidebar();
onAddCollectionTab = async (
collectionId: string,
targetTabId?: string,
edge?: 'left' | 'right'
) => {
await apis?.ui.addTab({
view: {
path: {
pathname: '/collection/' + collectionId,
},
},
target: targetTabId,
edge,
});
};

onToggleRightSidebar = apis?.ui.toggleRightSidebar;

moveTab = apis?.ui.moveTab;
}
Loading

0 comments on commit bfff10e

Please sign in to comment.