Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): stop rendering expressions as html #4420

Merged
merged 2 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/editor-ui/src/components/ParameterInputFull.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ import {
IUpdateInformation,
} from '@/Interface';

import InputHint from './ParameterInputHint.vue';
import ParameterOptions from './ParameterOptions.vue';
import DraggableTarget from '@/components/DraggableTarget.vue';
import mixins from 'vue-typed-mixins';
Expand All @@ -87,7 +86,6 @@ export default mixins(
.extend({
name: 'parameter-input-full',
components: {
InputHint,
ParameterOptions,
DraggableTarget,
ParameterInputWrapper,
Expand Down
11 changes: 10 additions & 1 deletion packages/editor-ui/src/components/ParameterInputHint.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<template>
<n8n-text size="small" color="text-base" tag="div" v-if="hint">
<div ref="hint" :class="{[$style.hint]: true, [$style.highlight]: highlight}" v-html="hint"></div>
<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>
</n8n-text>
</template>

<script lang="ts">
import { sanitizeHtml } from "@/utils";
import Vue from "vue";

export default Vue.extend({
Expand All @@ -16,6 +18,13 @@ export default Vue.extend({
highlight: {
type: Boolean,
},
renderHTML: {
type: Boolean,
default: false,
},
},
methods: {
sanitizeHtml,
},
mounted(){
if(this.$refs.hint){
Expand Down
3 changes: 2 additions & 1 deletion packages/editor-ui/src/components/ParameterInputWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
@drop="onDrop"
@textInput="onTextInput"
@valueChanged="onValueChanged" />
<input-hint v-if="expressionOutput || parameterHint" :class="$style.hint" :highlight="!!(expressionOutput && targetItem)" :hint="expressionOutput || parameterHint" />
<input-hint v-if="expressionOutput" :class="$style.hint" :highlight="!!(expressionOutput && targetItem)" :hint="expressionOutput" />
<input-hint v-else-if="parameterHint" :class="$style.hint" :renderHTML="true" :hint="parameterHint" />
</div>
</template>

Expand Down