feat(editor): replace slot with rxjs subject (#10768)

This commit is contained in:
Mirone
2025-03-12 11:29:24 +09:00
committed by GitHub
parent 19f978d9aa
commit cd63e0ed8b
302 changed files with 1405 additions and 1251 deletions
@@ -1,5 +1,5 @@
import type { PropertyMetaConfig } from '@blocksuite/data-view';
import type { Disposable } from '@blocksuite/global/slot';
import type { DisposableMember } from '@blocksuite/global/disposable';
import type { Block, BlockModel } from '@blocksuite/store';
type PropertyMeta<
@@ -14,7 +14,7 @@ type PropertyMeta<
setColumnData?: (block: T, data: ColumnData) => void;
get: (block: T) => Value;
set?: (block: T, value: Value) => void;
updated: (block: T, callback: () => void) => Disposable;
updated: (block: T, callback: () => void) => DisposableMember;
};
export type BlockMeta<T extends BlockModel = BlockModel> = {
selector: (block: Block) => boolean;
@@ -39,7 +39,7 @@ todoMeta.addProperty({
block.checked = value ?? false;
},
updated: (block, callback) => {
return block.propsUpdated.on(({ key }) => {
return block.propsUpdated.subscribe(({ key }) => {
if (key === 'checked') {
callback();
}
@@ -53,7 +53,7 @@ todoMeta.addProperty({
metaConfig: propertyPresets.textPropertyConfig,
get: block => block.doc.meta?.title ?? '',
updated: (block, callback) => {
return block.doc.workspace.slots.docListUpdated.on(() => {
return block.doc.workspace.slots.docListUpdated.subscribe(() => {
callback();
});
},