mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 10:38:13 -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
|
||||
|
||||
(ns debug
|
||||
#_(:import [goog.math AffineTransform])
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
#_[app.common.geom.matrix :as gmt]
|
||||
[app.common.math :as mth]
|
||||
[app.common.pages :as cp]
|
||||
#_[app.common.perf :as perf]
|
||||
[app.common.transit :as t]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.main.data.workspace.changes :as dwc]
|
||||
[app.main.store :as st]
|
||||
[app.util.object :as obj]
|
||||
[app.util.timers :as timers]
|
||||
[beicon.core :as rx]
|
||||
[cljs.pprint :refer [pprint]]
|
||||
[cuerdas.core :as str]
|
||||
[potok.core :as ptk]))
|
||||
[potok.core :as ptk]
|
||||
[promesa.core :as p]))
|
||||
|
||||
(def debug-options
|
||||
#{;; Displays the bounding box for the shapes
|
||||
|
@ -251,3 +251,19 @@
|
|||
(not (debug-exclude-events (ptk/type s))))))
|
||||
(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