Skip to content

Commit

Permalink
Refactored showing note window to clarify and remove a warning
Browse files Browse the repository at this point in the history
  • Loading branch information
charliescheer committed Apr 12, 2024
1 parent f87f00f commit 17c311d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Simplenote/NoteListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -875,11 +875,14 @@ extension NoteListViewController {
guard let note = listController.note(at: tableView.selectedRow) else {
return
}

let window = NoteWindow()
let windowController = NSWindowController(window: window)

window.show(note)
windowController.showWindow(window)

// We don't want to be able to display the note in more than one editor at a time
// So when double tapped we open into a new window and close the editor in the main window
tableView.deselectRow(tableView.selectedRow)
refreshPresentedNote()
}
Expand Down
2 changes: 0 additions & 2 deletions Simplenote/NoteWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,5 @@ class NoteWindow: NSWindow {
editor.toolbarView.sidebarButton.isHidden = true
editor.displayNote(note)
title = note.titlePreview

windowController?.showWindow(self)
}
}

0 comments on commit 17c311d

Please sign in to comment.