mirror of
https://github.com/penpot/penpot.git
synced 2025-02-12 18:18:24 -05: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 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 on importing (and exporting) files with flows [Taiga #8914](https://tree.taiga.io/project/penpot/issue/8914)
|
||||
|
||||
## 2.2.1
|
||||
|
||||
|
|
|
@ -45,37 +45,38 @@
|
|||
(sv/defmethod ::create-temp-file
|
||||
{::doc/added "1.17"
|
||||
::doc/module :files
|
||||
::sm/params schema:create-temp-file}
|
||||
[cfg {:keys [::rpc/profile-id project-id] :as params}]
|
||||
(db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}]
|
||||
(projects/check-edition-permissions! conn profile-id project-id)
|
||||
(let [team (teams/get-team conn :profile-id profile-id :project-id project-id)
|
||||
::sm/params schema:create-temp-file
|
||||
::db/transaction true}
|
||||
[{:keys [::db/conn] :as cfg} {:keys [::rpc/profile-id project-id] :as params}]
|
||||
(projects/check-edition-permissions! conn profile-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
|
||||
;; features, because some features can be enabled
|
||||
;; globally, but the team is still not migrated properly.
|
||||
input-features (:features params #{})
|
||||
;; If the imported project doesn't contain v2 we need to remove it
|
||||
team-features
|
||||
(cond-> (cfeat/get-team-enabled-features cf/flags team)
|
||||
(not (contains? input-features "components/v2"))
|
||||
(disj "components/v2"))
|
||||
|
||||
;; If the imported project doesn't contain v2 we need to remove it
|
||||
team-features
|
||||
(cond-> (cfeat/get-team-enabled-features cf/flags team)
|
||||
(not (contains? input-features "components/v2"))
|
||||
(disj "components/v2"))
|
||||
;; We also include all no migration features declared by
|
||||
;; 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))]
|
||||
|
||||
;; We also include all no migration features declared by
|
||||
;; 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)))))
|
||||
(files.create/create-file cfg params)))
|
||||
|
||||
;; --- MUTATION COMMAND: update-temp-file
|
||||
|
||||
|
|
|
@ -195,19 +195,17 @@
|
|||
(fn [_event]
|
||||
(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
|
||||
(mf/use-fn
|
||||
(fn [e]
|
||||
(let [scroll (dom/get-target-scroll e)
|
||||
scroll-left (:scroll-left scroll)
|
||||
(let [scroll (dom/get-target-scroll e)
|
||||
scroll-left (:scroll-left scroll)
|
||||
scroll-available (- (:scroll-width scroll) scroll-left)
|
||||
client-rect (dom/get-client-size (dom/get-target e))]
|
||||
(update-can-move scroll-left scroll-available (unchecked-get client-rect "width")))))
|
||||
client-rect (dom/get-client-size (dom/get-target e))
|
||||
client-width (unchecked-get client-rect "width")]
|
||||
|
||||
(reset! can-move {:left (> scroll-left 0)
|
||||
:right (> scroll-available client-width)}))))
|
||||
|
||||
on-move-left
|
||||
(mf/use-fn #(move-left))
|
||||
|
@ -231,7 +229,7 @@
|
|||
(let [content (mf/ref-val content-ref)]
|
||||
(when (and (some? content) (some? templates))
|
||||
(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]
|
||||
(swap! storage/global assoc ::collapsed collapsed)
|
||||
|
|
|
@ -173,7 +173,7 @@
|
|||
(mf/defc export-flows
|
||||
[{:keys [flows]}]
|
||||
[:> "penpot:flows" #js {}
|
||||
(for [{:keys [id name starting-frame]} flows]
|
||||
(for [{:keys [id name starting-frame]} (vals flows)]
|
||||
[:> "penpot:flow" #js {:id id
|
||||
:name name
|
||||
:starting-frame starting-frame}])])
|
||||
|
|
|
@ -720,6 +720,19 @@
|
|||
[filename 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
|
||||
[uri filename mtype description]
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
[app.common.transit :as t]
|
||||
[app.util.functions :as fns]
|
||||
[app.util.globals :as g]
|
||||
[app.util.time :as dt]
|
||||
[cuerdas.core :as str]
|
||||
[okulary.util :as ou]))
|
||||
|
||||
|
@ -157,3 +158,11 @@
|
|||
(defonce user (create-storage local-storage-backend "penpot-user"))
|
||||
(defonce storage (create-storage local-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)
|
||||
(assoc :name page-name)
|
||||
(assoc :id (resolve page-id)))
|
||||
|
||||
flows (->> (get page-data :flows)
|
||||
(update-vals #(update % :starting-frame resolve))
|
||||
(map #(update % :starting-frame resolve))
|
||||
(d/index-by :id)
|
||||
(not-empty))
|
||||
|
||||
guides (-> (get page-data :guides)
|
||||
|
@ -815,9 +817,12 @@
|
|||
:errors (:errors file)
|
||||
:file-id (:file-id data)})))))))
|
||||
(rx/catch (fn [cause]
|
||||
(log/error :hint (ex-message cause)
|
||||
:file-id (:file-id data)
|
||||
:cause cause)
|
||||
(let [data (ex-data cause)]
|
||||
(log/error :hint (ex-message cause)
|
||||
:file-id (:file-id data))
|
||||
(when-let [explain (:explain data)]
|
||||
(js/console.log explain)))
|
||||
|
||||
(rx/of {:status :import-error
|
||||
:file-id (:file-id data)
|
||||
:error (ex-message cause)
|
||||
|
|
Loading…
Add table
Reference in a new issue