mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-01 01:29:31 +08:00
refactor(editor): rename store api (#9518)
This commit is contained in:
+2
-2
@@ -501,7 +501,7 @@ export class EdgelessChangeEmbedCardButton extends WithDisposable(LitElement) {
|
||||
get _originalDocInfo(): AliasInfo | undefined {
|
||||
const model = this.model;
|
||||
const doc = isInternalEmbedModel(model)
|
||||
? this.std.collection.getDoc(model.pageId)
|
||||
? this.std.workspace.getDoc(model.pageId)
|
||||
: null;
|
||||
|
||||
if (doc) {
|
||||
@@ -518,7 +518,7 @@ export class EdgelessChangeEmbedCardButton extends WithDisposable(LitElement) {
|
||||
get _originalDocTitle() {
|
||||
const model = this.model;
|
||||
const doc = isInternalEmbedModel(model)
|
||||
? this.std.collection.getDoc(model.pageId)
|
||||
? this.std.workspace.getDoc(model.pageId)
|
||||
: null;
|
||||
|
||||
return doc?.meta?.title || 'Untitled';
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ export function createLinkedDocFromNote(
|
||||
note: NoteBlockModel,
|
||||
docTitle?: string
|
||||
) {
|
||||
const linkedDoc = doc.collection.createDoc({});
|
||||
const linkedDoc = doc.workspace.createDoc({});
|
||||
linkedDoc.load(() => {
|
||||
const rootId = linkedDoc.addBlock('affine:page', {
|
||||
title: new Text(docTitle),
|
||||
@@ -71,7 +71,7 @@ export function createLinkedDocFromEdgelessElements(
|
||||
elements: BlockSuite.EdgelessModel[],
|
||||
docTitle?: string
|
||||
) {
|
||||
const linkedDoc = host.doc.collection.createDoc({});
|
||||
const linkedDoc = host.doc.workspace.createDoc({});
|
||||
linkedDoc.load(() => {
|
||||
const rootId = linkedDoc.addBlock('affine:page', {
|
||||
title: new Text(docTitle),
|
||||
|
||||
@@ -263,7 +263,7 @@ export class EmbedCardToolbar extends WidgetComponent<
|
||||
if (!model) return undefined;
|
||||
|
||||
const doc = isInternalEmbedModel(model)
|
||||
? this.std.collection.getDoc(model.pageId)
|
||||
? this.std.workspace.getDoc(model.pageId)
|
||||
: null;
|
||||
|
||||
if (doc) {
|
||||
@@ -282,7 +282,7 @@ export class EmbedCardToolbar extends WidgetComponent<
|
||||
if (!model) return undefined;
|
||||
|
||||
const doc = isInternalEmbedModel(model)
|
||||
? this.std.collection.getDoc(model.pageId)
|
||||
? this.std.workspace.getDoc(model.pageId)
|
||||
: null;
|
||||
|
||||
return doc?.meta?.title || 'Untitled';
|
||||
|
||||
@@ -275,7 +275,7 @@ const pageToolGroup: KeyboardToolPanelGroup = {
|
||||
.chain()
|
||||
.getSelectedModels()
|
||||
.inline(({ selectedModels }) => {
|
||||
const newDoc = createDefaultDoc(std.doc.collection);
|
||||
const newDoc = createDefaultDoc(std.doc.workspace);
|
||||
if (!selectedModels?.length) return;
|
||||
insertContent(std.host, selectedModels[0], REFERENCE_NODE, {
|
||||
reference: {
|
||||
|
||||
@@ -105,7 +105,7 @@ export function createLinkedDocMenuGroup(
|
||||
inlineEditor: AffineInlineEditor
|
||||
) {
|
||||
const doc = editorHost.doc;
|
||||
const { docMetas } = doc.collection.meta;
|
||||
const { docMetas } = doc.workspace.meta;
|
||||
const filteredDocList = docMetas
|
||||
.filter(({ id }) => id !== doc.id)
|
||||
.filter(({ title }) => isFuzzyMatch(title, query));
|
||||
@@ -164,7 +164,7 @@ export function createNewDocMenuGroup(
|
||||
action: () => {
|
||||
abort();
|
||||
const docName = query;
|
||||
const newDoc = createDefaultDoc(doc.collection, {
|
||||
const newDoc = createDefaultDoc(doc.workspace, {
|
||||
title: docName,
|
||||
});
|
||||
insertLinkedNode({
|
||||
@@ -213,7 +213,7 @@ export function createNewDocMenuGroup(
|
||||
toast(editorHost, message);
|
||||
};
|
||||
showImportModal({
|
||||
collection: doc.collection,
|
||||
collection: doc.workspace,
|
||||
onSuccess,
|
||||
onFail,
|
||||
});
|
||||
|
||||
@@ -194,7 +194,7 @@ export const defaultSlashMenuConfig: SlashMenuConfig = {
|
||||
showWhen: ({ model }) =>
|
||||
model.doc.schema.flavourSchemaMap.has('affine:embed-linked-doc'),
|
||||
action: ({ rootComponent, model }) => {
|
||||
const newDoc = createDefaultDoc(rootComponent.doc.collection);
|
||||
const newDoc = createDefaultDoc(rootComponent.doc.workspace);
|
||||
insertContent(rootComponent.host, model, REFERENCE_NODE, {
|
||||
reference: {
|
||||
type: 'LinkedPage',
|
||||
|
||||
Reference in New Issue
Block a user