diff --git a/public/types.d.ts b/public/types.d.ts index 1de6b0a..40b03da 100644 --- a/public/types.d.ts +++ b/public/types.d.ts @@ -308,7 +308,10 @@ interface IState { */ export declare class DataView implements IDataView { constructor(protyle: IProtyle, embedNode: HTMLElement, top: number | null); - dispose(): void; + /** + * Repaint the embed block, essentially merely click the refresh button + */ + repaint(): void; /** * Persist state across renders; it will store the state in the block attributes when disposing, and restore it when creating. * @param key - The key of the state diff --git a/src/core/data-view.ts b/src/core/data-view.ts index 2634f5b..a995120 100644 --- a/src/core/data-view.ts +++ b/src/core/data-view.ts @@ -246,6 +246,7 @@ export class DataView extends UseStateMixin implements IDataView { this.disposers.push(() => this.storeState()); // 在 DataView 销毁时,将 state 同步到块属性中 } + /** @internal */ dispose() { if (this.disposed) return; this.disposed = true; @@ -260,6 +261,9 @@ export class DataView extends UseStateMixin implements IDataView { } } + /** + * Repaint the embed block, essentially merely click the refresh button + */ repaint() { const button = this.thisEmbedNode.querySelector('div.protyle-icons > span.protyle-action__reload'); if (button) {