mirror of
https://github.com/penpot/penpot.git
synced 2025-01-26 08:29:42 -05:00
Merge branch 'main' into develop
This commit is contained in:
commit
bce0e9194c
3 changed files with 38 additions and 14 deletions
|
@ -207,6 +207,9 @@
|
||||||
border-color: $color-gray-40;
|
border-color: $color-gray-40;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.error {
|
||||||
|
border-color: $color-danger;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-select {
|
.input-select {
|
||||||
|
|
|
@ -199,8 +199,20 @@
|
||||||
|
|
||||||
change-url
|
change-url
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(let [value (-> event dom/get-target dom/get-value)]
|
(let [target (dom/get-target event)
|
||||||
(update-interaction index #(cti/set-url % value))))
|
value (dom/get-value target)
|
||||||
|
has-prefix? (or (str/starts-with? value "http://")
|
||||||
|
(str/starts-with? value "https://"))
|
||||||
|
value (if has-prefix?
|
||||||
|
value
|
||||||
|
(str "http://" value))]
|
||||||
|
(when-not has-prefix?
|
||||||
|
(dom/set-value! target value))
|
||||||
|
(if (dom/valid? target)
|
||||||
|
(do
|
||||||
|
(dom/remove-class! target "error")
|
||||||
|
(update-interaction index #(cti/set-url % value)))
|
||||||
|
(dom/add-class! target "error"))))
|
||||||
|
|
||||||
change-overlay-pos-type
|
change-overlay-pos-type
|
||||||
(fn [event]
|
(fn [event]
|
||||||
|
@ -287,7 +299,9 @@
|
||||||
(when (cti/has-url interaction)
|
(when (cti/has-url interaction)
|
||||||
[:div.interactions-element
|
[:div.interactions-element
|
||||||
[:span.element-set-subtitle.wide (tr "workspace.options.interaction-url")]
|
[:span.element-set-subtitle.wide (tr "workspace.options.interaction-url")]
|
||||||
[:input.input-text {:default-value (str (:url interaction))
|
[:input.input-text {:type "url"
|
||||||
|
:placeholder "http://example.com"
|
||||||
|
:default-value (str (:url interaction))
|
||||||
:on-blur change-url}]])
|
:on-blur change-url}]])
|
||||||
|
|
||||||
(when (cti/has-overlay-opts interaction)
|
(when (cti/has-overlay-opts interaction)
|
||||||
|
|
|
@ -28,17 +28,6 @@
|
||||||
[e]
|
[e]
|
||||||
(.-target e))
|
(.-target e))
|
||||||
|
|
||||||
(defn classnames
|
|
||||||
[& params]
|
|
||||||
(assert (even? (count params)))
|
|
||||||
(str/join " " (reduce (fn [acc [k v]]
|
|
||||||
(if (true? (boolean v))
|
|
||||||
(conj acc (name k))
|
|
||||||
acc))
|
|
||||||
[]
|
|
||||||
(partition 2 params))))
|
|
||||||
|
|
||||||
|
|
||||||
;; --- New methods
|
;; --- New methods
|
||||||
|
|
||||||
(defn set-html-title
|
(defn set-html-title
|
||||||
|
@ -294,10 +283,28 @@
|
||||||
(defn get-root []
|
(defn get-root []
|
||||||
(query globals/document "#app"))
|
(query globals/document "#app"))
|
||||||
|
|
||||||
|
(defn classnames
|
||||||
|
[& params]
|
||||||
|
(assert (even? (count params)))
|
||||||
|
(str/join " " (reduce (fn [acc [k v]]
|
||||||
|
(if (true? (boolean v))
|
||||||
|
(conj acc (name k))
|
||||||
|
acc))
|
||||||
|
[]
|
||||||
|
(partition 2 params))))
|
||||||
|
|
||||||
(defn ^boolean class? [node class-name]
|
(defn ^boolean class? [node class-name]
|
||||||
(let [class-list (.-classList ^js node)]
|
(let [class-list (.-classList ^js node)]
|
||||||
(.contains ^js class-list class-name)))
|
(.contains ^js class-list class-name)))
|
||||||
|
|
||||||
|
(defn add-class! [node class-name]
|
||||||
|
(let [class-list (.-classList ^js node)]
|
||||||
|
(.add ^js class-list class-name)))
|
||||||
|
|
||||||
|
(defn remove-class! [node class-name]
|
||||||
|
(let [class-list (.-classList ^js node)]
|
||||||
|
(.remove ^js class-list class-name)))
|
||||||
|
|
||||||
(defn child? [node1 node2]
|
(defn child? [node1 node2]
|
||||||
(.contains ^js node2 ^js node1))
|
(.contains ^js node2 ^js node1))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue