This commit is contained in:
Elias Meire 2025-03-06 01:03:08 +09:00 committed by GitHub
commit 06ea2b7a57
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 8 deletions

View file

@ -74,7 +74,7 @@ const addTargetBlank = (html: string) =>
:class="[$style.infoIcon, showTooltip ? $style.visible : $style.hidden]" :class="[$style.infoIcon, showTooltip ? $style.visible : $style.hidden]"
> >
<N8nTooltip placement="top" :popper-class="$style.tooltipPopper" :show-after="300"> <N8nTooltip placement="top" :popper-class="$style.tooltipPopper" :show-after="300">
<N8nIcon icon="question-circle" size="small" /> <N8nIcon :class="$style.icon" icon="question-circle" size="small" />
<template #content> <template #content>
<div v-n8n-html="addTargetBlank(tooltipText)" /> <div v-n8n-html="addTargetBlank(tooltipText)" />
</template> </template>
@ -143,6 +143,10 @@ const addTargetBlank = (html: string) =>
} }
} }
.infoIcon:has(.icon[aria-describedby]) {
opacity: 1;
}
.trailing-content { .trailing-content {
display: flex; display: flex;
gap: var(--spacing-3xs); gap: var(--spacing-3xs);

View file

@ -1,5 +1,5 @@
import sanitize from 'sanitize-html'; import sanitize from 'sanitize-html';
import type { DirectiveBinding, ObjectDirective } from 'vue'; import type { DirectiveBinding, FunctionDirective } from 'vue';
/** /**
* Custom directive `n8nHtml` to replace v-html from Vue to sanitize content. * Custom directive `n8nHtml` to replace v-html from Vue to sanitize content.
@ -28,11 +28,11 @@ const configuredSanitize = (html: string) =>
}, },
}); });
export const n8nHtml: ObjectDirective = { export const n8nHtml: FunctionDirective<HTMLElement, string> = (
beforeMount(el: HTMLElement, binding: DirectiveBinding<string>) { el: HTMLElement,
binding: DirectiveBinding<string>,
) => {
if (binding.value !== binding.oldValue) {
el.innerHTML = configuredSanitize(binding.value); el.innerHTML = configuredSanitize(binding.value);
}, }
beforeUpdate(el: HTMLElement, binding: DirectiveBinding<string>) {
el.innerHTML = configuredSanitize(binding.value);
},
}; };