chore: bump bs (#8189)

This commit is contained in:
Saul-Mirone
2024-09-10 13:48:08 +00:00
parent 95738e796f
commit daa9d9ff5c
20 changed files with 217 additions and 199 deletions

View File

@@ -178,7 +178,7 @@ function addAIChatBlock(
}
export function promptDocTitle(host: EditorHost, autofill?: string) {
const notification = host.std.getService('affine:page').notificationService;
const notification = host.std.getService('affine:page')?.notificationService;
if (!notification) return Promise.resolve(undefined);
return notification.prompt({
@@ -386,6 +386,8 @@ const ADD_TO_EDGELESS_AS_NOTE = {
reportResponse('result:add-note');
const { doc } = host;
const service = host.std.getService<EdgelessRootService>('affine:page');
if (!service) return;
const elements = service.selection.selectedElements;
const props: { displayMode: NoteDisplayMode; xywh?: SerializedXYWH } = {
@@ -426,7 +428,7 @@ const CREATE_AS_DOC = {
newDoc.addBlock('affine:surface', {}, rootId);
const noteId = newDoc.addBlock('affine:note', {}, rootId);
host.std.getService('affine:page').slots.docLinkClicked.emit({
host.std.getService('affine:page')?.slots.docLinkClicked.emit({
pageId: newDoc.id,
});
let complete = false;
@@ -464,6 +466,9 @@ const CREATE_AS_LINKED_DOC = {
}
const service = host.std.getService<EdgelessRootService>('affine:page');
if (!service) {
return false;
}
const docModeService = host.std.get(DocModeProvider);
const mode = docModeService.getEditorMode();
if (mode !== 'edgeless') {

View File

@@ -148,7 +148,7 @@ export class ChatActionList extends LitElement {
messageId
);
if (success) {
this._rootService.notificationService?.notify({
this._rootService?.notificationService?.notify({
title: action.toast,
accent: 'success',
onClose: function (): void {},

View File

@@ -128,6 +128,7 @@ export class ChatCopyMore extends WithDisposable(LitElement) {
}
private readonly _notifySuccess = (title: string) => {
if (!this._rootService) return;
const { notificationService } = this._rootService;
notificationService?.notify({
title: title,

View File

@@ -78,7 +78,7 @@ export async function selectedToPng(editor: EditorHost) {
export async function getSelectedTextContent(editorHost: EditorHost) {
const slice = Slice.fromModels(
editorHost.std.doc,
getRootService(editorHost).selectedModels
getRootService(editorHost)?.selectedModels ?? []
);
return getMarkdownFromSlice(editorHost, slice);
}

View File

@@ -510,6 +510,7 @@ export const responses: {
if (!contents) return;
const images = data.images as { url: string; id: string }[][];
const service = host.std.getService<EdgelessRootService>('affine:page');
if (!service) return;
(async function () {
for (let i = 0; i < contents.length - 1; i++) {

View File

@@ -160,7 +160,7 @@ export class ChatPanel extends WithDisposable(ShadowlessElement) {
private readonly _cleanupHistories = async () => {
const notification =
this.host.std.getService('affine:page').notificationService;
this.host.std.getService('affine:page')?.notificationService;
if (!notification) return;
if (

View File

@@ -1,6 +1,8 @@
import type { MindmapStyle } from '@blocksuite/affine-block-surface';
import type { EditorHost } from '@blocksuite/block-std';
import type { AffineAIPanelWidgetConfig } from '@blocksuite/blocks';
import type {
AffineAIPanelWidgetConfig,
MindmapStyle,
} from '@blocksuite/blocks';
import { markdownToMindmap, MiniMindmapPreview } from '@blocksuite/blocks';
import { noop } from '@blocksuite/global/utils';
import { html, nothing } from 'lit';

View File

@@ -80,7 +80,7 @@ export class AISlidesRenderer extends WithDisposable(LitElement) {
PPTBuilder(this._editorHost)
.process(this.text)
.then(res => {
if (this.ctx) {
if (res && this.ctx) {
this.ctx.set({
contents: res.contents,
images: res.images,

View File

@@ -254,10 +254,9 @@ export class AIChatBlockPeekView extends LitElement {
* Clean current chat messages and delete the newly created AI chat block
*/
cleanCurrentChatHistories = async () => {
if (!this._rootService) return;
const { notificationService } = this._rootService;
if (!notificationService) {
return;
}
if (!notificationService) return;
const { currentChatBlockId, currentSessionId } = this.chatContext;
if (!currentChatBlockId && !currentSessionId) {

View File

@@ -35,7 +35,7 @@ export const PPTBuilder = (host: EditorHost) => {
};
docs.push(doc);
if (doc.isCover) return;
if (doc.isCover || !service) return;
const job = service.createTemplateJob('template');
const { images, content } = await basicTheme(doc);
contents.push(content);
@@ -56,6 +56,7 @@ export const PPTBuilder = (host: EditorHost) => {
return {
process: async (text: string) => {
try {
if (!service) return;
const snapshot = await markdownToSnapshot(text, host);
const block = snapshot.snapshot.content[0];