Skip to content

Commit

Permalink
Исправлена ошибка повторного открытия Markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
lintest committed Sep 23, 2021
1 parent 3a0d013 commit dbb8a6f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/vanessa-tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ export class VanessaTabs {
this.disposeHidden();
}

public findTab(callback: any) {
public findTab(callback: (t: VanessaTabItem) => boolean) {
let index = -1;
this.tabStack.forEach((t, i) => { if (callback(t)) index = i; });
if (index < 0) return undefined;
Expand Down Expand Up @@ -425,7 +425,8 @@ export class VanessaTabs {
src: string,
newTab: boolean = true,
): IVanessaEditor => {
this.findTab(tab => tab.key === url && tab.type === VAEditorType.MarkdownViwer)?.close();
const key = monaco.Uri.parse(url).toString();
this.findTab(tab => tab.key === key && tab.type === VAEditorType.MarkdownViwer)?.close();
const editor = new VanessaViwer(url, src);
return this.open(editor, title, url, 0, newTab);
}
Expand All @@ -436,7 +437,8 @@ export class VanessaTabs {
newTab: boolean = true,
): IVanessaEditor => {
const url = "memory:welcome";
this.findTab(tab => tab.key === url && tab.type === VAEditorType.MarkdownViwer)?.close();
const key = monaco.Uri.parse(url).toString();
this.findTab(tab => tab.key === key && tab.type === VAEditorType.MarkdownViwer)?.close();
const editor = new VanessaViwer(url, src, false);
return this.open(editor, title, url, 0, newTab);
}
Expand Down

0 comments on commit dbb8a6f

Please sign in to comment.