Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
frostime committed Dec 3, 2024
1 parent 2405507 commit b5fb863
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion public/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,10 @@ interface IState<T> {
*/
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
Expand Down
4 changes: 4 additions & 0 deletions src/core/data-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit b5fb863

Please sign in to comment.