diff --git a/djangoproject/scss/_console-tabs.scss b/djangoproject/scss/_console-tabs.scss index 7bd8a4f98..38013fbee 100644 --- a/djangoproject/scss/_console-tabs.scss +++ b/djangoproject/scss/_console-tabs.scss @@ -44,4 +44,17 @@ >.c-tab-win:checked~.c-content-win { display: block; } + >.c-content-win, >.c-content-unix .highlight-console{ + .highlight{ + display: flex; + justify-content: space-between; + + .btn-clipboard{ + float: right; + position: sticky; + cursor: pointer; + margin: 15px; + } + } + } } diff --git a/djangoproject/static/js/main.js b/djangoproject/static/js/main.js index e47cdeb39..cdc7f9a2b 100644 --- a/djangoproject/static/js/main.js +++ b/djangoproject/static/js/main.js @@ -98,7 +98,7 @@ define(function() { mods.push('mod/messages'); } - if (hasClass('code-block-caption') || hasClass('snippet')) { + if (hasClass('code-block-caption') || hasClass('snippet') || hasClass('c-content-unix') || hasClass('c-content-win')){ mods.push('mod/clippify'); } diff --git a/djangoproject/static/js/mod/clippify.js b/djangoproject/static/js/mod/clippify.js index d80df7e85..8da002dc9 100644 --- a/djangoproject/static/js/mod/clippify.js +++ b/djangoproject/static/js/mod/clippify.js @@ -8,6 +8,20 @@ define(['jquery', 'clipboard'], function($, Clipboard) { btn.data('clipboard-text', $.trim(code.text())); header.append(btn); }); + $('.c-content-win, .c-content-unix').each(function() { + var header = $(this); + var wrapper = header.parent(); + var code = $('.highlight', wrapper); + + // Check if the icon has already been added + if (!$('.btn-clipboard', code).length) { + var btn = $(''); + btn.append(''); + btn.data('clipboard-text', $.trim(code.text())); + code.append(btn); + } + }); + // For Django 2.0 docs and older. $('.snippet').each(function() { var code = $('.highlight', this);