fix(mac): allow typing in web chat panel
This commit is contained in:
@@ -12,6 +12,12 @@ private enum WebChatLayout {
|
|||||||
static let anchorPadding: CGFloat = 8
|
static let anchorPadding: CGFloat = 8
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A borderless panel that can still accept key focus (needed for typing into the embedded WebChat).
|
||||||
|
final class WebChatPanel: NSPanel {
|
||||||
|
override var canBecomeKey: Bool { true }
|
||||||
|
override var canBecomeMain: Bool { true }
|
||||||
|
}
|
||||||
|
|
||||||
enum WebChatPresentation {
|
enum WebChatPresentation {
|
||||||
case window
|
case window
|
||||||
case panel(anchorProvider: () -> NSRect?)
|
case panel(anchorProvider: () -> NSRect?)
|
||||||
@@ -92,9 +98,9 @@ final class WebChatWindowController: NSWindowController, WKNavigationDelegate, N
|
|||||||
window.minSize = NSSize(width: 880, height: 680)
|
window.minSize = NSSize(width: 880, height: 680)
|
||||||
return window
|
return window
|
||||||
case .panel:
|
case .panel:
|
||||||
let panel = NSPanel(
|
let panel = WebChatPanel(
|
||||||
contentRect: NSRect(origin: .zero, size: WebChatLayout.panelSize),
|
contentRect: NSRect(origin: .zero, size: WebChatLayout.panelSize),
|
||||||
styleMask: [.nonactivatingPanel, .borderless],
|
styleMask: [.borderless],
|
||||||
backing: .buffered,
|
backing: .buffered,
|
||||||
defer: false)
|
defer: false)
|
||||||
panel.level = .statusBar
|
panel.level = .statusBar
|
||||||
|
|||||||
Reference in New Issue
Block a user