comparison src/main.ts @ 29:66cada11efb8

Fix typescript warnings
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 14 Jul 2022 14:43:30 -0700
parents fbaf7c7126be
children 42ff65e35f4f
comparison
equal deleted inserted replaced
28:fbaf7c7126be 29:66cada11efb8
69 rememberedFiles: {} 69 rememberedFiles: {}
70 }; 70 };
71 71
72 // Simple warning message. 72 // Simple warning message.
73 class WarningModal extends Modal { 73 class WarningModal extends Modal {
74 title: string = "";
75 message: string = "";
76
74 constructor(app: App, title: string, message: string) { 77 constructor(app: App, title: string, message: string) {
75 super(app) 78 super(app)
76 this.title = title; 79 this.title = title;
77 this.message = message; 80 this.message = message;
78 } 81 }
131 }); 134 });
132 this._globalUninstallers.push(uninstall); 135 this._globalUninstallers.push(uninstall);
133 136
134 this.addSettingTab(new RememberFileStatePluginSettingTab(this.app, this)); 137 this.addSettingTab(new RememberFileStatePluginSettingTab(this.app, this));
135 138
136 if (this.app.vault.getConfig('legacyEditor') !== false) { 139 if ((this.app.vault as any).getConfig('legacyEditor') !== false) {
137 new WarningModal( 140 new WarningModal(
138 this.app, 141 this.app,
139 "Legacy Editor Not Supported", 142 "Legacy Editor Not Supported",
140 "The 'Remember File State' plugin works only with the new editor. Please turn off 'Legacy Editor' in the options." 143 "The 'Remember File State' plugin works only with the new editor. Please turn off 'Legacy Editor' in the options."
141 ).open(); 144 ).open();
227 var activeView: MarkdownView = this.app.workspace.getActiveViewOfType(MarkdownView); 230 var activeView: MarkdownView = this.app.workspace.getActiveViewOfType(MarkdownView);
228 if (activeView) { 231 if (activeView) {
229 this.registerOnUnloadFile(activeView); 232 this.registerOnUnloadFile(activeView);
230 233
231 var isRealFileOpen = true; 234 var isRealFileOpen = true;
232 const viewId = this.getUniqueViewId(activeView as ViewWithID); 235 const viewId = this.getUniqueViewId(activeView as unknown as ViewWithID);
233 if (viewId != undefined) { 236 if (viewId != undefined) {
234 const lastOpenFileInView = this._lastOpenFiles[viewId]; 237 const lastOpenFileInView = this._lastOpenFiles[viewId];
235 isRealFileOpen = (lastOpenFileInView != openedFile.path); 238 isRealFileOpen = (lastOpenFileInView != openedFile.path);
236 this._lastOpenFiles[viewId] = openedFile.path; 239 this._lastOpenFiles[viewId] = openedFile.path;
237 } 240 }