mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-01 17:39:55 +08:00
chore: bump blocksuite (#7579)
## Features - https://github.com/toeverything/BlockSuite/pull/7693 @akumatus ## Bugfix - https://github.com/toeverything/BlockSuite/pull/7713 @Saul-Mirone - https://github.com/toeverything/BlockSuite/pull/7710 @Saul-Mirone - https://github.com/toeverything/BlockSuite/pull/7709 @Saul-Mirone - https://github.com/toeverything/BlockSuite/pull/7707 @Saul-Mirone - https://github.com/toeverything/BlockSuite/pull/7689 @fourdim - https://github.com/toeverything/BlockSuite/pull/7699 @Saul-Mirone ## Refactor - https://github.com/toeverything/BlockSuite/pull/7715 @doodlewind - https://github.com/toeverything/BlockSuite/pull/7714 @doodlewind - https://github.com/toeverything/BlockSuite/pull/7705 @doodlewind ## Misc - https://github.com/toeverything/BlockSuite/pull/7712 @doodlewind - https://github.com/toeverything/BlockSuite/pull/7711 @doodlewind - https://github.com/toeverything/BlockSuite/pull/7706 @doodlewind - https://github.com/toeverything/BlockSuite/pull/7592 @doouding
This commit is contained in:
@@ -10,7 +10,6 @@ import type {
|
||||
SurfaceBlockModel,
|
||||
} from '@blocksuite/blocks';
|
||||
import {
|
||||
Bound,
|
||||
DeleteIcon,
|
||||
EDGELESS_ELEMENT_TOOLBAR_WIDGET,
|
||||
EDGELESS_TEXT_BLOCK_MIN_HEIGHT,
|
||||
@@ -23,7 +22,7 @@ import {
|
||||
NoteDisplayMode,
|
||||
ResetIcon,
|
||||
} from '@blocksuite/blocks';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { assertExists, Bound } from '@blocksuite/global/utils';
|
||||
import type { TemplateResult } from 'lit';
|
||||
|
||||
import { AIPenIcon, ChatWithAIIcon } from '../_common/icons';
|
||||
|
||||
@@ -4,13 +4,12 @@ import {
|
||||
AffineAIPanelWidget,
|
||||
type AffineAIPanelWidgetConfig,
|
||||
type AIItemConfig,
|
||||
Bound,
|
||||
ImageBlockModel,
|
||||
isInsideEdgelessEditor,
|
||||
matchFlavours,
|
||||
NoteDisplayMode,
|
||||
} from '@blocksuite/blocks';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { assertExists, Bound } from '@blocksuite/global/utils';
|
||||
import type { TemplateResult } from 'lit';
|
||||
|
||||
import {
|
||||
|
||||
+3
-6
@@ -3,17 +3,14 @@ import type {
|
||||
EditorHost,
|
||||
TextSelection,
|
||||
} from '@blocksuite/block-std';
|
||||
import type {
|
||||
EdgelessRootService,
|
||||
ImageSelection,
|
||||
SerializedXYWH,
|
||||
} from '@blocksuite/blocks';
|
||||
import type { EdgelessRootService, ImageSelection } from '@blocksuite/blocks';
|
||||
import {
|
||||
BlocksUtils,
|
||||
Bound,
|
||||
getElementsBound,
|
||||
NoteDisplayMode,
|
||||
} from '@blocksuite/blocks';
|
||||
import type { SerializedXYWH } from '@blocksuite/global/utils';
|
||||
import { Bound } from '@blocksuite/global/utils';
|
||||
|
||||
import { CreateIcon, InsertBelowIcon, ReplaceIcon } from '../../_common/icons';
|
||||
import { reportResponse } from '../../utils/action-reporter';
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ export function setupCodeToolbarEntry(codeToolbar: AffineCodeToolbarWidget) {
|
||||
const onAskAIClick = () => {
|
||||
const { host } = codeToolbar;
|
||||
const { selection } = host;
|
||||
const codeBlock = codeToolbar.blockElement;
|
||||
const codeBlock = codeToolbar.block;
|
||||
selection.setGroup('note', [
|
||||
selection.create('block', { blockId: codeBlock.blockId }),
|
||||
]);
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ export function setupImageToolbarEntry(imageToolbar: AffineImageToolbarWidget) {
|
||||
const onAskAIClick = () => {
|
||||
const { host } = imageToolbar;
|
||||
const { selection } = host;
|
||||
const imageBlock = imageToolbar.blockElement;
|
||||
const imageBlock = imageToolbar.block;
|
||||
selection.setGroup('note', [
|
||||
selection.create('image', { blockId: imageBlock.blockId }),
|
||||
]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Bound } from '@blocksuite/blocks';
|
||||
import { Bound } from '@blocksuite/global/utils';
|
||||
import { nanoid } from '@blocksuite/store';
|
||||
|
||||
import { AIProvider } from '../provider';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BlockElement, EditorHost } from '@blocksuite/block-std';
|
||||
import type { BlockComponent, EditorHost } from '@blocksuite/block-std';
|
||||
import {
|
||||
AFFINE_EDGELESS_COPILOT_WIDGET,
|
||||
type EdgelessCopilotWidget,
|
||||
@@ -59,7 +59,7 @@ export function getEdgelessCopilotWidget(
|
||||
return copilotWidget;
|
||||
}
|
||||
|
||||
export function findNoteBlockModel(blockElement: BlockElement) {
|
||||
export function findNoteBlockModel(blockElement: BlockComponent) {
|
||||
let curBlock = blockElement;
|
||||
while (curBlock) {
|
||||
if (matchFlavours(curBlock.model, ['affine:note'])) {
|
||||
@@ -68,7 +68,7 @@ export function findNoteBlockModel(blockElement: BlockElement) {
|
||||
if (matchFlavours(curBlock.model, ['affine:page', 'affine:surface'])) {
|
||||
return null;
|
||||
}
|
||||
curBlock = curBlock.parentBlockElement;
|
||||
curBlock = curBlock.parentBlock;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type {
|
||||
BlockElement,
|
||||
BlockComponent,
|
||||
EditorHost,
|
||||
TextSelection,
|
||||
} from '@blocksuite/block-std';
|
||||
@@ -13,10 +13,10 @@ import {
|
||||
markdownToSnapshot,
|
||||
} from './markdown-utils';
|
||||
|
||||
const getNoteId = (blockElement: BlockElement) => {
|
||||
const getNoteId = (blockElement: BlockComponent) => {
|
||||
let element = blockElement;
|
||||
while (element && element.flavour !== 'affine:note') {
|
||||
element = element.parentBlockElement;
|
||||
while (element.flavour !== 'affine:note') {
|
||||
element = element.parentBlock;
|
||||
}
|
||||
|
||||
return element.model.id;
|
||||
@@ -24,7 +24,7 @@ const getNoteId = (blockElement: BlockElement) => {
|
||||
|
||||
const setBlockSelection = (
|
||||
host: EditorHost,
|
||||
parent: BlockElement,
|
||||
parent: BlockComponent,
|
||||
models: BlockModel[]
|
||||
) => {
|
||||
const selections = models
|
||||
@@ -50,10 +50,10 @@ const setBlockSelection = (
|
||||
export const insert = async (
|
||||
host: EditorHost,
|
||||
content: string,
|
||||
selectBlock: BlockElement,
|
||||
selectBlock: BlockComponent,
|
||||
below: boolean = true
|
||||
) => {
|
||||
const blockParent = selectBlock.parentBlockElement;
|
||||
const blockParent = selectBlock.parentBlock;
|
||||
const index = blockParent.model.children.findIndex(
|
||||
model => model.id === selectBlock.model.id
|
||||
);
|
||||
@@ -72,7 +72,7 @@ export const insert = async (
|
||||
export const insertBelow = async (
|
||||
host: EditorHost,
|
||||
content: string,
|
||||
selectBlock: BlockElement
|
||||
selectBlock: BlockComponent
|
||||
) => {
|
||||
await insert(host, content, selectBlock, true);
|
||||
};
|
||||
@@ -80,7 +80,7 @@ export const insertBelow = async (
|
||||
export const insertAbove = async (
|
||||
host: EditorHost,
|
||||
content: string,
|
||||
selectBlock: BlockElement
|
||||
selectBlock: BlockComponent
|
||||
) => {
|
||||
await insert(host, content, selectBlock, false);
|
||||
};
|
||||
@@ -88,11 +88,11 @@ export const insertAbove = async (
|
||||
export const replace = async (
|
||||
host: EditorHost,
|
||||
content: string,
|
||||
firstBlock: BlockElement,
|
||||
firstBlock: BlockComponent,
|
||||
selectedModels: BlockModel[],
|
||||
textSelection?: TextSelection
|
||||
) => {
|
||||
const firstBlockParent = firstBlock.parentBlockElement;
|
||||
const firstBlockParent = firstBlock.parentBlock;
|
||||
const firstIndex = firstBlockParent.model.children.findIndex(
|
||||
model => model.id === firstBlock.model.id
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user