mirror of
https://github.com/penpot/penpot.git
synced 2025-01-26 00:19:07 -05:00
Merge remote-tracking branch 'origin/main' into develop
This commit is contained in:
commit
6cc8fca506
2 changed files with 20 additions and 19 deletions
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
(defmethod ig/init-key ::handler
|
(defmethod ig/init-key ::handler
|
||||||
[_ {:keys [pool max-age] :as cfg}]
|
[_ {:keys [pool max-age] :as cfg}]
|
||||||
(fn [task]
|
(fn [_]
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
(let [interval (db/interval max-age)
|
(let [interval (db/interval max-age)
|
||||||
result (db/exec-one! conn [sql:delete-files-xlog interval])
|
result (db/exec-one! conn [sql:delete-files-xlog interval])
|
||||||
|
|
|
@ -66,10 +66,10 @@
|
||||||
|
|
||||||
(cond-> changes
|
(cond-> changes
|
||||||
(not (empty? rops))
|
(not (empty? rops))
|
||||||
(update :rch conj (assoc change :operations rops))
|
(update :redo-changes conj (assoc change :operations rops))
|
||||||
|
|
||||||
(not (empty? uops))
|
(not (empty? uops))
|
||||||
(update :uch conj (assoc change :operations uops)))))
|
(update :undo-changes conj (assoc change :operations uops)))))
|
||||||
|
|
||||||
(defn update-shapes
|
(defn update-shapes
|
||||||
([ids f] (update-shapes ids f nil))
|
([ids f] (update-shapes ids f nil))
|
||||||
|
@ -82,25 +82,26 @@
|
||||||
(ptk/reify ::update-shapes
|
(ptk/reify ::update-shapes
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [it state stream]
|
(watch [it state stream]
|
||||||
(let [page-id (:current-page-id state)
|
(let [page-id (:current-page-id state)
|
||||||
objects (wsh/lookup-page-objects state)
|
objects (wsh/lookup-page-objects state)
|
||||||
reg-objects {:type :reg-objects :page-id page-id :shapes (vec ids)}
|
changes {:redo-changes []
|
||||||
|
:undo-changes []
|
||||||
|
:origin it
|
||||||
|
:save-undo? save-undo?}
|
||||||
|
|
||||||
{redo-changes :rch undo-changes :uch}
|
ids (into [] (filter some?) ids)
|
||||||
(reduce #(update-shape-changes %1 page-id objects f keys %2)
|
|
||||||
{:rch [] :uch []} ids)]
|
|
||||||
|
|
||||||
(when-not (empty? redo-changes)
|
changes (reduce #(update-shape-changes %1 page-id objects f keys %2) changes ids)]
|
||||||
(let [redo-changes (cond-> redo-changes
|
|
||||||
reg-objects? (conj reg-objects))
|
|
||||||
|
|
||||||
undo-changes (cond-> undo-changes
|
(when-not (empty? (:redo-changes changes))
|
||||||
reg-objects? (conj reg-objects))]
|
(let [reg-objs {:type :reg-objects
|
||||||
|
:page-id page-id
|
||||||
(rx/of (commit-changes {:redo-changes redo-changes
|
:shapes ids}
|
||||||
:undo-changes undo-changes
|
changes (cond-> changes
|
||||||
:origin it
|
reg-objects?
|
||||||
:save-undo? save-undo?})))))))))
|
(-> (update :redo-changes conj reg-objs)
|
||||||
|
(update :undo-changes conj reg-objs)))]
|
||||||
|
(rx/of (commit-changes changes)))))))))
|
||||||
|
|
||||||
(defn update-indices
|
(defn update-indices
|
||||||
[page-id changes]
|
[page-id changes]
|
||||||
|
|
Loading…
Add table
Reference in a new issue