mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
5046c8d862
commit
f3a1ce12f8
3 changed files with 10 additions and 0 deletions
|
|
@ -692,6 +692,11 @@ export class Wnd {
|
||||||
clearCounter();
|
clearCounter();
|
||||||
this.children.find((item, index) => {
|
this.children.find((item, index) => {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
|
if (item.model instanceof Custom) {
|
||||||
|
if (item.model.beforeDestroy) {
|
||||||
|
item.model.beforeDestroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (item.model instanceof Editor && hasSaveScroll) {
|
if (item.model instanceof Editor && hasSaveScroll) {
|
||||||
saveScroll(item.model.editor.protyle);
|
saveScroll(item.model.editor.protyle);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ export class Custom extends Model {
|
||||||
public type: string;
|
public type: string;
|
||||||
public init: () => void;
|
public init: () => void;
|
||||||
public destroy: () => void;
|
public destroy: () => void;
|
||||||
|
public beforeDestroy: () => void;
|
||||||
public resize: () => void;
|
public resize: () => void;
|
||||||
public update: () => void;
|
public update: () => void;
|
||||||
|
|
||||||
|
|
@ -18,6 +19,7 @@ export class Custom extends Model {
|
||||||
tab: Tab,
|
tab: Tab,
|
||||||
data: any,
|
data: any,
|
||||||
destroy?: () => void,
|
destroy?: () => void,
|
||||||
|
beforeDestroy?: () => void,
|
||||||
resize?: () => void,
|
resize?: () => void,
|
||||||
update?: () => void,
|
update?: () => void,
|
||||||
init: () => void
|
init: () => void
|
||||||
|
|
@ -33,6 +35,7 @@ export class Custom extends Model {
|
||||||
this.type = options.type;
|
this.type = options.type;
|
||||||
this.init = options.init;
|
this.init = options.init;
|
||||||
this.destroy = options.destroy;
|
this.destroy = options.destroy;
|
||||||
|
this.beforeDestroy = options.beforeDestroy;
|
||||||
this.resize = options.resize;
|
this.resize = options.resize;
|
||||||
this.update = options.update;
|
this.update = options.update;
|
||||||
this.init();
|
this.init();
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,7 @@ export class Plugin {
|
||||||
public addTab(options: {
|
public addTab(options: {
|
||||||
type: string,
|
type: string,
|
||||||
destroy?: () => void,
|
destroy?: () => void,
|
||||||
|
beforeDestroy?: () => void,
|
||||||
resize?: () => void,
|
resize?: () => void,
|
||||||
update?: () => void,
|
update?: () => void,
|
||||||
init: () => void
|
init: () => void
|
||||||
|
|
@ -187,6 +188,7 @@ export class Plugin {
|
||||||
type: type2,
|
type: type2,
|
||||||
data: arg.data,
|
data: arg.data,
|
||||||
init: options.init,
|
init: options.init,
|
||||||
|
beforeDestroy: options.beforeDestroy,
|
||||||
destroy: options.destroy,
|
destroy: options.destroy,
|
||||||
resize: options.resize,
|
resize: options.resize,
|
||||||
update: options.update,
|
update: options.update,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue