fix: quick search in public workspace (#1706)

This commit is contained in:
Himself65
2023-03-27 19:30:27 -05:00
committed by GitHub
parent 2fba1fa7c8
commit 427a5e7545
2 changed files with 49 additions and 30 deletions
+2 -22
View File
@@ -13,18 +13,11 @@ export const publicBlockSuiteAtom = atom<Promise<BlockSuiteWorkspace>>(
throw new Error('No workspace id');
}
const binary = await affineApis.downloadWorkspace(workspaceId, true);
// fixme: this is a hack
const params = new URLSearchParams(window.location.search);
const prefixUrl = params.get('prefixUrl')
? (params.get('prefixUrl') as string)
: '/';
const blockSuiteWorkspace = createEmptyBlockSuiteWorkspace(
workspaceId,
(k: string) =>
// fixme: token could be expired
({ api: `${prefixUrl}api/workspace`, token: getLoginStorage()?.token }[
k
])
({ api: `api/workspace`, token: getLoginStorage()?.token }[k])
);
BlockSuiteWorkspace.Y.applyUpdate(
blockSuiteWorkspace.doc,
@@ -39,19 +32,6 @@ export const publicBlockSuiteAtom = atom<Promise<BlockSuiteWorkspace>>(
);
blockSuiteWorkspace.awarenessStore.setFlag('enable_slash_menu', false);
blockSuiteWorkspace.awarenessStore.setFlag('enable_drag_handle', false);
return new Promise(resolve => {
setTimeout(() => {
// const workspace: LocalWorkspace = {
// id: workspaceId,
// blockSuiteWorkspace,
// flavour: RemWorkspaceFlavour.LOCAL,
// providers: [],
// };
// fixme: quick search won't work, ASAP
// dataCenter.workspaces.push(workspace);
// dataCenter.callbacks.forEach(cb => cb());
resolve(blockSuiteWorkspace);
}, 0);
});
return blockSuiteWorkspace;
}
);