Embeddeding chat without iframe besieds videos WIP

This commit is contained in:
John Livingston
2024-03-28 15:06:15 +01:00
parent ba52d4e3d8
commit 612a9f622d
10 changed files with 134 additions and 103 deletions

View File

@ -1,4 +1,4 @@
import type { InitConverseJSParams } from 'shared/lib/types'
import type { InitConverseJSParams, ChatIncludeMode } from 'shared/lib/types'
import { inIframe } from './lib/utils'
import { initDom } from './lib/dom'
import {
@ -54,14 +54,6 @@ function initConversePlugins (peertubeEmbedded: boolean): void {
}
window.initConversePlugins = initConversePlugins
/**
* ChatIncludeMode:
* - chat-only: the chat is on a full page, without Peertube
* - peertube-fullpage: the chat is embedded in Peertube, in a full custom page
* - peertube-video: the chat is embedded in Peertube, beside a video
*/
type ChatIncludeMode = 'chat-only' | 'peertube-fullpage' | 'peertube-video'
/**
* Init ConverseJS
* @param initConverseParams ConverseJS init Params

View File

@ -2,9 +2,12 @@
@import "shared/styles/index";
@import "./peertubetheme";
body.livechat-iframe #conversejs .chat-head {
// Hidding the chat-head when the plugin is displayed in an iframe.
display: none;
peertube-plugin-livechat-container,
body.livechat-iframe {
#conversejs .chat-head {
// Hidding the chat-head when the plugin is displayed in an iframe or besides a video.
display: none;
}
}
#conversejs-bg {

View File

@ -4,7 +4,7 @@ function initDom ({ forceReadonly, transparent }: InitConverseJSParams, isInIfra
const body = document.querySelector('body')
if (isInIframe) {
if (body) {
body.classList.add('livechat-iframe')
body.classList.add('livechat-iframe') // we need to keep this, for embedded chats in external websites
// prevent horizontal scrollbar when in iframe. (don't know why, but does not work if done by CSS)
body.style.overflowX = 'hidden'
}