feat(editor): selection as store extension (#9605)
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
||||
CommandExtension,
|
||||
FlavourExtension,
|
||||
} from '@blocksuite/block-std';
|
||||
import { DatabaseSelectionExtension } from '@blocksuite/data-view';
|
||||
import type { ExtensionType } from '@blocksuite/store';
|
||||
import { literal } from 'lit/static-html.js';
|
||||
|
||||
@@ -16,6 +15,5 @@ export const DatabaseBlockSpec: ExtensionType[] = [
|
||||
DatabaseBlockService,
|
||||
CommandExtension(commands),
|
||||
BlockViewExtension('affine:database', literal`affine-database`),
|
||||
DatabaseSelectionExtension,
|
||||
DatabaseBlockAdapterExtensions,
|
||||
].flat();
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { ImageSelection } from '@blocksuite/affine-shared/selection';
|
||||
import type { BaseSelection, UIEventStateContext } from '@blocksuite/block-std';
|
||||
import type { UIEventStateContext } from '@blocksuite/block-std';
|
||||
import {
|
||||
BlockSelection,
|
||||
ShadowlessElement,
|
||||
TextSelection,
|
||||
} from '@blocksuite/block-std';
|
||||
import { WithDisposable } from '@blocksuite/global/utils';
|
||||
import type { BaseSelection } from '@blocksuite/store';
|
||||
import { css, html, type PropertyValues } from 'lit';
|
||||
import { property, query, state } from 'lit/decorators.js';
|
||||
import { styleMap } from 'lit/directives/style-map.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { ImageSelectionExtension } from '@blocksuite/affine-shared/selection';
|
||||
import {
|
||||
BlockViewExtension,
|
||||
CommandExtension,
|
||||
@@ -29,6 +28,5 @@ export const ImageBlockSpec: ExtensionType[] = [
|
||||
imageToolbar: literal`affine-image-toolbar-widget`,
|
||||
}),
|
||||
ImageDropOption,
|
||||
ImageSelectionExtension,
|
||||
ImageBlockAdapterExtensions,
|
||||
].flat();
|
||||
|
||||
@@ -14,13 +14,14 @@ import {
|
||||
} from '@blocksuite/affine-shared/consts';
|
||||
import { DocModeProvider } from '@blocksuite/affine-shared/services';
|
||||
import { getViewportElement } from '@blocksuite/affine-shared/utils';
|
||||
import type { BaseSelection, BlockComponent } from '@blocksuite/block-std';
|
||||
import type { BlockComponent } from '@blocksuite/block-std';
|
||||
import {
|
||||
BlockSelection,
|
||||
getInlineRangeProvider,
|
||||
TextSelection,
|
||||
} from '@blocksuite/block-std';
|
||||
import type { InlineRangeProvider } from '@blocksuite/inline';
|
||||
import type { BaseSelection } from '@blocksuite/store';
|
||||
import { effect } from '@preact/signals-core';
|
||||
import { html, nothing, type TemplateResult } from 'lit';
|
||||
import { query, state } from 'lit/decorators.js';
|
||||
|
||||
@@ -2,7 +2,6 @@ import { textConversionConfigs } from '@blocksuite/affine-components/rich-text';
|
||||
import { NoteBlockSchema } from '@blocksuite/affine-model';
|
||||
import { matchFlavours } from '@blocksuite/affine-shared/utils';
|
||||
import {
|
||||
type BaseSelection,
|
||||
type BlockComponent,
|
||||
BlockSelection,
|
||||
BlockService,
|
||||
@@ -11,7 +10,7 @@ import {
|
||||
type UIEventHandler,
|
||||
type UIEventStateContext,
|
||||
} from '@blocksuite/block-std';
|
||||
import type { BlockModel } from '@blocksuite/store';
|
||||
import type { BaseSelection, BlockModel } from '@blocksuite/store';
|
||||
|
||||
import { moveBlockConfigs } from './move-block';
|
||||
import { quickActionConfig } from './quick-action';
|
||||
|
||||
@@ -26,7 +26,6 @@ import {
|
||||
SpecProvider,
|
||||
} from '@blocksuite/affine-shared/utils';
|
||||
import {
|
||||
type BaseSelection,
|
||||
BlockComponent,
|
||||
BlockSelection,
|
||||
BlockServiceWatcher,
|
||||
@@ -47,7 +46,7 @@ import {
|
||||
DisposableGroup,
|
||||
type SerializedXYWH,
|
||||
} from '@blocksuite/global/utils';
|
||||
import { type Store } from '@blocksuite/store';
|
||||
import type { BaseSelection, Store } from '@blocksuite/store';
|
||||
import { css, html, nothing, type TemplateResult } from 'lit';
|
||||
import { query, state } from 'lit/decorators.js';
|
||||
import { styleMap } from 'lit/directives/style-map.js';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { HighlightSelectionExtension } from '@blocksuite/affine-shared/selection';
|
||||
import {
|
||||
BlockViewExtension,
|
||||
CommandExtension,
|
||||
@@ -23,7 +22,6 @@ const CommonSurfaceBlockSpec: ExtensionType[] = [
|
||||
FlavourExtension('affine:surface'),
|
||||
SurfaceBlockService,
|
||||
CommandExtension(commands),
|
||||
HighlightSelectionExtension,
|
||||
MindMapView,
|
||||
EdgelessCRUDExtension,
|
||||
EdgelessLegacySlotExtension,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSelection, SelectionExtension } from '@blocksuite/block-std';
|
||||
import { BaseSelection, SelectionExtension } from '@blocksuite/store';
|
||||
import { z } from 'zod';
|
||||
|
||||
import type { DataViewSelection, GetDataViewSelection } from '../types.js';
|
||||
|
||||
@@ -2,7 +2,7 @@ import {
|
||||
type ReferenceParams,
|
||||
ReferenceParamsSchema,
|
||||
} from '@blocksuite/affine-model';
|
||||
import { BaseSelection, SelectionExtension } from '@blocksuite/block-std';
|
||||
import { BaseSelection, SelectionExtension } from '@blocksuite/store';
|
||||
|
||||
export class HighlightSelection extends BaseSelection {
|
||||
static override group = 'scene';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseSelection, SelectionExtension } from '@blocksuite/block-std';
|
||||
import { BaseSelection, SelectionExtension } from '@blocksuite/store';
|
||||
import z from 'zod';
|
||||
|
||||
const ImageSelectionSchema = z.object({
|
||||
|
||||
@@ -9,13 +9,9 @@ import {
|
||||
getClosestBlockComponentByPoint,
|
||||
matchFlavours,
|
||||
} from '@blocksuite/affine-shared/utils';
|
||||
import type {
|
||||
BaseSelection,
|
||||
BlockComponent,
|
||||
EditorHost,
|
||||
} from '@blocksuite/block-std';
|
||||
import type { BlockComponent, EditorHost } from '@blocksuite/block-std';
|
||||
import { Point, Rect } from '@blocksuite/global/utils';
|
||||
import type { BlockModel } from '@blocksuite/store';
|
||||
import type { BaseSelection, BlockModel } from '@blocksuite/store';
|
||||
|
||||
import {
|
||||
DRAG_HANDLE_CONTAINER_HEIGHT,
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { matchFlavours } from '@blocksuite/affine-shared/utils';
|
||||
import {
|
||||
type BaseSelection,
|
||||
BlockSelection,
|
||||
TextSelection,
|
||||
WidgetComponent,
|
||||
} from '@blocksuite/block-std';
|
||||
import { throttle } from '@blocksuite/global/utils';
|
||||
import type { UserInfo } from '@blocksuite/store';
|
||||
import type { BaseSelection, UserInfo } from '@blocksuite/store';
|
||||
import { computed, effect } from '@preact/signals-core';
|
||||
import { css, html, nothing, type PropertyValues } from 'lit';
|
||||
import { state } from 'lit/decorators.js';
|
||||
|
||||
Reference in New Issue
Block a user