Update scripting support for selected articles to make get title of selected articles work.

This commit is contained in:
Brent Simmons committed 2025-10-05 11:20:42 -07:00
1 parent c04daf289f
commit 2d8b47075a
2 files changed
+22

No files matched your search

@@ -51,6 +51,25 @@ extension NSApplication : ScriptingObjectContainer {
}
return scriptableArticles as NSArray
}
@objc(countOfSelectedArticles)
func countOfSelectedArticles() -> Int {
return appDelegate.scriptingSelectedArticles.count
}
@objc(objectInSelectedArticlesAtIndex:)
func objectInSelectedArticlesAtIndex(_ index: Int) -> ScriptableArticle? {
let articles = appDelegate.scriptingSelectedArticles
guard index >= 0 && index < articles.count else { return nil }
let article = articles[index]
if let feed = article.webFeed,
let scriptableFeed = ScriptableWebFeed.scriptableWebFeed(for: feed) {
return ScriptableArticle(article, container: scriptableFeed)
} else {
return nil
}
}
// MARK: --- scriptable elements ---