Skip to content

Commit

Permalink
add setting to default to tweet threads
Browse files Browse the repository at this point in the history
  • Loading branch information
kbravh committed Sep 11, 2022
1 parent 0397630 commit b388257
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-tweet-to-markdown",
"name": "Tweet to Markdown",
"version": "2.10.5",
"version": "2.11.0",
"minAppVersion": "0.12.17",
"description": "Save tweets as Markdown files, along with their images, polls, etc.",
"author": "kbravh",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-tweet-to-markdown",
"version": "2.10.5",
"version": "2.11.0",
"description": "Save tweets as beautiful markdown files in Obsidian (https://obsidian.md)",
"main": "main.js",
"engines": {
Expand Down
9 changes: 6 additions & 3 deletions src/TweetUrlModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class TweetUrlModal extends Modal {
constructor(app: App, plugin: TTM) {
super(app)
this.plugin = plugin
this.thread = this.plugin.settings.defaultToThread
}

onOpen(): void {
Expand All @@ -35,9 +36,11 @@ export class TweetUrlModal extends Modal {
'Download a tweet thread. (Put the link to the LAST tweet in the thread).'
)
.addToggle(toggle => {
toggle.setValue(false).onChange(value => {
this.thread = value
})
toggle
.setValue(this.plugin.settings.defaultToThread)
.onChange(value => {
this.thread = value
})
})

new Setting(contentEl)
Expand Down
16 changes: 16 additions & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface TTMSettings {
freeformFrontmatter: string[]
avatars: boolean
avatarSize: string
defaultToThread: boolean
condensedThread: boolean
/** @deprecated - split into includeImages and includeLinks */
textOnly: boolean
Expand Down Expand Up @@ -46,6 +47,7 @@ export const DEFAULT_SETTINGS: TTMSettings = {
freeformFrontmatter: [],
avatars: true,
avatarSize: '',
defaultToThread: false,
condensedThread: false,
textOnly: false,
includeImages: true,
Expand Down Expand Up @@ -209,6 +211,20 @@ export class TTMSettingTab extends PluginSettingTab {
})
)

new Setting(containerEl)
.setName('Default to thread download')
.setDesc(
'Defaults to downloading a tweet thread instead of a single tweet. This option can still be toggled on the tweet download window This does not apply to pasted tweets.'
)
.addToggle(toggle =>
toggle
.setValue(this.plugin.settings.defaultToThread)
.onChange(async value => {
this.plugin.settings.defaultToThread = value
await this.plugin.saveSettings()
})
)

new Setting(containerEl)
.setName('Condensed threads')
.setDesc(
Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"2.10.5": "0.12.17"
"2.11.0": "0.12.17"
}

0 comments on commit b388257

Please sign in to comment.