From 396cbb27b26ab801eb99fbd0f92bce977d61bf0c Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Thu, 5 Sep 2024 16:00:04 +0200 Subject: [PATCH] :bug: Fix plugins add interaction --- frontend/src/app/plugins/parser.cljs | 17 ++++++++--------- frontend/src/app/plugins/shape.cljs | 4 ++-- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/plugins/parser.cljs b/frontend/src/app/plugins/parser.cljs index 119c71bd3..fad9c55bf 100644 --- a/frontend/src/app/plugins/parser.cljs +++ b/frontend/src/app/plugins/parser.cljs @@ -450,20 +450,20 @@ (d/without-nils (case animation-type :dissolve - {:type animation-type + {:animation-type animation-type :duration (obj/get animation "duration") :easing (-> (obj/get animation "easing") parse-keyword)} :slide - {:type animation-type + {:animation-type animation-type :way (-> (obj/get animation "way") parse-keyword) :direction (-> (obj/get animation "direction") parse-keyword) :duration (obj/get animation "duration") :easing (-> (obj/get animation "easing") parse-keyword) - :offset-effect (obj/get animation "offsetEffect")} + :offset-effect (boolean (obj/get animation "offsetEffect"))} :push - {:type animation-type + {:animation-type animation-type :direction (-> (obj/get animation "direction") parse-keyword) :duration (obj/get animation "duration") :easing (-> (obj/get animation "easing") parse-keyword)} @@ -563,10 +563,9 @@ nil))))) (defn parse-interaction - [^js interaction] - (when interaction - (let [trigger (-> (obj/get interaction "trigger") parse-keyword) - delay (obj/get interaction "trigger") - action (-> (obj/get interaction "action") parse-action)] + [trigger ^js action delay] + (when (and (string? trigger) (some? action)) + (let [trigger (parse-keyword trigger) + action (parse-action action)] (d/without-nils (d/patch-object {:event-type trigger :delay delay} action))))) diff --git a/frontend/src/app/plugins/shape.cljs b/frontend/src/app/plugins/shape.cljs index f853116e6..809ff4edd 100644 --- a/frontend/src/app/plugins/shape.cljs +++ b/frontend/src/app/plugins/shape.cljs @@ -551,10 +551,10 @@ ;; Interactions (addInteraction - [self interaction] + [self trigger action delay] (let [interaction (-> ctsi/default-interaction - (d/patch-object (parser/parse-interaction interaction)))] + (d/patch-object (parser/parse-interaction trigger action delay)))] (cond (not (sm/validate ::ctsi/interaction interaction)) (u/display-not-valid :addInteraction interaction)