diff --git a/CHANGES.md b/CHANGES.md index d94ed54fd..1e1204380 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,10 @@ - Fix unexpected exception when uploading image - Fix 404 when acces shared link [#615](https://github.com/penpot/penpot/issues/615) - Fix show correct error when google auth is disabled +- Fix apply a color to a text selection from color palette was not working +- Fix logo icon in viewer should go to dashboard +- Fix text alignment in preview [#594](https://github.com/penpot/penpot/issues/594) +- Fix problem when pasting URL's copied from the browser url bar ### Community contributions by (Thank you! :heart:) diff --git a/frontend/resources/styles/main/partials/dashboard-grid.scss b/frontend/resources/styles/main/partials/dashboard-grid.scss index d39ec4e3f..e877491e3 100644 --- a/frontend/resources/styles/main/partials/dashboard-grid.scss +++ b/frontend/resources/styles/main/partials/dashboard-grid.scss @@ -38,6 +38,10 @@ width: 18%; box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1); + .grid-item-th { + text-align: initial; + } + &.placeholder { min-width: 115px; max-width: 115px; diff --git a/frontend/src/app/main/data/viewer.cljs b/frontend/src/app/main/data/viewer.cljs index 550b5ddb9..cc2a09ea6 100644 --- a/frontend/src/app/main/data/viewer.cljs +++ b/frontend/src/app/main/data/viewer.cljs @@ -417,3 +417,12 @@ (update [_ state] (assoc-in state [:viewer-local :hover] (when hover? id))))) + +(defn go-to-dashboard + ([] (go-to-dashboard nil)) + ([{:keys [team-id]}] + (ptk/reify ::go-to-dashboard + ptk/WatchEvent + (watch [_ state stream] + (let [team-id (or team-id (get-in state [:viewer-data :project :team-id]))] + (rx/of (rt/nav :dashboard-projects {:team-id team-id}))))))) diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index acb58b487..79d370c33 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -1481,11 +1481,16 @@ ptk/WatchEvent (watch [_ state stream] (try - (let [paste-data (wapi/read-from-paste-event event) + (let [objects (dwc/lookup-page-objects state) + paste-data (wapi/read-from-paste-event event) image-data (wapi/extract-images paste-data) text-data (wapi/extract-text paste-data) decoded-data (and (t/transit? text-data) - (t/decode text-data))] + (t/decode text-data)) + + edit-id (get-in state [:workspace-local :edition]) + is-editing-text? (and edit-id (= :text (get-in objects [edit-id :type])))] + (cond (seq image-data) (rx/from (map paste-image image-data)) @@ -1495,7 +1500,9 @@ (rx/filter #(= :copied-shapes (:type %))) (rx/map #(paste-shape % in-viewport?))) - (string? text-data) + ;; Some paste events can be fired while we're editing a text + ;; we forbid that scenario so the default behaviour is executed + (and (string? text-data) (not is-editing-text?)) (rx/of (paste-text text-data)) :else diff --git a/frontend/src/app/main/ui/viewer/header.cljs b/frontend/src/app/main/ui/viewer/header.cljs index 59310a1de..c97025f13 100644 --- a/frontend/src/app/main/ui/viewer/header.cljs +++ b/frontend/src/app/main/ui/viewer/header.cljs @@ -196,14 +196,9 @@ on-goback (mf/use-callback - (mf/deps project-id file-id page-id anonymous?) - (fn [] - (if anonymous? - (st/emit! (rt/nav :login)) - (st/emit! (rt/nav :workspace - {:project-id project-id - :file-id file-id} - {:page-id page-id}))))) + (mf/deps project) + (st/emitf (dv/go-to-dashboard project))) + on-edit (mf/use-callback (mf/deps project-id file-id page-id) diff --git a/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs b/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs index 68a143cfb..d279c16fa 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/editor.cljs @@ -173,13 +173,15 @@ options (dom/get-element-by-class "element-options") assets (dom/get-element-by-class "assets-bar") cpicker (dom/get-element-by-class "colorpicker-tooltip") + palette (dom/get-element-by-class "color-palette") self (mf/ref-val self-ref) selecting? (mf/ref-val selecting-ref)] (when-not (or (and options (.contains options target)) (and assets (.contains assets target)) (and self (.contains self target)) - (and cpicker (.contains cpicker target))) + (and cpicker (.contains cpicker target)) + (and palette (.contains palette target))) (do (if selecting?