mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
@@ -1,3 +1,4 @@
|
||||
import { getStoreManager } from '@affine/core/blocksuite/manager/migrating-store';
|
||||
import { AffineContext } from '@affine/core/components/context';
|
||||
import { AppFallback } from '@affine/core/mobile/components/app-fallback';
|
||||
import { configureMobileModules } from '@affine/core/mobile/modules';
|
||||
@@ -306,6 +307,7 @@ const frameworkProvider = framework.provider();
|
||||
collection: workspace.docCollection,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
markdown,
|
||||
extensions: getStoreManager().get('store'),
|
||||
});
|
||||
const docsService = workspace.scope.get(DocsService);
|
||||
if (docId) {
|
||||
|
||||
@@ -14,6 +14,8 @@ import type { Workspace } from '@blocksuite/affine/store';
|
||||
import { useServices } from '@toeverything/infra';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
|
||||
import { getStoreManager } from '../manager/migrating-store';
|
||||
|
||||
export const usePageHelper = (docCollection: Workspace) => {
|
||||
const {
|
||||
docsService,
|
||||
@@ -121,6 +123,7 @@ export const usePageHelper = (docCollection: Workspace) => {
|
||||
showImportModal({
|
||||
collection: docCollection,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
extensions: getStoreManager().get('store'),
|
||||
onSuccess,
|
||||
onFail: message => {
|
||||
reject(new Error(message));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Button, IconButton, Modal } from '@affine/component';
|
||||
import { getStoreManager } from '@affine/core/blocksuite/manager/migrating-store';
|
||||
import { useAsyncCallback } from '@affine/core/components/hooks/affine-async-hooks';
|
||||
import type {
|
||||
DialogComponentProps,
|
||||
@@ -145,6 +146,7 @@ const importConfigs: Record<ImportType, ImportConfig> = {
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
markdown: text,
|
||||
fileName,
|
||||
extensions: getStoreManager().get('store'),
|
||||
});
|
||||
if (docId) docIds.push(docId);
|
||||
}
|
||||
@@ -163,6 +165,7 @@ const importConfigs: Record<ImportType, ImportConfig> = {
|
||||
collection: docCollection,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
imported: file,
|
||||
extensions: getStoreManager().get('store'),
|
||||
});
|
||||
return {
|
||||
docIds,
|
||||
@@ -182,6 +185,7 @@ const importConfigs: Record<ImportType, ImportConfig> = {
|
||||
const docId = await HtmlTransformer.importHTMLToDoc({
|
||||
collection: docCollection,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
extensions: getStoreManager().get('store'),
|
||||
html: text,
|
||||
fileName,
|
||||
});
|
||||
@@ -203,6 +207,7 @@ const importConfigs: Record<ImportType, ImportConfig> = {
|
||||
collection: docCollection,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
imported: file,
|
||||
extensions: getStoreManager().get('store'),
|
||||
});
|
||||
return {
|
||||
docIds: pageIds,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { getStoreManager } from '@affine/core/blocksuite/manager/migrating-store';
|
||||
import { MarkdownTransformer } from '@blocksuite/affine/widgets/linked-doc';
|
||||
import { Service } from '@toeverything/infra';
|
||||
|
||||
@@ -34,6 +35,7 @@ export class ImportClipperService extends Service {
|
||||
collection: workspace.docCollection,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
markdown: clipperInput.contentMarkdown,
|
||||
extensions: getStoreManager().get('store'),
|
||||
});
|
||||
const docsService = workspace.scope.get(DocsService);
|
||||
if (docId) {
|
||||
@@ -67,6 +69,7 @@ export class ImportClipperService extends Service {
|
||||
collection: docCollection,
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
markdown: clipperInput.contentMarkdown,
|
||||
extensions: getStoreManager().get('store'),
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { getStoreManager } from '@affine/core/blocksuite/manager/migrating-store';
|
||||
import { MarkdownTransformer } from '@blocksuite/affine/widgets/linked-doc';
|
||||
import { Entity } from '@toeverything/infra';
|
||||
|
||||
@@ -60,6 +61,7 @@ export class IntegrationWriter extends Entity {
|
||||
schema: getAFFiNEWorkspaceSchema(),
|
||||
markdown,
|
||||
fileName: title,
|
||||
extensions: getStoreManager().get('store'),
|
||||
});
|
||||
|
||||
if (!newDocId) throw new Error('Failed to create a new doc');
|
||||
@@ -87,6 +89,7 @@ export class IntegrationWriter extends Entity {
|
||||
doc,
|
||||
blockId: noteBlockId,
|
||||
markdown,
|
||||
extensions: getStoreManager().get('store'),
|
||||
});
|
||||
} else if (updateStrategy === 'append') {
|
||||
const pageBlockId = doc.getBlocksByFlavour('affine:page')[0]?.id;
|
||||
@@ -95,6 +98,7 @@ export class IntegrationWriter extends Entity {
|
||||
doc,
|
||||
blockId,
|
||||
markdown: `---\n${markdown}`,
|
||||
extensions: getStoreManager().get('store'),
|
||||
});
|
||||
} else {
|
||||
throw new Error('Invalid update strategy');
|
||||
|
||||
Reference in New Issue
Block a user