clay-server 2.18.0-beta.1 → 2.18.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { mateAvatarUrl } from './avatar.js';
|
|
2
2
|
import { renderMarkdown, highlightCodeBlocks } from './markdown.js';
|
|
3
|
-
import { escapeHtml } from './utils.js';
|
|
3
|
+
import { escapeHtml, copyToClipboard } from './utils.js';
|
|
4
4
|
import { iconHtml, refreshIcons } from './icons.js';
|
|
5
5
|
|
|
6
6
|
var ctx;
|
|
@@ -540,7 +540,30 @@ export function renderMentionUser(entry) {
|
|
|
540
540
|
div.appendChild(bubble);
|
|
541
541
|
}
|
|
542
542
|
|
|
543
|
+
// Action bar below bubble (same as regular user messages)
|
|
544
|
+
var actions = document.createElement("div");
|
|
545
|
+
actions.className = "msg-actions";
|
|
546
|
+
var ts2 = timeStr();
|
|
547
|
+
actions.innerHTML =
|
|
548
|
+
'<span class="msg-action-time">' + ts2 + '</span>' +
|
|
549
|
+
'<button class="msg-action-btn msg-action-copy" type="button" title="Copy">' + iconHtml("copy") + '</button>' +
|
|
550
|
+
'<button class="msg-action-btn msg-action-fork" type="button" title="Fork">' + iconHtml("git-branch") + '</button>' +
|
|
551
|
+
'<button class="msg-action-btn msg-action-rewind msg-user-rewind-btn" type="button" title="Rewind">' + iconHtml("rotate-ccw") + '</button>' +
|
|
552
|
+
'<button class="msg-action-btn msg-action-hidden msg-action-edit" type="button" title="Edit">' + iconHtml("pencil") + '</button>';
|
|
553
|
+
div.appendChild(actions);
|
|
554
|
+
|
|
555
|
+
// Copy handler
|
|
556
|
+
var rawText = (entry.mateName ? "@" + entry.mateName + " " : "") + (entry.text || "");
|
|
557
|
+
actions.querySelector(".msg-action-copy").addEventListener("click", function () {
|
|
558
|
+
var self = this;
|
|
559
|
+
copyToClipboard(rawText);
|
|
560
|
+
self.innerHTML = iconHtml("check");
|
|
561
|
+
refreshIcons();
|
|
562
|
+
setTimeout(function () { self.innerHTML = iconHtml("copy"); refreshIcons(); }, 1200);
|
|
563
|
+
});
|
|
564
|
+
|
|
543
565
|
if (ctx.messagesEl) ctx.messagesEl.appendChild(div);
|
|
566
|
+
refreshIcons();
|
|
544
567
|
}
|
|
545
568
|
|
|
546
569
|
export function renderMentionResponse(entry) {
|