mirror of
https://gitgud.io/BondageProjects/Bondage-College.git
synced 2025-04-14 12:29:15 +00:00
BUG: Fix the new chat room header icons not producing text upon copy/pasting
This commit is contained in:
parent
1a185e0318
commit
fe716f31c7
2 changed files with 52 additions and 15 deletions
BondageClub
|
@ -31,7 +31,7 @@
|
|||
}
|
||||
|
||||
.chat-room-sep-header {
|
||||
user-select: text !important;
|
||||
user-select: all !important;
|
||||
align-content: center;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
|
@ -47,6 +47,10 @@
|
|||
margin-block: 0.1em;
|
||||
}
|
||||
|
||||
.chat-room-no-copy {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.chat-room-sep-collapse {
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
|
|
|
@ -907,6 +907,25 @@ var ChatRoomSep = {
|
|||
*/
|
||||
ActiveElem: null,
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {(this: HTMLDivElement, event: ClipboardEvent) => void}
|
||||
*/
|
||||
_CopyHeader: function _CopyHeader(ev) {
|
||||
let txt = "";
|
||||
for (const el of this.childNodes) {
|
||||
if (!(el instanceof Element)) {
|
||||
txt += el.textContent;
|
||||
continue;
|
||||
} else if (el.classList.contains("chat-room-no-copy")) {
|
||||
continue;
|
||||
}
|
||||
txt += el.textContent || (el.getAttribute("aria-label") ?? "");
|
||||
}
|
||||
ev.clipboardData.setData("text/plain", txt);
|
||||
ev.preventDefault();
|
||||
},
|
||||
|
||||
/**
|
||||
* Click event listener for collapsing one or more chat room separators
|
||||
* @private
|
||||
|
@ -948,20 +967,34 @@ var ChatRoomSep = {
|
|||
_GetDisplayName: function _GetDisplayName(button) {
|
||||
const namespace = FriendListIconMapping[button.dataset.space];
|
||||
return [
|
||||
namespace ? [ElementCreate({
|
||||
tag: "div",
|
||||
attributes: { role: "img", "aria-label": InterfaceTextGet(`ChatRoomSpace${button.dataset.space || "F"}`) },
|
||||
classList: ["chat-room-sep-image"],
|
||||
style: { mask: `url(${namespace.src}) center/contain` },
|
||||
}), " - "] : undefined,
|
||||
button.dataset.private === "true" ? [ElementCreate({
|
||||
tag: "div",
|
||||
attributes: { role: "img", "aria-label": InterfaceTextGet("Private") },
|
||||
classList: ["chat-room-sep-image"],
|
||||
style: { mask: `url(${FriendListIconMapping.Private.src}) center/contain` },
|
||||
}), " - "] : undefined,
|
||||
namespace ? [
|
||||
ElementCreate({
|
||||
tag: "div",
|
||||
attributes: { role: "img", "aria-label": InterfaceTextGet(`ChatRoomSpace${button.dataset.space || "F"}`) },
|
||||
classList: ["chat-room-sep-image"],
|
||||
style: { mask: `url(${namespace.src}) center/contain` },
|
||||
eventListeners: { copy: ChatRoomSep._CopyImage },
|
||||
}),
|
||||
" - ",
|
||||
] : undefined,
|
||||
button.dataset.private === "true" ? [
|
||||
ElementCreate({
|
||||
tag: "div",
|
||||
attributes: { role: "img", "aria-label": InterfaceTextGet("Private") },
|
||||
classList: ["chat-room-sep-image"],
|
||||
style: { mask: `url(${FriendListIconMapping.Private.src}) center/contain` },
|
||||
eventListeners: { copy: ChatRoomSep._CopyImage },
|
||||
}),
|
||||
" - ",
|
||||
] : undefined,
|
||||
ChatRoomHTMLEntities(ChatSearchMuffle(button.dataset.room)),
|
||||
button.dataset.messages ? ["✉", ElementCreate({ tag: "sup", children: [button.dataset.messages] })] : undefined,
|
||||
button.dataset.messages ? [
|
||||
ElementCreate({
|
||||
tag: "span",
|
||||
classList: ["chat-room-no-copy"],
|
||||
children: [" ✉", { tag: "sup", children: [button.dataset.messages] }],
|
||||
}),
|
||||
] : undefined,
|
||||
].flat().filter(Boolean);
|
||||
},
|
||||
|
||||
|
@ -994,7 +1027,7 @@ var ChatRoomSep = {
|
|||
),
|
||||
ElementButton.Create(
|
||||
`chat-room-sep-header-${now}`, this._ClickScrollUp, { noStyling: true },
|
||||
{ button: { classList: ["chat-room-sep-header"] } },
|
||||
{ button: { classList: ["chat-room-sep-header"], eventListeners: { copy: ChatRoomSep._CopyHeader } } },
|
||||
),
|
||||
],
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue