mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00: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:
@@ -377,7 +377,6 @@ export function patchQuickSearchService(framework: FrameworkProvider) {
|
||||
(item.name === 'Linked Doc' || item.name === 'Link')
|
||||
) {
|
||||
item.action = async ({ rootComponent }) => {
|
||||
// TODO(@Mirone): fix the type
|
||||
// @ts-expect-error fixme
|
||||
const { success, insertedLinkType } =
|
||||
// @ts-expect-error fixme
|
||||
@@ -385,7 +384,6 @@ export function patchQuickSearchService(framework: FrameworkProvider) {
|
||||
|
||||
if (!success) return;
|
||||
|
||||
// TODO(@Mirone): fix the type
|
||||
insertedLinkType
|
||||
?.then(
|
||||
(type: {
|
||||
@@ -394,17 +392,17 @@ export function patchQuickSearchService(framework: FrameworkProvider) {
|
||||
const flavour = type?.flavour;
|
||||
if (!flavour) return;
|
||||
|
||||
if (flavour === 'affine:bookmark') {
|
||||
track.doc.editor.slashMenu.bookmark();
|
||||
return;
|
||||
}
|
||||
|
||||
if (flavour === 'affine:embed-linked-doc') {
|
||||
track.doc.editor.slashMenu.linkDoc({
|
||||
control: 'linkDoc',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (flavour === 'affine:bookmark') {
|
||||
track.doc.editor.slashMenu.bookmark();
|
||||
return;
|
||||
}
|
||||
}
|
||||
)
|
||||
.catch(console.error);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { toURLSearchParams } from '@affine/core/utils';
|
||||
import type { DocMode } from '@blocksuite/blocks';
|
||||
import { createContext, useCallback, useContext, useMemo } from 'react';
|
||||
import type { NavigateFunction, NavigateOptions } from 'react-router-dom';
|
||||
@@ -45,11 +46,8 @@ export function useNavigateHelper() {
|
||||
elementIds?: string[],
|
||||
logic: RouteLogic = RouteLogic.PUSH
|
||||
) => {
|
||||
const search = new URLSearchParams();
|
||||
if (mode) search.append('mode', mode);
|
||||
if (blockIds?.length) search.append('blockIds', blockIds.join(','));
|
||||
if (elementIds?.length) search.append('elementIds', elementIds.join(','));
|
||||
const query = search.size > 0 ? `?${search.toString()}` : '';
|
||||
const search = toURLSearchParams({ mode, blockIds, elementIds });
|
||||
const query = search?.size ? `?${search.toString()}` : '';
|
||||
return navigate(`/workspace/${workspaceId}/${pageId}${query}`, {
|
||||
replace: logic === RouteLogic.REPLACE,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user