mirror of
https://github.com/penpot/penpot.git
synced 2025-05-05 02:35:52 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
aeebed6ef7
7 changed files with 145 additions and 10 deletions
|
@ -31,6 +31,8 @@
|
||||||
- Distribute fix enabled when two elements were selected (by @dfelinto) [Github #3266](https://github.com/penpot/penpot/pull/3266)
|
- Distribute fix enabled when two elements were selected (by @dfelinto) [Github #3266](https://github.com/penpot/penpot/pull/3266)
|
||||||
- Distribute vertical spacing failing for overlapped text (by @dfelinto) [Github #3267](https://github.com/penpot/penpot/pull/3267)
|
- Distribute vertical spacing failing for overlapped text (by @dfelinto) [Github #3267](https://github.com/penpot/penpot/pull/3267)
|
||||||
|
|
||||||
|
## 1.18.5
|
||||||
|
|
||||||
## 1.18.4
|
## 1.18.4
|
||||||
|
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
|
|
|
@ -169,14 +169,16 @@
|
||||||
[{:keys [::db/pool] :as cfg} params]
|
[{:keys [::db/pool] :as cfg} params]
|
||||||
|
|
||||||
(when-not (contains? cf/flags :registration)
|
(when-not (contains? cf/flags :registration)
|
||||||
(if-not (contains? params :invitation-token)
|
(when-not (contains? params :invitation-token)
|
||||||
(ex/raise :type :restriction
|
(ex/raise :type :restriction
|
||||||
:code :registration-disabled)
|
:code :registration-disabled)))
|
||||||
(let [invitation (tokens/verify (::main/props cfg) {:token (:invitation-token params) :iss :team-invitation})]
|
|
||||||
(when-not (= (:email params) (:member-email invitation))
|
(when (contains? params :invitation-token)
|
||||||
(ex/raise :type :restriction
|
(let [invitation (tokens/verify (::main/props cfg) {:token (:invitation-token params) :iss :team-invitation})]
|
||||||
:code :email-does-not-match-invitation
|
(when-not (= (:email params) (:member-email invitation))
|
||||||
:hint "email should match the invitation")))))
|
(ex/raise :type :restriction
|
||||||
|
:code :email-does-not-match-invitation
|
||||||
|
:hint "email should match the invitation"))))
|
||||||
|
|
||||||
(when-let [domains (cf/get :registration-domain-whitelist)]
|
(when-let [domains (cf/get :registration-domain-whitelist)]
|
||||||
(when-not (email-domain-in-whitelist? domains (:email params))
|
(when-not (email-domain-in-whitelist? domains (:email params))
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
[app.main.data.workspace.drawing.common :as dwdc]
|
[app.main.data.workspace.drawing.common :as dwdc]
|
||||||
[app.main.data.workspace.edition :as dwe]
|
[app.main.data.workspace.edition :as dwe]
|
||||||
[app.main.data.workspace.fix-bool-contents :as fbc]
|
[app.main.data.workspace.fix-bool-contents :as fbc]
|
||||||
|
[app.main.data.workspace.fix-deleted-fonts :as fdf]
|
||||||
[app.main.data.workspace.groups :as dwg]
|
[app.main.data.workspace.groups :as dwg]
|
||||||
[app.main.data.workspace.guides :as dwgu]
|
[app.main.data.workspace.guides :as dwgu]
|
||||||
[app.main.data.workspace.highlight :as dwh]
|
[app.main.data.workspace.highlight :as dwh]
|
||||||
|
@ -129,6 +130,7 @@
|
||||||
components-v2 (features/active-feature? state :components-v2)]
|
components-v2 (features/active-feature? state :components-v2)]
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(rx/of (fbc/fix-bool-contents))
|
(rx/of (fbc/fix-bool-contents))
|
||||||
|
(rx/of (fdf/fix-deleted-fonts))
|
||||||
(if (and has-graphics? components-v2)
|
(if (and has-graphics? components-v2)
|
||||||
(rx/of (remove-graphics (:id file) (:name file)))
|
(rx/of (remove-graphics (:id file) (:name file)))
|
||||||
(rx/empty)))))))
|
(rx/empty)))))))
|
||||||
|
|
129
frontend/src/app/main/data/workspace/fix_deleted_fonts.cljs
Normal file
129
frontend/src/app/main/data/workspace/fix_deleted_fonts.cljs
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
;; 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.fix-deleted-fonts
|
||||||
|
(:require
|
||||||
|
[app.common.data :as d]
|
||||||
|
[app.common.pages.helpers :as cph]
|
||||||
|
[app.common.text :as txt]
|
||||||
|
[app.main.data.workspace.changes :as dch]
|
||||||
|
[app.main.data.workspace.state-helpers :as wsh]
|
||||||
|
[app.main.fonts :as fonts]
|
||||||
|
[beicon.core :as rx]
|
||||||
|
[potok.core :as ptk]))
|
||||||
|
|
||||||
|
;; This event will update the file so the texts with non existing custom fonts try to be fixed.
|
||||||
|
;; This can happen when:
|
||||||
|
;; - Exporting/importing files to different teams or penpot instances
|
||||||
|
;; - Moving files from one team to another in the same instance
|
||||||
|
;; - Custom fonts are explicitly deleted in the team area
|
||||||
|
|
||||||
|
(defn has-invalid-font-family
|
||||||
|
[node]
|
||||||
|
(let [fonts (deref fonts/fontsdb)]
|
||||||
|
(and
|
||||||
|
(some? (:font-family node))
|
||||||
|
(nil? (get fonts (:font-id node))))))
|
||||||
|
|
||||||
|
(defn calculate-alternative-font-id
|
||||||
|
[value]
|
||||||
|
(let [fonts (deref fonts/fontsdb)]
|
||||||
|
(->> (vals fonts)
|
||||||
|
(filter #(= (:family %) value))
|
||||||
|
(first)
|
||||||
|
:id)))
|
||||||
|
|
||||||
|
(defn should-fix-deleted-font-shape?
|
||||||
|
[shape]
|
||||||
|
(let [text-nodes (txt/node-seq txt/is-text-node? (:content shape))]
|
||||||
|
(and (cph/text-shape? shape) (some has-invalid-font-family text-nodes))))
|
||||||
|
|
||||||
|
(defn should-fix-deleted-font-component?
|
||||||
|
[component]
|
||||||
|
(->> (:objects component)
|
||||||
|
(vals)
|
||||||
|
(d/seek should-fix-deleted-font-shape?)))
|
||||||
|
|
||||||
|
(defn should-fix-deleted-font-typography?
|
||||||
|
[typography]
|
||||||
|
(let [fonts (deref fonts/fontsdb)]
|
||||||
|
(nil? (get fonts (:font-id typography)))))
|
||||||
|
|
||||||
|
(defn fix-deleted-font
|
||||||
|
[node]
|
||||||
|
(let [alternative-font-id (calculate-alternative-font-id (:font-family node))]
|
||||||
|
(cond-> node
|
||||||
|
(some? alternative-font-id) (assoc :font-id alternative-font-id))))
|
||||||
|
|
||||||
|
(defn fix-deleted-font-shape
|
||||||
|
[shape]
|
||||||
|
(let [transform (partial txt/transform-nodes has-invalid-font-family fix-deleted-font)]
|
||||||
|
(update shape :content transform)))
|
||||||
|
|
||||||
|
(defn fix-deleted-font-component
|
||||||
|
[component]
|
||||||
|
(update component
|
||||||
|
:objects
|
||||||
|
(fn [objects]
|
||||||
|
(d/mapm #(fix-deleted-font-shape %2) objects))))
|
||||||
|
|
||||||
|
(defn fix-deleted-font-typography
|
||||||
|
[typography]
|
||||||
|
(let [alternative-font-id (calculate-alternative-font-id (:font-family typography))]
|
||||||
|
(cond-> typography
|
||||||
|
(some? alternative-font-id) (assoc :font-id alternative-font-id))))
|
||||||
|
|
||||||
|
(defn fix-deleted-fonts
|
||||||
|
[]
|
||||||
|
(ptk/reify ::fix-deleted-fonts
|
||||||
|
ptk/WatchEvent
|
||||||
|
(watch [it state _]
|
||||||
|
(let [objects (wsh/lookup-page-objects state)
|
||||||
|
|
||||||
|
ids (into #{}
|
||||||
|
(comp (filter should-fix-deleted-font-shape?) (map :id))
|
||||||
|
(vals objects))
|
||||||
|
|
||||||
|
components (->> (wsh/lookup-local-components state)
|
||||||
|
(vals)
|
||||||
|
(filter should-fix-deleted-font-component?))
|
||||||
|
|
||||||
|
component-changes
|
||||||
|
(into []
|
||||||
|
(map (fn [component]
|
||||||
|
{:type :mod-component
|
||||||
|
:id (:id component)
|
||||||
|
:objects (-> (fix-deleted-font-component component) :objects)}))
|
||||||
|
components)
|
||||||
|
|
||||||
|
typographies (->> (get-in state [:workspace-data :typographies])
|
||||||
|
(vals)
|
||||||
|
(filter should-fix-deleted-font-typography?))
|
||||||
|
|
||||||
|
typography-changes
|
||||||
|
(into []
|
||||||
|
(map (fn [typography]
|
||||||
|
{:type :mod-typography
|
||||||
|
:typography (fix-deleted-font-typography typography)}))
|
||||||
|
typographies)]
|
||||||
|
|
||||||
|
(rx/concat
|
||||||
|
(rx/of (dch/update-shapes ids #(fix-deleted-font-shape %) {:reg-objects? false
|
||||||
|
:save-undo? false
|
||||||
|
:ignore-tree true}))
|
||||||
|
(if (empty? component-changes)
|
||||||
|
(rx/empty)
|
||||||
|
(rx/of (dch/commit-changes {:origin it
|
||||||
|
:redo-changes component-changes
|
||||||
|
:undo-changes []
|
||||||
|
:save-undo? false})))
|
||||||
|
|
||||||
|
(if (empty? typography-changes)
|
||||||
|
(rx/empty)
|
||||||
|
(rx/of (dch/commit-changes {:origin it
|
||||||
|
:redo-changes typography-changes
|
||||||
|
:undo-changes []
|
||||||
|
:save-undo? false}))))))))
|
|
@ -388,7 +388,7 @@
|
||||||
(mf/defc context-menu-prototype
|
(mf/defc context-menu-prototype
|
||||||
[{:keys [shapes]}]
|
[{:keys [shapes]}]
|
||||||
(let [options (mf/deref refs/workspace-page-options)
|
(let [options (mf/deref refs/workspace-page-options)
|
||||||
options-mode (mf/deref refs/options-mode)
|
options-mode (mf/deref refs/options-mode-global)
|
||||||
do-add-flow #(st/emit! (dwi/add-flow-selected-frame))
|
do-add-flow #(st/emit! (dwi/add-flow-selected-frame))
|
||||||
do-remove-flow #(st/emit! (dwi/remove-flow (:id %)))
|
do-remove-flow #(st/emit! (dwi/remove-flow (:id %)))
|
||||||
flows (:flows options)
|
flows (:flows options)
|
||||||
|
|
|
@ -495,7 +495,7 @@ msgid "dashboard.export.title"
|
||||||
msgstr "Export files"
|
msgstr "Export files"
|
||||||
|
|
||||||
msgid "dashboard.fonts.deleted-placeholder"
|
msgid "dashboard.fonts.deleted-placeholder"
|
||||||
msgstr "Font deleted"
|
msgstr "Missing font"
|
||||||
|
|
||||||
#: src/app/main/ui/dashboard/fonts.cljs
|
#: src/app/main/ui/dashboard/fonts.cljs
|
||||||
msgid "dashboard.fonts.dismiss-all"
|
msgid "dashboard.fonts.dismiss-all"
|
||||||
|
|
|
@ -502,7 +502,7 @@ msgid "dashboard.export.title"
|
||||||
msgstr "Exportar ficheros"
|
msgstr "Exportar ficheros"
|
||||||
|
|
||||||
msgid "dashboard.fonts.deleted-placeholder"
|
msgid "dashboard.fonts.deleted-placeholder"
|
||||||
msgstr "Fuente eliminada"
|
msgstr "Fuente no encontrada"
|
||||||
|
|
||||||
#: src/app/main/ui/dashboard/fonts.cljs
|
#: src/app/main/ui/dashboard/fonts.cljs
|
||||||
msgid "dashboard.fonts.dismiss-all"
|
msgid "dashboard.fonts.dismiss-all"
|
||||||
|
|
Loading…
Add table
Reference in a new issue