Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1275 description markdown rendering not working #1297

Merged
merged 4 commits into from
Jan 11, 2024
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
12 changes: 11 additions & 1 deletion web/assets/css/watch.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
.playlist-thumbnail {
@apply bg-gray-100 dark:bg-gray-800 rounded-lg mr-4 bg-cover transition-all duration-500 hover:shadow-xl dark:shadow-gray-900/75;
}
}

/* Rendered, but not visible on the screen. Enables layout calculations. */
.offscreen {
position: absolute;
left: -9999px;
top: -9999px;
width: 100%;
height: auto;
overflow: visible;
}
10 changes: 8 additions & 2 deletions web/template/watch.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@
{{template "alert-modal" . }}
{{end}}
<div id="watchPageMainWrapper">
<input type="hidden" id="description" value="{{.Description}}">
<div class="offscreen video-description flex-grow p-3 order-2 basis-full lg:order-none lg:p-5 lg:mx-2">
<div>
<div class="rounded-lg bg-gray-50 hover:bg-gray-100 dark:bg-secondary-light hover:dark:bg-gray-600 text-3 text-sm">
<span id="description">{{.Description}}</span>
</div>
</div>
</div>
<input type="hidden" id="streamID" value="{{$stream.Model.ID}}">
<div x-data="interaction.videoInformationContext({{$stream.ID}});"
class="flex flex-wrap shadow border bg-white dark:bg-secondary dark:shadow-0 dark:border-0">
Expand Down Expand Up @@ -577,7 +583,7 @@
</button>
<template x-if="less">
<button class="font-semibold m-1 py-1 px-2 rounded-full hover:bg-gray-200 dark:hover:bg-gray-600"
x-text="showFullDescription.toggleText('Show more', 'Show less')"
x-text="showFullDescription.toggleText('Show less', 'Show more')"
@click="showFullDescription.toggle()"></button>
</template>
</div>
Expand Down
5 changes: 3 additions & 2 deletions web/ts/components/video-information.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import { ToggleableElement } from "../utilities/ToggleableElement";
import { RealtimeFacade } from "../utilities/ws";

const CUTOFFLENGTH = 256;
const CUTOFFHEIGHT = 52; // This is the height of one line of level 1 title + one line of plain text

export function videoInformationContext(streamId: number): AlpineComponent {
// TODO: REST
const descriptionEl = document.getElementById("description") as HTMLInputElement;
return {
viewers: 0 as number,
description: descriptionEl.value as string,
less: descriptionEl.value.length > CUTOFFLENGTH,
description: descriptionEl.innerHTML as string,
less: descriptionEl.innerHTML.length > CUTOFFLENGTH || descriptionEl.offsetHeight > CUTOFFHEIGHT,

showFullDescription: new ToggleableElement(),

Expand Down
Loading