pass in font family to web reader
This commit is contained in:
@ -152,7 +152,8 @@ import WebKit
|
||||
isDark: UITraitCollection.current.userInterfaceStyle == .dark,
|
||||
fontSize: fontSize(),
|
||||
lineHeight: lineHeight(),
|
||||
margin: margin()
|
||||
margin: margin(),
|
||||
fontFamily: .merriweather
|
||||
)
|
||||
.styledContent,
|
||||
baseURL: ViewsPackage.bundleURL
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import Foundation
|
||||
import Models
|
||||
import Utils
|
||||
import Views
|
||||
|
||||
struct WebReaderContent {
|
||||
let textFontSize: Int
|
||||
@ -10,6 +11,7 @@ struct WebReaderContent {
|
||||
let highlightsJSONString: String
|
||||
let item: LinkedItem
|
||||
let themeKey: String
|
||||
let fontFamily: WebFont
|
||||
|
||||
init(
|
||||
htmlContent: String,
|
||||
@ -18,7 +20,8 @@ struct WebReaderContent {
|
||||
isDark: Bool,
|
||||
fontSize: Int,
|
||||
lineHeight: Int,
|
||||
margin: Int
|
||||
margin: Int,
|
||||
fontFamily: WebFont
|
||||
) {
|
||||
self.textFontSize = fontSize
|
||||
self.lineHeight = lineHeight
|
||||
@ -27,6 +30,7 @@ struct WebReaderContent {
|
||||
self.highlightsJSONString = highlightsJSONString
|
||||
self.item = item
|
||||
self.themeKey = isDark ? "Gray" : "LightGray"
|
||||
self.fontFamily = fontFamily
|
||||
}
|
||||
|
||||
// swiftlint:disable line_length
|
||||
@ -77,6 +81,7 @@ struct WebReaderContent {
|
||||
}
|
||||
|
||||
window.fontSize = \(textFontSize)
|
||||
window.fontFamily = "\(fontFamily.rawValue)"
|
||||
window.margin = \(margin)
|
||||
window.lineHeight = \(lineHeight)
|
||||
window.localStorage.setItem("theme", "\(themeKey)")
|
||||
|
||||
@ -1,6 +1,14 @@
|
||||
import SwiftUI
|
||||
import Utils
|
||||
|
||||
public enum WebFont: String {
|
||||
case inter = "Inter"
|
||||
case merriweather = "Merriweather"
|
||||
case lyon = "Lyon"
|
||||
case sfmono = "SFMono"
|
||||
case tisa = "Tisa"
|
||||
}
|
||||
|
||||
public struct WebPreferencesPopoverView: View {
|
||||
let increaseFontAction: () -> Void
|
||||
let decreaseFontAction: () -> Void
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -41,6 +41,7 @@ const App = () => {
|
||||
highlightBarDisabled={true}
|
||||
highlightsBaseURL="https://example.com"
|
||||
fontSize={window.fontSize ?? 18}
|
||||
fontFamily={window.fontFamily ?? 'merriweather'}
|
||||
margin={window.margin}
|
||||
lineHeight={window.lineHeight}
|
||||
articleMutations={{
|
||||
|
||||
Reference in New Issue
Block a user