feat(mindspace): 全部页面管理、级联删除与页面同步去重

支持全部页面分页/多选/删除/分享,删除时可选移除广场帖并清理工作区附件;修复并发同步重复创建页面,并补齐预览下载链接重写与 iframe 下载权限。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-06-30 01:22:38 +08:00
parent 6e6d00568a
commit ea6c49f046
30 changed files with 2562 additions and 351 deletions
+22
View File
@@ -36,3 +36,25 @@ export function resolveMindSpaceHomeUrl(): string {
}
return `${window.location.origin}/space`;
}
/** 已发布页面的独立访问链接(非空间内编辑路由)。未发布时返回 null。 */
export function resolveMindSpacePagePublicViewUrl(page: {
publicationUrl?: string | null;
}): string | null {
const value = String(page.publicationUrl ?? '').trim();
if (!value) return null;
return resolvePublicPageUrl(value);
}
/** @deprecated 使用 resolveMindSpacePagePublicViewUrl */
export const resolveMindSpacePageViewUrl = resolveMindSpacePagePublicViewUrl;
/** 未发布时供本人查看的预览链接(需登录,不可对外分享)。 */
export function resolveMindSpacePageOwnerPreviewUrl(page: {
id: string;
versionNo?: number;
updatedAt?: number;
}): string {
const version = page.versionNo ?? page.updatedAt ?? Date.now();
return `${window.location.origin}/api/mindspace/v1/pages/${encodeURIComponent(page.id)}/preview?v=${version}`;
}
+3 -3
View File
@@ -1,4 +1,4 @@
import { resolveMindSpaceHomeUrl } from './publicUrl';
import { resolveMindSpaceHomeUrl, resolveMindSpacePagePublicViewUrl, resolvePublicPageUrl } from './publicUrl';
import type { MindSpacePage } from '../types';
export type SharePayload = {
@@ -58,8 +58,8 @@ export const SHARE_CHANNELS: ShareChannel[] = [
export function buildPageSharePayload(page: MindSpacePage, pagePublicUrl?: string): SharePayload {
const publicUrl = pagePublicUrl
? new URL(pagePublicUrl, window.location.origin).toString()
: window.location.href;
? resolvePublicPageUrl(pagePublicUrl)
: resolveMindSpacePagePublicViewUrl(page) ?? window.location.href;
return {
title: page.title || '我的 MindSpace 页面',
url: publicUrl,