Skip to content

Commit efb6d5d

Browse files
committed
Update syntax highlight css tag usage for dynamic preview
1 parent 564011b commit efb6d5d

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
<%#= vite_stylesheet_tag "entrypoints/code/dracula.css", media: "all", "data-turbo-track": "reload" %>
2-
<%= stylesheet_link_tag find_syntax_highlight.asset_path, media: "all", "data-turbo-track": "reload" %>
1+
<%= stylesheet_link_tag find_syntax_highlight.asset_path, media: "all", data: { turbo_track: "reload", syntax_highlight: find_syntax_highlight.name } %>

app/views/settings/syntax_highlights/form.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ def initialize(current_highlight:, available_highlights:)
1111
end
1212

1313
def view_template
14-
div(class: "grid grid-content") do
15-
# if @current_highlight != Settings::SyntaxHighlight.default
16-
stylesheet_link_tag @current_highlight.asset_path
17-
# end
14+
stylesheet_link_tag @current_highlight.asset_path, data: {syntax_highlight: @current_highlight.name}
1815

16+
div(class: "grid grid-content", data: {controller: "syntax-highlight-preview", syntax_highlight_preview_name_value: @current_highlight.name}) do
1917
p {
2018
plain %(Current syntax highlight style:)
2119
strong { @current_highlight.name }

0 commit comments

Comments
 (0)