feat: add macro video to embed various video URLs

This macro replaces `youtube`, `vimeo` and `bilibili` macros.
For backward compatibility, users can still use above macros,
but they can't access those commands from the commands menu anymore.
This commit is contained in:
llcc
2022-05-21 19:28:52 +08:00
committed by Tienson Qin
parent 2d8047de7f
commit 1fb3fdcf6d
5 changed files with 112 additions and 68 deletions

View File

@@ -2907,11 +2907,9 @@
(html-link-format! text)
(and (gp-util/url? text)
(or (string/includes? text "youtube.com")
(string/includes? text "youtu.be"))
(mobile-util/is-native-platform?))
(commands/simple-insert! (state/get-edit-input-id) (util/format "{{youtube %s}}" text) nil)
(boolean (text/get-matched-video text)))
(commands/simple-insert! (state/get-edit-input-id) (util/format "{{video %s}}" text) nil)
(and (gp-util/url? text)
(string/includes? text "twitter.com")
(mobile-util/is-native-platform?))