Merge branch 'staging' into develop

This commit is contained in:
Andrey Antukh 2022-10-31 10:44:15 +01:00
commit a85a65a554
15 changed files with 124 additions and 66 deletions

View file

@ -20,10 +20,19 @@
### :bug: Bugs fixed ### :bug: Bugs fixed
- Fix unexpected exception related to default nudge value
- Fix firefox changing layer color type is not applied [Taiga #4292](https://tree.taiga.io/project/penpot/issue/4292) - Fix firefox changing layer color type is not applied [Taiga #4292](https://tree.taiga.io/project/penpot/issue/4292)
- Fix justify alignes text left [Taiga #4322](https://tree.taiga.io/project/penpot/issue/4322) - Fix justify alignes text left [Taiga #4322](https://tree.taiga.io/project/penpot/issue/4322)
- Fix text out of borders with "auto width" and center align [Taiga #4308](https://tree.taiga.io/project/penpot/issue/4308) - Fix text out of borders with "auto width" and center align [Taiga #4308](https://tree.taiga.io/project/penpot/issue/4308)
- Fix wrong validation text after interaction with 2 and more files [Taiga #4276](https://tree.taiga.io/project/penpot/issue/4276)
- Fix auto-width for texts can make text appear stretched [Github #2482](https://github.com/penpot/penpot/issues/2482) - Fix auto-width for texts can make text appear stretched [Github #2482](https://github.com/penpot/penpot/issues/2482)
- Fix boards name do not disappear in focus mode [#4272](https://tree.taiga.io/project/penpot/issue/4272)
- Fix wrong email in the info message at change email [Taiga #4274](https://tree.taiga.io/project/penpot/issue/4274)
- Fix transform to path RMB menu item is not relevant if shape is already path [Taiga #4302](https://tree.taiga.io/project/penpot/issue/4302)
- Fix join nodes icon is active when 2 already joined nodes are selected [Taiga #4370](https://tree.taiga.io/project/penpot/issue/4370)
- Fix path nodes panel. "To curve" and "To corner" icons are active if node is already curved/cornered [Taiga #4371](https://tree.taiga.io/project/penpot/issue/4371)
- Fix displaying comments settings are not applied via "Comments" menu drop-down on the top navbar on view mode [Taiga #4389](https://tree.taiga.io/project/penpot/issue/4389)
- Fix bad behaviour on hovering and click nested artboards[Taiga #4018](https://tree.taiga.io/project/penpot/issue/4018) and [Taiga #4269](https://tree.taiga.io/project/penpot/us/4269)
## 1.16.0-beta ## 1.16.0-beta

View file

@ -288,7 +288,8 @@
props (-> (audit/extract-utm-params params) props (-> (audit/extract-utm-params params)
(merge (:props params)) (merge (:props params))
(merge {:viewed-tutorial? false (merge {:viewed-tutorial? false
:viewed-walkthrough? false}) :viewed-walkthrough? false
:nudge {:big 10 :small 1}})
(db/tjson)) (db/tjson))
password (if-let [password (:password params)] password (if-let [password (:password params)]

View file

@ -51,6 +51,10 @@
[{:keys [type]}] [{:keys [type]}]
(= type :svg-raw)) (= type :svg-raw))
(defn path-shape?
[{:keys [type]}]
(= type :path))
(defn unframed-shape? (defn unframed-shape?
"Checks if it's a non-frame shape in the top level." "Checks if it's a non-frame shape in the top level."
[shape] [shape]

View file

@ -183,11 +183,11 @@
(let [type-a (dm/get-in objects [id-a :type]) (let [type-a (dm/get-in objects [id-a :type])
type-b (dm/get-in objects [id-b :type])] type-b (dm/get-in objects [id-b :type])]
(cond (cond
(and bottom-frames? (= :frame type-a) (not= :frame type-b)) (and (= :frame type-a) (not= :frame type-b))
1 (if bottom-frames? 1 -1)
(and bottom-frames? (not= :frame type-a) (= :frame type-b)) (and (not= :frame type-a) (= :frame type-b))
-1 (if bottom-frames? -1 1)
(= id-a id-b) (= id-a id-b)
0 0

View file

@ -697,7 +697,7 @@
stopper (->> move-events stopper (->> move-events
(rx/debounce 100) (rx/debounce 100)
(rx/take 1)) (rx/take 1))
scale (if shift? (gpt/point (:big nudge)) (gpt/point (:small nudge))) scale (if shift? (gpt/point (or (:big nudge) 10)) (gpt/point (or (:small nudge) 1)))
mov-vec (gpt/multiply (get-displacement direction) scale)] mov-vec (gpt/multiply (get-displacement direction) scale)]
(rx/concat (rx/concat

View file

@ -82,12 +82,12 @@
on-duplicate on-duplicate
(fn [_] (fn [_]
(apply st/emit! (map dd/duplicate-file files)) (apply st/emit! (map dd/duplicate-file files))
(st/emit! (dm/success (tr "dashboard.success-duplicate-file")))) (st/emit! (dm/success (tr "dashboard.success-duplicate-file" (i18n/c (count files))))))
delete-fn delete-fn
(fn [_] (fn [_]
(apply st/emit! (map dd/delete-file files)) (apply st/emit! (map dd/delete-file files))
(st/emit! (dm/success (tr "dashboard.success-delete-file")))) (st/emit! (dm/success (tr "dashboard.success-delete-file" (i18n/c (count files))))))
on-delete on-delete
(fn [event] (fn [event]

View file

@ -52,20 +52,19 @@
(rx/throw error))) (rx/throw error)))
(defn- on-success (defn- on-success
[form data] [profile data]
(if (:changed data) (if (:changed data)
(st/emit! (du/fetch-profile) (st/emit! (du/fetch-profile)
(modal/hide)) (modal/hide))
(let [email (get-in @form [:clean-data :email-1]) (let [message (tr "notifications.validation-email-sent" (:email profile))]
message (tr "notifications.validation-email-sent" email)]
(st/emit! (dm/info message) (st/emit! (dm/info message)
(modal/hide))))) (modal/hide)))))
(defn- on-submit (defn- on-submit
[form _event] [profile form _event]
(let [params {:email (get-in @form [:clean-data :email-1])} (let [params {:email (get-in @form [:clean-data :email-1])}
mdata {:on-error (partial on-error form) mdata {:on-error (partial on-error form)
:on-success (partial on-success form)}] :on-success (partial on-success profile)}]
(st/emit! (du/request-email-change (with-meta params mdata))))) (st/emit! (du/request-email-change (with-meta params mdata)))))
(mf/defc change-email-modal (mf/defc change-email-modal
@ -77,7 +76,12 @@
:validators [email-equality] :validators [email-equality]
:initial profile) :initial profile)
on-close on-close
(mf/use-callback #(st/emit! (modal/hide)))] (mf/use-callback #(st/emit! (modal/hide)))
on-submit
(mf/use-callback
(mf/deps profile)
(partial on-submit profile))]
[:div.modal-overlay [:div.modal-overlay
[:div.modal-container.change-email-modal.form-container [:div.modal-container.change-email-modal.form-container

View file

@ -6,7 +6,6 @@
(ns app.main.ui.viewer.comments (ns app.main.ui.viewer.comments
(:require (:require
[app.common.data :as d]
[app.common.geom.matrix :as gmt] [app.common.geom.matrix :as gmt]
[app.common.geom.point :as gpt] [app.common.geom.point :as gpt]
[app.common.geom.shapes :as gsh] [app.common.geom.shapes :as gsh]
@ -27,21 +26,26 @@
{::mf/wrap [mf/memo] {::mf/wrap [mf/memo]
::mf/wrap-props false} ::mf/wrap-props false}
[] []
(let [local (mf/deref refs/comments-local) (let [{cmode :mode cshow :show show-sidebar? :show-sidebar?} (mf/deref refs/comments-local)
owner-filter (:owner-filter local)
status-filter (:status-filter local)
show-sidebar? (:show-sidebar? local)
show-dropdown? (mf/use-state false) show-dropdown? (mf/use-state false)
toggle-dropdown (mf/use-fn #(swap! show-dropdown? not)) toggle-dropdown (mf/use-fn #(swap! show-dropdown? not))
hide-dropdown (mf/use-fn #(reset! show-dropdown? false)) hide-dropdown (mf/use-fn #(reset! show-dropdown? false))
update-option (mf/use-fn update-mode
(fn [event] (mf/use-callback
(let [target (dom/get-current-target event) (fn [mode]
key (d/read-string (dom/get-attribute target "data-key")) (st/emit! (dcm/update-filters {:mode mode}))))
val (d/read-string (dom/get-attribute target "data-val"))]
(st/emit! (dcm/update-options {key val})))))] update-show
(mf/use-callback
(fn [mode]
(st/emit! (dcm/update-filters {:show mode}))))
update-options
(mf/use-callback
(fn [mode]
(st/emit! (dcm/update-options {:show-sidebar? mode}))))]
[:div.view-options {:on-click toggle-dropdown} [:div.view-options {:on-click toggle-dropdown}
[:span.label (tr "labels.comments")] [:span.label (tr "labels.comments")]
@ -50,34 +54,26 @@
:on-close hide-dropdown} :on-close hide-dropdown}
[:ul.dropdown.with-check [:ul.dropdown.with-check
[:li {:class (dom/classnames :selected (= :all owner-filter)) [:li {:class (dom/classnames :selected (or (= :all cmode) (nil? cmode)))
:data-key ":owner-filter" :on-click #(update-mode :all)}
:data-val ":all"
:on-click update-option}
[:span.icon i/tick] [:span.icon i/tick]
[:span.label (tr "labels.show-all-comments")]] [:span.label (tr "labels.show-all-comments")]]
[:li {:class (dom/classnames :selected (= :yours owner-filter)) [:li {:class (dom/classnames :selected (= :yours cmode))
:data-key ":owner-filter" :on-click #(update-mode :yours)}
:data-val ":yours"
:on-click update-option}
[:span.icon i/tick] [:span.icon i/tick]
[:span.label (tr "labels.show-your-comments")]] [:span.label (tr "labels.show-your-comments")]]
[:hr] [:hr]
[:li {:class (dom/classnames :selected (= :pending status-filter)) [:li {:class (dom/classnames :selected (= :pending cshow))
:data-key ":status-filter" :on-click #(update-show (if (= :pending cshow) :all :pending))}
:data-val (if (= :pending status-filter) ":all" ":pending")
:on-click update-option}
[:span.icon i/tick] [:span.icon i/tick]
[:span.label (tr "labels.hide-resolved-comments")]] [:span.label (tr "labels.hide-resolved-comments")]]
[:hr] [:hr]
[:li {:class (dom/classnames :selected show-sidebar?) [:li {:class (dom/classnames :selected show-sidebar?)
:data-key ":show-sidebar?" :on-click #(update-options (not show-sidebar?))}
:data-val (if show-sidebar? "false" "true")
:on-click update-option}
[:span.icon i/tick] [:span.icon i/tick]
[:span.label (tr "labels.show-comments-list")]]]]])) [:span.label (tr "labels.show-comments-list")]]]]]))

View file

@ -271,6 +271,7 @@
has-group? (->> shapes (d/seek cph/group-shape?)) has-group? (->> shapes (d/seek cph/group-shape?))
has-bool? (->> shapes (d/seek cph/bool-shape?)) has-bool? (->> shapes (d/seek cph/bool-shape?))
has-frame? (->> shapes (d/seek cph/frame-shape?)) has-frame? (->> shapes (d/seek cph/frame-shape?))
has-path? (->> shapes (d/seek cph/path-shape?))
is-group? (and single? has-group?) is-group? (and single? has-group?)
is-bool? (and single? has-bool?) is-bool? (and single? has-bool?)
@ -296,7 +297,7 @@
:shortcut (sc/get-tooltip :start-editing) :shortcut (sc/get-tooltip :start-editing)
:on-click do-start-editing}]) :on-click do-start-editing}])
(when-not (or disable-flatten? has-frame?) (when-not (or disable-flatten? has-frame? has-path?)
[:& menu-entry {:title (tr "workspace.shape.menu.transform-to-path") [:& menu-entry {:title (tr "workspace.shape.menu.transform-to-path")
:on-click do-transform-to-path}]) :on-click do-transform-to-path}])

View file

@ -330,7 +330,8 @@
:show-artboard-names? show-artboard-names? :show-artboard-names? show-artboard-names?
:on-frame-enter on-frame-enter :on-frame-enter on-frame-enter
:on-frame-leave on-frame-leave :on-frame-leave on-frame-leave
:on-frame-select on-frame-select}] :on-frame-select on-frame-select
:focus focus}]
(when show-prototypes? (when show-prototypes?
[:& widgets/frame-flows [:& widgets/frame-flows

View file

@ -17,15 +17,22 @@
(defn check-enabled [content selected-points] (defn check-enabled [content selected-points]
(let [segments (upt/get-segments content selected-points) (let [segments (upt/get-segments content selected-points)
num-segments (count segments)
num-points (count selected-points) num-points (count selected-points)
points-selected? (seq selected-points) points-selected? (seq selected-points)
segments-selected? (seq segments)] segments-selected? (seq segments)
{:make-corner points-selected? ;; max segments for n points is (n × (n -1)) / 2
:make-curve points-selected? max-segments (-> num-points
(* (- num-points 1))
(/ 2))
is-curve? (some #(upt/is-curve? content %) selected-points)]
{:make-corner (and points-selected? is-curve?)
:make-curve (and points-selected? (not is-curve?))
:add-node segments-selected? :add-node segments-selected?
:remove-node points-selected? :remove-node points-selected?
:merge-nodes segments-selected? :merge-nodes segments-selected?
:join-nodes (and points-selected? (>= num-points 2)) :join-nodes (and points-selected? (>= num-points 2) (< num-segments max-segments))
:separate-nodes segments-selected?})) :separate-nodes segments-selected?}))
(mf/defc path-actions [{:keys [shape]}] (mf/defc path-actions [{:keys [shape]}]

View file

@ -163,11 +163,15 @@
on-frame-enter (unchecked-get props "on-frame-enter") on-frame-enter (unchecked-get props "on-frame-enter")
on-frame-leave (unchecked-get props "on-frame-leave") on-frame-leave (unchecked-get props "on-frame-leave")
on-frame-select (unchecked-get props "on-frame-select") on-frame-select (unchecked-get props "on-frame-select")
frames (ctt/get-frames objects)] frames (ctt/get-frames objects)
focus (unchecked-get props "focus")]
[:g.frame-titles [:g.frame-titles
(for [frame frames] (for [frame frames]
(when (= (:parent-id frame) uuid/zero) (when (and
(= (:parent-id frame) uuid/zero)
(or (empty? focus)
(contains? focus (:id frame))))
[:& frame-title {:key (dm/str "frame-title-" (:id frame)) [:& frame-title {:key (dm/str "frame-title-" (:id frame))
:frame frame :frame frame
:selected? (contains? selected (:id frame)) :selected? (contains? selected (:id frame))

View file

@ -74,6 +74,13 @@
(assoc-in [:params :c2x] (:x h2)) (assoc-in [:params :c2x] (:x h2))
(assoc-in [:params :c2y] (:y h2))))) (assoc-in [:params :c2y] (:y h2)))))
(defn is-curve?
[content point]
(let [handlers (-> (upc/content->handlers content)
(get point))
handler-points (map #(upc/handler->point content (first %) (second %)) handlers)]
(some #(not= point %) handler-points)))
(defn make-curve-point (defn make-curve-point
"Changes the content to make the point a 'curve'. The handlers will be positioned "Changes the content to make the point a 'curve'. The handlers will be positioned
in the same vector that results from the previous->next points but with fixed length." in the same vector that results from the previous->next points but with fixed length."
@ -99,7 +106,6 @@
:next-p (upc/command->point next) :next-p (upc/command->point next)
:command cmd))))) :command cmd)))))
points (->> vectors (mapcat #(vector (:next-p %) (:prev-p %))) (remove nil?) (into #{}))] points (->> vectors (mapcat #(vector (:next-p %) (:prev-p %))) (remove nil?) (into #{}))]
(cond (cond
@ -124,8 +130,7 @@
next-correction (when (some? next-h) (gpt/scale (gpt/to-vec next-h point) (/ 1 3))) next-correction (when (some? next-h) (gpt/scale (gpt/to-vec next-h point) (/ 1 3)))
prev-h (when (some? prev-h) (gpt/add prev-h prev-correction)) prev-h (when (some? prev-h) (gpt/add prev-h prev-correction))
next-h (when (some? next-h) (gpt/add next-h next-correction)) next-h (when (some? next-h) (gpt/add next-h next-correction))]
]
(cond-> content (cond-> content
(and (= :line-to (:command cur-cmd)) (some? prev-p)) (and (= :line-to (:command cur-cmd)) (some? prev-p))
(update index upc/update-curve-to prev-p prev-h) (update index upc/update-curve-to prev-p prev-h)
@ -147,7 +152,13 @@
(= :line-to (:command command)) (= :line-to (:command command))
(update index #(line->curve prev-p %)) (update index #(line->curve prev-p %))
(= :curve-to (:command command))
(update index #(line->curve prev-p %))
(= :line-to (:command next-c)) (= :line-to (:command next-c))
(update next-i #(line->curve point %))
(= :curve-to (:command next-c))
(update next-i #(line->curve point %))))] (update next-i #(line->curve point %))))]
(->> vectors (reduce add-curve content)))))) (->> vectors (reduce add-curve content))))))

View file

@ -591,7 +591,9 @@ msgstr "Show all files"
#: src/app/main/ui/dashboard/file_menu.cljs #: src/app/main/ui/dashboard/file_menu.cljs
msgid "dashboard.success-delete-file" msgid "dashboard.success-delete-file"
msgstr "Your file has been deleted successfully" msgid_plural "dashboard.success-delete-file"
msgstr[0] "Your file has been deleted successfully"
msgstr[1] "Your files have been deleted successfully"
#: src/app/main/ui/dashboard/project_menu.cljs #: src/app/main/ui/dashboard/project_menu.cljs
msgid "dashboard.success-delete-project" msgid "dashboard.success-delete-project"
@ -599,7 +601,9 @@ msgstr "Your project has been deleted successfully"
#: src/app/main/ui/dashboard/file_menu.cljs #: src/app/main/ui/dashboard/file_menu.cljs
msgid "dashboard.success-duplicate-file" msgid "dashboard.success-duplicate-file"
msgstr "Your file has been duplicated successfully" msgid_plural "dashboard.success-delete-file"
msgstr[0] "Your file has been duplicated successfully"
msgstr[1] "Your files have been duplicated successfully"
#: src/app/main/ui/dashboard/project_menu.cljs #: src/app/main/ui/dashboard/project_menu.cljs
msgid "dashboard.success-duplicate-project" msgid "dashboard.success-duplicate-project"
@ -4288,3 +4292,15 @@ msgstr "There are updates in shared libraries"
#: src/app/main/data/workspace/libraries.cljs #: src/app/main/data/workspace/libraries.cljs
msgid "workspace.updates.update" msgid "workspace.updates.update"
msgstr "Update" msgstr "Update"
msgid "workspace.viewport.click-to-close-path"
msgstr "Click to close the path"
msgid "errors.profile-blocked"
msgstr "The profile is blocked"
msgid "errors.bad-font"
msgstr "The font %s could not be loaded"
msgid "errors.bad-font-plural"
msgstr "The fonts %s could not be loaded"

View file

@ -628,7 +628,9 @@ msgstr "Ver todos los archivos"
#: src/app/main/ui/dashboard/file_menu.cljs #: src/app/main/ui/dashboard/file_menu.cljs
msgid "dashboard.success-delete-file" msgid "dashboard.success-delete-file"
msgstr "Tu archivo ha sido borrado con éxito" msgid_plural "dashboard.success-delete-file"
msgstr[0] "Tu archivo ha sido borrado con éxito"
msgstr[1] "Tus archivos han sido borrado con éxito"
#: src/app/main/ui/dashboard/project_menu.cljs #: src/app/main/ui/dashboard/project_menu.cljs
msgid "dashboard.success-delete-project" msgid "dashboard.success-delete-project"
@ -636,7 +638,9 @@ msgstr "Tu proyecto ha sido borrado con éxito"
#: src/app/main/ui/dashboard/file_menu.cljs #: src/app/main/ui/dashboard/file_menu.cljs
msgid "dashboard.success-duplicate-file" msgid "dashboard.success-duplicate-file"
msgstr "Tu archivo ha sido duplicado con éxito" msgid_plural "dashboard.success-delete-file"
msgstr[0] "Tu archivo ha sido duplicado con éxito"
msgstr[1] "Tus archivos han sido duplicado con éxito"
#: src/app/main/ui/dashboard/project_menu.cljs #: src/app/main/ui/dashboard/project_menu.cljs
msgid "dashboard.success-duplicate-project" msgid "dashboard.success-duplicate-project"