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
refactor(editor): move focus block commands to blocksuite/shared (#10671)
L-Sun98d44d5be567
diff --git a/blocksuite/affine/block-image/src/components/page-image-block.ts b/blocksuite/affine/block-image/src/components/page-image-block.tsindex 89c806b494..fb1a81a47f 100644--- a/blocksuite/affine/block-image/src/components/page-image-block.ts+++ b/blocksuite/affine/block-image/src/components/page-image-block.ts@@ -1,5 +1,6 @@-import { focusBlockEnd, focusBlockStart } from '@blocksuite/affine-block-note';import {+ focusBlockEnd,+ focusBlockStart,getNextBlockCommand,getPrevBlockCommand,} from '@blocksuite/affine-shared/commands';diff --git a/blocksuite/affine/block-note/src/commands/index.ts b/blocksuite/affine/block-note/src/commands/index.tsindex a58bfa6867..5af625afc0 100644--- a/blocksuite/affine/block-note/src/commands/index.ts+++ b/blocksuite/affine/block-note/src/commands/index.ts@@ -4,8 +4,6 @@ export { dedentBlock } from './dedent-block.js';export { dedentBlockToRoot } from './dedent-block-to-root.js';export { dedentBlocks } from './dedent-blocks.js';export { dedentBlocksToRoot } from './dedent-blocks-to-root.js';-export { focusBlockEnd } from './focus-block-end.js';-export { focusBlockStart } from './focus-block-start.js';export { indentBlock } from './indent-block.js';export { indentBlocks } from './indent-blocks.js';export { selectBlock } from './select-block.js';diff --git a/blocksuite/affine/block-note/src/note-service.ts b/blocksuite/affine/block-note/src/note-service.tsindex f4417050bb..b40f3446d7 100644--- a/blocksuite/affine/block-note/src/note-service.ts+++ b/blocksuite/affine/block-note/src/note-service.ts@@ -7,6 +7,8 @@ import {ParagraphBlockModel,} from '@blocksuite/affine-model';import {+ focusBlockEnd,+ focusBlockStart,getBlockSelectionsCommand,getNextBlockCommand,getPrevBlockCommand,@@ -28,8 +30,6 @@ import type { BaseSelection, BlockModel } from '@blocksuite/store';import {dedentBlocks,dedentBlocksToRoot,- focusBlockEnd,- focusBlockStart,indentBlocks,selectBlock,selectBlocksBetween,diff --git a/blocksuite/affine/shared/src/commands/index.ts b/blocksuite/affine/shared/src/commands/index.tsindex 9b43680d15..2ca07d21bd 100644--- a/blocksuite/affine/shared/src/commands/index.ts+++ b/blocksuite/affine/shared/src/commands/index.ts@@ -14,6 +14,8 @@ export {retainFirstModelCommand,} from './model-crud/index.js';export {+ focusBlockEnd,+ focusBlockStart,getBlockSelectionsCommand,getImageSelectionsCommand,getRangeRects,diff --git a/blocksuite/affine/block-note/src/commands/focus-block-end.ts b/blocksuite/affine/shared/src/commands/selection/focus-block-end.tssimilarity index 100%rename from blocksuite/affine/block-note/src/commands/focus-block-end.tsrename to blocksuite/affine/shared/src/commands/selection/focus-block-end.tsdiff --git a/blocksuite/affine/block-note/src/commands/focus-block-start.ts b/blocksuite/affine/shared/src/commands/selection/focus-block-start.tssimilarity index 100%rename from blocksuite/affine/block-note/src/commands/focus-block-start.tsrename to blocksuite/affine/shared/src/commands/selection/focus-block-start.tsdiff --git a/blocksuite/affine/shared/src/commands/selection/index.ts b/blocksuite/affine/shared/src/commands/selection/index.tsindex bb3fd72659..4aaa0fd62c 100644--- a/blocksuite/affine/shared/src/commands/selection/index.ts+++ b/blocksuite/affine/shared/src/commands/selection/index.ts@@ -1,8 +1,10 @@-export { getBlockSelectionsCommand } from './get-block-selections.js';-export { getImageSelectionsCommand } from './get-image-selections.js';+export { focusBlockEnd } from './focus-block-end';+export { focusBlockStart } from './focus-block-start';+export { getBlockSelectionsCommand } from './get-block-selections';+export { getImageSelectionsCommand } from './get-image-selections';export {getRangeRects,getSelectionRectsCommand,type SelectionRect,-} from './get-selection-rects.js';-export { getTextSelectionCommand } from './get-text-selection.js';+} from './get-selection-rects';+export { getTextSelectionCommand } from './get-text-selection';diff --git a/blocksuite/affine/widget-slash-menu/src/config.ts b/blocksuite/affine/widget-slash-menu/src/config.tsindex b3bbed7bfc..2df9429033 100644--- a/blocksuite/affine/widget-slash-menu/src/config.ts+++ b/blocksuite/affine/widget-slash-menu/src/config.ts@@ -1,7 +1,6 @@import { addSiblingAttachmentBlocks } from '@blocksuite/affine-block-attachment';import { insertImagesCommand } from '@blocksuite/affine-block-image';import { insertLatexBlockCommand } from '@blocksuite/affine-block-latex';-import { focusBlockEnd } from '@blocksuite/affine-block-note';import { getSurfaceBlock } from '@blocksuite/affine-block-surface';import { insertSurfaceRefBlockCommand } from '@blocksuite/affine-block-surface-ref';import { insertTableBlockCommand } from '@blocksuite/affine-block-table';@@ -19,6 +18,7 @@ import type {ParagraphBlockModel,} from '@blocksuite/affine-model';import {+ focusBlockEnd,getSelectedModelsCommand,getTextSelectionCommand,} from '@blocksuite/affine-shared/commands';