generated from obsidianmd/obsidian-sample-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from mProjectsCode/main
- Loading branch information
Showing
11 changed files
with
1,285 additions
and
1,154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/settingsView/SettingComponents/InfoTextSettingComponent.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { AbstractSettingComponent } from './AbstractSettingComponent'; | ||
import { MarkdownRenderer, Setting } from 'obsidian'; | ||
import { InfoText } from '../../SettingHandlers'; | ||
import { getDescription, getTitle } from '../../Utils'; | ||
|
||
export class InfoTextSettingComponent extends AbstractSettingComponent { | ||
settingEl: Setting; | ||
|
||
setting: InfoText; | ||
|
||
render(containerEl: HTMLElement): void { | ||
const title = getTitle(this.setting); | ||
const description = getDescription(this.setting); | ||
|
||
this.settingEl = new Setting(containerEl); | ||
this.settingEl.setClass('style-settings-info-text'); | ||
if (title) { | ||
this.settingEl.setName(title); | ||
} | ||
if (description) { | ||
if (this.setting.markdown) { | ||
MarkdownRenderer.renderMarkdown( | ||
description, | ||
this.settingEl.descEl, | ||
'', | ||
undefined | ||
); | ||
this.settingEl.descEl.addClass('style-settings-markdown'); | ||
} else { | ||
this.settingEl.setDesc(description); | ||
} | ||
} | ||
|
||
this.settingEl.settingEl.dataset.id = this.setting.id; | ||
} | ||
|
||
destroy(): void { | ||
this.settingEl?.settingEl.remove(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.