diff --git a/CHANGES.md b/CHANGES.md index 079eb6291..7ee9836bd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -67,6 +67,13 @@ - Fix close overlay from a nested board [Taiga #5587](https://tree.taiga.io/project/penpot/issue/5587) - Fix overlay position when it has shadow or blur [Taiga #4752](https://tree.taiga.io/project/penpot/issue/4752) - Fix overlay position when there are elements fixed when scrolling [Taiga #4383](https://tree.taiga.io/project/penpot/issue/4383) +- Fix problem when sliding color picker in selected-colors [#3150](https://github.com/penpot/penpot/issues/3150) +- Fix error screen on upload image error [Taiga #5608](https://tree.taiga.io/project/penpot/issue/5608) +- Fix bad frame-id for certain componentes [#3205](https://github.com/penpot/penpot/issues/3205) +- Fix paste elements at bottom of frame [Taig #5253](https://tree.taiga.io/project/penpot/issue/5253) +- Fix new-file button on project not redirecting to the new file [Taiga #5610](https://tree.taiga.io/project/penpot/issue/5610) +- Fix retrieve user comments in dashboard [Taiga #5607](https://tree.taiga.io/project/penpot/issue/5607) +- Locks shapes when moved inside a locked parent [Taiga #5252](https://tree.taiga.io/project/penpot/issue/5252) ### :arrow_up: Deps updates diff --git a/common/src/app/common/file_builder.cljc b/common/src/app/common/file_builder.cljc index f8faff235..9903d0f9f 100644 --- a/common/src/app/common/file_builder.cljc +++ b/common/src/app/common/file_builder.cljc @@ -341,13 +341,15 @@ :else (let [objects (lookup-objects file) + bool-content (gsh/calc-bool-content bool objects) bool' (gsh/update-bool-selrect bool children objects)] (commit-change file {:type :mod-obj :id bool-id :operations - [{:type :set :attr :selrect :val (:selrect bool') :ignore-touched true} + [{:type :set :attr :bool-content :val bool-content :ignore-touched true} + {:type :set :attr :selrect :val (:selrect bool') :ignore-touched true} {:type :set :attr :points :val (:points bool') :ignore-touched true} {:type :set :attr :x :val (-> bool' :selrect :x) :ignore-touched true} {:type :set :attr :y :val (-> bool' :selrect :y) :ignore-touched true} diff --git a/common/src/app/common/pages/common.cljc b/common/src/app/common/pages/common.cljc index 49e922632..e0443616b 100644 --- a/common/src/app/common/pages/common.cljc +++ b/common/src/app/common/pages/common.cljc @@ -12,7 +12,7 @@ [app.common.schema :as sm] [app.common.uuid :as uuid])) -(def file-version 20) +(def file-version 21) (def default-color clr/gray-20) (def root uuid/zero) diff --git a/common/src/app/common/pages/migrations.cljc b/common/src/app/common/pages/migrations.cljc index 510423710..72205dd4c 100644 --- a/common/src/app/common/pages/migrations.cljc +++ b/common/src/app/common/pages/migrations.cljc @@ -436,7 +436,7 @@ (update :pages-index update-vals update-container) (update :components update-vals update-container)))) -(defmethod migrate 20 +(defmethod migrate 21 [data] (letfn [(update-object [objects object] (let [frame-id (:frame-id object) diff --git a/frontend/src/app/main/data/comments.cljs b/frontend/src/app/main/data/comments.cljs index 65f409178..225ddae8b 100644 --- a/frontend/src/app/main/data/comments.cljs +++ b/frontend/src/app/main/data/comments.cljs @@ -314,9 +314,18 @@ (ptk/reify ::retrieve-unread-comment-threads ptk/WatchEvent (watch [_ _ _] - (let [fetched #(assoc %2 :comment-threads (d/index-by :id %1))] + (let [fetched-comments #(assoc %2 :comment-threads (d/index-by :id %1)) + fetched-users #(assoc %2 :current-team-comments-users %1)] (->> (rp/cmd! :get-unread-comment-threads {:team-id team-id}) - (rx/map #(partial fetched %)) + (rx/merge-map + (fn [comments] + (rx/concat + (rx/of (partial fetched-comments comments)) + + (->> (rx/from (map :file-id comments)) + (rx/merge-map #(rp/cmd! :get-profiles-for-file-comments {:file-id %})) + (rx/reduce #(merge %1 (d/index-by :id %2)) {}) + (rx/map #(partial fetched-users %)))))) (rx/catch #(rx/throw {:type :comment-error}))))))) diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index 704332767..95050c190 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -717,17 +717,18 @@ groups-to-delete groups-to-unmask shapes-to-detach shapes-to-reroot shapes-to-deroot shapes-to-unconstraint] (let [ordered-indexes (cph/order-by-indexed-shapes objects ids) - shapes (map (d/getf objects) ordered-indexes)] + shapes (map (d/getf objects) ordered-indexes) + parent (get objects parent-id)] (-> (pcb/empty-changes it page-id) (pcb/with-objects objects) ;; Remove layout-item properties when moving a shape outside a layout - (cond-> (not (ctl/any-layout? objects parent-id)) + (cond-> (not (ctl/any-layout? parent)) (pcb/update-shapes ordered-indexes ctl/remove-layout-item-data)) ;; Remove the hide in viewer flag - (cond-> (and (not= uuid/zero parent-id) (cph/frame-shape? objects parent-id)) + (cond-> (and (not= uuid/zero parent-id) (cph/frame-shape? parent)) (pcb/update-shapes ordered-indexes #(cond-> % (cph/frame-shape? %) (assoc :hide-in-viewer true)))) ;; Move the shapes @@ -759,8 +760,7 @@ ;; Reset constraints depending on the new parent (pcb/update-shapes shapes-to-unconstraint (fn [shape] - (let [parent (get objects parent-id) - frame-id (if (= (:type parent) :frame) + (let [frame-id (if (= (:type parent) :frame) (:id parent) (:frame-id parent)) moved-shape (assoc shape @@ -783,6 +783,10 @@ (assoc :layout-item-v-sizing :fix)) parent))) + ;; If parent locked, lock the added shapes + (cond-> (:blocked parent) + (pcb/update-shapes ordered-indexes #(assoc % :blocked true))) + ;; Resize parent containers that need to (pcb/resize-parents parents)))) @@ -1694,7 +1698,8 @@ [(:frame-id base) parent-id delta index]) ;; Paste inside selected frame otherwise - (let [origin-frame-id (:frame-id first-selected-obj) + (let [selected-frame-obj (get page-objects (first page-selected)) + origin-frame-id (:frame-id first-selected-obj) origin-frame-object (get page-objects origin-frame-id) margin-x (-> (- (:width origin-frame-object) (+ (:x wrapper) (:width wrapper))) @@ -1720,7 +1725,7 @@ ;; - Align it to the limits on the x and y axis ;; - Respect the distance of the object to the right and bottom in the original frame (gpt/point paste-x paste-y))] - [frame-id frame-id delta])) + [frame-id frame-id delta (dec (count (:shapes selected-frame-obj )))])) (empty? page-selected) (let [frame-id (ctst/top-nested-frame page-objects mouse-pos) diff --git a/frontend/src/app/main/data/workspace/media.cljs b/frontend/src/app/main/data/workspace/media.cljs index 424899ad8..b7226dd99 100644 --- a/frontend/src/app/main/data/workspace/media.cljs +++ b/frontend/src/app/main/data/workspace/media.cljs @@ -181,7 +181,9 @@ (on-error error) :else - (rx/throw error))))] + (do + (.error js/console "ERROR" error) + (rx/of (msg/error (tr "errors.cannot-upload")))))))] (ptk/reify ::process-media-objects ptk/WatchEvent diff --git a/frontend/src/app/main/refs.cljs b/frontend/src/app/main/refs.cljs index bcb78e7a4..7f7e4bc75 100644 --- a/frontend/src/app/main/refs.cljs +++ b/frontend/src/app/main/refs.cljs @@ -459,6 +459,9 @@ (def current-file-comments-users (l/derived :current-file-comments-users st/state)) +(def current-team-comments-users + (l/derived :current-team-comments-users st/state)) + (def viewer-fullscreen? (l/derived (fn [state] (dm/get-in state [:viewer-local :fullscreen?])) diff --git a/frontend/src/app/main/ui/dashboard/comments.cljs b/frontend/src/app/main/ui/dashboard/comments.cljs index c03518fb9..2da270779 100644 --- a/frontend/src/app/main/ui/dashboard/comments.cljs +++ b/frontend/src/app/main/ui/dashboard/comments.cljs @@ -32,7 +32,7 @@ show-dropdown (mf/use-fn #(reset! show-dropdown? true)) hide-dropdown (mf/use-fn #(reset! show-dropdown? false)) threads-map (mf/deref refs/comment-threads) - users (mf/deref refs/current-file-comments-users) + users (mf/deref refs/current-team-comments-users) tgroups (->> (vals threads-map) (sort-by :modified-at) diff --git a/frontend/src/app/main/ui/dashboard/files.cljs b/frontend/src/app/main/ui/dashboard/files.cljs index b7d9426cf..1ad4e9ada 100644 --- a/frontend/src/app/main/ui/dashboard/files.cljs +++ b/frontend/src/app/main/ui/dashboard/files.cljs @@ -18,6 +18,7 @@ [app.util.dom :as dom] [app.util.i18n :as i18n :refer [tr]] [app.util.keyboard :as kbd] + [app.util.router :as rt] [app.util.webapi :as wapi] [beicon.core :as rx] [cuerdas.core :as str] @@ -142,12 +143,22 @@ (sort-by :modified-at) (reverse))) + on-file-created + (mf/use-fn + (fn [data] + (let [pparams {:project-id (:project-id data) + :file-id (:id data)} + qparams {:page-id (get-in data [:data :pages 0])}] + (st/emit! (rt/nav :workspace pparams qparams))))) + create-file (mf/use-fn (mf/deps project) (fn [origin] - (st/emit! (with-meta (dd/create-file {:project-id (:id project)}) - {::ev/origin origin}))))] + (let [mdata {:on-success on-file-created} + params {:project-id (:id project)}] + (st/emit! (-> (dd/create-file (with-meta params mdata)) + (with-meta {::ev/origin origin}))))))] (mf/with-effect [] (let [node (mf/ref-val rowref) diff --git a/frontend/src/app/main/ui/workspace/left_toolbar.cljs b/frontend/src/app/main/ui/workspace/left_toolbar.cljs index c0b4bce21..6439725af 100644 --- a/frontend/src/app/main/ui/workspace/left_toolbar.cljs +++ b/frontend/src/app/main/ui/workspace/left_toolbar.cljs @@ -85,7 +85,7 @@ dw/clear-edition-mode) ;; Delay so anything that launched :interrupt can finish - (st/emit! 100 (dw/select-for-drawing tool))))) + (ts/schedule 100 #(st/emit! (dw/select-for-drawing tool)))))) toggle-text-palette (mf/use-fn diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs index 857e60da5..333103028 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/color_selection.cljs @@ -75,7 +75,7 @@ (d/without-nils {:color (str/lower (dm/get-in shadow [:color :color])) :opacity (dm/get-in shadow [:color :opacity]) :gradient (dm/get-in shadow [:color :gradient])}))] - + {:attrs attrs :prop :shadow @@ -157,41 +157,33 @@ expand-color (mf/use-state false) grouped-colors* (mf/use-var nil) - prev-color* (mf/use-var nil) + prev-colors* (mf/use-var []) on-change (mf/use-fn (fn [new-color old-color from-picker?] - (let [old-color (-> old-color - (dissoc :name) - (dissoc :path) - (d/without-nils)) - - prev-color (when @prev-color* - (-> @prev-color* - (dissoc :name) - (dissoc :path) - (d/without-nils))) + (let [old-color (-> old-color (dissoc :name :path) d/without-nils) ;; When dragging on the color picker sometimes all the shapes hasn't updated the color to the prev value so we need this extra calculation shapes-by-old-color (get @grouped-colors* old-color) + prev-color (d/seek #(get @grouped-colors* %) @prev-colors*) shapes-by-prev-color (get @grouped-colors* prev-color) shapes-by-color (or shapes-by-prev-color shapes-by-old-color)] (when from-picker? - (reset! prev-color* new-color)) + (swap! prev-colors* conj (-> new-color (dissoc :name :path) d/without-nils))) (st/emit! (dc/change-color-in-selected new-color shapes-by-color (or prev-color old-color)))))) on-open (mf/use-fn (fn [] - (reset! prev-color* nil))) + (reset! prev-colors* []))) on-close (mf/use-fn (fn [] - (reset! prev-color* nil))) + (reset! prev-colors* []))) on-detach (mf/use-fn @@ -217,7 +209,7 @@ [:div.element-set-content [:div.selected-colors (for [[index color] (d/enumerate (take 3 library-colors))] - [:& color-row {:key (dm/str "library-color-" index) + [:& color-row {:key (dm/str "library-color-" (:color color)) :color color :index index :on-detach on-detach @@ -231,7 +223,7 @@ [:span.text (tr "workspace.options.more-lib-colors")]]) (when @expand-lib-color (for [[index color] (d/enumerate (drop 3 library-colors))] - [:& color-row {:key (dm/str "library-color-" index) + [:& color-row {:key (dm/str "library-color-" (:color color)) :color color :index index :on-detach on-detach @@ -255,7 +247,7 @@ [:span.text (tr "workspace.options.more-colors")]]) (when @expand-color (for [[index color] (d/enumerate (drop 3 colors))] - [:& color-row {:key (dm/str "color-" index) + [:& color-row {:key (dm/str "color-" (:color color)) :color color :index index :select-only select-only diff --git a/frontend/translations/en.po b/frontend/translations/en.po index 7c5e2f162..13b41ee30 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -1017,6 +1017,9 @@ msgstr "Email or password is incorrect." msgid "errors.wrong-old-password" msgstr "Old password is incorrect" +msgid "errors.cannot-upload" +msgstr "Cannot upload the media file." + #: src/app/main/ui/settings/feedback.cljs msgid "feedback.description" msgstr "Description" diff --git a/frontend/translations/es.po b/frontend/translations/es.po index dcdd6727b..8076484d0 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -1057,6 +1057,9 @@ msgstr "El email o la contraseña son incorrectos." msgid "errors.wrong-old-password" msgstr "La contraseña anterior no es correcta" +msgid "errors.cannot-upload" +msgstr "No se puede subir el fichero" + #: src/app/main/ui/settings/feedback.cljs msgid "feedback.description" msgstr "Descripción"