Help with WorkspaceLeaf.openFile()

First, search the help docs and this forum. Maybe your question has been answered! The debugging steps can help, too. Still stuck? Delete this line and proceed.

What I’m trying to do

I am trying to create a button that will open a note in a new window (not new tab). The script below opens a new window (as I want), and the file opens, BUT it opens in Notepad++ (the Windows default for .md files). I want the note to open in the new obsidian window.

Things I have tried

This is what I have currently. I’ve searched this forum, and everything I can find indicates it should work. Any insight into why the file is opening in Notepad++ rather than obsidian?

dataviewjs
 const tableHeadings = ["File",  ""];
 
 dv.table( tableHeadings,
     dv.pages('').map(p => {
     		const reviewNoteBtn = this.container.createEl('button', {text: "Review"});
			reviewNoteBtn.innerText = "Review"; // Correct way to set button text
			reviewNoteBtn.onclick = () => {
			    console.log(p.file); // Ensure `p.file` is a valid Obsidian file object
		        this.app.workspace.getLeaf('window').openFile(p.file);
			   
			}; 		
         return [
             p.file.link,
             reviewNoteBtn,
         ];
     })
 );
dv.table( ["File",  ""],
    dv.pages(`"Your Directory"`).map(p => {
        const reviewNoteBtn = dv.el('button', 'Review');
        reviewNoteBtn.onclick = () => {
            app.workspace.getLeaf('window').openFile(app.vault.getAbstractFileByPath(p.file.path));
        };
     return [
         p.file.link,
         reviewNoteBtn,
     ];
 })
);

20240404_211906