Display labels on the appreader page
This commit is contained in:
@ -66,6 +66,7 @@ struct WebReaderContent {
|
||||
contentReader: "WEB",
|
||||
readingProgressPercent: \(item.readingProgress),
|
||||
readingProgressAnchorIndex: \(item.readingProgressAnchor),
|
||||
labels: \(item.labelsJSONString),
|
||||
highlights: \(highlightsJSONString),
|
||||
}
|
||||
|
||||
|
||||
@ -58,6 +58,19 @@ public extension LinkedItem {
|
||||
return URL(string: pageURLString ?? "")
|
||||
}
|
||||
|
||||
var labelsJSONString: String {
|
||||
let labels = self.labels.asArray(of: LinkedItemLabel.self).map { label in
|
||||
[
|
||||
"id": NSString(string: label.id ?? ""),
|
||||
"color": NSString(string: label.color ?? ""),
|
||||
"name": NSString(string: label.name ?? ""),
|
||||
"description": NSString(string: label.labelDescription ?? "")
|
||||
]
|
||||
}
|
||||
guard let JSON = (try? JSONSerialization.data(withJSONObject: labels, options: .prettyPrinted)) else { return "[]" }
|
||||
return String(data: JSON, encoding: .utf8) ?? "[]"
|
||||
}
|
||||
|
||||
static func lookup(byID itemID: String, inContext context: NSManagedObjectContext) -> LinkedItem? {
|
||||
let fetchRequest: NSFetchRequest<Models.LinkedItem> = LinkedItem.fetchRequest()
|
||||
fetchRequest.predicate = NSPredicate(
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -34,6 +34,7 @@ const App = () => {
|
||||
>
|
||||
<ArticleContainer
|
||||
article={window.omnivoreArticle}
|
||||
labels={window.omnivoreArticle.labels}
|
||||
scrollElementRef={React.createRef()}
|
||||
isAppleAppEmbed={true}
|
||||
highlightBarDisabled={true}
|
||||
|
||||
Reference in New Issue
Block a user