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.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix: drag paragraph block from note to edgeless (#10242)
doouding73f3226f5801
diff --git a/blocksuite/affine/widget-drag-handle/src/helpers/preview-helper.ts b/blocksuite/affine/widget-drag-handle/src/helpers/preview-helper.tsindex 3bd0ff70bc..95b6769f18 100644--- a/blocksuite/affine/widget-drag-handle/src/helpers/preview-helper.ts+++ b/blocksuite/affine/widget-drag-handle/src/helpers/preview-helper.ts@@ -30,7 +30,7 @@ import { getSnapshotRect } from '../utils.js';export class PreviewHelper {private readonly _calculateQuery = (selectedIds: string[],- mode: 'page' | 'edgeless'+ mode: 'block' | 'gfx'): Query => {const ids: Array<{ id: string; viewType: BlockViewType }> = selectedIds.map(id => ({@@ -59,7 +59,7 @@ export class PreviewHelper {const children = model.children ?? [];if (- mode === 'edgeless' &&+ mode === 'gfx' &&matchModels(model, [RootBlockModel, SurfaceBlockModel])) {children.forEach(child => {@@ -86,12 +86,12 @@ export class PreviewHelper {getPreviewStd = (blockIds: string[],snapshot: SliceSnapshot,- mode: 'edgeless' | 'page'+ mode: 'block' | 'gfx') => {const widget = this.widget;const std = widget.std;const sourceGfx = std.get(GfxControllerIdentifier);- const isEdgeless = mode === 'edgeless';+ const isEdgeless = mode === 'gfx';blockIds = blockIds.slice();if (isEdgeless) {@@ -195,7 +195,7 @@ export class PreviewHelper {blockIds: string[];snapshot: SliceSnapshot;container: HTMLElement;- mode: 'page' | 'edgeless';+ mode: 'block' | 'gfx';}): void => {const { blockIds, snapshot, container, mode } = options;const { previewStd, width, height, scale } = this.getPreviewStd(diff --git a/blocksuite/affine/widget-drag-handle/src/watchers/drag-event-watcher.ts b/blocksuite/affine/widget-drag-handle/src/watchers/drag-event-watcher.tsindex 693f51edf9..cae18f9a04 100644--- a/blocksuite/affine/widget-drag-handle/src/watchers/drag-event-watcher.ts+++ b/blocksuite/affine/widget-drag-handle/src/watchers/drag-event-watcher.ts@@ -1067,16 +1067,12 @@ export class DragEventWatcher {schema.safeValidate(block.flavour, 'affine:note'));// create note to wrap the snapshot- const pos = this.gfx.viewport.toModelCoordFromClientCoord([- point.x,- point.y,- ]);const noteId = store.addBlock('affine:note',{xywh: new Bound(- pos[0],- pos[1],+ point.x,+ point.y,DEFAULT_NOTE_WIDTH,DEFAULT_NOTE_HEIGHT).serialize(),@@ -1263,13 +1259,13 @@ export class DragEventWatcher {return;}- const { snapshot } = source.data.bsEntity;+ const { snapshot, fromMode } = source.data.bsEntity;this.previewHelper.renderDragPreview({blockIds: source.data?.bsEntity?.modelIds,snapshot,container,- mode: this.mode ?? 'page',+ mode: fromMode ?? 'block',});setOffset({ x: 0, y: 0 });