Skip to content

Commit

Permalink
Include user settings when rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
livid committed Apr 25, 2024
1 parent 2c1074e commit 5006e93
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Planet/Labs/Quick Post/QuickPostView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct QuickPostView: View {

TextEditor(text: $content)
.font(.system(size: 14, weight: .regular, design: .default))
.lineSpacing(8)
.lineSpacing(7)
.disableAutocorrection(true)
.padding(.top, 10)
.padding(.bottom, 10)
Expand Down Expand Up @@ -60,7 +60,8 @@ struct QuickPostView: View {
dismiss()
} label: {
Text("Post")
}.keyboardShortcut(.defaultAction)
}
.keyboardShortcut(.defaultAction)
.keyboardShortcut("d", modifiers: [.command, .shift])
.buttonStyle(.borderedProminent)
.buttonBorderShape(.roundedRectangle)
Expand Down
10 changes: 10 additions & 0 deletions Planet/TemplateBrowser/Template.swift
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ class Template: Codable, Identifiable {
"has_podcast": hasPodcast,
"planet_ipns": article.planet.ipns,
"assets_prefix": "../",
"template_settings": self.settings,
"user_settings": planet.templateSettings(),
"article_id": article.id.uuidString,
"article": article.publicArticle,
"article_type": article.articleType?.rawValue ?? 0,
Expand Down Expand Up @@ -279,6 +281,8 @@ class Template: Codable, Identifiable {
let pageAboutHTML = CMarkRenderer.renderMarkdownHTML(markdown: planet.about) ?? planet.about
var contextForRendering: [String: Any] = [
"assets_prefix": "./",
"template_settings": self.settings,
"user_settings": myPlanet.templateSettings(),
"page_title": planet.name,
"page_description": planet.about,
"page_description_html": pageAboutHTML,
Expand Down Expand Up @@ -312,6 +316,8 @@ class Template: Codable, Identifiable {
let pageAboutHTML = CMarkRenderer.renderMarkdownHTML(markdown: planet.about) ?? planet.about
var contextForRendering: [String: Any] = [
"assets_prefix": "./",
"template_settings": self.settings,
"user_settings": myPlanet.templateSettings(),
"page_title": "\(planet.name) - Tags",
"page_description": planet.about,
"page_description_html": pageAboutHTML,
Expand Down Expand Up @@ -340,6 +346,8 @@ class Template: Codable, Identifiable {
let pageAboutHTML = CMarkRenderer.renderMarkdownHTML(markdown: planet.about) ?? planet.about
var contextForRendering: [String: Any] = [
"assets_prefix": "./",
"template_settings": self.settings,
"user_settings": myPlanet.templateSettings(),
"page_title": "\(planet.name) - Archive",
"page_description": planet.about,
"page_description_html": pageAboutHTML,
Expand Down Expand Up @@ -504,6 +512,8 @@ class Template: Codable, Identifiable {
// render stencil template
let context: [String: Any] = [
"assets_prefix": "../",
"template_settings": self.settings,
"user_settings": [:],
"article": article,
"articles": [article],
"content_html": content_html,
Expand Down

0 comments on commit 5006e93

Please sign in to comment.