MCPcopy Create free account
hub / github.com/UNLINEARITY/Obsidian-CodeSpace / onClose

Method onClose

src/code_view.ts:1356–1373  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1354 }
1355
1356 async onClose(): Promise<void> {
1357 // 视图关闭前自动保存(如果内容已修改)
1358 if (this.isDirty && this.file) {
1359 console.debug("Code Space: Auto-saving on close...");
1360 await this.save();
1361 }
1362
1363 this.cleanupMobileViewportFix?.();
1364 this.cleanupMobileViewportFix = undefined;
1365 this.rootEl = undefined;
1366 // 销毁自定义搜索面板
1367 if (this.searchPanel) {
1368 this.searchPanel.destroy();
1369 }
1370 if (this.editorView) {
1371 this.editorView.destroy();
1372 }
1373 }
1374
1375 getViewData(): string {
1376 return this.editorView ? this.editorView.state.doc.toString() : this.data;

Callers

nothing calls this directly

Calls 2

saveMethod · 0.95
destroyMethod · 0.80

Tested by

no test coverage detected