diff --git a/CHANGES.md b/CHANGES.md index ae4ad9f1b..2ba82415b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -32,9 +32,11 @@ - Add set selection in create Token themes flow [Taiga #10746](https://tree.taiga.io/project/penpot/issue/10746) - Display indicator on not active sets [Taiga #10668](https://tree.taiga.io/project/penpot/issue/10668) - Create `input*` wrapper component, and `label*`, `input-field*` and `hint-message*` components [Taiga #10713](https://tree.taiga.io/project/penpot/us/10713) +- Fix problem in viewer with the back button [Taiga #10907](https://tree.taiga.io/project/penpot/issue/10907) ### :bug: Bugs fixed +- Fix shortcut for history version panel [Taiga #11006](https://tree.taiga.io/project/penpot/issue/11006) - Fix positioning of comment drafts when near the right / bottom edges of viewport [Taiga #10534](https://tree.taiga.io/project/penpot/issue/10534) - Fix path having a wrong selrect [Taiga #10257](https://tree.taiga.io/project/penpot/issue/10257) - Fix SVG `stroke-linecap` property when importing SVGs [Taiga #9489](https://tree.taiga.io/project/penpot/issue/9489) diff --git a/common/src/app/common/files/tokens.cljc b/common/src/app/common/files/tokens.cljc index eb0991445..3a0a632a7 100644 --- a/common/src/app/common/files/tokens.cljc +++ b/common/src/app/common/files/tokens.cljc @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns app.common.files.tokens (:require [app.common.data :as d] diff --git a/common/test/common_tests/logic/token_test.cljc b/common/test/common_tests/logic/token_test.cljc index 93548f39a..a68a96b2a 100644 --- a/common/test/common_tests/logic/token_test.cljc +++ b/common/test/common_tests/logic/token_test.cljc @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns common-tests.logic.token-test (:require [app.common.files.changes-builder :as pcb] diff --git a/frontend/playwright/ui/specs/versions.spec.js b/frontend/playwright/ui/specs/versions.spec.js index edd8fc9ea..dd28a74c5 100644 --- a/frontend/playwright/ui/specs/versions.spec.js +++ b/frontend/playwright/ui/specs/versions.spec.js @@ -4,11 +4,13 @@ import { presenceFixture } from "../../data/workspace/ws-notifications"; test.beforeEach(async ({ page }) => { await WorkspacePage.init(page); + const workspacePage = new WorkspacePage(page); + await workspacePage.setupEmptyFile(page); }); test("Save and restore version", async ({ page }) => { const workspacePage = new WorkspacePage(page); - await workspacePage.setupEmptyFile(page); + await workspacePage.mockRPC(/get\-file\?/, "workspace/versions-init.json"); await workspacePage.mockRPC( "get-file-fragment?file-id=*&fragment-id=406b7b01-d3e2-80e4-8005-3138b7cc5f0b", @@ -87,3 +89,20 @@ test("Save and restore version", async ({ page }) => { // check that the history panel is closed after restore await expect(page.getByRole("tab", { name: "design" })).toBeVisible(); }); + +test("BUG 11006 - Fix history panel shortcut", async ({ page }) => { + const workspacePage = new WorkspacePage(page); + await workspacePage.mockRPC(/get\-file\?/, "workspace/versions-init.json"); + await workspacePage.mockRPC( + "get-file-snapshots?file-id=*", + "workspace/versions-snapshot-1.json", + ); + + await workspacePage.goToWorkspace(); + + await page.keyboard.press("Control+Alt+h"); + + await expect( + workspacePage.rightSidebar.getByText("There are no versions yet"), + ).toBeVisible(); +}); diff --git a/frontend/src/app/main/data/style_dictionary.cljs b/frontend/src/app/main/data/style_dictionary.cljs index d4a99233e..493f50616 100644 --- a/frontend/src/app/main/data/style_dictionary.cljs +++ b/frontend/src/app/main/data/style_dictionary.cljs @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns app.main.data.style-dictionary (:require ["@tokens-studio/sd-transforms" :as sd-transforms] diff --git a/frontend/src/app/main/data/tinycolor.cljs b/frontend/src/app/main/data/tinycolor.cljs index 2ec94fece..13fea42e0 100644 --- a/frontend/src/app/main/data/tinycolor.cljs +++ b/frontend/src/app/main/data/tinycolor.cljs @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns app.main.data.tinycolor "Bindings for tinycolor2 which supports a wide range of css compatible colors. diff --git a/frontend/src/app/main/data/workspace/libraries.cljs b/frontend/src/app/main/data/workspace/libraries.cljs index 777c63b11..28d159ad3 100644 --- a/frontend/src/app/main/data/workspace/libraries.cljs +++ b/frontend/src/app/main/data/workspace/libraries.cljs @@ -582,11 +582,14 @@ changes (-> (pcb/empty-changes it) (cll/generate-restore-component ldata component-id library-id page objects)) + page-id + (->> changes :redo-changes (keep :page-id) first) + frames (->> changes :redo-changes (keep :frame-id))] (rx/of (dch/commit-changes changes) - (ptk/data-event :layout/update {:ids frames})))))) + (ptk/data-event :layout/update {:page-id page-id :ids frames})))))) (defn restore-components diff --git a/frontend/src/app/main/data/workspace/shape_layout.cljs b/frontend/src/app/main/data/workspace/shape_layout.cljs index 829021a2d..529561c51 100644 --- a/frontend/src/app/main/data/workspace/shape_layout.cljs +++ b/frontend/src/app/main/data/workspace/shape_layout.cljs @@ -98,18 +98,20 @@ ;; Never call this directly but through the data-event `:layout/update` ;; Otherwise a lot of cycle dependencies could be generated (defn- update-layout-positions - [{:keys [ids undo-group]}] + [{:keys [page-id ids undo-group]}] (ptk/reify ::update-layout-positions ptk/WatchEvent (watch [_ state _] - (let [objects (dsh/lookup-page-objects state) + (let [page-id (or page-id (:current-page-id state)) + objects (dsh/lookup-page-objects state page-id) ids (->> ids (filter #(contains? objects %)))] (if (d/not-empty? ids) (let [modif-tree (dwm/create-modif-tree ids (ctm/reflow-modifiers))] (if (features/active-feature? state "render-wasm/v1") (rx/of (dwm/apply-wasm-modifiers modif-tree :stack-undo? true :undo-group undo-group)) - (rx/of (dwm/apply-modifiers {:modifiers modif-tree + (rx/of (dwm/apply-modifiers {:page-id page-id + :modifiers modif-tree :stack-undo? true :undo-group undo-group})))) (rx/empty)))))) @@ -131,8 +133,9 @@ (rx/filter #(d/not-empty? %)) (rx/map (fn [data] - (let [ids (reduce #(into %1 (:ids %2)) #{} data)] - (update-layout-positions {:ids ids})))) + (let [page-id (->> data (keep :page-id) first) + ids (reduce #(into %1 (:ids %2)) #{} data)] + (update-layout-positions {:page-id page-id :ids ids})))) (rx/take-until stopper)))))) (defn finalize-shape-layout diff --git a/frontend/src/app/main/data/workspace/shortcuts.cljs b/frontend/src/app/main/data/workspace/shortcuts.cljs index a54e14cf0..e1535516b 100644 --- a/frontend/src/app/main/data/workspace/shortcuts.cljs +++ b/frontend/src/app/main/data/workspace/shortcuts.cljs @@ -464,11 +464,11 @@ :subsections [:panels] :fn #(st/emit! (dcm/go-to-workspace :layout :assets))} - :toggle-history {:tooltip (ds/alt "H") - :command (ds/a-mod "h") + :toggle-history {:tooltip (ds/meta-alt "H") + :command (ds/ca-mod "h") :subsections [:panels] :fn #(emit-when-no-readonly - (dcm/go-to-workspace :layout :document-history))} + (dw/toggle-layout-flag :document-history))} :toggle-colorpalette {:tooltip (ds/alt "P") :command (ds/a-mod "p") diff --git a/frontend/src/app/main/data/workspace/tokens/errors.cljs b/frontend/src/app/main/data/workspace/tokens/errors.cljs index 48457a49a..025b7e791 100644 --- a/frontend/src/app/main/data/workspace/tokens/errors.cljs +++ b/frontend/src/app/main/data/workspace/tokens/errors.cljs @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns app.main.data.workspace.tokens.errors (:require [app.util.i18n :refer [tr]] diff --git a/frontend/src/app/main/data/workspace/tokens/warnings.cljs b/frontend/src/app/main/data/workspace/tokens/warnings.cljs index 193eafecd..1849f824a 100644 --- a/frontend/src/app/main/data/workspace/tokens/warnings.cljs +++ b/frontend/src/app/main/data/workspace/tokens/warnings.cljs @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns app.main.data.workspace.tokens.warnings (:require [app.util.i18n :refer [tr]] diff --git a/frontend/src/app/main/ui/dashboard/import.scss b/frontend/src/app/main/ui/dashboard/import.scss index 34bb378fa..0ce6ae41a 100644 --- a/frontend/src/app/main/ui/dashboard/import.scss +++ b/frontend/src/app/main/ui/dashboard/import.scss @@ -198,7 +198,7 @@ } .import-error-disclaimer { - color: var(--color-foreground-primary); + color: var(--color-foreground-secondary); } .import-error-list { diff --git a/frontend/src/app/main/ui/viewer.scss b/frontend/src/app/main/ui/viewer.scss index 31194da31..2ece31cd8 100644 --- a/frontend/src/app/main/ui/viewer.scss +++ b/frontend/src/app/main/ui/viewer.scss @@ -127,6 +127,7 @@ width: $s-28; margin-left: $s-8; background-color: var(--viewer-controls-background-color); + pointer-events: all; svg { @extend .button-icon; stroke: var(--icon-foreground); diff --git a/frontend/src/app/main/ui/workspace/main_menu.cljs b/frontend/src/app/main/ui/workspace/main_menu.cljs index 5da0b952c..149bb5dcd 100644 --- a/frontend/src/app/main/ui/workspace/main_menu.cljs +++ b/frontend/src/app/main/ui/workspace/main_menu.cljs @@ -618,7 +618,7 @@ [:> dropdown-menu-item* {:class (stl/css :submenu-item) :on-click on-pin-version :on-key-down on-pin-version-key-down - :id "file-menu-show-version-history"} + :id "file-menu-create-version"} [:span {:class (stl/css :item-name)} (tr "dashboard.create-version-menu")]] @@ -627,7 +627,10 @@ :on-key-down on-show-version-history-key-down :id "file-menu-show-version-history"} [:span {:class (stl/css :item-name)} - (tr "dashboard.show-version-history")]] + (tr "dashboard.show-version-history")] + [:span {:class (stl/css :shortcut)} + (for [sc (scd/split-sc (sc/get-tooltip :toggle-history))] + [:span {:class (stl/css :shortcut-key) :key sc} sc])]] [:div {:class (stl/css :separator)}]]) @@ -786,6 +789,7 @@ on-power-up-click (mf/use-fn (fn [] + (st/emit! (ptk/event ::ev/event {::ev/name "explore-pricing-click" ::ev/origin "workspace-menu"})) (dom/open-new-window "https://penpot.app/pricing"))) toggle-flag @@ -900,14 +904,16 @@ :id "file-menu-help-info"} [:span {:class (stl/css :item-name)} (tr "workspace.header.menu.option.help-info")] [:span {:class (stl/css :open-arrow)} i/arrow]] - [:> dropdown-menu-item* {:class (stl/css-case :menu-item true) - :on-click on-power-up-click - :on-key-down (fn [event] - (when (kbd/enter? event) - (on-power-up-click))) - :on-pointer-enter close-sub-menu - :id "file-menu-power-up"} - [:span {:class (stl/css :item-name)} (tr "workspace.header.menu.option.power-up")]]] + ;; TODO remove this block when subscriptions is full implemented + (when (contains? cf/flags :subscriptions-old) + [:> dropdown-menu-item* {:class (stl/css-case :menu-item true) + :on-click on-power-up-click + :on-key-down (fn [event] + (when (kbd/enter? event) + (on-power-up-click))) + :on-pointer-enter close-sub-menu + :id "file-menu-power-up"} + [:span {:class (stl/css :item-name)} (tr "workspace.header.menu.option.power-up")]])] (case sub-menu :file diff --git a/frontend/test/frontend_tests/tokens/helpers/state.cljs b/frontend/test/frontend_tests/tokens/helpers/state.cljs index 4a6972a9a..c5a7f864d 100644 --- a/frontend/test/frontend_tests/tokens/helpers/state.cljs +++ b/frontend/test/frontend_tests/tokens/helpers/state.cljs @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns frontend-tests.tokens.helpers.state (:require [app.common.types.tokens-lib :as ctob] diff --git a/frontend/test/frontend_tests/tokens/helpers/tokens.cljs b/frontend/test/frontend_tests/tokens/helpers/tokens.cljs index f9f97f7ef..d97089a00 100644 --- a/frontend/test/frontend_tests/tokens/helpers/tokens.cljs +++ b/frontend/test/frontend_tests/tokens/helpers/tokens.cljs @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns frontend-tests.tokens.helpers.tokens (:require [app.common.files.tokens :as cft] diff --git a/frontend/test/frontend_tests/tokens/logic/token_actions_test.cljs b/frontend/test/frontend_tests/tokens/logic/token_actions_test.cljs index d38e8cb08..8bccd46fb 100644 --- a/frontend/test/frontend_tests/tokens/logic/token_actions_test.cljs +++ b/frontend/test/frontend_tests/tokens/logic/token_actions_test.cljs @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns frontend-tests.tokens.logic.token-actions-test (:require [app.common.test-helpers.compositions :as ctho] diff --git a/frontend/test/frontend_tests/tokens/logic/token_data_test.cljs b/frontend/test/frontend_tests/tokens/logic/token_data_test.cljs index b518f2296..0329d05f1 100644 --- a/frontend/test/frontend_tests/tokens/logic/token_data_test.cljs +++ b/frontend/test/frontend_tests/tokens/logic/token_data_test.cljs @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns frontend-tests.tokens.logic.token-data-test (:require [app.common.test-helpers.files :as cthf] diff --git a/frontend/test/frontend_tests/tokens/style_dictionary_test.cljs b/frontend/test/frontend_tests/tokens/style_dictionary_test.cljs index 1b794c1c0..629bcee05 100644 --- a/frontend/test/frontend_tests/tokens/style_dictionary_test.cljs +++ b/frontend/test/frontend_tests/tokens/style_dictionary_test.cljs @@ -1,3 +1,9 @@ +;; This Source Code Form is subject to the terms of the Mozilla Public +;; License, v. 2.0. If a copy of the MPL was not distributed with this +;; file, You can obtain one at http://mozilla.org/MPL/2.0/. +;; +;; Copyright (c) KALEIDOS INC + (ns frontend-tests.tokens.style-dictionary-test (:require [app.common.transit :as tr]