mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-17 18:16:15 +08:00
feat(core): enhance share page with selector (#8319)
Closes [BS-1346](https://linear.app/affine-design/issue/BS-1346/白板上的-link-to-block-在只读模式下打开无法跳转和高亮) <div class='graphite__hidden'> <div>🎥 Video uploaded on Graphite:</div> <a href="https://app.graphite.dev/media/video/8ypiIKZXudF5a0tIgIzf/84bb27a9-608f-4cfc-a4c8-58de8aa5d791.mov"> <img src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/8ypiIKZXudF5a0tIgIzf/84bb27a9-608f-4cfc-a4c8-58de8aa5d791.mov"> </a> </div> <video src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/8ypiIKZXudF5a0tIgIzf/84bb27a9-608f-4cfc-a4c8-58de8aa5d791.mov">Screen Recording 2024-09-20 at 06.21.45.mov</video>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { toURLSearchParams } from '@affine/core/utils';
|
||||
import { Unreachable } from '@affine/env/constant';
|
||||
import type { DocMode } from '@blocksuite/blocks';
|
||||
import type { ReferenceParams } from '@blocksuite/blocks';
|
||||
import { Entity, LiveData } from '@toeverything/infra';
|
||||
import { type To } from 'history';
|
||||
import { omit } from 'lodash-es';
|
||||
import { nanoid } from 'nanoid';
|
||||
|
||||
import type { WorkbenchNewTabHandler } from '../services/workbench-new-tab-handler';
|
||||
@@ -122,14 +124,7 @@ export class Workbench extends Entity {
|
||||
}
|
||||
|
||||
openDoc(
|
||||
id:
|
||||
| string
|
||||
| {
|
||||
docId: string;
|
||||
mode?: DocMode;
|
||||
blockIds?: string[];
|
||||
elementIds?: string[];
|
||||
},
|
||||
id: string | ({ docId: string } & ReferenceParams),
|
||||
options?: WorkbenchOpenOptions
|
||||
) {
|
||||
const isString = typeof id === 'string';
|
||||
@@ -137,12 +132,10 @@ export class Workbench extends Entity {
|
||||
|
||||
let query = '';
|
||||
if (!isString) {
|
||||
const { mode, blockIds, elementIds } = id;
|
||||
const search = new URLSearchParams();
|
||||
if (mode) search.set('mode', mode);
|
||||
if (blockIds?.length) search.set('blockIds', blockIds.join(','));
|
||||
if (elementIds?.length) search.set('elementIds', elementIds.join(','));
|
||||
if (search.size > 0) query = `?${search.toString()}`;
|
||||
const search = toURLSearchParams(omit(id, ['docId']));
|
||||
if (search?.size) {
|
||||
query = `?${search.toString()}`;
|
||||
}
|
||||
}
|
||||
|
||||
this.open(`/${docId}${query}`, options);
|
||||
|
||||
Reference in New Issue
Block a user