diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-02-09 15:43:45 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-02-09 15:43:45 +0000 |
commit | 4975f4160ac65b3d9ae51d074efcb61bb63cf6b4 (patch) | |
tree | c8b176b665836417207488c75d489fa335ab9620 | |
parent | 088096cd25589e3608a40de5f8ee8b74dfebe370 (diff) | |
parent | cc44caf7dc55dfac9538cbee461726a3763f27e8 (diff) | |
download | gitlab-ce-4975f4160ac65b3d9ae51d074efcb61bb63cf6b4.tar.gz |
Merge branch 'dm-copy-as-gfm-anchor-link' into 'master'
Correctly transform an anchor link to GFM when copying it
See merge request !9080
-rw-r--r-- | app/assets/javascripts/copy_as_gfm.js.es6 | 3 | ||||
-rw-r--r-- | spec/features/copy_as_gfm_spec.rb | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/app/assets/javascripts/copy_as_gfm.js.es6 b/app/assets/javascripts/copy_as_gfm.js.es6 index 2bfe57b4100..4bd537a6f28 100644 --- a/app/assets/javascripts/copy_as_gfm.js.es6 +++ b/app/assets/javascripts/copy_as_gfm.js.es6 @@ -91,6 +91,9 @@ require('./lib/utils/common_utils'); }, }, SanitizationFilter: { + 'a[name]:not([href]):empty'(el, text) { + return el.outerHTML; + }, 'dl'(el, text) { let lines = text.trim().split('\n'); // Add two spaces to the front of subsequent list items lines, diff --git a/spec/features/copy_as_gfm_spec.rb b/spec/features/copy_as_gfm_spec.rb index f3a5b565122..fec86128d03 100644 --- a/spec/features/copy_as_gfm_spec.rb +++ b/spec/features/copy_as_gfm_spec.rb @@ -251,6 +251,8 @@ describe 'Copy as GFM', feature: true, js: true do 'SanitizationFilter', <<-GFM.strip_heredoc + <a name="named-anchor"></a> + <sub>sub</sub> <dl> |