Skip to content

Conversation

@aadeina
Copy link
Contributor

@aadeina aadeina commented Jan 5, 2026

Summary

Adds a copy-to-clipboard button to console tab code blocks (Unix / Windows installation commands).

Fixes: #1276, #2399
Builds on feedback from @sabderemane in PR #1434.

Changes

JavaScript

djangoproject/static/js/djangoproject.js

  • Extends existing clipboard functionality to support console tabs
  • Adds smart command text extraction that excludes:
    • Shell prompts (.gp — e.g. $, ...>)
    • Command output (.go)
  • Minimal change set (~20 lines added), reusing existing patterns and logic

SCSS

djangoproject/scss/_console-tabs.scss

  • Adds position: relative to console tab sections
  • Introduces .btn-clipboard styling using absolute positioning (no float)
  • Includes hover states and “Copied!” success feedback animation
  • Uses existing CSS variables for light/dark mode compatibility

Visual Comparison

Before

Before: console tabs without copy button

After

Video.Project.mp4

@ulgens
Copy link
Member

ulgens commented Jan 5, 2026

This looks nice 🌻 I'd recommend installing git hooks (you can follow the last section of the readme) and rebasing the PR to have a bit more clear history.

@aadeina aadeina force-pushed the docs-copy-to-clipboard branch from ad9d2d6 to 24e3b21 Compare January 5, 2026 19:16
@aadeina aadeina closed this Jan 5, 2026
@aadeina aadeina force-pushed the docs-copy-to-clipboard branch from bb03309 to 07c155d Compare January 5, 2026 19:39
@aadeina aadeina reopened this Jan 5, 2026
@aadeina aadeina force-pushed the docs-copy-to-clipboard branch from c22de90 to cd6cf4c Compare January 5, 2026 20:04
@aadeina
Copy link
Contributor Author

aadeina commented Jan 5, 2026

Hi @ulgens ,
I’ve cleaned up the branch and ensured the PR now contains only the intended commit.
Please let me know if anything else is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants