2023-04-27 20:03:00 +08:00
|
|
|
import {Tab} from "../Tab";
|
|
|
|
|
import {Model} from "../Model";
|
2023-05-18 19:27:21 +08:00
|
|
|
import {App} from "../../index";
|
2023-04-27 20:03:00 +08:00
|
|
|
|
|
|
|
|
export class Custom extends Model {
|
2023-05-12 17:11:43 +08:00
|
|
|
public element: Element;
|
2023-04-28 12:02:08 +08:00
|
|
|
public data: any;
|
2023-05-10 00:01:47 +08:00
|
|
|
public type: string;
|
2023-04-28 12:02:08 +08:00
|
|
|
public init: () => void;
|
|
|
|
|
public destroy: () => void;
|
|
|
|
|
public resize: () => void;
|
|
|
|
|
public update: () => void;
|
2023-04-27 20:03:00 +08:00
|
|
|
|
|
|
|
|
constructor(options: {
|
2023-05-18 19:27:21 +08:00
|
|
|
app: App,
|
2023-05-10 00:01:47 +08:00
|
|
|
type: string,
|
2023-04-27 20:03:00 +08:00
|
|
|
tab: Tab,
|
|
|
|
|
data: any,
|
2023-04-28 10:30:27 +08:00
|
|
|
destroy?: () => void,
|
|
|
|
|
resize?: () => void,
|
2023-04-28 12:02:08 +08:00
|
|
|
update?: () => void,
|
|
|
|
|
init: () => void
|
2023-04-27 20:03:00 +08:00
|
|
|
}) {
|
2023-05-18 19:27:21 +08:00
|
|
|
super({app: options.app, id: options.tab.id});
|
2023-05-10 00:01:47 +08:00
|
|
|
this.type = options.type;
|
2023-04-27 20:03:00 +08:00
|
|
|
if (window.siyuan.config.fileTree.openFilesUseCurrentTab) {
|
|
|
|
|
options.tab.headElement.classList.add("item--unupdate");
|
|
|
|
|
}
|
|
|
|
|
this.element = options.tab.panelElement;
|
2023-04-28 12:02:08 +08:00
|
|
|
this.data = options.data;
|
|
|
|
|
this.init = options.init;
|
2023-04-28 10:30:27 +08:00
|
|
|
this.destroy = options.destroy;
|
|
|
|
|
this.resize = options.resize;
|
2023-04-28 12:02:08 +08:00
|
|
|
this.update = options.update;
|
|
|
|
|
this.init();
|
2023-04-27 20:03:00 +08:00
|
|
|
}
|
|
|
|
|
}
|