mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-19 11:06:25 +08:00
fix(core): add toDocSearchParams for better typeschecking doc search params (#11383)
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { notify } from '@affine/component';
|
||||
import { ServerService } from '@affine/core/modules/cloud';
|
||||
import { toURLSearchParams } from '@affine/core/modules/navigation';
|
||||
import { toDocSearchParams } from '@affine/core/modules/navigation';
|
||||
import { copyTextToClipboard } from '@affine/core/utils/clipboard';
|
||||
import { useI18n } from '@affine/i18n';
|
||||
import { track } from '@affine/track';
|
||||
import type { SerializedXYWH } from '@blocksuite/affine/global/gfx';
|
||||
import { type DocMode } from '@blocksuite/affine/model';
|
||||
import {
|
||||
getBlockSelectionsCommand,
|
||||
@@ -25,7 +26,7 @@ export type UseSharingUrl = {
|
||||
mode?: DocMode;
|
||||
blockIds?: string[];
|
||||
elementIds?: string[];
|
||||
xywh?: string; // not needed currently
|
||||
xywh?: SerializedXYWH; // not needed currently
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -44,7 +45,7 @@ export const generateUrl = ({
|
||||
}: UseSharingUrl & { baseUrl: string }) => {
|
||||
try {
|
||||
const url = new URL(`/workspace/${workspaceId}/${pageId}`, baseUrl);
|
||||
const search = toURLSearchParams({ mode, blockIds, elementIds, xywh });
|
||||
const search = toDocSearchParams({ mode, blockIds, elementIds, xywh });
|
||||
if (search?.size) url.search = search.toString();
|
||||
return url.toString();
|
||||
} catch (err) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { SettingTab } from '@affine/core/modules/dialogs/constant';
|
||||
import { toURLSearchParams } from '@affine/core/modules/navigation';
|
||||
import { toDocSearchParams } from '@affine/core/modules/navigation';
|
||||
import { getOpenUrlInDesktopAppLink } from '@affine/core/modules/open-in-app';
|
||||
import type { DocMode } from '@blocksuite/affine/model';
|
||||
import { nanoid } from 'nanoid';
|
||||
@@ -49,7 +49,7 @@ export function useNavigateHelper() {
|
||||
elementIds?: string[],
|
||||
logic: RouteLogic = RouteLogic.PUSH
|
||||
) => {
|
||||
const search = toURLSearchParams({
|
||||
const search = toDocSearchParams({
|
||||
mode,
|
||||
blockIds,
|
||||
elementIds,
|
||||
|
||||
Reference in New Issue
Block a user