reload study video and better handle invalid URLs
This commit is contained in:
parent
ae689824ce
commit
6492f9e35b
|
@ -479,7 +479,8 @@ final class StudyApi(
|
|||
val shouldReload =
|
||||
(newChapter.setup.orientation != chapter.setup.orientation) ||
|
||||
(newChapter.practice != chapter.practice) ||
|
||||
(newChapter.gamebook != chapter.gamebook)
|
||||
(newChapter.gamebook != chapter.gamebook) ||
|
||||
(newChapter.embed != chapter.embed)
|
||||
if (study.position.chapterId == chapter.id && shouldReload)
|
||||
sendTo(study, Socket.ChangeChapter(uid, study.position))
|
||||
else
|
||||
|
|
|
@ -141,7 +141,10 @@ export function main(ctrl: StudyCtrl): VNode {
|
|||
return embedUrl ? h('div', [
|
||||
sideBox,
|
||||
h('div.side_box.embed', {
|
||||
hook: innerHTML(embedUrl, t => toYouTubeEmbed(t, 140)!)
|
||||
hook: innerHTML(embedUrl, t => {
|
||||
const html = toYouTubeEmbed(t, 140);
|
||||
return html || (ctrl.members.canContribute() ? 'Invalid YouTube URL' : '')
|
||||
})
|
||||
})
|
||||
]) : sideBox;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue