mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
chore(editor): rename std.doc to std.store (#9596)
This commit is contained in:
@@ -194,7 +194,7 @@ export class TextRenderer extends WithDisposable(ShadowlessElement) {
|
||||
if (this._answers.length > 0) {
|
||||
const latestAnswer = this._answers.pop();
|
||||
this._answers = [];
|
||||
const schema = this.schema ?? this.host?.std.doc.workspace.schema;
|
||||
const schema = this.schema ?? this.host?.std.store.workspace.schema;
|
||||
let provider: ServiceProvider;
|
||||
if (this.host) {
|
||||
provider = this.host.std.provider;
|
||||
|
||||
@@ -80,15 +80,15 @@ export async function getContentFromSlice(
|
||||
type: 'markdown' | 'plain-text' = 'markdown'
|
||||
) {
|
||||
const job = new Job({
|
||||
schema: host.std.doc.workspace.schema,
|
||||
blobCRUD: host.std.doc.workspace.blobSync,
|
||||
schema: host.std.store.workspace.schema,
|
||||
blobCRUD: host.std.store.workspace.blobSync,
|
||||
docCRUD: {
|
||||
create: (id: string) => host.std.doc.workspace.createDoc({ id }),
|
||||
get: (id: string) => host.std.doc.workspace.getDoc(id),
|
||||
delete: (id: string) => host.std.doc.workspace.removeDoc(id),
|
||||
create: (id: string) => host.std.store.workspace.createDoc({ id }),
|
||||
get: (id: string) => host.std.store.workspace.getDoc(id),
|
||||
delete: (id: string) => host.std.store.workspace.removeDoc(id),
|
||||
},
|
||||
middlewares: [
|
||||
titleMiddleware(host.std.doc.workspace.meta.docMetas),
|
||||
titleMiddleware(host.std.store.workspace.meta.docMetas),
|
||||
embedSyncedDocMiddleware('content'),
|
||||
],
|
||||
});
|
||||
@@ -110,14 +110,14 @@ export async function getContentFromSlice(
|
||||
|
||||
export async function getPlainTextFromSlice(host: EditorHost, slice: Slice) {
|
||||
const job = new Job({
|
||||
schema: host.std.doc.workspace.schema,
|
||||
blobCRUD: host.std.doc.workspace.blobSync,
|
||||
schema: host.std.store.workspace.schema,
|
||||
blobCRUD: host.std.store.workspace.blobSync,
|
||||
docCRUD: {
|
||||
create: (id: string) => host.std.doc.workspace.createDoc({ id }),
|
||||
get: (id: string) => host.std.doc.workspace.getDoc(id),
|
||||
delete: (id: string) => host.std.doc.workspace.removeDoc(id),
|
||||
create: (id: string) => host.std.store.workspace.createDoc({ id }),
|
||||
get: (id: string) => host.std.store.workspace.getDoc(id),
|
||||
delete: (id: string) => host.std.store.workspace.removeDoc(id),
|
||||
},
|
||||
middlewares: [titleMiddleware(host.std.doc.workspace.meta.docMetas)],
|
||||
middlewares: [titleMiddleware(host.std.store.workspace.meta.docMetas)],
|
||||
});
|
||||
const snapshot = job.sliceToSnapshot(slice);
|
||||
if (!snapshot) {
|
||||
@@ -137,12 +137,12 @@ export const markdownToSnapshot = async (
|
||||
host: EditorHost
|
||||
) => {
|
||||
const job = new Job({
|
||||
schema: host.std.doc.workspace.schema,
|
||||
blobCRUD: host.std.doc.workspace.blobSync,
|
||||
schema: host.std.store.workspace.schema,
|
||||
blobCRUD: host.std.store.workspace.blobSync,
|
||||
docCRUD: {
|
||||
create: (id: string) => host.std.doc.workspace.createDoc({ id }),
|
||||
get: (id: string) => host.std.doc.workspace.getDoc(id),
|
||||
delete: (id: string) => host.std.doc.workspace.removeDoc(id),
|
||||
create: (id: string) => host.std.store.workspace.createDoc({ id }),
|
||||
get: (id: string) => host.std.store.workspace.getDoc(id),
|
||||
delete: (id: string) => host.std.store.workspace.removeDoc(id),
|
||||
},
|
||||
middlewares: [defaultImageProxyMiddleware, pasteMiddleware(host.std)],
|
||||
});
|
||||
@@ -150,8 +150,8 @@ export const markdownToSnapshot = async (
|
||||
const payload = {
|
||||
file: markdown,
|
||||
assets: job.assetsManager,
|
||||
workspaceId: host.std.doc.workspace.id,
|
||||
pageId: host.std.doc.id,
|
||||
workspaceId: host.std.store.workspace.id,
|
||||
pageId: host.std.store.id,
|
||||
};
|
||||
|
||||
const snapshot = await markdownAdapter.toSliceSnapshot(payload);
|
||||
|
||||
@@ -147,7 +147,7 @@ export const copyTextAnswer = async (panel: AffineAIPanelWidget) => {
|
||||
export const copyText = async (host: EditorHost, text: string) => {
|
||||
const previewDoc = await markDownToDoc(
|
||||
host.std.provider,
|
||||
host.std.doc.schema,
|
||||
host.std.store.schema,
|
||||
text
|
||||
);
|
||||
const models = previewDoc
|
||||
|
||||
@@ -124,7 +124,7 @@ export async function getTextContentFromBlockModels(
|
||||
);
|
||||
const drafts = selectedTextModels.map(toDraftModel);
|
||||
drafts.forEach(draft => traverse(draft, drafts));
|
||||
const slice = Slice.fromModels(editorHost.std.doc, drafts);
|
||||
const slice = Slice.fromModels(editorHost.std.store, drafts);
|
||||
return getContentFromSlice(editorHost, slice, type);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user