summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz1@gmail.com>2016-03-10 14:20:48 +0000
committerJacob Schatz <jschatz1@gmail.com>2016-03-10 14:20:48 +0000
commitb9c9948ff8bb9a61994d25d243f7d74f2342f83a (patch)
treecba2e7903fdb1fe14a02c27a64a941ffd4515cde
parent198926dc7f1bf539862ead04e1e3ebb9d5b9de31 (diff)
parent704f46837627df405d2ffcf0bd9b74faf8f72f86 (diff)
downloadgitlab-ce-b9c9948ff8bb9a61994d25d243f7d74f2342f83a.tar.gz
Merge branch 'copy-markdown-snippet' into 'master'
Fixes issue with markdown snippet not being copyable On markdown snippets this adds a hidden div with the raw markdown content so that it can be copied Closes #13882 See merge request !3153
-rw-r--r--app/assets/stylesheets/pages/snippets.scss8
-rw-r--r--app/views/shared/snippets/_blob.html.haml2
2 files changed, 10 insertions, 0 deletions
diff --git a/app/assets/stylesheets/pages/snippets.scss b/app/assets/stylesheets/pages/snippets.scss
index 7d414ae003d..639d639d5b0 100644
--- a/app/assets/stylesheets/pages/snippets.scss
+++ b/app/assets/stylesheets/pages/snippets.scss
@@ -28,3 +28,11 @@
border: 1px solid;
line-height: 32px;
}
+
+.markdown-snippet-copy {
+ position: fixed;
+ top: -10px;
+ left: -10px;
+ max-height: 0;
+ max-width: 0;
+}
diff --git a/app/views/shared/snippets/_blob.html.haml b/app/views/shared/snippets/_blob.html.haml
index e0e41fc4bea..773ce8ac240 100644
--- a/app/views/shared/snippets/_blob.html.haml
+++ b/app/views/shared/snippets/_blob.html.haml
@@ -1,5 +1,7 @@
- unless @snippet.content.empty?
- if markup?(@snippet.file_name)
+ %textarea.markdown-snippet-copy.blob-content{data: {blob_id: @snippet.id}}
+ = @snippet.data
.file-content.wiki
= render_markup(@snippet.file_name, @snippet.data)
- else