Skip to content

Commit 53c67fe

Browse files
committed
Rename tooltip to clipboard
The original JavaScript is based on a tooltip example https://github.com/jupyterhub/jupyter-remote-desktop-proxy/blob/d702e1a68f1ffee0fab57dbbefb1c11b36c48776/js/tooltip.js#L4 but it's been modified so the naming is misleading.
1 parent d702e1a commit 53c67fe

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

js/tooltip.css renamed to js/clipboard.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
display: none !important;
33
}
44

5-
.tooltip-container {
5+
.clipboard-container {
66
overflow: visible; /* Needed for the arrow to show up */
77
width: max-content;
88
position: absolute;

js/tooltip.js renamed to js/clipboard.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
* Mostly follows https://floating-ui.com/docs/tutorial
55
*/
66
import { computePosition, flip, shift, offset, arrow } from "@floating-ui/dom";
7-
import "./tooltip.css";
7+
import "./clipboard.css";
88

99
/**
10-
* Setup trigger element to toggle showing / hiding tooltip element
10+
* Setup trigger element to toggle showing / hiding clipboard element
1111
* @param {Element} trigger
12-
* @param {Element} tooltip
12+
* @param {Element} clipboard
1313
*/
14-
export function setupTooltip(trigger, tooltip) {
15-
const arrowElement = tooltip.querySelector(".arrow");
14+
export function setupClipboard(trigger, clipboard) {
15+
const arrowElement = clipboard.querySelector(".arrow");
1616
function updatePosition() {
17-
computePosition(trigger, tooltip, {
17+
computePosition(trigger, clipboard, {
1818
placement: "bottom",
1919
middleware: [
2020
offset(6),
@@ -23,7 +23,7 @@ export function setupTooltip(trigger, tooltip) {
2323
arrow({ element: arrowElement }),
2424
],
2525
}).then(({ x, y, placement, middlewareData }) => {
26-
Object.assign(tooltip.style, {
26+
Object.assign(clipboard.style, {
2727
left: `${x}px`,
2828
top: `${y}px`,
2929
});
@@ -49,7 +49,7 @@ export function setupTooltip(trigger, tooltip) {
4949
}
5050

5151
trigger.addEventListener("click", (e) => {
52-
tooltip.classList.toggle("hidden");
52+
clipboard.classList.toggle("hidden");
5353
trigger.classList.toggle("active");
5454
updatePosition();
5555
e.preventDefault();

js/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import "./index.css";
99
// RFB holds the API to connect and communicate with a VNC server
1010
import RFB from "@novnc/novnc/core/rfb";
1111

12-
import { setupTooltip } from "./tooltip.js";
12+
import { setupClipboard } from "./clipboard.js";
1313

1414
const maxRetryCount = 5;
1515
const retryInterval = 3; // seconds
@@ -82,7 +82,7 @@ function connect() {
8282
.getElementById("clipboard-text")
8383
.addEventListener("change", clipboardSend);
8484

85-
setupTooltip(
85+
setupClipboard(
8686
document.getElementById("clipboard-button"),
8787
document.getElementById("clipboard-container"),
8888
);

jupyter_remote_desktop_proxy/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
</div>
4242

4343
<!-- Clipboard -->
44-
<div id="clipboard-container" class="tooltip-container hidden">
44+
<div id="clipboard-container" class="clipboard-container hidden">
4545
<div class="arrow"></div>
4646
<div id="clipboard-content">
4747
<p>

0 commit comments

Comments
 (0)