chore: bump bs (#7914)

This commit is contained in:
Saul-Mirone
2024-08-20 00:24:00 +00:00
parent 152815c175
commit 6b0c398ae5
20 changed files with 199 additions and 135 deletions

View File

@@ -10,12 +10,12 @@ import type {
ImageSelection,
PageRootService,
} from '@blocksuite/blocks';
import { BlocksUtils, NoteDisplayMode } from '@blocksuite/blocks';
import {
BlocksUtils,
Bound,
getElementsBound,
NoteDisplayMode,
} from '@blocksuite/blocks';
import { Bound, type SerializedXYWH } from '@blocksuite/global/utils';
type SerializedXYWH,
} from '@blocksuite/global/utils';
import { type ChatMessage } from '@blocksuite/presets';
import type { Doc } from '@blocksuite/store';
import type { TemplateResult } from 'lit';
@@ -304,7 +304,10 @@ const SAVE_CHAT_TO_BLOCK_ACTION: ChatAction = {
const { docModeService, notificationService } = rootService;
const { layer } = surfaceService;
const curMode = docModeService.getMode();
const viewportCenter = getViewportCenter(curMode, rootService);
const viewportCenter = getViewportCenter(
curMode,
rootService as PageRootService
);
const newBlockIndex = layer.generateIndex('affine:embed-ai-chat');
// If current mode is not edgeless, switch to edgeless mode first
if (curMode !== 'edgeless') {

View File

@@ -216,8 +216,6 @@ export class AISlidesRenderer extends WithDisposable(LitElement) {
const collection = new DocCollection({
schema,
id: 'SLIDES_PREVIEW',
disableBacklinkIndex: true,
disableSearchIndex: true,
});
collection.meta.initialize();
collection.start();

View File

@@ -226,6 +226,7 @@ export class AIChatBlockPeekView extends LitElement {
const { doc } = this.host;
const chatBlock = doc.getBlock(this.chatContext.currentChatBlockId);
if (!chatBlock) return;
// Get fork session messages
const { parentRootWorkspaceId, parentRootDocId } = this;
@@ -278,7 +279,7 @@ export class AIChatBlockPeekView extends LitElement {
if (currentChatBlockId) {
const edgelessService = this._rootService as EdgelessRootService;
const chatBlock = doc.getBlock(currentChatBlockId).model;
const chatBlock = doc.getBlock(currentChatBlockId)?.model;
if (chatBlock) {
const connectors = edgelessService.getConnectors(
chatBlock as AIChatBlockModel

View File

@@ -68,7 +68,10 @@ export function findNoteBlockModel(blockElement: BlockComponent) {
if (matchFlavours(curBlock.model, ['affine:page', 'affine:surface'])) {
return null;
}
curBlock = curBlock.parentBlock;
if (!curBlock.parentComponent) {
break;
}
curBlock = curBlock.parentComponent;
}
return null;
}

View File

@@ -16,7 +16,10 @@ import {
const getNoteId = (blockElement: BlockComponent) => {
let element = blockElement;
while (element.flavour !== 'affine:note') {
element = element.parentBlock;
if (!element.parentComponent) {
break;
}
element = element.parentComponent;
}
return element.model.id;
@@ -53,7 +56,8 @@ export const insert = async (
selectBlock: BlockComponent,
below: boolean = true
) => {
const blockParent = selectBlock.parentBlock;
const blockParent = selectBlock.parentComponent;
if (!blockParent) return;
const index = blockParent.model.children.findIndex(
model => model.id === selectBlock.model.id
);
@@ -94,7 +98,8 @@ export const replace = async (
selectedModels: BlockModel[],
textSelection?: TextSelection
) => {
const firstBlockParent = firstBlock.parentBlock;
const firstBlockParent = firstBlock.parentComponent;
if (!firstBlockParent) return;
const firstIndex = firstBlockParent.model.children.findIndex(
model => model.id === firstBlock.model.id
);

View File

@@ -189,8 +189,6 @@ export async function markDownToDoc(host: EditorHost, answer: string) {
// Should not create a new doc in the original collection
const collection = new DocCollection({
schema,
disableBacklinkIndex: true,
disableSearchIndex: true,
});
collection.meta.initialize();
const job = new Job({