Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "DocumenterCopyButton"
uuid = "e492c155-30e5-4d09-a3ac-117479612e06"
version = "0.2.0"
version = "0.2.1"
authors = ["Jack Champagne <jack@harmoniqs.co>"]

[deps]
Expand Down
16 changes: 15 additions & 1 deletion assets/copybutton.css
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,24 @@ body:has(.modal.is-active) .copybutton-container {
}

/* Override Bulma dropdown-item to work as block links in our context */
.copybutton-dropdown .dropdown-item {
.copybutton-dropdown a.dropdown-item {
cursor: pointer;
font-size: 0.8rem;
white-space: nowrap;
display: flex !important;
align-items: center;
justify-content: space-between;
gap: 12px;
}

.copybutton-redirect-icon {
opacity: 0.4;
flex-shrink: 0;
transition: opacity 0.15s ease;
}

.copybutton-dropdown .dropdown-item:hover .copybutton-redirect-icon {
opacity: 0.8;
}

.copybutton-dropdown a.dropdown-item:hover {
Expand Down
19 changes: 18 additions & 1 deletion assets/copybutton.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,24 @@
var item = document.createElement("a");
item.className = "dropdown-item";
item.setAttribute("role", "menuitem");
item.textContent = provider.name || "Open";
var nameSpan = document.createElement("span");
nameSpan.textContent = provider.name || "Open";
item.appendChild(nameSpan);
var redirectSvg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
redirectSvg.setAttribute("width", "8");
redirectSvg.setAttribute("height", "8");
redirectSvg.setAttribute("viewBox", "0 0 8 8");
redirectSvg.setAttribute("fill", "none");
redirectSvg.setAttribute("aria-hidden", "true");
redirectSvg.classList.add("copybutton-redirect-icon");
var redirectPath = document.createElementNS("http://www.w3.org/2000/svg", "path");
redirectPath.setAttribute("d", "M2.91667 0.75H7.25M7.25 0.75V5.08333M7.25 0.75L0.75 7.25");
redirectPath.setAttribute("stroke", "currentColor");
redirectPath.setAttribute("stroke-width", "1.5");
redirectPath.setAttribute("stroke-linecap", "round");
redirectPath.setAttribute("stroke-linejoin", "round");
redirectSvg.appendChild(redirectPath);
item.appendChild(redirectSvg);
item.href = "#";
item.addEventListener("click", function (e) {
e.preventDefault();
Expand Down
Loading