Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat: allow peek view to be closed by the caller && bump bs (#8542)

pengx1781029db6ce4f
diff --git a/packages/common/env/package.json b/packages/common/env/package.json
index 57ada1e1c4..7026fa5e12 100644
--- a/packages/common/env/package.json
+++ b/packages/common/env/package.json
@@ -3,7 +3,7 @@
"private": true,
"type": "module",
"devDependencies": {
- "@blocksuite/affine": "0.17.19",
+ "@blocksuite/affine": "0.0.0-canary-20241028080828",
"vitest": "2.1.1"
},
"exports": {
diff --git a/packages/common/infra/package.json b/packages/common/infra/package.json
index 1e8a36bc7a..48ebc4aa13 100644
--- a/packages/common/infra/package.json
+++ b/packages/common/infra/package.json
@@ -14,7 +14,7 @@
"@affine/debug": "workspace:*",
"@affine/env": "workspace:*",
"@affine/templates": "workspace:*",
- "@blocksuite/affine": "0.17.19",
+ "@blocksuite/affine": "0.0.0-canary-20241028080828",
"@datastructures-js/binary-search-tree": "^5.3.2",
"foxact": "^0.2.33",
"fractional-indexing": "^3.2.0",
diff --git a/packages/frontend/apps/android/package.json b/packages/frontend/apps/android/package.json
index 88a87ba311..7019a0b7d2 100644
--- a/packages/frontend/apps/android/package.json
+++ b/packages/frontend/apps/android/package.json
@@ -13,7 +13,7 @@
"@affine/component": "workspace:*",
"@affine/core": "workspace:*",
"@affine/i18n": "workspace:*",
- "@blocksuite/affine": "0.17.19",
+ "@blocksuite/affine": "0.0.0-canary-20241028080828",
"@blocksuite/icons": "^2.1.67",
"@capacitor/android": "^6.1.2",
"@capacitor/core": "^6.1.2",
diff --git a/packages/frontend/apps/electron/package.json b/packages/frontend/apps/electron/package.json
index 8c2693b8f8..e0c0487cfd 100644
--- a/packages/frontend/apps/electron/package.json
+++ b/packages/frontend/apps/electron/package.json
@@ -28,7 +28,7 @@
"@affine/core": "workspace:*",
"@affine/i18n": "workspace:*",
"@affine/native": "workspace:*",
- "@blocksuite/affine": "0.17.19",
+ "@blocksuite/affine": "0.0.0-canary-20241028080828",
"@electron-forge/cli": "^7.3.0",
"@electron-forge/core": "^7.3.0",
"@electron-forge/core-utils": "^7.3.0",
diff --git a/packages/frontend/apps/ios/package.json b/packages/frontend/apps/ios/package.json
index de11ba96ec..c8636429a0 100644
--- a/packages/frontend/apps/ios/package.json
+++ b/packages/frontend/apps/ios/package.json
@@ -13,7 +13,7 @@
"@affine/component": "workspace:*",
"@affine/core": "workspace:*",
"@affine/i18n": "workspace:*",
- "@blocksuite/affine": "0.17.19",
+ "@blocksuite/affine": "0.0.0-canary-20241028080828",
"@blocksuite/icons": "^2.1.67",
"@capacitor/app": "^6.0.1",
"@capacitor/browser": "^6.0.3",
diff --git a/packages/frontend/apps/mobile/package.json b/packages/frontend/apps/mobile/package.json
index b83864d2b3..89c6a8485f 100644
--- a/packages/frontend/apps/mobile/package.json
+++ b/packages/frontend/apps/mobile/package.json
@@ -13,7 +13,7 @@
"@affine/component": "workspace:*",
"@affine/core": "workspace:*",
"@affine/i18n": "workspace:*",
- "@blocksuite/affine": "0.17.19",
+ "@blocksuite/affine": "0.0.0-canary-20241028080828",
"@blocksuite/icons": "^2.1.67",
"@sentry/react": "^8.0.0",
"react": "^18.2.0",
diff --git a/packages/frontend/component/package.json b/packages/frontend/component/package.json
index 0fbe970148..7ef019a37c 100644
--- a/packages/frontend/component/package.json
+++ b/packages/frontend/component/package.json
@@ -62,7 +62,7 @@
"zod": "^3.22.4"
},
"devDependencies": {
- "@blocksuite/affine": "0.17.19",
+ "@blocksuite/affine": "0.0.0-canary-20241028080828",
"@blocksuite/icons": "2.1.69",
"@chromatic-com/storybook": "^3.0.0",
"@storybook/addon-essentials": "^8.2.9",
diff --git a/packages/frontend/core/package.json b/packages/frontend/core/package.json
index ac28113a0d..0a15771497 100644
--- a/packages/frontend/core/package.json
+++ b/packages/frontend/core/package.json
@@ -16,7 +16,7 @@
"@affine/i18n": "workspace:*",
"@affine/templates": "workspace:*",
"@affine/track": "workspace:*",
- "@blocksuite/affine": "0.17.19",
+ "@blocksuite/affine": "0.0.0-canary-20241028080828",
"@blocksuite/icons": "2.1.69",
"@capacitor/app": "^6.0.1",
"@capacitor/browser": "^6.0.3",
diff --git a/packages/frontend/core/src/blocksuite/presets/ai/_common/chat-actions-handle.ts b/packages/frontend/core/src/blocksuite/presets/ai/_common/chat-actions-handle.ts
index bdb0ef3282..c2170cfdb3 100644
--- a/packages/frontend/core/src/blocksuite/presets/ai/_common/chat-actions-handle.ts
+++ b/packages/frontend/core/src/blocksuite/presets/ai/_common/chat-actions-handle.ts
@@ -21,7 +21,7 @@ import {
} from '@blocksuite/affine/blocks';
import {
Bound,
- getElementsBound,
+ getCommonBoundWithRotation,
type SerializedXYWH,
} from '@blocksuite/affine/global/utils';
import type { Doc } from '@blocksuite/affine/store';
@@ -398,7 +398,7 @@ const ADD_TO_EDGELESS_AS_NOTE = {
};
if (elements.length > 0) {
- const bound = getElementsBound(
+ const bound = getCommonBoundWithRotation(
elements.map(e => Bound.deserialize(e.xywh))
);
const newBound = new Bound(bound.x, bound.maxY + 10, bound.w);
@@ -494,7 +494,7 @@ const CREATE_AS_LINKED_DOC = {
let y = 0;
if (elements.length) {
// Calculate the bound of the selected elements first
- const bound = getElementsBound(
+ const bound = getCommonBoundWithRotation(
elements.map(e => Bound.deserialize(e.xywh))
);
x = bound.x;
diff --git a/packages/frontend/core/src/blocksuite/presets/ai/_common/config.ts b/packages/frontend/core/src/blocksuite/presets/ai/_common/config.ts
index 73713ee886..3b978913ef 100644
--- a/packages/frontend/core/src/blocksuite/presets/ai/_common/config.ts
+++ b/packages/frontend/core/src/blocksuite/presets/ai/_common/config.ts
@@ -6,7 +6,7 @@ import type {
import {
type AIItemGroupConfig,
type AISubItemConfig,
- type CopilotSelectionController,
+ type CopilotTool,
EDGELESS_ELEMENT_TOOLBAR_WIDGET,
type EdgelessElementToolbarWidget,
matchFlavours,
@@ -251,10 +251,9 @@ function edgelessHandler<T extends keyof BlockSuitePresets.AIActions>(
if (!edgeless) {
AIProvider.slots.requestRunInEdgeless.emit({ host });
} else {
- edgeless.tools.setEdgelessTool({ type: 'copilot' });
- const currentController = edgeless.tools.controllers[
- 'copilot'
- ] as CopilotSelectionController;
+ edgeless.gfx.tool.setTool({ type: 'copilot' });
+ const currentController =
+ edgeless.gfx.tool.currentTool$.peek() as CopilotTool;
const selectedElements = edgeless.service.selection.selectedElements;
currentController.updateDragPointsWith(selectedElements, 10);
currentController.draggingAreaUpdated.emit(false); // do not show edgeless panel
diff --git a/packages/frontend/core/src/blocksuite/presets/ai/actions/edgeless-handler.ts b/packages/frontend/core/src/blocksuite/presets/ai/actions/edgeless-handler.ts
index 48af9acf65..28a15e201e 100644
--- a/packages/frontend/core/src/blocksuite/presets/ai/actions/edgeless-handler.ts
+++ b/packages/frontend/core/src/blocksuite/presets/ai/actions/edgeless-handler.ts
@@ -388,7 +388,8 @@ function updateEdgelessAIPanelConfig<
config.hideCallback = () => {
aiPanel.updateComplete
.finally(() => {
- edgelessCopilot.edgeless.service.tool.switchToDefaultMode({
+ edgelessCopilot.edgeless.gfx.tool.setTool('default');
+ edgelessCopilot.edgeless.gfx.selection.set({
elements: [],
editing: false,
});
diff --git a/packages/frontend/core/src/blocksuite/presets/ai/actions/edgeless-response.ts b/packages/frontend/core/src/blocksuite/presets/ai/actions/edgeless-response.ts
index ecd76eb518..74761effc9 100644
--- a/packages/frontend/core/src/blocksuite/presets/ai/actions/edgeless-response.ts
+++ b/packages/frontend/core/src/blocksuite/presets/ai/actions/edgeless-response.ts
@@ -10,6 +10,7 @@ import type {
SurfaceBlockModel,
} from '@blocksuite/affine/blocks';
import {
+ addImages,
DeleteIcon,
EDGELESS_ELEMENT_TOOLBAR_WIDGET,
EDGELESS_TEXT_BLOCK_MIN_HEIGHT,
@@ -312,8 +313,7 @@ const imageHandler = (host: EditorHost) => {
const [x, y] = edgelessRoot.service.viewport.toViewCoord(minX, minY);
host.doc.transact(() => {
- edgelessRoot
- .addImages([img], [x, y])
+ addImages(edgelessRoot.std, [img], [x, y])
.then(blockIds => {
const imageBlockId = blockIds[0];
const imageBlock = host.doc.getBlock(imageBlockId);
@@ -413,7 +413,7 @@ export const responses: {
const mindmap = elements[0].group as MindmapElementModel;
const xywh = mindmap.tree.element.xywh;
- surface.removeElement(mindmap.id);
+ surface.deleteElement(mindmap.id);
if (data.node) {
data.node.xywh = xywh;
diff --git a/packages/frontend/core/src/blocksuite/presets/ai/ai-spec.ts b/packages/frontend/core/src/blocksuite/presets/ai/ai-spec.ts
index 0f8eadd546..d7e2334318 100644
--- a/packages/frontend/core/src/blocksuite/presets/ai/ai-spec.ts
+++ b/packages/frontend/core/src/blocksuite/presets/ai/ai-spec.ts
@@ -15,7 +15,7 @@ import {
EdgelessCopilotWidget,
EdgelessElementToolbarWidget,
EdgelessRootBlockSpec,
- edgelessRootWigetViewMap,
+ edgelessRootWidgetViewMap,
ImageBlockSpec,
PageRootBlockSpec,
pageRootWidgetViewMap,
@@ -114,7 +114,7 @@ export const AIEdgelessRootBlockSpec: ExtensionType[] = [
setup: di => {
di.override(WidgetViewMapIdentifier('affine:page'), () => {
return {
- ...edgelessRootWigetViewMap,
+ ...edgelessRootWidgetViewMap,
[AFFINE_EDGELESS_COPILOT_WIDGET]: literal`${unsafeStatic(
AFFINE_EDGELESS_COPILOT_WIDGET
)}`,
diff --git a/packages/frontend/core/src/blocksuite/presets/ai/utils/selection-utils.ts b/packages/frontend/core/src/blocksuite/presets/ai/utils/selection-utils.ts
index 2b1fb5724b..5c1a5c6080 100644
--- a/packages/frontend/core/src/blocksuite/presets/ai/utils/selection-utils.ts
+++ b/packages/frontend/core/src/blocksuite/presets/ai/utils/selection-utils.ts
@@ -1,6 +1,6 @@
import type { EditorHost } from '@blocksuite/affine/block-std';
import {
- type CopilotSelectionController,
+ type CopilotTool,
type FrameBlockModel,
ImageBlockModel,
type SurfaceBlockComponent,
@@ -279,7 +279,7 @@ export function getCopilotSelectedElems(
const copilotWidget = getEdgelessCopilotWidget(host);
if (copilotWidget.visible) {
- return (service.tool.controllers['copilot'] as CopilotSelectionController)
+ return (service.gfx.tool.currentTool$.peek() as CopilotTool)
.selectedElements;
}
diff --git a/packages/frontend/core/src/components/affine/reference-link/index.tsx b/packages/frontend/core/src/components/affine/reference-link/index.tsx
index 38bf78dd85..0eee0237fc 100644
--- a/packages/frontend/core/src/components/affine/reference-link/index.tsx
+++ b/packages/frontend/core/src/components/affine/reference-link/index.tsx
@@ -83,7 +83,11 @@ export function AffinePageReference({
if (e.shiftKey && ref.current) {
e.preventDefault();
e.stopPropagation();
- peekView.open(ref.current).catch(console.error);
+ peekView
+ .open({
+ element: ref.current,
+ })
+ .catch(console.error);
}
if (isInPeekView) {
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx
index e769b4bdb9..3a19799d94 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx
@@ -21,6 +21,7 @@ import {
useRef,
} from 'react';
+import type { DefaultOpenProperty } from '../../doc-properties';
import { BlocksuiteDocEditor, BlocksuiteEdgelessEditor } from './lit-adaper';
import * as styles from './styles.css';
@@ -29,6 +30,7 @@ interface BlocksuiteEditorContainerProps {
mode: DocMode;
shared?: boolean;
className?: string;
+ defaultOpenProperty?: DefaultOpenProperty;
style?: React.CSSProperties;
}
@@ -43,7 +45,7 @@ export const BlocksuiteEditorContainer = forwardRef<
AffineEditorContainer,
BlocksuiteEditorContainerProps
>(function AffineEditorContainer(
- { page, mode, className, style, shared },
+ { page, mode, className, style, shared, defaultOpenProperty },
ref
) {
const rootRef = useRef<HTMLDivElement>(null);
@@ -171,6 +173,7 @@ export const BlocksuiteEditorContainer = forwardRef<
ref={docRef}
titleRef={docTitleRef}
onClickBlank={handleClickPageModeBlank}
+ defaultOpenProperty={defaultOpenProperty}
/>
) : (
<BlocksuiteEdgelessEditor
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor.tsx
index e27ba8b8ea..34317be3c3 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor.tsx
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor.tsx
@@ -16,6 +16,7 @@ import { use } from 'foxact/use';
import type { CSSProperties } from 'react';
import { Suspense, useEffect } from 'react';
+import type { DefaultOpenProperty } from '../../doc-properties';
import { BlocksuiteEditorContainer } from './blocksuite-editor-container';
import { NoPageRootError } from './no-page-error';
@@ -23,6 +24,7 @@ export type EditorProps = {
page: Doc;
mode: DocMode;
shared?: boolean;
+ defaultOpenProperty?: DefaultOpenProperty;
// on Editor ready
onEditorReady?: (editor: AffineEditorContainer) => (() => void) | void;
style?: CSSProperties;
@@ -58,6 +60,7 @@ const BlockSuiteEditorImpl = ({
shared,
style,
onEditorReady,
+ defaultOpenProperty,
}: EditorProps) => {
usePageRoot(page);
@@ -134,6 +137,7 @@ const BlockSuiteEditorImpl = ({
mode={mode}
page={page}
shared={shared}
+ defaultOpenProperty={defaultOpenProperty}
ref={editorRef}
className={className}
style={style}
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/lit-adaper.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/lit-adaper.tsx
index 0a131f6235..49cb5043f6 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/lit-adaper.tsx
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/lit-adaper.tsx
@@ -39,7 +39,10 @@ import {
AffinePageReference,
AffineSharedPageReference,
} from '../../affine/reference-link';
-import { DocPropertiesTable } from '../../doc-properties';
+import {
+ type DefaultOpenProperty,
+ DocPropertiesTable,
+} from '../../doc-properties';
import { BiDirectionalLinkPanel } from './bi-directional-link-panel';
import { BlocksuiteEditorJournalDocTitle } from './journal-doc-title';
import {
@@ -76,6 +79,7 @@ const adapted = {
interface BlocksuiteEditorProps {
page: Doc;
shared?: boolean;
+ defaultOpenProperty?: DefaultOpenProperty;
}
const usePatchSpecs = (shared: boolean, mode: DocMode) => {
@@ -191,7 +195,13 @@ export const BlocksuiteDocEditor = forwardRef<
titleRef?: React.Ref<DocTitle>;
}
>(function BlocksuiteDocEditor(
- { page, shared, onClickBlank, titleRef: externalTitleRef },
+ {
+ page,
+ shared,
+ onClickBlank,
+ titleRef: externalTitleRef,
+ defaultOpenProperty,
+ },
ref
) {
const titleRef = useRef<DocTitle | null>(null);
@@ -245,7 +255,9 @@ export const BlocksuiteDocEditor = forwardRef<
) : (
<BlocksuiteEditorJournalDocTitle page={page} />
)}
- {!shared ? <DocPropertiesTable /> : null}
+ {!shared ? (
+ <DocPropertiesTable defaultOpenProperty={defaultOpenProperty} />
+ ) : null}
<adapted.DocEditor
className={styles.docContainer}
ref={onDocRef}
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/root-block.ts b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/root-block.ts
index e19cbb85bc..f6ee2e3df1 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/root-block.ts
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/root-block.ts
@@ -9,7 +9,9 @@ import {
type ExtensionType,
} from '@blocksuite/affine/block-std';
import {
+ EdgelessBuiltInManager,
EdgelessRootBlockSpec,
+ EdgelessToolExtension,
EditorSettingExtension,
FontLoaderService,
PageRootBlockSpec,
@@ -74,6 +76,8 @@ export function createEdgelessRootBlockSpec(
return [
enableAI ? AIEdgelessRootBlockSpec : EdgelessRootBlockSpec,
FontLoaderService,
+ EdgelessToolExtension,
+ EdgelessBuiltInManager,
getFontConfigExtension(),
getTelemetryExtension(),
getEditorConfigExtension(framework),
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx
index 6bdce4f588..9fbb56d606 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/specs/custom/spec-patchers.tsx
@@ -11,7 +11,6 @@ import type { EditorService } from '@affine/core/modules/editor';
import { EditorSettingService } from '@affine/core/modules/editor-settting';
import { resolveLinkToDoc } from '@affine/core/modules/navigation';
import type { PeekViewService } from '@affine/core/modules/peek-view';
-import type { ActivePeekView } from '@affine/core/modules/peek-view/entities/peek-view';
import {
CreationQuickSearchSession,
DocsQuickSearchSession,
@@ -35,6 +34,8 @@ import type {
AffineReference,
DocMode,
DocModeProvider,
+ PeekOptions,
+ PeekViewService as BSPeekViewService,
QuickSearchResult,
RootService,
} from '@blocksuite/affine/blocks';
@@ -243,11 +244,28 @@ export function patchEmbedLinkedDocBlockConfig(framework: FrameworkProvider) {
export function patchPeekViewService(service: PeekViewService) {
return PeekViewExtension({
- peek: (target: ActivePeekView['target'], template?: TemplateResult) => {
- logger.debug('center peek', target, template);
- return service.peekView.open(target, template);
+ peek: (
+ element: {
+ target: HTMLElement;
+ docId: string;
+ blockIds?: string[];
+ template?: TemplateResult;
+ },
+ options?: PeekOptions
+ ) => {
+ logger.debug('center peek', element);
+ const { template, target, ...props } = element;
+
+ return service.peekView.open(
+ {
+ element: target,
+ docRef: props,
+ },
+ template,
+ options?.abortSignal
+ );
},
- });
+ } satisfies BSPeekViewService);
}
export function patchDocModeService(
diff --git a/packages/frontend/core/src/components/doc-properties/table.tsx b/packages/frontend/core/src/components/doc-properties/table.tsx
index 16fe542a2c..7c6f93060d 100644
--- a/packages/frontend/core/src/components/doc-properties/table.tsx
+++ b/packages/frontend/core/src/components/doc-properties/table.tsx
@@ -41,6 +41,20 @@ type DocBacklinksPopupProps = PropsWithChildren<{
backlinks: { docId: string; blockId: string; title: string }[];
}>;
+export type DefaultOpenProperty =
+ | {
+ type: 'workspace';
+ }
+ | {
+ type: 'database';
+ databaseId: string;
+ databaseRowId: string;
+ };
+
+export interface DocPropertiesTableProps {
+ defaultOpenProperty?: DefaultOpenProperty;
+}
+
export const DocBacklinksPopup = ({
backlinks,
children,
@@ -231,18 +245,19 @@ export const DocPropertyRow = ({
);
};
-interface DocPropertiesTableBodyProps {
+interface DocWorkspacePropertiesTableBodyProps {
className?: string;
style?: React.CSSProperties;
+ defaultOpen?: boolean;
}
// 🏷️ Tags (⋅ xxx) (⋅ yyy)
// #️⃣ Number 123456
// + Add a property
-export const DocPropertiesTableBody = forwardRef<
+const DocWorkspacePropertiesTableBody = forwardRef<
HTMLDivElement,
- DocPropertiesTableBodyProps & HTMLProps<HTMLDivElement>
->(({ className, style, ...props }, ref) => {
+ DocWorkspacePropertiesTableBodyProps & HTMLProps<HTMLDivElement>
+>(({ className, style, defaultOpen, ...props }, ref) => {
const t = useI18n();
const docsService = useService(DocsService);
const workbenchService = useService(WorkbenchService);
@@ -258,6 +273,7 @@ export const DocPropertiesTableBody = forwardRef<
className={clsx(styles.tableBodyRoot, className)}
style={style}
title={t.t('com.affine.workspace.properties')}
+ defaultCollapsed={!defaultOpen}
{...props}
>
<PropertyCollapsibleContent
@@ -334,10 +350,12 @@ export const DocPropertiesTableBody = forwardRef<
</PropertyCollapsibleSection>
);
});
-DocPropertiesTableBody.displayName = 'PagePropertiesTableBody';
+DocWorkspacePropertiesTableBody.displayName = 'PagePropertiesTableBody';
-const DocPropertiesTableInner = () => {
- const [expanded, setExpanded] = useState(false);
+const DocPropertiesTableInner = ({
+ defaultOpenProperty,
+}: DocPropertiesTableProps) => {
+ const [expanded, setExpanded] = useState(!!defaultOpenProperty);
return (
<div className={styles.root}>
<Collapsible.Root
@@ -347,9 +365,24 @@ const DocPropertiesTableInner = () => {
>
<DocPropertiesTableHeader open={expanded} onOpenChange={setExpanded} />
<Collapsible.Content>
- <DocPropertiesTableBody />
+ <DocWorkspacePropertiesTableBody
+ defaultOpen={
+ !defaultOpenProperty || defaultOpenProperty.type === 'workspace'
+ }
+ />
<div className={styles.tableHeaderDivider} />
- <DocDatabaseBacklinkInfo />
+ <DocDatabaseBacklinkInfo
+ defaultOpen={
+ defaultOpenProperty?.type === 'database'
+ ? [
+ {
+ databaseId: defaultOpenProperty.databaseId,
+ rowId: defaultOpenProperty.databaseRowId,
+ },
+ ]
+ : []
+ }
+ />
</Collapsible.Content>
</Collapsible.Root>
</div>
@@ -358,6 +391,8 @@ const DocPropertiesTableInner = () => {
// this is the main component that renders the page properties table at the top of the page below
// the page title
-export const DocPropertiesTable = () => {
- return <DocPropertiesTableInner />;
+export const DocPropertiesTable = ({
+ defaultOpenProperty,
+}: DocPropertiesTableProps) => {
+ return <DocPropertiesTableInner defaultOpenProperty={defaultOpenProperty} />;
};
diff --git a/packages/frontend/core/src/components/page-detail-editor.tsx b/packages/frontend/core/src/components/page-detail-editor.tsx
index 7c55411eb3..f81b982a6a 100644
--- a/packages/frontend/core/src/components/page-detail-editor.tsx
+++ b/packages/frontend/core/src/components/page-detail-editor.tsx
@@ -31,6 +31,7 @@ export interface PageDetailEditorProps {
export const PageDetailEditor = ({ onLoad }: PageDetailEditorProps) => {
const editor = useService(EditorService).editor;
const mode = useLiveData(editor.mode$);
+ const defaultOpenProperty = useLiveData(editor.defaultOpenProperty$);
const isSharedMode = editor.isSharedMode;
const editorSetting = useService(EditorSettingService).editorSetting;
@@ -68,6 +69,7 @@ export const PageDetailEditor = ({ onLoad }: PageDetailEditorProps) => {
} as CSSProperties
}
mode={mode}
+ defaultOpenProperty={defaultOpenProperty}
page={editor.doc.blockSuiteDoc}
shared={isSharedMode}
onEditorReady={onLoad}
diff --git a/packages/frontend/core/src/desktop/pages/workspace/index.tsx b/packages/frontend/core/src/desktop/pages/workspace/index.tsx
index 7107c84b3a..f9bbb5639d 100644
--- a/packages/frontend/core/src/desktop/pages/workspace/index.tsx
+++ b/packages/frontend/core/src/desktop/pages/workspace/index.tsx
@@ -152,19 +152,12 @@ const WorkspacePage = ({ meta }: { meta: WorkspaceMetadata }) => {
})
);
window.exportWorkspaceSnapshot = async (docs?: string[]) => {
- const zip = await ZipTransformer.exportDocs(
+ await ZipTransformer.exportDocs(
workspace.docCollection,
Array.from(workspace.docCollection.docs.values())
.filter(doc => (docs ? docs.includes(doc.id) : true))
.map(doc => doc.getDoc())
);
- const url = URL.createObjectURL(zip);
- // download url
- const a = document.createElement('a');
- a.href = url;
- a.download = `${workspace.docCollection.meta.name}.zip`;
- a.click();
- URL.revokeObjectURL(url);
};
window.importWorkspaceSnapshot = async () => {
const input = document.createElement('input');
diff --git a/packages/frontend/core/src/mobile/pages/workspace/detail/sheets/doc-info.tsx b/packages/frontend/core/src/mobile/pages/workspace/detail/sheets/doc-info.tsx
index 4a1b5ea5fd..82bf78eebc 100644
--- a/packages/frontend/core/src/mobile/pages/workspace/detail/sheets/doc-info.tsx
+++ b/packages/frontend/core/src/mobile/pages/workspace/detail/sheets/doc-info.tsx
@@ -1,5 +1,8 @@
import { Divider, Scrollable } from '@affine/component';
-import { DocPropertiesTable } from '@affine/core/components/doc-properties';
+import {
+ type DefaultOpenProperty,
+ DocPropertiesTable,
+} from '@affine/core/components/doc-properties';
import { LinksRow } from '@affine/core/components/doc-properties/info-modal/links-row';
import { TimeRow } from '@affine/core/components/doc-properties/info-modal/time-row';
import { DocsSearchService } from '@affine/core/modules/docs-search';
@@ -9,7 +12,13 @@ import { Suspense, useMemo } from 'react';
import * as styles from './doc-info.css';
-export const DocInfoSheet = ({ docId }: { docId: string }) => {
+export const DocInfoSheet = ({
+ docId,
+ defaultOpenProperty,
+}: {
+ docId: string;
+ defaultOpenProperty?: DefaultOpenProperty;
+}) => {
const docsSearchService = useService(DocsSearchService);
const t = useI18n();
@@ -52,7 +61,7 @@ export const DocInfoSheet = ({ docId }: { docId: string }) => {
<Divider size="thinner" />
</>
) : null}
- <DocPropertiesTable />
+ <DocPropertiesTable defaultOpenProperty={defaultOpenProperty} />
</Suspense>
</Scrollable.Viewport>
<Scrollable.Scrollbar className={styles.scrollBar} />
diff --git a/packages/frontend/core/src/modules/doc-info/views/database-properties/doc-database-backlink-info.tsx b/packages/frontend/core/src/modules/doc-info/views/database-properties/doc-database-backlink-info.tsx
index 96371ece3a..7595641286 100644
--- a/packages/frontend/core/src/modules/doc-info/views/database-properties/doc-database-backlink-info.tsx
+++ b/packages/frontend/core/src/modules/doc-info/views/database-properties/doc-database-backlink-info.tsx
@@ -95,6 +95,14 @@ const DatabaseBacklinkRow = ({
}, [row?.cells]);
const t = useI18n();
+ const pageRefParams = useMemo(() => {
+ const params = new URLSearchParams();
+ if (row?.id) {
+ params.set('blockIds', row.databaseId);
+ }
+ return params;
+ }, [row]);
+
if (!row || !sortedCells) {
return null;
}
@@ -105,7 +113,11 @@ const DatabaseBacklinkRow = ({
defaultCollapsed={!defaultOpen}
icon={<DatabaseTableViewIcon />}
suffix={
- <AffinePageReference className={styles.docRefLink} pageId={row.docId} />
+ <AffinePageReference
+ className={styles.docRefLink}
+ pageId={row.docId}
+ params={pageRefParams}
+ />
}
>
<PropertyCollapsibleContent
@@ -131,8 +143,8 @@ export const DocDatabaseBacklinkInfo = ({
defaultOpen = [],
}: {
defaultOpen?: {
- docId: string;
- blockId: string;
+ databaseId: string;
+ rowId: string;
}[];
}) => {
const doc = useService(DocService).doc;
@@ -151,11 +163,13 @@ export const DocDatabaseBacklinkInfo = ({
return (
<div className={styles.root}>
- {rows.map(({ docId, rowId, row$ }) => (
+ {rows.map(({ docId, databaseBlockId, rowId, row$ }) => (
<Fragment key={`${docId}-${rowId}`}>
<DatabaseBacklinkRow
defaultOpen={defaultOpen?.some(
- backlink => backlink.docId === docId && backlink.blockId === rowId
+ backlink =>
+ backlink.databaseId === databaseBlockId &&
+ backlink.rowId === rowId
)}
row$={row$}
/>
diff --git a/packages/frontend/core/src/modules/editor/entities/editor.ts b/packages/frontend/core/src/modules/editor/entities/editor.ts
index b331c5c859..6228d1c9e1 100644
--- a/packages/frontend/core/src/modules/editor/entities/editor.ts
+++ b/packages/frontend/core/src/modules/editor/entities/editor.ts
@@ -1,3 +1,4 @@
+import type { DefaultOpenProperty } from '@affine/core/components/doc-properties';
import type {
DocMode,
EdgelessRootService,
@@ -8,6 +9,7 @@ import type {
DocTitle,
} from '@blocksuite/affine/presets';
import type { InlineEditor } from '@blocksuite/inline';
+import { effect } from '@preact/signals-core';
import type { DocService, WorkspaceService } from '@toeverything/infra';
import { Entity, LiveData } from '@toeverything/infra';
import { defaults, isEqual, omit } from 'lodash-es';
@@ -29,6 +31,9 @@ export class Editor extends Entity {
this.workspaceService.workspace.openOptions.isSharedMode;
readonly editorContainer$ = new LiveData<AffineEditorContainer | null>(null);
+ readonly defaultOpenProperty$ = new LiveData<DefaultOpenProperty | undefined>(
+ undefined
+ );
isPresenting$ = new LiveData<boolean>(false);
@@ -39,7 +44,7 @@ export class Editor extends Entity {
) as EdgelessRootService;
if (!edgelessRootService) return;
- edgelessRootService.tool.setEdgelessTool({
+ edgelessRootService.gfx.tool.setTool({
type: !this.isPresenting$.value ? 'frameNavigator' : 'default',
});
}
@@ -60,6 +65,10 @@ export class Editor extends Entity {
this.editorContainer$.next(editorContainer);
}
+ setDefaultOpenProperty(defaultOpenProperty: DefaultOpenProperty | undefined) {
+ this.defaultOpenProperty$.next(defaultOpenProperty);
+ }
+
/**
* sync editor params with view query string
*/
@@ -102,6 +111,17 @@ export class Editor extends Entity {
if (!isEqual(selector, omit(editorParams, ['mode']))) {
this.setSelector(selector);
}
+
+ if (params.databaseId && params.databaseRowId) {
+ const defaultOpenProperty: DefaultOpenProperty = {
+ type: 'database',
+ databaseId: params.databaseId,
+ databaseRowId: params.databaseRowId,
+ };
+ if (!isEqual(defaultOpenProperty, this.defaultOpenProperty$.value)) {
+ this.setDefaultOpenProperty(defaultOpenProperty);
+ }
+ }
} finally {
updating = false;
}
@@ -194,15 +214,15 @@ export class Editor extends Entity {
this.isPresenting$.next(false);
} else {
this.isPresenting$.next(
- edgelessPage.edgelessTool.type === 'frameNavigator'
+ edgelessPage.gfx.tool.currentToolName$.peek() === 'frameNavigator'
);
- const disposable = edgelessPage.slots.edgelessToolUpdated.on(() => {
+ const disposable = effect(() => {
this.isPresenting$.next(
- edgelessPage.edgelessTool.type === 'frameNavigator'
+ edgelessPage.gfx.tool.currentToolName$.value === 'frameNavigator'
);
});
- unsubs.push(disposable.dispose.bind(disposable));
+ unsubs.push(disposable);
}
return () => {
diff --git a/packages/frontend/core/src/modules/navigation/utils.ts b/packages/frontend/core/src/modules/navigation/utils.ts
index c1f7db8ef1..e3bf3185af 100644
--- a/packages/frontend/core/src/modules/navigation/utils.ts
+++ b/packages/frontend/core/src/modules/navigation/utils.ts
@@ -129,7 +129,14 @@ export const preprocessParams = (
result.elementIds = result.elementIds.filter(v => v.length);
}
- return pick(result, ['mode', 'blockIds', 'elementIds', 'refreshKey']);
+ return pick(result, [
+ 'mode',
+ 'blockIds',
+ 'elementIds',
+ 'databaseId',
+ 'databaseRowId',
+ 'refreshKey',
+ ]);
};
export const paramsParseOptions: ParseOptions = {
@@ -142,6 +149,8 @@ export const paramsParseOptions: ParseOptions = {
value.length ? value.split(',').filter(v => v.length) : [],
elementIds: value =>
value.length ? value.split(',').filter(v => v.length) : [],
+ databaseId: 'string',
+ databaseRowId: 'string',
refreshKey: 'string',
},
};
diff --git a/packages/frontend/core/src/modules/peek-view/entities/peek-view.ts b/packages/frontend/core/src/modules/peek-view/entities/peek-view.ts
index 6556b6c6a6..9dfe4935d6 100644
--- a/packages/frontend/core/src/modules/peek-view/entities/peek-view.ts
+++ b/packages/frontend/core/src/modules/peek-view/entities/peek-view.ts
@@ -17,31 +17,43 @@ import { firstValueFrom, map, race } from 'rxjs';
import { resolveLinkToDoc } from '../../navigation';
import type { WorkbenchService } from '../../workbench';
-export type PeekViewTarget =
+export type DocReferenceInfo = {
+ docId: string;
+ mode?: DocMode;
+ blockIds?: string[];
+ elementIds?: string[];
+ databaseId?: string;
+ databaseRowId?: string;
+ /**
+ * viewport in edgeless mode
+ */
+ xywh?: `[${number},${number},${number},${number}]`;
+};
+
+export type PeekViewElement =
| HTMLElement
| BlockComponent
| AffineReference
- | HTMLAnchorElement
- | { docId: string; blockIds?: string[] };
+ | HTMLAnchorElement;
+
+export interface PeekViewTarget {
+ element?: PeekViewElement;
+ docRef?: DocReferenceInfo;
+}
export interface DocPeekViewInfo {
type: 'doc';
- docId: string;
- mode?: DocMode;
- blockIds?: string[];
- elementIds?: string[];
- xywh?: `[${number},${number},${number},${number}]`;
+ docRef: DocReferenceInfo;
}
export type ImagePeekViewInfo = {
type: 'image';
- docId: string;
- blockIds: [string];
+ docRef: DocReferenceInfo;
};
export type AIChatBlockPeekViewInfo = {
type: 'ai-chat-block';
- docId: string;
+ docRef: DocReferenceInfo;
host: EditorHost;
model: AIChatBlockModel;
};
@@ -101,83 +113,90 @@ function resolvePeekInfoFromPeekTarget(
};
}
- if (peekTarget instanceof AffineReference) {
- const referenceInfo = peekTarget.referenceInfo;
- if (referenceInfo) {
- const { pageId: docId } = referenceInfo;
- const info: DocPeekViewInfo = {
- type: 'doc',
- docId,
- };
- Object.assign(info, referenceInfo.params);
- return info;
- }
- } else if ('model' in peekTarget) {
- const blockModel = peekTarget.model;
- if (isEmbedLinkedDocModel(blockModel)) {
- const info: DocPeekViewInfo = {
- type: 'doc',
- docId: blockModel.pageId,
- };
- Object.assign(info, blockModel.params);
- return info;
- } else if (isEmbedSyncedDocModel(blockModel)) {
- return {
- type: 'doc',
- docId: blockModel.pageId,
- };
- } else if (isSurfaceRefModel(blockModel)) {
- const refModel = (peekTarget as SurfaceRefBlockComponent).referenceModel;
- // refModel can be null if the reference is invalid
- if (refModel) {
- const docId =
- 'doc' in refModel ? refModel.doc.id : refModel.surface.doc.id;
- return {
+ const element = peekTarget.element;
+
+ if (element) {
+ if (element instanceof AffineReference) {
+ const referenceInfo = element.referenceInfo;
+ if (referenceInfo) {
+ const { pageId: docId } = referenceInfo;
+ const info: DocPeekViewInfo = {
type: 'doc',
- docId,
- mode: 'edgeless',
- xywh: refModel.xywh,
+ docRef: {
+ docId,
+ },
};
+ Object.assign(info, referenceInfo.params);
+ return info;
}
- } else if (isImageBlockModel(blockModel)) {
- return {
- type: 'image',
- docId: blockModel.doc.id,
- blockIds: [blockModel.id],
- };
- } else if (isAIChatBlockModel(blockModel)) {
- return {
- type: 'ai-chat-block',
- docId: blockModel.doc.id,
- model: blockModel,
- host: peekTarget.host,
- };
- }
- } else if (peekTarget instanceof HTMLAnchorElement) {
- const maybeDoc = resolveLinkToDoc(peekTarget.href);
- if (maybeDoc) {
- const info: DocPeekViewInfo = {
- type: 'doc',
- docId: maybeDoc.docId,
- };
-
- if (maybeDoc.mode) {
- info.mode = maybeDoc.mode;
- }
- if (maybeDoc.blockIds?.length) {
- info.blockIds = maybeDoc.blockIds;
+ } else if ('model' in element) {
+ const blockModel = element.model;
+ if (isEmbedLinkedDocModel(blockModel)) {
+ const info: DocPeekViewInfo = {
+ type: 'doc',
+ docRef: {
+ docId: blockModel.pageId,
+ },
+ };
+ Object.assign(info, blockModel.params);
+ return info;
+ } else if (isEmbedSyncedDocModel(blockModel)) {
+ return {
+ type: 'doc',
+ docRef: {
+ docId: blockModel.pageId,
+ },
+ };
+ } else if (isSurfaceRefModel(blockModel)) {
+ const refModel = (element as SurfaceRefBlockComponent).referenceModel;
+ // refModel can be null if the reference is invalid
+ if (refModel) {
+ const docId =
+ 'doc' in refModel ? refModel.doc.id : refModel.surface.doc.id;
+ return {
+ type: 'doc',
+ docRef: {
+ docId,
+ mode: 'edgeless',
+ xywh: refModel.xywh,
+ },
+ };
+ }
+ } else if (isImageBlockModel(blockModel)) {
+ return {
+ type: 'image',
+ docRef: {
+ docId: blockModel.doc.id,
+ blockIds: [blockModel.id],
+ },
+ };
+ } else if (isAIChatBlockModel(blockModel)) {
+ return {
+ type: 'ai-chat-block',
+ docRef: {
+ docId: blockModel.doc.id,
+ blockIds: [blockModel.id],
+ },
+ model: blockModel,
+ host: element.host,
+ };
}
- if (maybeDoc.elementIds?.length) {
- info.elementIds = maybeDoc.elementIds;
+ } else if (element instanceof HTMLAnchorElement) {
+ const maybeDoc = resolveLinkToDoc(element.href);
+ if (maybeDoc) {
+ const info: DocPeekViewInfo = {
+ type: 'doc',
+ docRef: maybeDoc,
+ };
+ return info;
}
-
- return info;
}
- } else if ('docId' in peekTarget) {
+ }
+
+ if ('docRef' in peekTarget && peekTarget.docRef) {
return {
type: 'doc',
- docId: peekTarget.docId,
- blockIds: peekTarget.blockIds,
+ docRef: peekTarget.docRef,
};
}
return;
@@ -208,7 +227,8 @@ export class PeekViewEntity extends Entity {
// return true if the peek view will be handled
open = async (
target: ActivePeekView['target'],
- template?: TemplateResult
+ template?: TemplateResult,
+ abortSignal?: AbortSignal
) => {
const resolvedInfo = resolvePeekInfoFromPeekTarget(target, template);
if (!resolvedInfo) {
@@ -220,7 +240,7 @@ export class PeekViewEntity extends Entity {
// if there is an active peek view and it is a doc peek view, we will navigate it first
if (active?.info.type === 'doc' && this.show$.value?.value) {
// TODO(@pengx17): scroll to the viewing position?
- this.workbenchService.workbench.openDoc(active.info.docId);
+ this.workbenchService.workbench.openDoc(active.info.docRef);
}
this._active$.next({ target, info: resolvedInfo });
@@ -231,6 +251,24 @@ export class PeekViewEntity extends Entity {
? 'zoom'
: 'fade',
});
+
+ if (abortSignal) {
+ const abortListener = () => {
+ if (this.active$.value?.target === target) {
+ this.close();
+ }
+ };
+
+ abortSignal.addEventListener('abort', abortListener);
+
+ const showSubscription = this.show$.subscribe(v => {
+ if (!v && !abortSignal.aborted) {
+ abortSignal.removeEventListener('abort', abortListener);
+ showSubscription.unsubscribe();
+ }
+ });
+ }
+
return firstValueFrom(race(this._active$, this.show$).pipe(map(() => {})));
};
diff --git a/packages/frontend/core/src/modules/peek-view/view/doc-preview/doc-peek-view.tsx b/packages/frontend/core/src/modules/peek-view/view/doc-preview/doc-peek-view.tsx
index 801d6360db..d716de2281 100644
--- a/packages/frontend/core/src/modules/peek-view/view/doc-preview/doc-peek-view.tsx
+++ b/packages/frontend/core/src/modules/peek-view/view/doc-preview/doc-peek-view.tsx
@@ -8,7 +8,6 @@ import { PageNotFound } from '@affine/core/desktop/pages/404';
import { EditorService } from '@affine/core/modules/editor';
import { DebugLogger } from '@affine/debug';
import {
- type DocMode,
type EdgelessRootService,
RefNodeSlotsProvider,
} from '@blocksuite/affine/blocks';
@@ -24,6 +23,7 @@ import clsx from 'clsx';
import { useCallback, useEffect } from 'react';
import { WorkbenchService } from '../../../workbench';
+import type { DocReferenceInfo } from '../../entities/peek-view';
import { PeekViewService } from '../../services/peek-view';
import { useEditor } from '../utils';
import * as styles from './doc-peek-view.css';
@@ -81,6 +81,7 @@ function DocPeekPreviewEditor({
const doc = editor.doc;
const workspace = editor.doc.workspace;
const mode = useLiveData(editor.mode$);
+ const defaultOpenProperty = useLiveData(editor.defaultOpenProperty$);
const workbench = useService(WorkbenchService).workbench;
const peekView = useService(PeekViewService).peekView;
const editorElement = useLiveData(editor.editorContainer$);
@@ -96,11 +97,11 @@ function DocPeekPreviewEditor({
if (!refNodeSlots) return;
// doc change event inside peek view should be handled by peek view
disposableGroup.add(
+ // todo(@pengx17): seems not working
refNodeSlots.docLinkClicked.on(options => {
peekView
.open({
- type: 'doc',
- docId: options.pageId,
+ docRef: { docId: options.pageId },
...options.params,
})
.catch(console.error);
@@ -158,6 +159,7 @@ function DocPeekPreviewEditor({
mode={mode}
page={doc.blockSuiteDoc}
onEditorReady={handleOnEditorReady}
+ defaultOpenProperty={defaultOpenProperty}
/>
</Scrollable.Viewport>
<Scrollable.Scrollbar />
@@ -171,23 +173,24 @@ function DocPeekPreviewEditor({
);
}
-export function DocPeekPreview({
- docId,
- blockIds,
- elementIds,
- mode,
- xywh,
-}: {
- docId: string;
- blockIds?: string[];
- elementIds?: string[];
- mode?: DocMode;
- xywh?: `[${number},${number},${number},${number}]`;
-}) {
- const { doc, editor, loading } = useEditor(docId, mode, {
- blockIds,
- elementIds,
- });
+export function DocPeekPreview({ docRef }: { docRef: DocReferenceInfo }) {
+ const { docId, blockIds, elementIds, mode, xywh, databaseId, databaseRowId } =
+ docRef;
+ const { doc, editor, loading } = useEditor(
+ docId,
+ mode,
+ {
+ blockIds,
+ elementIds,
+ },
+ databaseId && databaseRowId
+ ? {
+ databaseId,
+ databaseRowId,
+ type: 'database',
+ }
+ : undefined
+ );
// if sync engine has been synced and the page is null, show 404 page.
if (!doc || !editor) {
diff --git a/packages/frontend/core/src/modules/peek-view/view/peek-view-controls.tsx b/packages/frontend/core/src/modules/peek-view/view/peek-view-controls.tsx
index 20849c9fcf..d08fd99202 100644
--- a/packages/frontend/core/src/modules/peek-view/view/peek-view-controls.tsx
+++ b/packages/frontend/core/src/modules/peek-view/view/peek-view-controls.tsx
@@ -20,6 +20,7 @@ import {
import { DocInfoService } from '../../doc-info';
import { WorkbenchService } from '../../workbench';
+import type { DocReferenceInfo } from '../entities/peek-view';
import { PeekViewService } from '../services/peek-view';
import * as styles from './peek-view-controls.css';
@@ -60,10 +61,8 @@ export const ControlButton = ({
};
type DocPeekViewControlsProps = HTMLAttributes<HTMLDivElement> & {
- docId: string;
mode?: DocMode;
- blockIds?: string[];
- elementIds?: string[];
+ docRef: DocReferenceInfo;
};
export const DefaultPeekViewControls = ({
@@ -92,10 +91,7 @@ export const DefaultPeekViewControls = ({
};
export const DocPeekViewControls = ({
- docId,
- mode,
- blockIds,
- elementIds,
+ docRef,
className,
...rest
}: DocPeekViewControlsProps) => {
@@ -116,7 +112,7 @@ export const DocPeekViewControls = ({
name: t['com.affine.peek-view-controls.open-doc'](),
nameKey: 'open',
onClick: () => {
- workbench.openDoc({ docId, mode, blockIds, elementIds });
+ workbench.openDoc(docRef);
peekView.close('none');
},
},
@@ -125,10 +121,7 @@ export const DocPeekViewControls = ({
nameKey: 'new-tab',
name: t['com.affine.peek-view-controls.open-doc-in-new-tab'](),
onClick: () => {
- workbench.openDoc(
- { docId, mode, blockIds, elementIds },
- { at: 'new-tab' }
- );
+ workbench.openDoc(docRef, { at: 'new-tab' });
peekView.close('none');
},
},
@@ -137,7 +130,7 @@ export const DocPeekViewControls = ({
nameKey: 'split-view',
name: t['com.affine.peek-view-controls.open-doc-in-split-view'](),
onClick: () => {
- workbench.openDoc({ docId, mode }, { at: 'beside' });
+ workbench.openDoc(docRef, { at: 'beside' });
peekView.close('none');
},
},
@@ -146,20 +139,13 @@ export const DocPeekViewControls = ({
nameKey: 'info',
name: t['com.affine.peek-view-controls.open-info'](),
onClick: () => {
- docInfoService.modal.open(docId);
+ docInfoService.modal.open(
+ typeof docRef === 'string' ? docRef : docRef.docId
+ );
},
},
].filter((opt): opt is ControlButtonProps => Boolean(opt));
- }, [
- t,
- peekView,
- workbench,
- docId,
- mode,
- blockIds,
- elementIds,
- docInfoService.modal,
- ]);
+ }, [t, peekView, workbench, docRef, docInfoService.modal]);
return (
<div {...rest} className={clsx(styles.root, className)}>
{controls.map(option => (
diff --git a/packages/frontend/core/src/modules/peek-view/view/peek-view-manager.tsx b/packages/frontend/core/src/modules/peek-view/view/peek-view-manager.tsx
index fd47d82a7c..f2fe712a60 100644
--- a/packages/frontend/core/src/modules/peek-view/view/peek-view-manager.tsx
+++ b/packages/frontend/core/src/modules/peek-view/view/peek-view-manager.tsx
@@ -22,20 +22,15 @@ function renderPeekView({ info }: ActivePeekView) {
return toReactNode(info.template);
}
if (info.type === 'doc') {
- return (
- <DocPeekPreview
- mode={info.mode}
- xywh={info.xywh}
- docId={info.docId}
- blockIds={info.blockIds}
- elementIds={info.elementIds}
- />
- );
+ return <DocPeekPreview docRef={info.docRef} />;
}
- if (info.type === 'image') {
+ if (info.type === 'image' && info.docRef.blockIds?.[0]) {
return (
- <ImagePreviewPeekView docId={info.docId} blockId={info.blockIds[0]} />
+ <ImagePreviewPeekView
+ docId={info.docRef.docId}
+ blockId={info.docRef.blockIds?.[0]}
+ />
);
}
@@ -49,14 +44,7 @@ function renderPeekView({ info }: ActivePeekView) {
const renderControls = ({ info }: ActivePeekView) => {
if (info.type === 'doc') {
- return (
- <DocPeekViewControls
- mode={info.mode}
- docId={info.docId}
- blockIds={info.blockIds}
- elementIds={info.elementIds}
- />
- );
+ return <DocPeekViewControls docRef={info.docRef} />;
}
if (info.type === 'image') {
@@ -86,8 +74,8 @@ const getRendererProps = (
children: preview,
controls,
target:
- activePeekView?.target instanceof HTMLElement
- ? activePeekView.target
+ activePeekView?.target.element instanceof HTMLElement
+ ? activePeekView.target.element
: undefined,
mode: getMode(activePeekView.info),
dialogFrame: activePeekView.info.type !== 'image',
@@ -108,8 +96,8 @@ export const PeekViewManagerModal = () => {
useEffect(() => {
const subscription = peekViewEntity.show$.subscribe(() => {
- if (activePeekView?.target instanceof BlockComponent) {
- activePeekView.target.requestUpdate();
+ if (activePeekView?.target.element instanceof BlockComponent) {
+ activePeekView.target.element.requestUpdate();
}
});
diff --git a/packages/frontend/core/src/modules/peek-view/view/utils.ts b/packages/frontend/core/src/modules/peek-view/view/utils.ts
index 765ac2ff26..27dadbcc61 100644
--- a/packages/frontend/core/src/modules/peek-view/view/utils.ts
+++ b/packages/frontend/core/src/modules/peek-view/view/utils.ts
@@ -1,3 +1,4 @@
+import type { DefaultOpenProperty } from '@affine/core/components/doc-properties';
import type { DocMode } from '@blocksuite/affine/blocks';
import type { Doc } from '@toeverything/infra';
import {
@@ -13,7 +14,8 @@ import { type Editor, type EditorSelector, EditorsService } from '../../editor';
export const useEditor = (
pageId: string,
preferMode?: DocMode,
- preferSelector?: EditorSelector
+ preferSelector?: EditorSelector,
+ defaultOpenProperty?: DefaultOpenProperty
) => {
const currentWorkspace = useService(WorkspaceService).workspace;
const docsService = useService(DocsService);
@@ -22,7 +24,7 @@ export const useEditor = (
const docRecord = docRecordList.doc$(pageId).value;
const preferModeRef = useRef(preferMode);
const preferSelectorRef = useRef(preferSelector);
-
+ const defaultOpenPropertyRef = useRef(defaultOpenProperty);
const [doc, setDoc] = useState<Doc | null>(null);
const [editor, setEditor] = useState<Editor | null>(null);
@@ -44,6 +46,7 @@ export const useEditor = (
const editor = doc.scope.get(EditorsService).createEditor();
editor.setMode(preferModeRef.current || doc.primaryMode$.value);
editor.setSelector(preferSelectorRef.current);
+ editor.setDefaultOpenProperty(defaultOpenPropertyRef.current);
setEditor(editor);
return () => {
editor.dispose();
diff --git a/tools/cli/package.json b/tools/cli/package.json
index 7db91c079b..e41eaece0b 100644
--- a/tools/cli/package.json
+++ b/tools/cli/package.json
@@ -6,7 +6,7 @@
"@affine/env": "workspace:*",
"@affine/templates": "workspace:*",
"@aws-sdk/client-s3": "^3.620.0",
- "@blocksuite/affine": "0.17.19",
+ "@blocksuite/affine": "0.0.0-canary-20241028080828",
"@clack/core": "^0.3.4",
"@clack/prompts": "^0.7.0",
"@magic-works/i18n-codegen": "^0.6.0",
diff --git a/yarn.lock b/yarn.lock
index 9a0615bed3..3d09d70c0f 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -213,7 +213,7 @@ __metadata:
"@affine/component": "workspace:*"
"@affine/core": "workspace:*"
"@affine/i18n": "workspace:*"
- "@blocksuite/affine": "npm:0.17.19"
+ "@blocksuite/affine": "npm:0.0.0-canary-20241028080828"
"@blocksuite/icons": "npm:^2.1.67"
"@capacitor/android": "npm:^6.1.2"
"@capacitor/cli": "npm:^6.1.2"
@@ -260,7 +260,7 @@ __metadata:
"@affine/env": "workspace:*"
"@affine/templates": "workspace:*"
"@aws-sdk/client-s3": "npm:^3.620.0"
- "@blocksuite/affine": "npm:0.17.19"
+ "@blocksuite/affine": "npm:0.0.0-canary-20241028080828"
"@clack/core": "npm:^0.3.4"
"@clack/prompts": "npm:^0.7.0"
"@magic-works/i18n-codegen": "npm:^0.6.0"
@@ -317,7 +317,7 @@ __metadata:
"@affine/i18n": "workspace:*"
"@atlaskit/pragmatic-drag-and-drop": "npm:^1.2.1"
"@atlaskit/pragmatic-drag-and-drop-hitbox": "npm:^1.0.3"
- "@blocksuite/affine": "npm:0.17.19"
+ "@blocksuite/affine": "npm:0.0.0-canary-20241028080828"
"@blocksuite/icons": "npm:2.1.69"
"@chromatic-com/storybook": "npm:^3.0.0"
"@emotion/react": "npm:^11.11.4"
@@ -389,7 +389,7 @@ __metadata:
"@affine/i18n": "workspace:*"
"@affine/templates": "workspace:*"
"@affine/track": "workspace:*"
- "@blocksuite/affine": "npm:0.17.19"
+ "@blocksuite/affine": "npm:0.0.0-canary-20241028080828"
"@blocksuite/icons": "npm:2.1.69"
"@capacitor/app": "npm:^6.0.1"
"@capacitor/browser": "npm:^6.0.3"
@@ -496,7 +496,7 @@ __metadata:
"@affine/core": "workspace:*"
"@affine/i18n": "workspace:*"
"@affine/native": "workspace:*"
- "@blocksuite/affine": "npm:0.17.19"
+ "@blocksuite/affine": "npm:0.0.0-canary-20241028080828"
"@electron-forge/cli": "npm:^7.3.0"
"@electron-forge/core": "npm:^7.3.0"
"@electron-forge/core-utils": "npm:^7.3.0"
@@ -549,7 +549,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@affine/env@workspace:packages/common/env"
dependencies:
- "@blocksuite/affine": "npm:0.17.19"
+ "@blocksuite/affine": "npm:0.0.0-canary-20241028080828"
vitest: "npm:2.1.1"
zod: "npm:^3.22.4"
peerDependencies:
@@ -598,7 +598,7 @@ __metadata:
"@affine/component": "workspace:*"
"@affine/core": "workspace:*"
"@affine/i18n": "workspace:*"
- "@blocksuite/affine": "npm:0.17.19"
+ "@blocksuite/affine": "npm:0.0.0-canary-20241028080828"
"@blocksuite/icons": "npm:^2.1.67"
"@capacitor/app": "npm:^6.0.1"
"@capacitor/browser": "npm:^6.0.3"
@@ -623,7 +623,7 @@ __metadata:
"@affine/component": "workspace:*"
"@affine/core": "workspace:*"
"@affine/i18n": "workspace:*"
- "@blocksuite/affine": "npm:0.17.19"
+ "@blocksuite/affine": "npm:0.0.0-canary-20241028080828"
"@blocksuite/icons": "npm:^2.1.67"
"@sentry/react": "npm:^8.0.0"
"@types/react": "npm:^18.2.75"
@@ -2488,19 +2488,19 @@ __metadata:
languageName: node
linkType: hard
-"@blocksuite/affine-block-embed@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/affine-block-embed@npm:0.17.19"
- dependencies:
- "@blocksuite/affine-block-surface": "npm:0.17.19"
- "@blocksuite/affine-components": "npm:0.17.19"
- "@blocksuite/affine-model": "npm:0.17.19"
- "@blocksuite/affine-shared": "npm:0.17.19"
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
+"@blocksuite/affine-block-embed@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/affine-block-embed@npm:0.0.0-canary-20241028080828"
+ dependencies:
+ "@blocksuite/affine-block-surface": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-components": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-model": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-shared": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
"@blocksuite/icons": "npm:^2.1.68"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/store": "npm:0.17.19"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
"@floating-ui/dom": "npm:^1.6.10"
"@lit/context": "npm:^1.1.2"
"@preact/signals-core": "npm:^1.8.0"
@@ -2508,21 +2508,21 @@ __metadata:
lit: "npm:^3.2.0"
minimatch: "npm:^10.0.1"
zod: "npm:^3.23.8"
- checksum: 10/33586d045e67766ab2f2ef6f2df1776fb1a43e036e4bf10b99d523c4844d781ef9037afbd5203665cf5e30566d934e33a292593afb4e15261efe8268ff051290
+ checksum: 10/5d2d16f32eafc65dbde3a340d96a509c8b5cda870fe80c851ca11fb23abd16344273b9d574b0e43404491e6dda59bdb7d54dd6ea4d008f2bc8aad48ce37937a2
languageName: node
linkType: hard
-"@blocksuite/affine-block-list@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/affine-block-list@npm:0.17.19"
- dependencies:
- "@blocksuite/affine-components": "npm:0.17.19"
- "@blocksuite/affine-model": "npm:0.17.19"
- "@blocksuite/affine-shared": "npm:0.17.19"
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/store": "npm:0.17.19"
+"@blocksuite/affine-block-list@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/affine-block-list@npm:0.0.0-canary-20241028080828"
+ dependencies:
+ "@blocksuite/affine-components": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-model": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-shared": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
"@floating-ui/dom": "npm:^1.6.10"
"@lit/context": "npm:^1.1.2"
"@preact/signals-core": "npm:^1.8.0"
@@ -2530,21 +2530,21 @@ __metadata:
lit: "npm:^3.2.0"
minimatch: "npm:^10.0.1"
zod: "npm:^3.23.8"
- checksum: 10/e804d4ea2bef41efe7ee323aecde1339b3c8a499f16854c4a67877a39bae2d100e590dc758f004ec90fb8b7ebe1a61f003d045389557838230a905f2a187446d
+ checksum: 10/e2944f7494b8c83820ded20420fed1b9db5fdf581d5b36adcb4440d40eb8cac509659cc3d931c9be26270c57f16a64bb6f786a5743611a14a02f1fd6c09b31ec
languageName: node
linkType: hard
-"@blocksuite/affine-block-paragraph@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/affine-block-paragraph@npm:0.17.19"
- dependencies:
- "@blocksuite/affine-components": "npm:0.17.19"
- "@blocksuite/affine-model": "npm:0.17.19"
- "@blocksuite/affine-shared": "npm:0.17.19"
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/store": "npm:0.17.19"
+"@blocksuite/affine-block-paragraph@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/affine-block-paragraph@npm:0.0.0-canary-20241028080828"
+ dependencies:
+ "@blocksuite/affine-components": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-model": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-shared": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
"@floating-ui/dom": "npm:^1.6.10"
"@lit/context": "npm:^1.1.2"
"@preact/signals-core": "npm:^1.8.0"
@@ -2552,21 +2552,21 @@ __metadata:
lit: "npm:^3.2.0"
minimatch: "npm:^10.0.1"
zod: "npm:^3.23.8"
- checksum: 10/a8caa526260b16ded0dae7bd4caae0d38f4fa7bcbdf96e36acf5cdb7e0fc14c330b2d0727b08c84384e19e3115ea1eec6a4061d29ccbc638bd68f7bcadb6fb98
+ checksum: 10/499f162f77f09b6d558f741b8296743f59eb9c424a696c4faa9f43bab99444065089bc3683c1ea11eed3f4d65a1dc4ca7d2137290333008d18267c563c53d690
languageName: node
linkType: hard
-"@blocksuite/affine-block-surface@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/affine-block-surface@npm:0.17.19"
- dependencies:
- "@blocksuite/affine-components": "npm:0.17.19"
- "@blocksuite/affine-model": "npm:0.17.19"
- "@blocksuite/affine-shared": "npm:0.17.19"
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/store": "npm:0.17.19"
+"@blocksuite/affine-block-surface@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/affine-block-surface@npm:0.0.0-canary-20241028080828"
+ dependencies:
+ "@blocksuite/affine-components": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-model": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-shared": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
"@lit/context": "npm:^1.1.2"
"@preact/signals-core": "npm:^1.8.0"
"@toeverything/theme": "npm:^1.0.8"
@@ -2575,21 +2575,21 @@ __metadata:
lodash.chunk: "npm:^4.2.0"
nanoid: "npm:^5.0.7"
zod: "npm:^3.23.8"
- checksum: 10/037831fca259761d23972958eff52d93068cf564efc4a149195a1979e754bad225232c20adb4eff0dbdfad37d1c07850042dde50efdeba1f9446bf5075cd9183
+ checksum: 10/74ef2f7e26a88c713468837f86c78d404fd77bd19b0d684d7c2f2208452414c15a70556a37a23f676d48560063797859efa413ec9e606d2b7a732931ef142aba
languageName: node
linkType: hard
-"@blocksuite/affine-components@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/affine-components@npm:0.17.19"
+"@blocksuite/affine-components@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/affine-components@npm:0.0.0-canary-20241028080828"
dependencies:
- "@blocksuite/affine-model": "npm:0.17.19"
- "@blocksuite/affine-shared": "npm:0.17.19"
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
+ "@blocksuite/affine-model": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-shared": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
"@blocksuite/icons": "npm:^2.1.68"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/store": "npm:0.17.19"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
"@floating-ui/dom": "npm:^1.6.10"
"@lit/context": "npm:^1.1.2"
"@lottiefiles/dotlottie-wc": "npm:^0.2.16"
@@ -2600,33 +2600,33 @@ __metadata:
lit: "npm:^3.2.0"
shiki: "npm:^1.12.0"
zod: "npm:^3.23.8"
- checksum: 10/d77ec6a908851b06c3efb97ce6e8d3e944ce383f1804763a20b1956bb4fac9feb5d61e8bdd1abb968102989716a64246908017c93002d2d7996b4271ebdae324
+ checksum: 10/3db08fd6fd2a8398628cca0aa5764c238e84a1f29def6774359c41406b9e22468b739f460c318907a62f9588f622477a050fec22f62bceada21af0e8bccf256d
languageName: node
linkType: hard
-"@blocksuite/affine-model@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/affine-model@npm:0.17.19"
+"@blocksuite/affine-model@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/affine-model@npm:0.0.0-canary-20241028080828"
dependencies:
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/store": "npm:0.17.19"
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
fractional-indexing: "npm:^3.2.0"
zod: "npm:^3.23.8"
- checksum: 10/a47c149ed8dfde0bd56cc81be38d12884eb52e94df0484870fe6bb44ad5ea0ad82abe7a1a33e71d2ea9d6a1ffdf48d7bbb543318c4a97dbf0f09b39278700eaa
+ checksum: 10/89ff1a3fef8d4a307e0d8794244e26ecfecc1adaf4c0a8f77fc0b6dd32d50c1e11c29c607e8413225b75f211336d474623d7ddb0e5be0469b68dd558800d8303
languageName: node
linkType: hard
-"@blocksuite/affine-shared@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/affine-shared@npm:0.17.19"
+"@blocksuite/affine-shared@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/affine-shared@npm:0.0.0-canary-20241028080828"
dependencies:
- "@blocksuite/affine-model": "npm:0.17.19"
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/store": "npm:0.17.19"
+ "@blocksuite/affine-model": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
"@floating-ui/dom": "npm:^1.6.10"
"@lit/context": "npm:^1.1.2"
"@preact/signals-core": "npm:^1.8.0"
@@ -2636,46 +2636,46 @@ __metadata:
lodash.mergewith: "npm:^4.6.2"
minimatch: "npm:^10.0.1"
zod: "npm:^3.23.8"
- checksum: 10/2771454709f2a6f595b386464707c51a8e952cc36424ca1efe2fbb89444401f725a24bd66bddd1afa1f9668f005d4a6462306e70c672936f50e0d37092495a66
+ checksum: 10/38aac5892970bc60a2196d0ab834b88c85fe8c26a712060ae7ffeec01ab0210a4cf9a702b221c7ee341a78e9e56c094f7c20209b035d961d342ae3e9073af1e1
languageName: node
linkType: hard
-"@blocksuite/affine-widget-scroll-anchoring@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/affine-widget-scroll-anchoring@npm:0.17.19"
+"@blocksuite/affine-widget-scroll-anchoring@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/affine-widget-scroll-anchoring@npm:0.0.0-canary-20241028080828"
dependencies:
- "@blocksuite/affine-model": "npm:0.17.19"
- "@blocksuite/affine-shared": "npm:0.17.19"
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
+ "@blocksuite/affine-model": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-shared": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
"@preact/signals-core": "npm:^1.8.0"
"@toeverything/theme": "npm:^1.0.8"
lit: "npm:^3.2.0"
- checksum: 10/ef2bbfe1b024404356ad4ceee00c0373bcd3627d32dc5ea4a241cf3539a6de2f5feb02e09f14b54721add9a30e7616c6f56234d3cf481f0625ea81ddbb555fab
+ checksum: 10/ad85aab8874499c363b4a847498c6f4f82b56a661bcc86bdcdad268bd8416e430f6f5cce3d8854de3dc22de48ee52d4715f31cc5160779f25901c2d6d206d8a6
languageName: node
linkType: hard
-"@blocksuite/affine@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/affine@npm:0.17.19"
+"@blocksuite/affine@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/affine@npm:0.0.0-canary-20241028080828"
dependencies:
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/blocks": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/presets": "npm:0.17.19"
- "@blocksuite/store": "npm:0.17.19"
- checksum: 10/58ec92eaa00624fbe9a6a180315afe7bbebafa5465cb86b01b38c378fa18a1a8cf5f9ff9325bf356fbd96448cdf5a6fcc4c002d08db3d34fc84b0b0b2b28f23a
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/blocks": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/presets": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
+ checksum: 10/9ed3b923bb04007024c6256cd4af1bfecf14db7a67c8208fe5b50c99597c3ac9b4be93547cc2d12580d558bffcf05916179985fd2c9a6cf3f1682f4d05291916
languageName: node
linkType: hard
-"@blocksuite/block-std@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/block-std@npm:0.17.19"
+"@blocksuite/block-std@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/block-std@npm:0.0.0-canary-20241028080828"
dependencies:
- "@blocksuite/global": "npm:0.17.19"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/store": "npm:0.17.19"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
"@lit/context": "npm:^1.1.2"
"@preact/signals-core": "npm:^1.8.0"
"@types/hast": "npm:^3.0.4"
@@ -2687,28 +2687,28 @@ __metadata:
unified: "npm:^11.0.5"
w3c-keyname: "npm:^2.2.8"
zod: "npm:^3.23.8"
- checksum: 10/b6011fc979f9711811b9ed8357df6c943fe4769db7fe4911a211964dbfd1fa38ba006df0a9d3c859c827a7f9f785d1865084b68d64c558a240139817b16c919f
+ checksum: 10/6c0ef2920d65d0e56e08f51adbd5d5a1f20aa51f0909870c17c299596762b7581a4003d44e25fbb0572ee8173fd17afc11817ca3cbd09b71f6e195740c54669e
languageName: node
linkType: hard
-"@blocksuite/blocks@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/blocks@npm:0.17.19"
- dependencies:
- "@blocksuite/affine-block-embed": "npm:0.17.19"
- "@blocksuite/affine-block-list": "npm:0.17.19"
- "@blocksuite/affine-block-paragraph": "npm:0.17.19"
- "@blocksuite/affine-block-surface": "npm:0.17.19"
- "@blocksuite/affine-components": "npm:0.17.19"
- "@blocksuite/affine-model": "npm:0.17.19"
- "@blocksuite/affine-shared": "npm:0.17.19"
- "@blocksuite/affine-widget-scroll-anchoring": "npm:0.17.19"
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/data-view": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
+"@blocksuite/blocks@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/blocks@npm:0.0.0-canary-20241028080828"
+ dependencies:
+ "@blocksuite/affine-block-embed": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-block-list": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-block-paragraph": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-block-surface": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-components": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-model": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-shared": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-widget-scroll-anchoring": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/data-view": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
"@blocksuite/icons": "npm:^2.1.68"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/store": "npm:0.17.19"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
"@floating-ui/dom": "npm:^1.6.10"
"@lit/context": "npm:^1.1.2"
"@preact/signals-core": "npm:^1.8.0"
@@ -2747,20 +2747,20 @@ __metadata:
sortablejs: "npm:^1.15.2"
unified: "npm:^11.0.5"
zod: "npm:^3.23.8"
- checksum: 10/b3ab015d3d622638056bc831a2a21ba4877e8beb303895e0e8ca1dbe722172714f248c26fec52dab065db3976c47b76fb57a897bee5f2cd4fe70792eb6d3a92c
+ checksum: 10/a50124338441a3386ca82fcdf28d31f4d80cbed5cbe04a32788886b008f5d9f3bfa843f15129cd36a92ac7ae80cc9f7d141b81b013cdcc0da056856ab339a184
languageName: node
linkType: hard
-"@blocksuite/data-view@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/data-view@npm:0.17.19"
+"@blocksuite/data-view@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/data-view@npm:0.0.0-canary-20241028080828"
dependencies:
- "@blocksuite/affine-components": "npm:0.17.19"
- "@blocksuite/affine-shared": "npm:0.17.19"
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
+ "@blocksuite/affine-components": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-shared": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
"@blocksuite/icons": "npm:^2.1.68"
- "@blocksuite/store": "npm:0.17.19"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
"@floating-ui/dom": "npm:^1.6.10"
"@lit/context": "npm:^1.1.2"
"@preact/signals-core": "npm:^1.8.0"
@@ -2769,19 +2769,19 @@ __metadata:
lit: "npm:^3.2.0"
sortablejs: "npm:^1.15.2"
zod: "npm:^3.23.8"
- checksum: 10/8e874f7038f1ca35f0f01db8b03d2ba8f84b83ae268ca92d7ebd6e3341e3fff9897bcb281e6321fe42e00aae9f8d9025d2ee7770ee0741783acedb15f0181dfe
+ checksum: 10/a5284f185be426900af87dfce6e7e488618262a504bd88e747b62f7081bbd0b8263fe1e0905f501b084a0dc6ef16dca5c2e35f75e8776e09960b3bf4c24b707b
languageName: node
linkType: hard
-"@blocksuite/global@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/global@npm:0.17.19"
+"@blocksuite/global@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/global@npm:0.0.0-canary-20241028080828"
dependencies:
"@preact/signals-core": "npm:^1.8.0"
lib0: "npm:^0.2.97"
lit: "npm:^3.2.0"
zod: "npm:^3.23.8"
- checksum: 10/eac517fb270f7680f465af3874d64492fcf41d4313336dee2ba778b696b8019fb64cbe0e982da2bc1d4cc4c6b21726e5d81ad06a90017517ffaa579274f87b73
+ checksum: 10/cea8aa492d7dbd701ecce8b1c5e0f032cdec7d22d10505b4ad8d3f35d32836fc438f56837d9e25080434f7641980e5ea07ec8e0c3f4d30758bd367deefc0a912
languageName: node
linkType: hard
@@ -2801,49 +2801,49 @@ __metadata:
languageName: node
linkType: hard
-"@blocksuite/inline@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/inline@npm:0.17.19"
+"@blocksuite/inline@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/inline@npm:0.0.0-canary-20241028080828"
dependencies:
- "@blocksuite/global": "npm:0.17.19"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
"@preact/signals-core": "npm:^1.8.0"
zod: "npm:^3.23.8"
peerDependencies:
lit: ^3.2.0
yjs: ^13.6.18
- checksum: 10/fa03765e69847b2677548b2f491cd53e9028ca7d48e2ec102147d43d155fb1084bbc7c72cde51070a700e9b511cb462c9406e5f6f68cf8872a5a4f7ae0770b70
+ checksum: 10/3ee6bfd337288ce94744a6e6184189daed0fb8222fef8731789792bde983ee872a6ab554a6ccb0d7ad91dd994d5d58a33aff22416278fa30264a7178ac46d962
languageName: node
linkType: hard
-"@blocksuite/presets@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/presets@npm:0.17.19"
- dependencies:
- "@blocksuite/affine-block-surface": "npm:0.17.19"
- "@blocksuite/affine-model": "npm:0.17.19"
- "@blocksuite/affine-shared": "npm:0.17.19"
- "@blocksuite/block-std": "npm:0.17.19"
- "@blocksuite/blocks": "npm:0.17.19"
- "@blocksuite/global": "npm:0.17.19"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/store": "npm:0.17.19"
+"@blocksuite/presets@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/presets@npm:0.0.0-canary-20241028080828"
+ dependencies:
+ "@blocksuite/affine-block-surface": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-model": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/affine-shared": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/block-std": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/blocks": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/store": "npm:0.0.0-canary-20241028080828"
"@floating-ui/dom": "npm:^1.6.10"
"@lottiefiles/dotlottie-wc": "npm:^0.2.16"
"@preact/signals-core": "npm:^1.8.0"
"@toeverything/theme": "npm:^1.0.8"
lit: "npm:^3.2.0"
zod: "npm:^3.23.8"
- checksum: 10/9f7c34223df50f23f872241e7fd05d163f6731710af01ba8a37fe91eb88596dd565f5e86a71717ba6e07ba888e22e72c75b0298959aebefc1583819a61629384
+ checksum: 10/d260fe305a8b4d2569d064a2ce3b1b913a0d517b793af3ead8fc501d40e588272de0a2b49b24785ba37edb205006b658e56ab4ee36e335de24c5b09cb8aa7190
languageName: node
linkType: hard
-"@blocksuite/store@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/store@npm:0.17.19"
+"@blocksuite/store@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/store@npm:0.0.0-canary-20241028080828"
dependencies:
- "@blocksuite/global": "npm:0.17.19"
- "@blocksuite/inline": "npm:0.17.19"
- "@blocksuite/sync": "npm:0.17.19"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/inline": "npm:0.0.0-canary-20241028080828"
+ "@blocksuite/sync": "npm:0.0.0-canary-20241028080828"
"@preact/signals-core": "npm:^1.8.0"
"@types/flexsearch": "npm:^0.7.6"
"@types/lodash.ismatch": "npm:^4.4.9"
@@ -2859,21 +2859,21 @@ __metadata:
zod: "npm:^3.23.8"
peerDependencies:
yjs: ^13.6.18
- checksum: 10/64418424c466af8fec004f338fe1931c872af0cc2ec75c669a85ea52bd44c02b359e4f9def5ef1d99518397aae75e0931fe52be080d35410039b46d00243b404
+ checksum: 10/53d1309267775258392b75cec9b11d66386c28e2f8dbc34d1d90213d053679e1589018b397b00f14a2e00d4f693ab317ccb3a643f7f6af8fb3f08fb4b98a06d2
languageName: node
linkType: hard
-"@blocksuite/sync@npm:0.17.19":
- version: 0.17.19
- resolution: "@blocksuite/sync@npm:0.17.19"
+"@blocksuite/sync@npm:0.0.0-canary-20241028080828":
+ version: 0.0.0-canary-20241028080828
+ resolution: "@blocksuite/sync@npm:0.0.0-canary-20241028080828"
dependencies:
- "@blocksuite/global": "npm:0.17.19"
+ "@blocksuite/global": "npm:0.0.0-canary-20241028080828"
idb: "npm:^8.0.0"
idb-keyval: "npm:^6.2.1"
y-protocols: "npm:^1.0.6"
peerDependencies:
yjs: ^13.6.15
- checksum: 10/e3893e09122559df5d373e8f693683aa971e5c241b032ab2e5236bd91a544d1487ac00e1413805f1c657cf9475842073eeadfbaa6f307998830e40f0591ac921
+ checksum: 10/c007bd85538cd6cd74d5eea21eb87c58d4815fdc5aa5fb0d71e0ebc63744fe22d086fa6f20a1ca6d049aa6974cb0a6bfe32cb72647ba7f196b2a5519807c721a
languageName: node
linkType: hard
@@ -13163,7 +13163,7 @@ __metadata:
"@affine/debug": "workspace:*"
"@affine/env": "workspace:*"
"@affine/templates": "workspace:*"
- "@blocksuite/affine": "npm:0.17.19"
+ "@blocksuite/affine": "npm:0.0.0-canary-20241028080828"
"@datastructures-js/binary-search-tree": "npm:^5.3.2"
"@testing-library/react": "npm:^16.0.0"
fake-indexeddb: "npm:^6.0.0"