mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
refactor(editor): remove deprecated editor slot (#9908)
This commit is contained in:
@@ -4,19 +4,11 @@ import type {
|
||||
DocMode,
|
||||
GroupElementModel,
|
||||
} from '@blocksuite/affine-model';
|
||||
import type { Slot } from '@blocksuite/global/utils';
|
||||
import type { Store } from '@blocksuite/store';
|
||||
|
||||
/** Common context interface definition for block models. */
|
||||
|
||||
type EditorSlots = {
|
||||
docUpdated: Slot<{ newDocId: string }>;
|
||||
};
|
||||
|
||||
export type AbstractEditor = {
|
||||
doc: Store;
|
||||
mode: DocMode;
|
||||
readonly slots: EditorSlots;
|
||||
} & HTMLElement;
|
||||
|
||||
export type Connectable = Exclude<
|
||||
|
||||
@@ -118,9 +118,6 @@ export async function mountDefaultDocEditor(collection: Workspace) {
|
||||
const modeService = editor.std.provider.get(DocModeProvider);
|
||||
editor.mode = modeService.getPrimaryMode(doc.id);
|
||||
setDocModeFromUrlParams(modeService, url.searchParams, doc.id);
|
||||
editor.slots.docUpdated.on(({ newDocId }) => {
|
||||
editor.mode = modeService.getPrimaryMode(newDocId);
|
||||
});
|
||||
|
||||
const outlinePanel = new CustomOutlinePanel();
|
||||
outlinePanel.editor = editor;
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
PageEditorBlockSpecs,
|
||||
ThemeProvider,
|
||||
} from '@blocksuite/blocks';
|
||||
import { SignalWatcher, Slot, WithDisposable } from '@blocksuite/global/utils';
|
||||
import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
|
||||
import {
|
||||
type BlockModel,
|
||||
type ExtensionType,
|
||||
@@ -115,13 +115,6 @@ export class AffineEditorContainer
|
||||
return this._std.value.render();
|
||||
});
|
||||
|
||||
/**
|
||||
* @deprecated need to refactor
|
||||
*/
|
||||
slots: AbstractEditor['slots'] = {
|
||||
docUpdated: new Slot(),
|
||||
};
|
||||
|
||||
get doc() {
|
||||
return this._doc.value as Store;
|
||||
}
|
||||
@@ -228,19 +221,6 @@ export class AffineEditorContainer
|
||||
this._mode.value = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated need to refactor
|
||||
*/
|
||||
override updated(changedProperties: Map<string, unknown>) {
|
||||
if (changedProperties.has('doc')) {
|
||||
this.slots.docUpdated.emit({ newDocId: this.doc.id });
|
||||
}
|
||||
|
||||
if (!changedProperties.has('doc') && !changedProperties.has('mode')) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@property({ attribute: false })
|
||||
override accessor autofocus = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user