mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
@@ -111,7 +111,10 @@ export class ChatPanelDocChip extends SignalWatcher(
|
||||
if (!doc.ready) {
|
||||
doc.load();
|
||||
}
|
||||
const value = await extractMarkdownFromDoc(doc, this.host.std.provider);
|
||||
const value = await extractMarkdownFromDoc(
|
||||
doc,
|
||||
this.host.std.store.provider
|
||||
);
|
||||
const tokenCount = estimateTokenCount(value);
|
||||
if (this.checkTokenLimit(this.chip, tokenCount)) {
|
||||
const markdown = this.chip.markdown ?? new Signal<string>('');
|
||||
|
||||
@@ -228,7 +228,7 @@ export class TextRenderer extends WithDisposable(ShadowlessElement) {
|
||||
const schema = this.schema ?? this.host?.std.store.schema;
|
||||
let provider: ServiceProvider;
|
||||
if (this.host) {
|
||||
provider = this.host.std.provider;
|
||||
provider = this.host.std.store.provider;
|
||||
} else {
|
||||
const container = new Container();
|
||||
getMarkdownAdapterExtensions().forEach(ext => {
|
||||
|
||||
@@ -21,9 +21,7 @@ export function enableAIExtension(
|
||||
framework: FrameworkProvider,
|
||||
enableAI: boolean
|
||||
) {
|
||||
if (!enableAI) {
|
||||
return;
|
||||
}
|
||||
if (!enableAI) return;
|
||||
|
||||
specBuilder.replace(CodeBlockSpec, AICodeBlockSpec);
|
||||
specBuilder.replace(ImageBlockSpec, AIImageBlockSpec);
|
||||
|
||||
@@ -56,7 +56,7 @@ export const createMindmapExecuteRenderer: (
|
||||
}
|
||||
|
||||
ctx.set({
|
||||
node: markdownToMindmap(answer, host.doc, host.std.provider),
|
||||
node: markdownToMindmap(answer, host.doc, host.std.store.provider),
|
||||
});
|
||||
|
||||
handler(host, ctx);
|
||||
|
||||
@@ -132,7 +132,7 @@ export class MiniMindmapPreview extends WithDisposable(LitElement) {
|
||||
}
|
||||
|
||||
private _toMindmapNode(answer: string, doc: Store) {
|
||||
return markdownToMindmap(answer, doc, this.host.std.provider);
|
||||
return markdownToMindmap(answer, doc, this.host.std.store.provider);
|
||||
}
|
||||
|
||||
override connectedCallback(): void {
|
||||
|
||||
@@ -154,7 +154,7 @@ export const copyTextAnswer = async (panel: AffineAIPanelWidget) => {
|
||||
|
||||
export const copyText = async (host: EditorHost, text: string) => {
|
||||
const previewDoc = await markDownToDoc(
|
||||
host.std.provider,
|
||||
host.std.store.provider,
|
||||
host.std.store.schema,
|
||||
text,
|
||||
[defaultImageProxyMiddleware]
|
||||
|
||||
@@ -1,3 +1,18 @@
|
||||
import { AttachmentStoreExtension } from '@blocksuite/affine/blocks/attachment/store';
|
||||
import { BookmarkStoreExtension } from '@blocksuite/affine/blocks/bookmark/store';
|
||||
import { CalloutStoreExtension } from '@blocksuite/affine/blocks/callout/store';
|
||||
import { CodeStoreExtension } from '@blocksuite/affine/blocks/code/store';
|
||||
import { DataViewStoreExtension } from '@blocksuite/affine/blocks/data-view/store';
|
||||
import { DatabaseStoreExtension } from '@blocksuite/affine/blocks/database/store';
|
||||
import { DividerStoreExtension } from '@blocksuite/affine/blocks/divider/store';
|
||||
import { EdgelessTextStoreExtension } from '@blocksuite/affine/blocks/edgeless-text/store';
|
||||
import { EmbedStoreExtension } from '@blocksuite/affine/blocks/embed/store';
|
||||
import { FrameStoreExtension } from '@blocksuite/affine/blocks/frame/store';
|
||||
import { ImageStoreExtension } from '@blocksuite/affine/blocks/image/store';
|
||||
import { LatexStoreExtension } from '@blocksuite/affine/blocks/latex/store';
|
||||
import { ListStoreExtension } from '@blocksuite/affine/blocks/list/store';
|
||||
import { NoteStoreExtension } from '@blocksuite/affine/blocks/note/store';
|
||||
import { ParagraphStoreExtension } from '@blocksuite/affine/blocks/paragraph/store';
|
||||
import {
|
||||
type StoreExtensionContext,
|
||||
StoreExtensionManager,
|
||||
@@ -17,8 +32,24 @@ class MigratingAffineStoreExtension extends StoreExtensionProvider {
|
||||
}
|
||||
|
||||
const manager = new StoreExtensionManager([
|
||||
MigratingAffineStoreExtension,
|
||||
AttachmentStoreExtension,
|
||||
BookmarkStoreExtension,
|
||||
CalloutStoreExtension,
|
||||
CodeStoreExtension,
|
||||
DataViewStoreExtension,
|
||||
DatabaseStoreExtension,
|
||||
DividerStoreExtension,
|
||||
EdgelessTextStoreExtension,
|
||||
EmbedStoreExtension,
|
||||
FrameStoreExtension,
|
||||
ImageStoreExtension,
|
||||
LatexStoreExtension,
|
||||
ListStoreExtension,
|
||||
NoteStoreExtension,
|
||||
ParagraphStoreExtension,
|
||||
|
||||
MigratingStoreExtension,
|
||||
MigratingAffineStoreExtension,
|
||||
]);
|
||||
|
||||
export function getStoreManager() {
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
import { PeekViewService } from '@affine/core/modules/peek-view';
|
||||
import { AttachmentViewExtension } from '@blocksuite/affine/blocks/attachment/view';
|
||||
import { BookmarkViewExtension } from '@blocksuite/affine/blocks/bookmark/view';
|
||||
import { CalloutViewExtension } from '@blocksuite/affine/blocks/callout/view';
|
||||
import { CodeBlockViewExtension } from '@blocksuite/affine/blocks/code/view';
|
||||
import { DataViewViewExtension } from '@blocksuite/affine/blocks/data-view/view';
|
||||
import { DatabaseViewExtension } from '@blocksuite/affine/blocks/database/view';
|
||||
import { DividerViewExtension } from '@blocksuite/affine/blocks/divider/view';
|
||||
import { EdgelessTextViewExtension } from '@blocksuite/affine/blocks/edgeless-text/view';
|
||||
import { EmbedViewExtension } from '@blocksuite/affine/blocks/embed/view';
|
||||
import { FrameViewExtension } from '@blocksuite/affine/blocks/frame/view';
|
||||
import { ImageViewExtension } from '@blocksuite/affine/blocks/image/view';
|
||||
import { LatexViewExtension } from '@blocksuite/affine/blocks/latex/view';
|
||||
import { ListViewExtension } from '@blocksuite/affine/blocks/list/view';
|
||||
import { NoteViewExtension } from '@blocksuite/affine/blocks/note/view';
|
||||
import { ParagraphBlockConfigExtension } from '@blocksuite/affine/blocks/paragraph';
|
||||
import { ParagraphViewExtension } from '@blocksuite/affine/blocks/paragraph/view';
|
||||
import {
|
||||
type ViewExtensionContext,
|
||||
ViewExtensionManager,
|
||||
@@ -129,6 +144,23 @@ class MigratingAffineViewExtension extends ViewExtensionProvider<
|
||||
|
||||
const manager = new ViewExtensionManager([
|
||||
MigratingViewExtension,
|
||||
|
||||
AttachmentViewExtension,
|
||||
BookmarkViewExtension,
|
||||
CalloutViewExtension,
|
||||
CodeBlockViewExtension,
|
||||
DataViewViewExtension,
|
||||
DatabaseViewExtension,
|
||||
DividerViewExtension,
|
||||
EdgelessTextViewExtension,
|
||||
EmbedViewExtension,
|
||||
FrameViewExtension,
|
||||
ImageViewExtension,
|
||||
LatexViewExtension,
|
||||
ListViewExtension,
|
||||
NoteViewExtension,
|
||||
ParagraphViewExtension,
|
||||
|
||||
MigratingAffineViewExtension,
|
||||
]);
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@ export async function getContentFromSlice(
|
||||
processTextInSnapshot(snapshot, host);
|
||||
const adapter =
|
||||
type === 'markdown'
|
||||
? new MarkdownAdapter(transformer, host.std.provider)
|
||||
: new PlainTextAdapter(transformer, host.std.provider);
|
||||
? new MarkdownAdapter(transformer, host.std.store.provider)
|
||||
: new PlainTextAdapter(transformer, host.std.store.provider);
|
||||
const content = await adapter.fromSliceSnapshot({
|
||||
snapshot,
|
||||
assets: transformer.assetsManager,
|
||||
|
||||
@@ -76,7 +76,7 @@ async function exportDoc(
|
||||
],
|
||||
});
|
||||
|
||||
const adapterFactory = std.provider.get(config.identifier);
|
||||
const adapterFactory = std.store.provider.get(config.identifier);
|
||||
const adapter = adapterFactory.get(transformer);
|
||||
const result = (await adapter.fromDoc(doc)) as AdapterResult;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user