Improved visualization preference pane

This commit is contained in:
Andrea Alberti 2024-10-20 16:15:06 +02:00
parent b5e9663b5d
commit 84d646d7b7
2 changed files with 20 additions and 15 deletions

View file

@ -41,6 +41,7 @@ export class PluginsAnnotationsSettingTab extends PluginSettingTab {
// Clean container in the preference pane // Clean container in the preference pane
const containerEl = this.containerEl; const containerEl = this.containerEl;
containerEl.empty(); containerEl.empty();
containerEl.classList.add('plugin-comment-settings');
/* ====== Editing ====== */ /* ====== Editing ====== */
@ -66,10 +67,10 @@ export class PluginsAnnotationsSettingTab extends PluginSettingTab {
p3.innerText = "You can directly link notes inside your \ p3.innerText = "You can directly link notes inside your \
vault by adding Obsidian links such as "; vault by adding Obsidian links such as ";
const em = document.createElement('em'); const code = document.createElement('code');
em.appendText('[[My notes/Review of plugin XYZ|my plugin note]]'); code.appendText('[[My notes/Review of plugin XYZ|my plugin note]]');
em.classList.add('plugin-comment-selectable'); code.classList.add('plugin-comment-selectable');
p3.appendChild(em); p3.appendChild(code);
p3.appendText('.'); p3.appendText('.');
div.appendChild(p3); div.appendChild(p3);
@ -150,7 +151,7 @@ export class PluginsAnnotationsSettingTab extends PluginSettingTab {
.setName('Markdown File Path') .setName('Markdown File Path')
.setDesc(createFragment((frag) => { .setDesc(createFragment((frag) => {
frag.appendText('Markdown file where the plugins\' annotations are stored (e.g, '); frag.appendText('Markdown file where the plugins\' annotations are stored (e.g, ');
frag.createEl('em', {'cls': 'plugin-comment-selectable'}).appendText('00 Meta/Misc/Plugins annotations.md'); frag.createEl('code', {'cls': 'plugin-comment-selectable'}).appendText('00 Meta/Misc/Plugins annotations.md');
frag.appendText(').'); frag.appendText(').');
md_filepath_error_div = frag.createDiv({text: 'Error: the filename must end with .md extension.', cls: "mod-warning" }); md_filepath_error_div = frag.createDiv({text: 'Error: the filename must end with .md extension.', cls: "mod-warning" });
md_filepath_error_div.style.display = 'none'; md_filepath_error_div.style.display = 'none';
@ -312,10 +313,10 @@ export class PluginsAnnotationsSettingTab extends PluginSettingTab {
frag.appendText(`Choose the annotation label for the ${label_version} version of Obsidian. \ frag.appendText(`Choose the annotation label for the ${label_version} version of Obsidian. \
Use HTML code if you want to format it. Enter an empty string if you want \ Use HTML code if you want to format it. Enter an empty string if you want \
to hide the label. Use `); to hide the label. Use `);
frag.createEl('em',{cls: 'plugin-comment-selectable'}).appendText('${plugin_name}'); frag.createEl('code',{cls: 'plugin-comment-selectable'}).appendText('${plugin_name}');
frag.appendText(' as a template for the plugin name; for example, you can generate automatic links to your notes with a label of the kind "'); frag.appendText(' as a template for the plugin name; for example, you can generate automatic links to your notes with a label of the kind ');
frag.createEl('em', {'cls': 'plugin-comment-selectable'}).appendText('[[00 Meta/Installed plugins/${plugin_name} | ${plugin_name}]]'); frag.createEl('code', {'cls': 'plugin-comment-selectable'}).appendText('[[00 Meta/Installed plugins/${plugin_name}|${plugin_name}]]');
frag.appendText('".'); frag.appendText('.');
})); }));
let label_text: TextComponent; let label_text: TextComponent;
@ -349,11 +350,11 @@ export class PluginsAnnotationsSettingTab extends PluginSettingTab {
.setName('Placeholder label') .setName('Placeholder label')
.setDesc(createFragment((frag) => { .setDesc(createFragment((frag) => {
frag.appendText('Choose the label appearing where no user annotation is provied yet. Use '); frag.appendText('Choose the label appearing where no user annotation is provied yet. Use ');
frag.createEl('em',{cls: 'plugin-comment-selectable'}).appendText('${plugin_name}'); frag.createEl('code',{cls: 'plugin-comment-selectable'}).appendText('${plugin_name}');
frag.appendText(' as a template for the plugin name; for example, you can generate automatic \ frag.appendText(' as a template for the plugin name; for example, you can generate automatic \
links to your notes with a placeholder of the kind "'); links to your notes with a placeholder of the kind ');
frag.createEl('em', {'cls': 'plugin-comment-selectable'}).appendText('[[00 Meta/Installed plugins/${plugin_name} | ${plugin_name}]]'); frag.createEl('code', {'cls': 'plugin-comment-selectable'}).appendText('[[00 Meta/Installed plugins/${plugin_name}|${plugin_name}]]');
frag.appendText('".') frag.appendText('.')
})); }));
let placeholder_text: TextComponent; let placeholder_text: TextComponent;

View file

@ -47,9 +47,13 @@
} }
/* Setting pane */ /* Setting pane */
.plugin-comment-settings code {
padding: 0;
}
.plugin-comment-instructions { .plugin-comment-instructions {
margin: none; margin: 0;
padding: none; padding: 0;
} }
div.plugin-comment-instructions em { div.plugin-comment-instructions em {