Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf9d2f29

Browse files
authored
Merge pull request#205 from increments/add-figma-script-host
Add new figma embed script host embed.figma.com
2 parents442ef3f +eefe2a8 commitf9d2f29

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

‎lib/qiita/markdown/embed/figma.rb‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ module Qiita
44
moduleMarkdown
55
moduleEmbed
66
moduleFigma
7-
SCRIPT_HOST="www.figma.com"
7+
SCRIPT_HOSTS=[
8+
"www.figma.com",
9+
"embed.figma.com",
10+
].freeze
811
end
912
end
1013
end

‎lib/qiita/markdown/transformers/filter_iframe.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class FilterIframe
99
Embed::SlideShare::SCRIPT_HOST,
1010
Embed::GoogleSlide::SCRIPT_HOST,
1111
Embed::Docswell::SCRIPT_HOSTS,
12-
Embed::Figma::SCRIPT_HOST,
12+
Embed::Figma::SCRIPT_HOSTS,
1313
Embed::GoogleDrive::SCRIPT_HOST,
1414
Embed::StackBlitz::SCRIPT_HOST,
1515
Embed::BlueprintUe::SCRIPT_HOST,

‎spec/qiita/markdown/processor_spec.rb‎

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,25 +1632,33 @@
16321632

16331633
context"with HTML embed code for Figma"do
16341634
shared_examples"embed code figma example"do
1635-
let(:markdown)do
1636-
<<-MARKDOWN.strip_heredoc
1637-
<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="100" height="100" src="#{url}"></iframe>
1638-
MARKDOWN
1639-
end
1640-
let(:url){"#{scheme}//www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com"}
1641-
let(:encoded_url){CGI.escapeHTML(url)}
1635+
[
1636+
"www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com",
1637+
"embed.figma.com/design/nrPSsILSYjesyc5UHjYYa4?embed_host=share",
1638+
].eachdo |script_url|
1639+
context"with HTML embed code for Figma using script url `#{script_url}`"do
1640+
let(:markdown)do
1641+
<<-MARKDOWN.strip_heredoc
1642+
<iframe style="border: 1px solid rgba(0, 0, 0, 0.1);" width="100" height="100" src="#{url}"></iframe>
1643+
MARKDOWN
1644+
end
16421645

1643-
ifallowed
1644-
it"does not sanitize embed code"do
1645-
shouldeq<<-HTML.strip_heredoc
1646-
<iframestyle="border: 1px solid rgba(0, 0, 0, 0.1);"width="100"height="100"src="#{encoded_url}"></iframe>
1647-
HTML
1648-
end
1649-
else
1650-
it"forces width attribute on iframe"do
1651-
shouldeq<<-HTML.strip_heredoc
1652-
<iframestyle="border: 1px solid rgba(0, 0, 0, 0.1);"width="100%"height="100"src="#{encoded_url}"></iframe>
1653-
HTML
1646+
let(:url){"#{scheme}//#{script_url}"}
1647+
let(:encoded_url){CGI.escapeHTML(url)}
1648+
1649+
ifallowed
1650+
it"does not sanitize embed code"do
1651+
shouldeq<<-HTML.strip_heredoc
1652+
<iframestyle="border: 1px solid rgba(0, 0, 0, 0.1);"width="100"height="100"src="#{encoded_url}"></iframe>
1653+
HTML
1654+
end
1655+
else
1656+
it"forces width attribute on iframe"do
1657+
shouldeq<<-HTML.strip_heredoc
1658+
<iframestyle="border: 1px solid rgba(0, 0, 0, 0.1);"width="100%"height="100"src="#{encoded_url}"></iframe>
1659+
HTML
1660+
end
1661+
end
16541662
end
16551663
end
16561664
end

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp