mirror of https://github.com/logseq/logseq
commands: add vimeo video embed block command
parent
55265f1657
commit
dfb0ff6bd3
|
@ -138,6 +138,10 @@
|
|||
|
||||
["Embed Youtube Video" [[:editor/input "{{youtube }}" {:last-pattern slash
|
||||
:backward-pos 2}]]]
|
||||
|
||||
["Embed Vimeo Video" [[:editor/input "{{vimeo }}" {:last-pattern slash
|
||||
:backward-pos 2}]]]
|
||||
|
||||
["Html Inline " (->inline "html")]
|
||||
|
||||
;; TODO:
|
||||
|
|
|
@ -800,6 +800,23 @@
|
|||
:height height
|
||||
:width width}])))))
|
||||
|
||||
(= name "vimeo")
|
||||
(let [url (first arguments)]
|
||||
(let [Vimeo-regex #"^((?:https?:)?//)?((?:www).)?((?:player.vimeo.com|vimeo.com)?)((?:/video/)?)([\w-]+)(\S+)?$"]
|
||||
(when-let [vimeo-id (nth (re-find Vimeo-regex url) 5)]
|
||||
(when-not (string/blank? vimeo-id)
|
||||
(let [width (min (- (util/get-width) 96)
|
||||
560)
|
||||
height (int (* width (/ 315 560)))]
|
||||
[:iframe
|
||||
{:allow-full-screen "allowfullscreen"
|
||||
:allow
|
||||
"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
||||
:frame-border "0"
|
||||
:src (str "https://player.vimeo.com/video/" vimeo-id)
|
||||
:height height
|
||||
:width width}])))))
|
||||
|
||||
;; TODO: support fullscreen mode, maybe we need a fullscreen dialog?
|
||||
(= name "bilibili")
|
||||
(let [url (first arguments)
|
||||
|
|
Loading…
Reference in New Issue