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
3f63da94
Commit
3f63da94
authored
Oct 22, 2021
by
Dheeraj Joshi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to v-safe-html for rendering notes
parent
0c4e0b2c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
7 deletions
+16
-7
app/assets/javascripts/batch_comments/components/draft_note.vue
...sets/javascripts/batch_comments/components/draft_note.vue
+8
-2
app/assets/javascripts/notes/components/note_body.vue
app/assets/javascripts/notes/components/note_body.vue
+8
-5
No files found.
app/assets/javascripts/batch_comments/components/draft_note.vue
View file @
3f63da94
<
script
>
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlSafeHtmlDirective
}
from
'
@gitlab/ui
'
;
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
import
NoteableNote
from
'
~/notes/components/noteable_note.vue
'
;
import
PublishButton
from
'
./publish_button.vue
'
;
...
...
@@ -10,6 +10,9 @@ export default {
PublishButton
,
GlButton
,
},
directives
:
{
SafeHtml
:
GlSafeHtmlDirective
,
},
props
:
{
draft
:
{
type
:
Object
,
...
...
@@ -72,6 +75,9 @@ export default {
}
},
},
safeHtmlConfig
:
{
ADD_TAGS
:
[
'
use
'
,
'
gl-emoji
'
],
},
};
</
script
>
<
template
>
...
...
@@ -104,8 +110,8 @@ export default {
<
template
v-if=
"!isEditingDraft"
>
<div
v-if=
"draftCommands"
v-safe-html:
[$
options.safeHtmlConfig]=
"draftCommands"
class=
"referenced-commands draft-note-commands"
v-html=
"draftCommands /* eslint-disable-line vue/no-v-html */"
></div>
<p
class=
"draft-note-actions d-flex"
>
...
...
app/assets/javascripts/notes/components/note_body.vue
View file @
3f63da94
<
script
>
import
$
from
'
jquery
'
;
import
{
GlSafeHtmlDirective
}
from
'
@gitlab/ui
'
;
import
{
escape
}
from
'
lodash
'
;
import
{
mapActions
,
mapGetters
,
mapState
}
from
'
vuex
'
;
...
...
@@ -19,6 +20,9 @@ export default {
noteForm
,
Suggestions
,
},
directives
:
{
SafeHtml
:
GlSafeHtmlDirective
,
},
mixins
:
[
autosave
],
props
:
{
note
:
{
...
...
@@ -144,6 +148,9 @@ export default {
this
.
removeSuggestionInfoFromBatch
(
suggestionId
);
},
},
safeHtmlConfig
:
{
ADD_TAGS
:
[
'
use
'
,
'
gl-emoji
'
],
},
};
</
script
>
...
...
@@ -163,11 +170,7 @@ export default {
@
addToBatch=
"addSuggestionToBatch"
@
removeFromBatch=
"removeSuggestionFromBatch"
/>
<div
v-else
class=
"note-text md"
v-html=
"note.note_html /* eslint-disable-line vue/no-v-html */"
></div>
<div
v-else
v-safe-html:
[$
options.safeHtmlConfig]=
"note.note_html"
class=
"note-text md"
></div>
<note-form
v-if=
"isEditing"
ref=
"noteForm"
...
...
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