mirror of
https://github.com/penpot/penpot.git
synced 2025-02-15 11:38:24 -05:00
✨ Add a debug option to apply changes
This commit is contained in:
parent
2962dc1faa
commit
cd1170c543
1 changed files with 20 additions and 4 deletions
|
@ -5,21 +5,21 @@
|
||||||
;; Copyright (c) UXBOX Labs SL
|
;; Copyright (c) UXBOX Labs SL
|
||||||
|
|
||||||
(ns debug
|
(ns debug
|
||||||
#_(:import [goog.math AffineTransform])
|
|
||||||
(:require
|
(:require
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
#_[app.common.geom.matrix :as gmt]
|
|
||||||
[app.common.math :as mth]
|
[app.common.math :as mth]
|
||||||
[app.common.pages :as cp]
|
[app.common.pages :as cp]
|
||||||
#_[app.common.perf :as perf]
|
[app.common.transit :as t]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
|
[app.main.data.workspace.changes :as dwc]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.util.object :as obj]
|
[app.util.object :as obj]
|
||||||
[app.util.timers :as timers]
|
[app.util.timers :as timers]
|
||||||
[beicon.core :as rx]
|
[beicon.core :as rx]
|
||||||
[cljs.pprint :refer [pprint]]
|
[cljs.pprint :refer [pprint]]
|
||||||
[cuerdas.core :as str]
|
[cuerdas.core :as str]
|
||||||
[potok.core :as ptk]))
|
[potok.core :as ptk]
|
||||||
|
[promesa.core :as p]))
|
||||||
|
|
||||||
(def debug-options
|
(def debug-options
|
||||||
#{;; Displays the bounding box for the shapes
|
#{;; Displays the bounding box for the shapes
|
||||||
|
@ -251,3 +251,19 @@
|
||||||
(not (debug-exclude-events (ptk/type s))))))
|
(not (debug-exclude-events (ptk/type s))))))
|
||||||
(rx/subs #(println "[stream]: " (ptk/repr-event %))))))
|
(rx/subs #(println "[stream]: " (ptk/repr-event %))))))
|
||||||
|
|
||||||
|
(defn ^:export apply-changes
|
||||||
|
"Takes a Transit JSON changes"
|
||||||
|
[^string changes*]
|
||||||
|
|
||||||
|
(let [file-id (:current-file-id @st/state)
|
||||||
|
changes (t/decode-str changes*)]
|
||||||
|
(st/emit! (dwc/commit-changes {:redo-changes changes
|
||||||
|
:undo-changes []
|
||||||
|
:save-undo? true
|
||||||
|
:file-id file-id}))))
|
||||||
|
|
||||||
|
(defn ^:export fetch-apply
|
||||||
|
[^string url]
|
||||||
|
(-> (p/let [response (js/fetch url)]
|
||||||
|
(.text response))
|
||||||
|
(p/then apply-changes)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue