mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-16 22:07:09 +08:00
feat(editor): add sidebar service (#9761)
This commit is contained in:
@@ -64,6 +64,7 @@ import {
|
||||
patchPeekViewService,
|
||||
patchQuickSearchService,
|
||||
patchReferenceRenderer,
|
||||
patchSideBarService,
|
||||
type ReferenceReactRenderer,
|
||||
} from './specs/custom/spec-patchers';
|
||||
import { createEdgelessModeSpecs } from './specs/edgeless';
|
||||
@@ -167,6 +168,7 @@ const usePatchSpecs = (mode: DocMode) => {
|
||||
patched = patched.concat(patchParseDocUrlExtension(framework));
|
||||
patched = patched.concat(patchGenerateDocUrlExtension(framework));
|
||||
patched = patched.concat(patchQuickSearchService(framework));
|
||||
patched = patched.concat(patchSideBarService(framework));
|
||||
if (BUILD_CONFIG.isMobileEdition) {
|
||||
patched = patched.concat(patchForMobile());
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
} from '@affine/core/modules/quicksearch';
|
||||
import { ExternalLinksQuickSearchSession } from '@affine/core/modules/quicksearch/impls/external-links';
|
||||
import { JournalsQuickSearchSession } from '@affine/core/modules/quicksearch/impls/journals';
|
||||
import { WorkbenchService } from '@affine/core/modules/workbench';
|
||||
import { WorkspaceService } from '@affine/core/modules/workspace';
|
||||
import { DebugLogger } from '@affine/debug';
|
||||
import { I18n } from '@affine/i18n';
|
||||
@@ -61,6 +62,7 @@ import {
|
||||
PeekViewExtension,
|
||||
QuickSearchExtension,
|
||||
ReferenceNodeConfigExtension,
|
||||
SidebarExtension,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import { Bound } from '@blocksuite/affine/global/utils';
|
||||
import {
|
||||
@@ -665,3 +667,20 @@ export function patchForEdgelessNoteConfig(
|
||||
reactToLit(<EdgelessNoteHeader note={note} />),
|
||||
});
|
||||
}
|
||||
|
||||
export function patchSideBarService(framework: FrameworkProvider) {
|
||||
const { workbench } = framework.get(WorkbenchService);
|
||||
|
||||
return SidebarExtension({
|
||||
open: (tabId?: string) => {
|
||||
workbench.openSidebar();
|
||||
workbench.activeView$.value.activeSidebarTab(tabId ?? null);
|
||||
},
|
||||
close: () => {
|
||||
workbench.closeSidebar();
|
||||
},
|
||||
getTabIds: () => {
|
||||
return workbench.activeView$.value.sidebarTabs$.value.map(tab => tab.id);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user