mirror of
https://github.com/penpot/penpot.git
synced 2025-07-22 08:27:13 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
efc61241a0
13 changed files with 76 additions and 18 deletions
|
@ -152,6 +152,16 @@
|
|||
(rx/of (rt/nav-raw href)))
|
||||
(rx/throw cause))))
|
||||
|
||||
(defn- on-fetch-profile-exception
|
||||
[cause]
|
||||
(let [data (ex-data cause)]
|
||||
(if (and (= :authorization (:type data))
|
||||
(= :challenge-required (:code data)))
|
||||
(let [path (rt/get-current-path)
|
||||
href (str "/challenge.html?redirect=" path)]
|
||||
(rx/of (rt/nav-raw href)))
|
||||
(rx/throw cause))))
|
||||
|
||||
(defn fetch-profile
|
||||
[]
|
||||
(ptk/reify ::fetch-profile
|
||||
|
|
|
@ -73,7 +73,6 @@
|
|||
(let [id (d/nilv id (uuid/next))
|
||||
page-id (:current-page-id state)
|
||||
objects (wsh/lookup-page-objects state page-id)
|
||||
frame-id (ctst/top-nested-frame objects position)
|
||||
selected (if ignore-selection? #{} (wsh/lookup-selected state))
|
||||
base (cfh/get-base-shape objects selected)
|
||||
|
||||
|
@ -81,9 +80,16 @@
|
|||
selected-frame? (and (= 1 (count selected))
|
||||
(= :frame (dm/get-in objects [selected-id :type])))
|
||||
|
||||
base-id (:parent-id base)
|
||||
|
||||
frame-id (if (or selected-frame? (empty? selected)
|
||||
(not= :frame (dm/get-in objects [base-id :type])))
|
||||
(ctst/top-nested-frame objects position)
|
||||
base-id)
|
||||
|
||||
parent-id (if (or selected-frame? (empty? selected))
|
||||
frame-id
|
||||
(:parent-id base))
|
||||
base-id)
|
||||
|
||||
[new-shape new-children]
|
||||
(csvg.shapes-builder/create-svg-shapes id svg-data position objects frame-id parent-id selected true)
|
||||
|
|
|
@ -427,7 +427,8 @@
|
|||
(let [childs (mapv #(get objects %) (:shapes (unchecked-get props "shape")))
|
||||
props (obj/merge! #js {} props
|
||||
#js {:childs childs
|
||||
:objects objects})]
|
||||
:objects objects
|
||||
:all-objects all-objects})]
|
||||
(when (not-empty childs)
|
||||
[:> group-wrapper props])))))
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
overflow-x: hidden;
|
||||
overflow-y: overlay;
|
||||
scrollbar-gutter: stable;
|
||||
max-width: var(--width);
|
||||
}
|
||||
|
||||
.pages-list {
|
||||
|
|
29
frontend/src/app/util/functions.cljs
Normal file
29
frontend/src/app/util/functions.cljs
Normal file
|
@ -0,0 +1,29 @@
|
|||
;; 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.util.functions
|
||||
"A functions helpers"
|
||||
(:require
|
||||
["lodash/debounce.js" :as lodash-debounce]))
|
||||
|
||||
;; NOTE: this is needed because depending on the type of the build and
|
||||
;; target execution evironment (browser, esm), the real export can be
|
||||
;; different. All this issue is about the commonjs and esm
|
||||
;; interop/conversion, because the js ecosystem decided that is should
|
||||
;; work this way.
|
||||
;;
|
||||
;; In this concrete case, lodash exposes commonjs module which works
|
||||
;; ok on browser build but for ESM build it is converted in the best
|
||||
;; effort to esm module, exporting the module.exports as the default
|
||||
;; property. This is why on ESM builds we need to look on .-default
|
||||
;; property.
|
||||
(def ^:private ext-debounce
|
||||
(or (.-default lodash-debounce)
|
||||
lodash-debounce))
|
||||
|
||||
(defn debounce
|
||||
[f timeout]
|
||||
(ext-debounce f timeout #{:leading false :trailing true}))
|
|
@ -13,7 +13,7 @@
|
|||
[app.main.data.events :as ev]
|
||||
[app.util.browser-history :as bhistory]
|
||||
[app.util.dom :as dom]
|
||||
[app.util.globals :as globals]
|
||||
[app.util.globals :as globals]
|
||||
[app.util.timers :as ts]
|
||||
[beicon.v2.core :as rx]
|
||||
[cuerdas.core :as str]
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
(ns app.util.storage
|
||||
(:require
|
||||
["lodash/debounce" :as ldebounce]
|
||||
[app.common.exceptions :as ex]
|
||||
[app.common.transit :as t]
|
||||
[app.util.functions :as fns]
|
||||
[app.util.globals :as g]
|
||||
[cuerdas.core :as str]))
|
||||
|
||||
|
@ -76,8 +76,7 @@
|
|||
(set! latest-state curr-state)))))
|
||||
|
||||
(defonce on-change
|
||||
(ldebounce on-change* 2000 #js {:leading false :trailing true}))
|
||||
|
||||
(fns/debounce on-change* 2000))
|
||||
|
||||
(defonce storage (atom latest-state))
|
||||
(add-watch storage :persistence
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue