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">
|
2023-02-26 22:25:57 -08:00
|
|
|
<div
|
|
|
|
v-if="!renderHTML"
|
|
|
|
:class="{ [$style.singleline]: singleLine, [$style.highlight]: highlight }"
|
|
|
|
>
|
2022-12-14 01:04:10 -08:00
|
|
|
{{ hint }}
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
v-else
|
|
|
|
ref="hint"
|
2023-02-26 22:25:57 -08:00
|
|
|
:class="{ [$style.singleline]: singleLine, [$style.highlight]: highlight }"
|
2022-12-14 01:04:10 -08:00
|
|
|
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,
|
|
|
|
},
|
2023-02-26 22:25:57 -08:00
|
|
|
singleLine: {
|
|
|
|
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>
|
2023-02-26 22:25:57 -08:00
|
|
|
.singleline {
|
2022-12-14 01:04:10 -08:00
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
|
|
|
.highlight {
|
|
|
|
color: var(--color-secondary);
|
|
|
|
}
|
2022-10-12 05:06:28 -07:00
|
|
|
</style>
|