mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-19 02:51:47 +08:00
fix(core): selected content should not be activated when executing open in chat (#7302)
Closes: [AF-949](https://linear.app/affine-design/issue/AF-949/执行-open-in-chat-时,不应该激活选中内容)
This commit is contained in:
@@ -2,6 +2,7 @@ import type { EditorHost } from '@blocksuite/block-std';
|
|||||||
import { WithDisposable } from '@blocksuite/block-std';
|
import { WithDisposable } from '@blocksuite/block-std';
|
||||||
import {
|
import {
|
||||||
type ImageBlockModel,
|
type ImageBlockModel,
|
||||||
|
isInsidePageEditor,
|
||||||
type NoteBlockModel,
|
type NoteBlockModel,
|
||||||
NoteDisplayMode,
|
NoteDisplayMode,
|
||||||
} from '@blocksuite/blocks';
|
} from '@blocksuite/blocks';
|
||||||
@@ -467,6 +468,18 @@ export class ChatCards extends WithDisposable(LitElement) {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this._disposables.add(
|
||||||
|
AIProvider.slots.requestContinueInChat.on(async ({ host, show }) => {
|
||||||
|
if (show) {
|
||||||
|
if (isInsidePageEditor(host)) {
|
||||||
|
await this._extract();
|
||||||
|
} else {
|
||||||
|
await this._extractOnEdgeless();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
this._disposables.add(
|
this._disposables.add(
|
||||||
AIProvider.slots.toggleChatCards.on(({ visible, ok }) => {
|
AIProvider.slots.toggleChatCards.on(({ visible, ok }) => {
|
||||||
if (visible && ok && this._selectedCardId > 0) {
|
if (visible && ok && this._selectedCardId > 0) {
|
||||||
|
|||||||
@@ -212,19 +212,6 @@ export class ChatPanel extends WithDisposable(ShadowlessElement) {
|
|||||||
this._resetItems();
|
this._resetItems();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
AIProvider.slots.requestContinueInChat.on(async ({ show }) => {
|
|
||||||
if (show) {
|
|
||||||
const text = await getSelectedTextContent(this.host, 'plain-text');
|
|
||||||
const markdown = await getSelectedTextContent(this.host, 'markdown');
|
|
||||||
const images = await getSelectedImagesAsBlobs(this.host);
|
|
||||||
this.updateContext({
|
|
||||||
quote: text,
|
|
||||||
markdown: markdown,
|
|
||||||
images: images,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateContext = (context: Partial<ChatContextValue>) => {
|
updateContext = (context: Partial<ChatContextValue>) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user