Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
86a697f6
Commit
86a697f6
authored
Apr 07, 2022
by
Dheeraj Joshi
Committed by
Peter Hegman
Apr 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to v-safe-html for Markdown Fields
parent
238e5184
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
app/assets/javascripts/vue_shared/components/markdown/field.vue
...sets/javascripts/vue_shared/components/markdown/field.vue
+10
-4
spec/frontend/vue_shared/components/markdown/field_spec.js
spec/frontend/vue_shared/components/markdown/field_spec.js
+1
-1
No files found.
app/assets/javascripts/vue_shared/components/markdown/field.vue
View file @
86a697f6
<
script
>
import
{
GlIcon
}
from
'
@gitlab/ui
'
;
import
{
GlIcon
,
GlSafeHtmlDirective
}
from
'
@gitlab/ui
'
;
import
$
from
'
jquery
'
;
import
'
~/behaviors/markdown/render_gfm
'
;
import
{
debounce
,
unescape
}
from
'
lodash
'
;
...
...
@@ -24,6 +24,9 @@ export default {
GlIcon
,
Suggestions
,
},
directives
:
{
SafeHtml
:
GlSafeHtmlDirective
,
},
mixins
:
[
glFeatureFlagsMixin
()],
props
:
{
/**
...
...
@@ -308,6 +311,9 @@ export default {
);
},
},
safeHtmlConfig
:
{
ADD_TAGS
:
[
'
gl-emoji
'
],
},
};
</
script
>
...
...
@@ -369,19 +375,19 @@ export default {
<div
v-show=
"previewMarkdown"
ref=
"markdown-preview"
v-safe-html:
[$
options.safeHtmlConfig]=
"markdownPreview"
class=
"js-vue-md-preview md md-preview-holder"
v-html=
"markdownPreview /* eslint-disable-line vue/no-v-html */"
></div>
</
template
>
<div
v-if=
"referencedCommands && previewMarkdown && !markdownPreviewLoading"
v-safe-html:
[$
options.safeHtmlConfig]=
"referencedCommands"
class=
"referenced-commands"
data-testid=
"referenced-commands"
v-html=
"referencedCommands /* eslint-disable-line vue/no-v-html */"
></div>
<div
v-if=
"shouldShowReferencedUsers"
class=
"referenced-users"
>
<gl-icon
name=
"warning-solid"
/>
<span
v-
html=
"addMultipleToDiscussionWarning /* eslint-disable-line vue/no-v-html */
"
></span>
<span
v-
safe-html:
[$
options.safeHtmlConfig]=
"addMultipleToDiscussionWarning
"
></span>
</div>
</div>
</template>
spec/frontend/vue_shared/components/markdown/field_spec.js
View file @
86a697f6
...
...
@@ -85,7 +85,7 @@ describe('Markdown field component', () => {
describe
(
'
mounted
'
,
()
=>
{
const
previewHTML
=
`
<p>markdown preview</p>
<video src="
${
FIXTURES_PATH
}
/static/mock-video.mp4"
muted="muted"
></video>
<video src="
${
FIXTURES_PATH
}
/static/mock-video.mp4"></video>
`
;
let
previewLink
;
let
writeLink
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment