diff --git a/src/webviews/apps/media/hovers-autolink.png b/src/webviews/apps/media/hovers-autolink.png new file mode 100644 index 0000000..2d7f9be Binary files /dev/null and b/src/webviews/apps/media/hovers-autolink.png differ diff --git a/src/webviews/apps/settings/partials/autolinks.html b/src/webviews/apps/settings/partials/autolinks.html index a170f3d..eddd6cf 100644 --- a/src/webviews/apps/settings/partials/autolinks.html +++ b/src/webviews/apps/settings/partials/autolinks.html @@ -6,6 +6,11 @@
+
+ +
+
+

diff --git a/src/webviews/apps/settings/settings.scss b/src/webviews/apps/settings/settings.scss index 14a4fb6..a8429f6 100644 --- a/src/webviews/apps/settings/settings.scss +++ b/src/webviews/apps/settings/settings.scss @@ -209,6 +209,10 @@ header { width: 600px; } +.image__preview--fit { + width: max-content; +} + .image__preview--overlay { left: 0; position: absolute; diff --git a/src/webviews/apps/settings/settings.ts b/src/webviews/apps/settings/settings.ts index 1162c23..5eed5e5 100644 --- a/src/webviews/apps/settings/settings.ts +++ b/src/webviews/apps/settings/settings.ts @@ -241,7 +241,15 @@ export class SettingsApp extends AppWithConfig { const $root = document.querySelector('[data-component="autolinks"]'); if ($root == null) return; - const autolinkTemplate = (index: number, autolink?: AutolinkReference, isNew = false) => ` + const helpTemplate = () => ` +

+ + Matches prefixes that are followed by a reference value within commit messages.
      The URL must contain a <num> for the reference value to be included in the link. +
+
+ `; + + const autolinkTemplate = (index: number, autolink?: AutolinkReference, isNew = false, renderHelp = true) => ` `; const fragment: string[] = []; - if (this.state.config.autolinks != null) { - this.state.config.autolinks.forEach((autolink, i) => fragment.push(autolinkTemplate(i, autolink))); + const autolinks = (this.state.config.autolinks?.length || 0) > 0; + if (autolinks) { + this.state.config.autolinks?.forEach((autolink, i) => fragment.push(autolinkTemplate(i, autolink))); + } + + fragment.push(autolinkTemplate(this.state.config.autolinks?.length ?? 0, undefined, true, !autolinks)); + + if (autolinks) { + fragment.push( helpTemplate()); } - fragment.push(autolinkTemplate(this.state.config.autolinks?.length ?? 0, undefined, true)); $root.innerHTML = fragment.join(''); }