Reflect picked color automatically with a custom stream action
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import { Turbo } from "@hotwired/turbo-rails"
|
||||
|
||||
Turbo.StreamActions.set_css_variable = function() {
|
||||
const name = this.getAttribute("name")
|
||||
const value = this.getAttribute("value")
|
||||
|
||||
this.targetElements.forEach(element => element.style.setProperty(name, value))
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
import "initializers/current"
|
||||
import "initializers/custom_stream_actions"
|
||||
|
||||
Reference in New Issue
Block a user