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
5b0bedde
Commit
5b0bedde
authored
Oct 13, 2021
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix gfm pasting of custom emoji
parent
f21f76b8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
app/assets/javascripts/behaviors/markdown/nodes/emoji.js
app/assets/javascripts/behaviors/markdown/nodes/emoji.js
+12
-0
app/assets/javascripts/behaviors/markdown/nodes/image.js
app/assets/javascripts/behaviors/markdown/nodes/image.js
+1
-1
spec/features/markdown/copy_as_gfm_spec.rb
spec/features/markdown/copy_as_gfm_spec.rb
+9
-0
No files found.
app/assets/javascripts/behaviors/markdown/nodes/emoji.js
View file @
5b0bedde
...
@@ -26,6 +26,18 @@ export default class Emoji extends Node {
...
@@ -26,6 +26,18 @@ export default class Emoji extends Node {
moji
:
el
.
textContent
,
moji
:
el
.
textContent
,
}),
}),
},
},
{
tag
:
'
img.emoji
'
,
getAttrs
:
(
el
)
=>
{
const
name
=
el
.
getAttribute
(
'
title
'
).
replace
(
/^:|:$/g
,
''
);
return
{
name
,
title
:
name
,
moji
:
name
,
};
},
},
],
],
toDOM
:
(
node
)
=>
[
toDOM
:
(
node
)
=>
[
'
gl-emoji
'
,
'
gl-emoji
'
,
...
...
app/assets/javascripts/behaviors/markdown/nodes/image.js
View file @
5b0bedde
...
@@ -29,7 +29,7 @@ export default class Image extends BaseImage {
...
@@ -29,7 +29,7 @@ export default class Image extends BaseImage {
},
},
// Matches HTML generated by Banzai::Filter::ImageLazyLoadFilter
// Matches HTML generated by Banzai::Filter::ImageLazyLoadFilter
{
{
tag
:
'
img[src]
'
,
tag
:
'
img[src]
:not(.emoji)
'
,
getAttrs
:
(
el
)
=>
{
getAttrs
:
(
el
)
=>
{
const
imageSrc
=
el
.
src
;
const
imageSrc
=
el
.
src
;
const
imageUrl
=
const
imageUrl
=
...
...
spec/features/markdown/copy_as_gfm_spec.rb
View file @
5b0bedde
...
@@ -201,6 +201,15 @@ RSpec.describe 'Copy as GFM', :js do
...
@@ -201,6 +201,15 @@ RSpec.describe 'Copy as GFM', :js do
GFM
GFM
)
)
aggregate_failures
(
'CustomEmojiFilter'
)
do
gfm
=
':custom_emoji:'
html
=
'<img class="emoji" src="custom_emoji.svg" title=":custom_emoji:" height="20" width="20">'
output_gfm
=
html_to_gfm
(
html
)
expect
(
output_gfm
.
strip
).
to
eq
(
gfm
.
strip
)
end
aggregate_failures
(
'MathFilter: math as transformed from HTML to KaTeX'
)
do
aggregate_failures
(
'MathFilter: math as transformed from HTML to KaTeX'
)
do
gfm
=
'$`c = \pm\sqrt{a^2 + b^2}`$'
gfm
=
'$`c = \pm\sqrt{a^2 + b^2}`$'
...
...
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