2022-01-27 22:55:25 -08:00
|
|
|
<template>
|
2022-10-12 05:06:28 -07:00
|
|
|
<n8n-text size="small" color="text-base" tag="div" v-if="hint">
|
2022-12-14 01:04:10 -08:00
|
|
|
<div v-if="!renderHTML" :class="{ [$style.hint]: true, [$style.highlight]: highlight }">
|
|
|
|
{{ hint }}
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
v-else
|
|
|
|
ref="hint"
|
|
|
|
:class="{ [$style.hint]: true, [$style.highlight]: highlight }"
|
|
|
|
v-html="sanitizeHtml(hint)"
|
|
|
|
></div>
|
2022-10-12 05:06:28 -07:00
|
|
|
</n8n-text>
|
2022-01-27 22:55:25 -08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2022-12-14 01:04:10 -08:00
|
|
|
import { sanitizeHtml } from '@/utils';
|
|
|
|
import Vue from 'vue';
|
2022-01-27 22:55:25 -08:00
|
|
|
|
|
|
|
export default Vue.extend({
|
|
|
|
name: 'InputHint',
|
2022-10-12 05:06:28 -07:00
|
|
|
props: {
|
|
|
|
hint: {
|
|
|
|
type: String,
|
|
|
|
},
|
|
|
|
highlight: {
|
|
|
|
type: Boolean,
|
|
|
|
},
|
2022-10-24 01:48:33 -07:00
|
|
|
renderHTML: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
sanitizeHtml,
|
2022-10-12 05:06:28 -07:00
|
|
|
},
|
2022-12-14 01:04:10 -08:00
|
|
|
mounted() {
|
|
|
|
if (this.$refs.hint) {
|
|
|
|
(this.$refs.hint as Element).querySelectorAll('a').forEach((a) => (a.target = '_blank'));
|
2022-01-27 22:55:25 -08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2022-10-12 05:06:28 -07:00
|
|
|
<style lang="scss" module>
|
2022-12-14 01:04:10 -08:00
|
|
|
.hint {
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
2022-10-12 05:06:28 -07:00
|
|
|
|
2022-12-14 01:04:10 -08:00
|
|
|
.highlight {
|
|
|
|
color: var(--color-secondary);
|
|
|
|
}
|
2022-10-12 05:06:28 -07:00
|
|
|
</style>
|