fix for requested changes - uses textContent instead of innterHTML to display date preview in settings panel, also prefixed element id with media-db

This commit is contained in:
spozer 2023-08-28 17:38:24 +02:00
parent 52309dda59
commit 78c7dd8b7d

View file

@ -172,7 +172,7 @@ export class MediaDbSettingTab extends PluginSettingTab {
.setName('Date format')
.setDesc(fragWithHTML("Your custom date format. Use <em>\'YYYY-MM-DD\'</em> for example.<br>" +
"For more syntax, refer to <a href='https://momentjs.com/docs/#/displaying/format/'>format reference</a>.<br>" +
"Your current syntax looks like this: <b><a id='dateformat-preview' style='pointer-events: none; cursor: default; text-decoration: none;'>" +
"Your current syntax looks like this: <b><a id='media-db-dateformat-preview' style='pointer-events: none; cursor: default; text-decoration: none;'>" +
this.plugin.dateFormatter.getPreview() + "</a></b>"))
.addText(cb => {
cb.setPlaceholder(DEFAULT_SETTINGS.customDateFormat)
@ -180,7 +180,7 @@ export class MediaDbSettingTab extends PluginSettingTab {
.onChange(data => {
const newDateFormat = data ? data : DEFAULT_SETTINGS.customDateFormat;
this.plugin.settings.customDateFormat = newDateFormat;
document.getElementById('dateformat-preview').innerHTML = this.plugin.dateFormatter.getPreview(newDateFormat); // update preview
document.getElementById('media-db-dateformat-preview').textContent = this.plugin.dateFormatter.getPreview(newDateFormat); // update preview
this.plugin.saveSettings();
});
});