Skip to content

Commit

Permalink
Add various attributes to video
Browse files Browse the repository at this point in the history
  • Loading branch information
hojberg committed Nov 27, 2023
1 parent 728e439 commit 250567c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
19 changes: 12 additions & 7 deletions src/Code/Definition/Doc.elm
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ import Html
import Html.Attributes
exposing
( alt
, attribute
, autoplay
, class
, classList
, controls
, href
, id
, loop
, poster
, rel
, src
Expand All @@ -64,6 +68,7 @@ import Lib.EmbedKatex as EmbedKatex
import Lib.EmbedSvg as EmbedSvg
import Lib.MermaidDiagram as MermaidDiagram
import Lib.TreePath as TreePath exposing (TreePath)
import Maybe.Extra as MaybeE
import Set exposing (Set)
import UI
import UI.Click as Click
Expand Down Expand Up @@ -695,14 +700,14 @@ view linkedCfg toggleFoldMsg docFoldToggles document =
List.map viewMediaSource mediaSources

videoAttrs =
case Dict.get "poster" attrs of
Just poster_ ->
[ poster poster_ ]

Nothing ->
[]
[ Dict.get "poster" attrs |> Maybe.map poster
, Dict.get "controls" attrs |> Maybe.map (always (controls True))
, Dict.get "autoplay" attrs |> Maybe.map (always (autoplay True))
, Dict.get "muted" attrs |> Maybe.map (\_ -> attribute "muted" "muted")
, Dict.get "loop" attrs |> Maybe.map (always (loop True))
]
in
video videoAttrs sources
video (MaybeE.values videoAttrs) sources

FrontMatter _ ->
-- FrontMatter shouldn't be shown when rendered
Expand Down
6 changes: 3 additions & 3 deletions src/Code/Finder.elm
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,9 @@ isShowFinderKeyboardShortcut os shortcut =
KeyboardShortcut.Chord Meta (K _) ->
os == OperatingSystem.MacOS

{- Sequence _ ForwardSlash ->
True
-}
Sequence _ ForwardSlash ->
True

_ ->
False

Expand Down

0 comments on commit 250567c

Please sign in to comment.