一旦您安装了使用Docker部署TinyMCE超链接服务端组件,就需要对application.conf文件进行额外配置。(请记得在更新配置后重新启动Docker容器。)
增强型媒体嵌入服务允许您选择使用自己的Iframely账户、配置自定义oEmbed端点或同时使用两者。
当您在内容中插入媒体时,该服务将按以下顺序执行操作:
检查URL是否匹配任何自定义oEmbed配置。如果匹配失败,
如果已配置Iframely,则查询Iframely API。如果未配置Iframely,
创建摘要卡片。
使用您自己的Iframely账户
要使用您自己的Iframely账户,请提供以下配置项:
enabled- 设为true以使用Iframely。如果设为false,则无需提供base-url或api-key配置项。base-url- Iframely API的基础URL。如果不确定,请查阅他们的文档。api-key- 您的Iframely API密钥。这是在Iframely设置账户后由其提供的。
启用Iframely的示例(将xxx替换为您的Iframely API密钥):
ephox {
embed {
iframely {
enabled = true
base-url = "https://iframe.ly/api/iframely"
api-key = "xxx" // 将此处更改为您自己的Iframely API密钥
}
}
}禁用Iframely的示例:
ephox {
embed {
iframely {
enabled = false
}
}
}配置自定义端点
可以配置该服务,以便在插入与提供模式匹配的URL媒体时,请求特定的oEmbed端点。
endpoint- 当插入的媒体URL匹配schemes中的条目时,应查询的oEmbed端点URL。schemes- 按照oEmbed规范2.1节. 配置中定义的方案列表。请注意,HTTP和HTTPS是两个独立的方案。
示例说明:此配置仅作为示例提供。增强型媒体嵌入服务会将oEmbed响应转换为可嵌入的代码片段。该片段的内容和质量取决于oEmbed响应。
示例:
ephox {
embed {
custom = [
# youtube
{
endpoint = "http://www.youtube.com/oembed"
schemes = [
"http://youtu.be/*",
"https://youtu.be/*",
"http://www.youtu.be/*",
"https://www.youtu.be/*",
"http://youtube.com/*",
"https://youtube.com/*",
"http://www.youtube.com/*",
"https://www.youtube.com/*",
"http://m.youtube.com/*",
"https://m.youtube.com/*"
]
},
# NY Times
{
endpoint = "https://www.nytimes.com/svc/oembed/json/"
schemes = [
"http://www.nytimes.com/*",
"https://www.nytimes.com/*"
]
},
# Daily Motion
{
endpoint = "http://www.dailymotion.com/services/oembed"
schemes = [
"http://www.dailymotion.com/video/*"
"https://www.dailymotion.com/video/*"
"http://www.dailymotion.com/embed/video/*"
"https://www.dailymotion.com/embed/video/*"
]
},
# Soundcloud
{
endpoint = "http://soundcloud.com/oembed"
schemes = [
"http://soundcloud.com/*",
"https://soundcloud.com/*",
"http://api.soundcloud.com/tracks/*",
"https://api.soundcloud.com/tracks/*"
]
},
# Facebook post
{
endpoint = "https://www.facebook.com/plugins/post/oembed.json/"
schemes = [
"http://*.facebook.com/permalink.php*",
"https://*.facebook.com/permalink.php*",
"http://*.facebook.com/photo.php*",
"https://*.facebook.com/photo.php*",
"http://*.facebook.com/*/photos/*",
"https://*.facebook.com/*/photos/*",
"http://*.facebook.com/*/posts/*",
"https://*.facebook.com/*/posts/*",
"http://*.facebook.com/*/activity/*",
"https://*.facebook.com/*/activity/*",
"http://*.facebook.com/notes/*",
"https://*.facebook.com/media/set/*"
]
},
# Facebook Video
{
endpoint = "https://www.facebook.com/plugins/video/oembed.json/"
schemes = [
"http://www.facebook.com/video*",
"https://www.facebook.com/video*",
"http://www.facebook.com/*/videos/*",
"https://www.facebook.com/*/videos/*",
"http://business.facebook.com/video*",
"https://business.facebook.com/video*",
"http://business.facebook.com/*/videos/*",
"https://business.facebook.com/*/videos/*"
]
},
# Facebook Page
{
endpoint = "https://www.facebook.com/plugins/page/oembed.json/"
schemes = [
"http://www.facebook.com/*",
"https://www.facebook.com/*",
"http://m.facebook.com/*",
"https://m.facebook.com/*"
]
},
# Spotify
{
endpoint = "https://embed.spotify.com/oembed/"
schemes = [
"http://spotify.com/*",
"https://spotify.com/*",
"http://open.spotify.com/*",
"https://open.spotify.com/*",
"http://embed.spotify.com/*",
"https://embed.spotify.com/*",
"http://play.spotify.com/*",
"https://play.spotify.com/*"
]
},
# Hulu
{
endpoint = "http://www.hulu.com/api/oembed.json",
schemes = [
"http://www.hulu.com/watch/*",
"https://www.hulu.com/watch/*"
]
},
# Vimeo
{
endpoint = "http://vimeo.com/api/oembed.json",
schemes = [
"http://vimeo.com/*",
"https://vimeo.com/*",
"http://www.vimeo.com/*",
"https://www.vimeo.com/*"
]
},
# SmugMug
{
endpoint = "http://api.smugmug.com/services/oembed/"
schemes = [
"http://*.smugmug.com/*",
"https://*.smugmug.com/*"
]
},
# Slideshare
{
endpoint = "http://www.slideshare.net/api/oembed/2"
schemes = [
"http://*.slideshare.net/*"
]
},
# Wordpress
{
endpoint = "https://public-api.wordpress.com/oembed/?for=ephox"
schemes = [
"http://*.wordpress.com/*",
"https://*.wordpress.com/*"
]
},
# Meetup
{
endpoint = "https://api.meetup.com/oembed"
schemes = [
"http://www.meetup.com/*",
"https://www.meetup.com/*",
"http://meetup.com/*",
"https://meetup.com/*",
"http://meetu.ps/*",
"https://meetu.ps/*"
]
},
# Spotify
{
endpoint = "https://embed.spotify.com/oembed/"
schemes = [
"http://open.spotify.com/*",
"https://open.spotify.com/*",
"http://play.spotify.com/*",
"https://play.spotify.com/*"
]
},
# Tech crunch
{
endpoint = "http://public-api.wordpress.com/oembed/?for=ephox"
schemes = [
"http://techcrunch.com/*",
"https://techcrunch.com/*"
]
},
# Dotsub
{
endpoint = "https://dotsub.com/services/oembed"
schemes = [
"http://dotsub.com/view/*",
"https://dotsub.com/view/*"
]
},
# Speaker deck
{
endpoint = "https://speakerdeck.com/oembed.json"
schemes = [
"http://speakerdeck.com/*/*",
"https://speakerdeck.com/*/*"
]
},
# Tumblr
{
endpoint = "https://www.tumblr.com/oembed/1.0"
schemes = [
"http://*.tumblr.com/post/*",
"https://*.tumblr.com/post/*"
]
},
# Adobe Stock
{
endpoint = "https://stock.adobe.com/oembed"
schemes = [
"http://stock.adobe.com/*",
"https://stock.adobe.com/*"
]
},
# Code pen
{
endpoint = "https://codepen.io/api/oembed" schemes = [ "http://codepen.io/*/pen/*", "https://codepen.io/*/pen/*" ] }, # 500px { endpoint = "https://500px.com/oembed" schemes = [ "http://500px.com/photo/*", "https://500px.com/photo/*" ] } ] }}结合 Iframely 和自定义端点
也可以使用自定义 oEmbed 端点来配置 Iframely。例如,您可能希望使用 Iframely 来嵌入来自互联网的媒体,并使用内部 oEmbed 服务器来嵌入来自局域网的媒体。
示例(将 xxx 替换为您的 Iframely API 密钥):
ephox {
embed {
iframely {
enabled = true
base-url = "https://iframe.ly/api/iframely"
api-key = "xxx" // 将其更改为您自己的 Iframely API 密钥
},
custom = [
{
endpoint = "http://localhost:3000/oembed"
schemes = [
"http://intranet.example.com/*"
]
}
]
}
}摘要卡片
如果给定 URL 既没有配置 Iframely 也没有配置 oEmbed 端点,则会创建一个摘要卡片。
摘要卡片是一个可嵌入的代码片段,它是根据 Enhanced Media Embed 服务对 URL 内容的识别结果生成的。有关更多详细信息,请参阅 Enhanced Media Embed Server 的集成文档。