Skip to content

Commit

Permalink
Conditionally display notification text option
Browse files Browse the repository at this point in the history
  • Loading branch information
rca-umb committed Dec 30, 2024
1 parent 3a483d2 commit 0e4b191
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

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).

## [1.0.1] - 2024-12-30

### Fixed

- In the plugin options menu, the notification text setting will appear conditionally based on if notifications are enabled.

## [1.0.0] - 2024-12-1

### Changed
Expand Down
11 changes: 10 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,19 @@ export default class AnchorDisplayText extends Plugin {

class AnchorDisplayTextSettingTab extends PluginSettingTab {
plugin: AnchorDisplayText;
private notificationTextSetting?: Setting;

constructor(app: App, plugin: AnchorDisplayText) {
super(app, plugin);
this.plugin = plugin;
}

displayNotificationTextSetting() {
if (this.notificationTextSetting) {
this.notificationTextSetting.settingEl.style.display = this.plugin.settings.includeNotice ? 'block' : 'none';
}
}

display(): void {
const {containerEl} = this;
containerEl.empty();
Expand Down Expand Up @@ -135,10 +142,11 @@ class AnchorDisplayTextSettingTab extends PluginSettingTab {
toggle.setValue(this.plugin.settings.includeNotice);
toggle.onChange(value => {
this.plugin.settings.includeNotice = value;
this.displayNotificationTextSetting();
this.plugin.saveSettings();
});
});
new Setting(containerEl)
this.notificationTextSetting = new Setting(containerEl)
.setName('Notification text')
.setDesc('Set the text to appear in the notification.')
.addText(text => {
Expand All @@ -148,5 +156,6 @@ class AnchorDisplayTextSettingTab extends PluginSettingTab {
this.plugin.saveSettings();
});
});
this.displayNotificationTextSetting();
}
}
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "anchor-display-text",
"name": "Anchor Link Display Text",
"version": "1.0.0",
"version": "1.0.1",
"minAppVersion": "0.15.0",
"description": "Automatically uses the linked heading as the display text for the anchor links.",
"author": "Robert C Arsenault",
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": "anchor-display-text-plugin",
"version": "1.0.0",
"version": "1.0.1",
"description": "Plugin for Obsidian (https://obsidian.md) that sets the display text of anchor links to the name of the heading.",
"main": "main.js",
"scripts": {
Expand Down

0 comments on commit 0e4b191

Please sign in to comment.