Make spoiler click to toggle (#176)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
1ed1dfc78a
commit
c22c407ee5
2 changed files with 19 additions and 13 deletions
|
@ -210,6 +210,7 @@
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
background-color: rgba(124, 124, 124, 0.5);
|
background-color: rgba(124, 124, 124, 0.5);
|
||||||
color:transparent;
|
color:transparent;
|
||||||
|
cursor: pointer;
|
||||||
-webkit-touch-callout: none;
|
-webkit-touch-callout: none;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-khtml-user-select: none;
|
-khtml-user-select: none;
|
||||||
|
@ -219,15 +220,14 @@
|
||||||
& > * {
|
& > * {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
&:focus, &:hover {
|
}
|
||||||
background-color: transparent;
|
.data-mx-spoiler--visible {
|
||||||
color: inherit;
|
background-color: var(--bg-surface-active) !important;
|
||||||
user-select: initial;
|
color: inherit !important;
|
||||||
& > * {
|
user-select: initial !important;
|
||||||
opacity: inherit;
|
& > * {
|
||||||
}
|
opacity: inherit !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
&-edited {
|
&-edited {
|
||||||
color: var(--tc-surface-low);
|
color: var(--tc-surface-low);
|
||||||
|
|
|
@ -74,12 +74,18 @@ function genRoomIntro(mEvent, roomTimeline) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleOnClickCapture(e) {
|
function handleOnClickCapture(e) {
|
||||||
const { target } = e;
|
const { target, nativeEvent } = e;
|
||||||
const userId = target.getAttribute('data-mx-pill');
|
|
||||||
if (!userId) return;
|
|
||||||
|
|
||||||
const roomId = navigation.selectedRoomId;
|
const userId = target.getAttribute('data-mx-pill');
|
||||||
openProfileViewer(userId, roomId);
|
if (userId) {
|
||||||
|
const roomId = navigation.selectedRoomId;
|
||||||
|
openProfileViewer(userId, roomId);
|
||||||
|
}
|
||||||
|
|
||||||
|
const spoiler = nativeEvent.path.find((el) => el?.hasAttribute?.('data-mx-spoiler'));
|
||||||
|
if (spoiler) {
|
||||||
|
spoiler.classList.toggle('data-mx-spoiler--visible');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderEvent(roomTimeline, mEvent, prevMEvent, isFocus = false) {
|
function renderEvent(roomTimeline, mEvent, prevMEvent, isFocus = false) {
|
||||||
|
|
Loading…
Reference in a new issue