mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-18 10:31:50 +08:00
feat(editor): replace slot with rxjs subject (#10768)
This commit is contained in:
@@ -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();
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user