这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/live_svelte.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ defmodule LiveSvelte do
doc: "LiveJson props to pass to the Svelte component",
examples: [%{my_big_data_set: %{some_data: 1}}]

attr :nonce, :string,
default: nil,
doc: "Nonce value for Content Security Policy"

slot :inner_block, doc: "Inner block of the Svelte component"

slot(:loading,
Expand Down Expand Up @@ -91,7 +95,7 @@ defmodule LiveSvelte do

~H"""
<.live_json live_json_props={@live_json_props}>
<script>
<script nonce={@nonce}>
<%= raw(@ssr_render["head"]) %>
</script>
<div
Expand All @@ -108,7 +112,7 @@ defmodule LiveSvelte do
class={@class}
>
<%= raw(@ssr_render["head"]) %>
<style>
<style nonce={@nonce}>
<%= raw(@ssr_render["css"]["code"]) %>
</style>
<%= raw(@ssr_render["html"]) %>
Expand Down