Skip to content
Snippets Groups Projects

Add copy button to snippet

Merged Michael Le requested to merge mle/336307-add-copy-code-embedded-snippets into master
1 unresolved thread

What does this MR do and why?

Add copy button to embedded snippets for parity of actions of a GitLab snippet when used in product or on third party website.

Relates to #336307 (closed)

  • Add functionality to copy to clipboard by adding a button to embedded snippets
  • Update icons to reflect the thinner icons

Screenshots or screen recordings

Current Change
image image

How to set up and validate locally

  • Run GDK
  • Create a snippet in a local project
  • Click Embed and copy the script
    • Example: <script src="http://127.0.0.1:3000/flightjs/Flight/-/snippets/21.js"></script>
  • Create a new HTML page and call it index.html somewhere on your computer with the following code inside
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script src="http://127.0.0.1:3000/flightjs/Flight/-/snippets/21.js"></script>
</body>
</html>
  • Open the webpage in a browser

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Michael Le

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Michael Le added 1 commit

    added 1 commit

    • a6267f4b - Improve the naming of the button function

    Compare with previous version

  • Michael Le added 384 commits

    added 384 commits

    Compare with previous version

  • Kerri Miller
  • Kerri Miller added 1 commit

    added 1 commit

    Compare with previous version

  • Kerri Miller resolved all threads

    resolved all threads

  • Kerri Miller approved this merge request

    approved this merge request

  • Kerri Miller enabled an automatic merge when the pipeline for 01b39276 succeeds

    enabled an automatic merge when the pipeline for 01b39276 succeeds

  • Kerri Miller aborted the automatic merge because source branch was updated

    aborted the automatic merge because source branch was updated

  • Kerri Miller added 166 commits

    added 166 commits

    Compare with previous version

  • Kerri Miller enabled an automatic merge when the pipeline for ddaab27d succeeds

    enabled an automatic merge when the pipeline for ddaab27d succeeds

  • Michael Le aborted the automatic merge because source branch was updated

    aborted the automatic merge because source branch was updated

  • Michael Le added 40 commits

    added 40 commits

    Compare with previous version

  • Kerri Miller resolved all threads

    resolved all threads

  • merged

  • Kerri Miller mentioned in commit f5f43909

    mentioned in commit f5f43909

  • David O'Regan mentioned in merge request !89072 (closed)

    mentioned in merge request !89072 (closed)

  • added workflowstaging label and removed workflowcanary label

  • Michael Le mentioned in merge request !89367 (closed)

    mentioned in merge request !89367 (closed)

  • mentioned in issue #336307 (closed)

  • added Category:Source Code Management snippets labels and removed 1 deleted label

  • Please register or sign in to reply
    Loading