mirror of
https://github.com/penpot/penpot.git
synced 2025-06-03 10:31:40 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
754e09b0de
7 changed files with 69 additions and 42 deletions
|
@ -49,6 +49,7 @@
|
||||||
- Fix problem with hover layers when hidden/blocked [Github #5074](https://github.com/penpot/penpot/issues/5074)
|
- Fix problem with hover layers when hidden/blocked [Github #5074](https://github.com/penpot/penpot/issues/5074)
|
||||||
- Fix problem with precision on boolean calculation [Taiga #8482](https://tree.taiga.io/project/penpot/issue/8482)
|
- Fix problem with precision on boolean calculation [Taiga #8482](https://tree.taiga.io/project/penpot/issue/8482)
|
||||||
- Fix problem when translating multiple path points [Github #4459](https://github.com/penpot/penpot/issues/4459)
|
- Fix problem when translating multiple path points [Github #4459](https://github.com/penpot/penpot/issues/4459)
|
||||||
|
- Fix problem on importing (and exporting) files with flows [Taiga #8914](https://tree.taiga.io/project/penpot/issue/8914)
|
||||||
|
|
||||||
## 2.2.1
|
## 2.2.1
|
||||||
|
|
||||||
|
|
|
@ -45,37 +45,38 @@
|
||||||
(sv/defmethod ::create-temp-file
|
(sv/defmethod ::create-temp-file
|
||||||
{::doc/added "1.17"
|
{::doc/added "1.17"
|
||||||
::doc/module :files
|
::doc/module :files
|
||||||
::sm/params schema:create-temp-file}
|
::sm/params schema:create-temp-file
|
||||||
[cfg {:keys [::rpc/profile-id project-id] :as params}]
|
::db/transaction true}
|
||||||
(db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}]
|
[{:keys [::db/conn] :as cfg} {:keys [::rpc/profile-id project-id] :as params}]
|
||||||
(projects/check-edition-permissions! conn profile-id project-id)
|
(projects/check-edition-permissions! conn profile-id project-id)
|
||||||
(let [team (teams/get-team conn :profile-id profile-id :project-id project-id)
|
(let [team (teams/get-team conn :profile-id profile-id :project-id project-id)
|
||||||
|
;; When we create files, we only need to respect the team
|
||||||
|
;; features, because some features can be enabled
|
||||||
|
;; globally, but the team is still not migrated properly.
|
||||||
|
input-features
|
||||||
|
(:features params #{})
|
||||||
|
|
||||||
;; When we create files, we only need to respect the team
|
;; If the imported project doesn't contain v2 we need to remove it
|
||||||
;; features, because some features can be enabled
|
team-features
|
||||||
;; globally, but the team is still not migrated properly.
|
(cond-> (cfeat/get-team-enabled-features cf/flags team)
|
||||||
input-features (:features params #{})
|
(not (contains? input-features "components/v2"))
|
||||||
|
(disj "components/v2"))
|
||||||
|
|
||||||
;; If the imported project doesn't contain v2 we need to remove it
|
;; We also include all no migration features declared by
|
||||||
team-features
|
;; client; that enables the ability to enable a runtime
|
||||||
(cond-> (cfeat/get-team-enabled-features cf/flags team)
|
;; feature on frontend and make it permanent on file
|
||||||
(not (contains? input-features "components/v2"))
|
features
|
||||||
(disj "components/v2"))
|
(-> input-features
|
||||||
|
(set/intersection cfeat/no-migration-features)
|
||||||
|
(set/union team-features))
|
||||||
|
|
||||||
|
params
|
||||||
|
(-> params
|
||||||
|
(assoc :profile-id profile-id)
|
||||||
|
(assoc :deleted-at (dt/in-future {:days 1}))
|
||||||
|
(assoc :features features))]
|
||||||
|
|
||||||
;; We also include all no migration features declared by
|
(files.create/create-file cfg params)))
|
||||||
;; client; that enables the ability to enable a runtime
|
|
||||||
;; feature on frontend and make it permanent on file
|
|
||||||
features (-> input-features
|
|
||||||
(set/intersection cfeat/no-migration-features)
|
|
||||||
(set/union team-features))
|
|
||||||
|
|
||||||
params (-> params
|
|
||||||
(assoc :profile-id profile-id)
|
|
||||||
(assoc :deleted-at (dt/in-future {:days 1}))
|
|
||||||
(assoc :features features))]
|
|
||||||
|
|
||||||
(files.create/create-file cfg params)))))
|
|
||||||
|
|
||||||
;; --- MUTATION COMMAND: update-temp-file
|
;; --- MUTATION COMMAND: update-temp-file
|
||||||
|
|
||||||
|
|
|
@ -195,19 +195,17 @@
|
||||||
(fn [_event]
|
(fn [_event]
|
||||||
(swap! collapsed* not)))
|
(swap! collapsed* not)))
|
||||||
|
|
||||||
update-can-move
|
|
||||||
(fn [scroll-left scroll-available client-width]
|
|
||||||
(reset! can-move {:left (> scroll-left 0)
|
|
||||||
:right (> scroll-available client-width)}))
|
|
||||||
|
|
||||||
on-scroll
|
on-scroll
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(fn [e]
|
(fn [e]
|
||||||
(let [scroll (dom/get-target-scroll e)
|
(let [scroll (dom/get-target-scroll e)
|
||||||
scroll-left (:scroll-left scroll)
|
scroll-left (:scroll-left scroll)
|
||||||
scroll-available (- (:scroll-width scroll) scroll-left)
|
scroll-available (- (:scroll-width scroll) scroll-left)
|
||||||
client-rect (dom/get-client-size (dom/get-target e))]
|
client-rect (dom/get-client-size (dom/get-target e))
|
||||||
(update-can-move scroll-left scroll-available (unchecked-get client-rect "width")))))
|
client-width (unchecked-get client-rect "width")]
|
||||||
|
|
||||||
|
(reset! can-move {:left (> scroll-left 0)
|
||||||
|
:right (> scroll-available client-width)}))))
|
||||||
|
|
||||||
on-move-left
|
on-move-left
|
||||||
(mf/use-fn #(move-left))
|
(mf/use-fn #(move-left))
|
||||||
|
@ -231,7 +229,7 @@
|
||||||
(let [content (mf/ref-val content-ref)]
|
(let [content (mf/ref-val content-ref)]
|
||||||
(when (and (some? content) (some? templates))
|
(when (and (some? content) (some? templates))
|
||||||
(dom/scroll-to content #js {:behavior "instant" :left 0 :top 0})
|
(dom/scroll-to content #js {:behavior "instant" :left 0 :top 0})
|
||||||
(.dispatchEvent content (js/Event. "scroll")))))
|
(dom/dispatch-event content (dom/event "scroll")))))
|
||||||
|
|
||||||
(mf/with-effect [profile collapsed]
|
(mf/with-effect [profile collapsed]
|
||||||
(swap! storage/global assoc ::collapsed collapsed)
|
(swap! storage/global assoc ::collapsed collapsed)
|
||||||
|
|
|
@ -173,7 +173,7 @@
|
||||||
(mf/defc export-flows
|
(mf/defc export-flows
|
||||||
[{:keys [flows]}]
|
[{:keys [flows]}]
|
||||||
[:> "penpot:flows" #js {}
|
[:> "penpot:flows" #js {}
|
||||||
(for [{:keys [id name starting-frame]} flows]
|
(for [{:keys [id name starting-frame]} (vals flows)]
|
||||||
[:> "penpot:flow" #js {:id id
|
[:> "penpot:flow" #js {:id id
|
||||||
:name name
|
:name name
|
||||||
:starting-frame starting-frame}])])
|
:starting-frame starting-frame}])])
|
||||||
|
|
|
@ -720,6 +720,19 @@
|
||||||
[filename blob]
|
[filename blob]
|
||||||
(trigger-download-uri filename (.-type ^js blob) (wapi/create-uri blob)))
|
(trigger-download-uri filename (.-type ^js blob) (wapi/create-uri blob)))
|
||||||
|
|
||||||
|
(defn event
|
||||||
|
"Create an instance of DOM Event"
|
||||||
|
([^string type]
|
||||||
|
(js/Event. type))
|
||||||
|
([^string type options]
|
||||||
|
(js/Event. type options)))
|
||||||
|
|
||||||
|
(defn dispatch-event
|
||||||
|
[target event]
|
||||||
|
(when (some? target)
|
||||||
|
(.dispatchEvent ^js target event)))
|
||||||
|
|
||||||
|
|
||||||
(defn save-as
|
(defn save-as
|
||||||
[uri filename mtype description]
|
[uri filename mtype description]
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
[app.common.transit :as t]
|
[app.common.transit :as t]
|
||||||
[app.util.functions :as fns]
|
[app.util.functions :as fns]
|
||||||
[app.util.globals :as g]
|
[app.util.globals :as g]
|
||||||
|
[app.util.time :as dt]
|
||||||
[cuerdas.core :as str]
|
[cuerdas.core :as str]
|
||||||
[okulary.util :as ou]))
|
[okulary.util :as ou]))
|
||||||
|
|
||||||
|
@ -157,3 +158,11 @@
|
||||||
(defonce user (create-storage local-storage-backend "penpot-user"))
|
(defonce user (create-storage local-storage-backend "penpot-user"))
|
||||||
(defonce storage (create-storage local-storage-backend "penpot"))
|
(defonce storage (create-storage local-storage-backend "penpot"))
|
||||||
(defonce session (create-storage session-storage-backend "penpot"))
|
(defonce session (create-storage session-storage-backend "penpot"))
|
||||||
|
|
||||||
|
(defonce before-unload
|
||||||
|
(letfn [(on-before-unload [_]
|
||||||
|
(binding [*sync* true]
|
||||||
|
(swap! global assoc ::last-refresh (dt/now))
|
||||||
|
(swap! user assoc ::last-refresh (dt/now))))]
|
||||||
|
(.addEventListener g/window "beforeunload" on-before-unload)
|
||||||
|
on-before-unload))
|
||||||
|
|
|
@ -458,8 +458,10 @@
|
||||||
page-data (-> (parser/parse-page-data content)
|
page-data (-> (parser/parse-page-data content)
|
||||||
(assoc :name page-name)
|
(assoc :name page-name)
|
||||||
(assoc :id (resolve page-id)))
|
(assoc :id (resolve page-id)))
|
||||||
|
|
||||||
flows (->> (get page-data :flows)
|
flows (->> (get page-data :flows)
|
||||||
(update-vals #(update % :starting-frame resolve))
|
(map #(update % :starting-frame resolve))
|
||||||
|
(d/index-by :id)
|
||||||
(not-empty))
|
(not-empty))
|
||||||
|
|
||||||
guides (-> (get page-data :guides)
|
guides (-> (get page-data :guides)
|
||||||
|
@ -815,9 +817,12 @@
|
||||||
:errors (:errors file)
|
:errors (:errors file)
|
||||||
:file-id (:file-id data)})))))))
|
:file-id (:file-id data)})))))))
|
||||||
(rx/catch (fn [cause]
|
(rx/catch (fn [cause]
|
||||||
(log/error :hint (ex-message cause)
|
(let [data (ex-data cause)]
|
||||||
:file-id (:file-id data)
|
(log/error :hint (ex-message cause)
|
||||||
:cause cause)
|
:file-id (:file-id data))
|
||||||
|
(when-let [explain (:explain data)]
|
||||||
|
(js/console.log explain)))
|
||||||
|
|
||||||
(rx/of {:status :import-error
|
(rx/of {:status :import-error
|
||||||
:file-id (:file-id data)
|
:file-id (:file-id data)
|
||||||
:error (ex-message cause)
|
:error (ex-message cause)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue