Commit 017dfebd authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch 'djadmin-badge-form-safe-html' into 'master'

Switch to v-safe-html in Badge form

See merge request gitlab-org/gitlab!69825
parents 34f92953 927dfce2
<script> <script>
import { GlLoadingIcon, GlFormInput, GlFormGroup, GlButton } from '@gitlab/ui'; import { GlLoadingIcon, GlFormInput, GlFormGroup, GlButton, GlSafeHtmlDirective } from '@gitlab/ui';
import { escape, debounce } from 'lodash'; import { escape, debounce } from 'lodash';
import { mapActions, mapState } from 'vuex'; import { mapActions, mapState } from 'vuex';
import createFlash from '~/flash'; import createFlash from '~/flash';
...@@ -18,6 +18,9 @@ export default { ...@@ -18,6 +18,9 @@ export default {
GlFormInput, GlFormInput,
GlFormGroup, GlFormGroup,
}, },
directives: {
SafeHtml: GlSafeHtmlDirective,
},
props: { props: {
isEditing: { isEditing: {
type: Boolean, type: Boolean,
...@@ -167,6 +170,7 @@ export default { ...@@ -167,6 +170,7 @@ export default {
}); });
}, },
}, },
safeHtmlConfig: { ALLOW_TAGS: ['a', 'code'] },
}; };
</script> </script>
...@@ -183,7 +187,7 @@ export default { ...@@ -183,7 +187,7 @@ export default {
<div class="form-group"> <div class="form-group">
<label for="badge-link-url" class="label-bold">{{ s__('Badges|Link') }}</label> <label for="badge-link-url" class="label-bold">{{ s__('Badges|Link') }}</label>
<p v-html="helpText /* eslint-disable-line vue/no-v-html */"></p> <p v-safe-html:[$options.safeHtmlConfig]="helpText"></p>
<input <input
id="badge-link-url" id="badge-link-url"
v-model="linkUrl" v-model="linkUrl"
...@@ -198,7 +202,7 @@ export default { ...@@ -198,7 +202,7 @@ export default {
<div class="form-group"> <div class="form-group">
<label for="badge-image-url" class="label-bold">{{ s__('Badges|Badge image URL') }}</label> <label for="badge-image-url" class="label-bold">{{ s__('Badges|Badge image URL') }}</label>
<p v-html="helpText /* eslint-disable-line vue/no-v-html */"></p> <p v-safe-html:[$options.safeHtmlConfig]="helpText"></p>
<input <input
id="badge-image-url" id="badge-image-url"
v-model="imageUrl" v-model="imageUrl"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment