mirror of
https://github.com/penpot/penpot.git
synced 2025-05-18 11:16:13 +02:00
✨ Fix extensibility and naming of workspace shape fixer
This commit is contained in:
parent
c7f9774524
commit
a097ed29a9
4 changed files with 20 additions and 13 deletions
|
@ -46,7 +46,7 @@
|
|||
[app.main.data.workspace.drawing.common :as dwdc]
|
||||
[app.main.data.workspace.edition :as dwe]
|
||||
[app.main.data.workspace.fix-bool-contents :as fbc]
|
||||
[app.main.data.workspace.fix-broken-shape-links :as fbs]
|
||||
[app.main.data.workspace.fix-broken-shapes :as fbs]
|
||||
[app.main.data.workspace.fix-deleted-fonts :as fdf]
|
||||
[app.main.data.workspace.groups :as dwg]
|
||||
[app.main.data.workspace.guides :as dwgu]
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
;;
|
||||
;; Copyright (c) KALEIDOS INC
|
||||
|
||||
(ns app.main.data.workspace.fix-broken-shape-links
|
||||
(ns app.main.data.workspace.fix-broken-shapes
|
||||
(:require
|
||||
[app.main.data.workspace.changes :as dch]
|
||||
[beicon.core :as rx]
|
||||
[potok.core :as ptk]))
|
||||
|
||||
(defn- generate-changes
|
||||
(defn- generate-broken-link-changes
|
||||
[attr {:keys [objects id] :as container}]
|
||||
(let [base {:type :fix-obj attr id}
|
||||
(let [base {:type :fix-obj :fix :broken-children attr id}
|
||||
contains? (partial contains? objects)
|
||||
xform (comp
|
||||
;; FIXME: Ensure all obj have id field (this is needed
|
||||
|
@ -36,14 +36,14 @@
|
|||
|
||||
(defn fix-broken-shapes
|
||||
[]
|
||||
(ptk/reify ::fix-broken-shape-links
|
||||
(ptk/reify ::fix-broken-shapes
|
||||
ptk/WatchEvent
|
||||
(watch [it state _]
|
||||
(let [data (get state :workspace-data)
|
||||
changes (concat
|
||||
(mapcat (partial generate-changes :page-id)
|
||||
(mapcat (partial generate-broken-link-changes :page-id)
|
||||
(vals (:pages-index data)))
|
||||
(mapcat (partial generate-changes :component-id)
|
||||
(mapcat (partial generate-broken-link-changes :component-id)
|
||||
(vals (:components data))))]
|
||||
|
||||
(if (seq changes)
|
Loading…
Add table
Add a link
Reference in a new issue