mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 08:50:57 -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;
|
||||
}
|
||||
|
||||
&.error {
|
||||
border-color: $color-danger;
|
||||
}
|
||||
}
|
||||
|
||||
.input-select {
|
||||
|
|
|
@ -199,8 +199,20 @@
|
|||
|
||||
change-url
|
||||
(fn [event]
|
||||
(let [value (-> event dom/get-target dom/get-value)]
|
||||
(update-interaction index #(cti/set-url % value))))
|
||||
(let [target (dom/get-target event)
|
||||
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
|
||||
(fn [event]
|
||||
|
@ -287,7 +299,9 @@
|
|||
(when (cti/has-url interaction)
|
||||
[:div.interactions-element
|
||||
[: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}]])
|
||||
|
||||
(when (cti/has-overlay-opts interaction)
|
||||
|
|
|
@ -28,17 +28,6 @@
|
|||
[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
|
||||
|
||||
(defn set-html-title
|
||||
|
@ -294,10 +283,28 @@
|
|||
(defn get-root []
|
||||
(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]
|
||||
(let [class-list (.-classList ^js node)]
|
||||
(.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]
|
||||
(.contains ^js node2 ^js node1))
|
||||
|
||||
|
|
Loading…
Reference in a new issue