Skip to content

Commit 58e5bc0

Browse files
authored
Merge pull request #2 from rca-umb/settings
Conditionally display notification text option
2 parents 3a483d2 + 0e4b191 commit 58e5bc0

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.0.1] - 2024-12-30
8+
9+
### Fixed
10+
11+
- In the plugin options menu, the notification text setting will appear conditionally based on if notifications are enabled.
12+
713
## [1.0.0] - 2024-12-1
814

915
### Changed

main.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,19 @@ export default class AnchorDisplayText extends Plugin {
7979

8080
class AnchorDisplayTextSettingTab extends PluginSettingTab {
8181
plugin: AnchorDisplayText;
82+
private notificationTextSetting?: Setting;
8283

8384
constructor(app: App, plugin: AnchorDisplayText) {
8485
super(app, plugin);
8586
this.plugin = plugin;
8687
}
8788

89+
displayNotificationTextSetting() {
90+
if (this.notificationTextSetting) {
91+
this.notificationTextSetting.settingEl.style.display = this.plugin.settings.includeNotice ? 'block' : 'none';
92+
}
93+
}
94+
8895
display(): void {
8996
const {containerEl} = this;
9097
containerEl.empty();
@@ -135,10 +142,11 @@ class AnchorDisplayTextSettingTab extends PluginSettingTab {
135142
toggle.setValue(this.plugin.settings.includeNotice);
136143
toggle.onChange(value => {
137144
this.plugin.settings.includeNotice = value;
145+
this.displayNotificationTextSetting();
138146
this.plugin.saveSettings();
139147
});
140148
});
141-
new Setting(containerEl)
149+
this.notificationTextSetting = new Setting(containerEl)
142150
.setName('Notification text')
143151
.setDesc('Set the text to appear in the notification.')
144152
.addText(text => {
@@ -148,5 +156,6 @@ class AnchorDisplayTextSettingTab extends PluginSettingTab {
148156
this.plugin.saveSettings();
149157
});
150158
});
159+
this.displayNotificationTextSetting();
151160
}
152161
}

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "anchor-display-text",
33
"name": "Anchor Link Display Text",
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"minAppVersion": "0.15.0",
66
"description": "Automatically uses the linked heading as the display text for the anchor links.",
77
"author": "Robert C Arsenault",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "anchor-display-text-plugin",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Plugin for Obsidian (https://obsidian.md) that sets the display text of anchor links to the name of the heading.",
55
"main": "main.js",
66
"scripts": {

0 commit comments

Comments
 (0)