// // PrismeWebView.swift // Prisme // // Author: Simon-Pierre Boucher // import UIKit import WebKit /// The engine's web view: adds "Sauver l'extrait" to the system text /// selection menu. Selecting a passage and keeping *it* — not the page — /// is the primary save gesture (CLAUDE.md §5, "L'extrait", P0). final class PrismeWebView: WKWebView { /// Set by the coordinator while a tab is attached. var onSaveExcerpt: (() -> Void)? override func buildMenu(with builder: UIMenuBuilder) { super.buildMenu(with: builder) guard onSaveExcerpt != nil else { return } let save = UIAction( title: "Sauver l'extrait", image: UIImage(systemName: "quote.opening") ) { [weak self] _ in self?.onSaveExcerpt?() } builder.insertSibling( UIMenu(options: .displayInline, children: [save]), afterMenu: .standardEdit ) } }