mirror of
https://github.com/penpot/penpot.git
synced 2025-07-26 01:47:15 +02:00
🔥 Remove library method addComponentInstance
This commit is contained in:
parent
969b171510
commit
37f88067b9
3 changed files with 1 additions and 51 deletions
|
@ -133,20 +133,6 @@
|
||||||
(def decode-add-component
|
(def decode-add-component
|
||||||
(sm/decode-fn schema:add-component sm/json-transformer))
|
(sm/decode-fn schema:add-component sm/json-transformer))
|
||||||
|
|
||||||
(def schema:add-component-instance
|
|
||||||
[:map
|
|
||||||
[:component-id ::sm/uuid]
|
|
||||||
[:file-id {:optional true} ::sm/uuid]
|
|
||||||
[:frame-id {:optional true} ::sm/uuid]
|
|
||||||
[:page-id {:optional true} ::sm/uuid]])
|
|
||||||
|
|
||||||
(def ^:private check-add-component-instance
|
|
||||||
(sm/check-fn schema:add-component-instance
|
|
||||||
:hint "invalid arguments passed for add-component-instance"))
|
|
||||||
|
|
||||||
(def decode-add-component-instance
|
|
||||||
(sm/decode-fn schema:add-component-instance sm/json-transformer))
|
|
||||||
|
|
||||||
(def schema:add-bool
|
(def schema:add-bool
|
||||||
[:map
|
[:map
|
||||||
[:group-id ::sm/uuid]
|
[:group-id ::sm/uuid]
|
||||||
|
@ -452,33 +438,6 @@
|
||||||
(commit-change change1)
|
(commit-change change1)
|
||||||
(commit-change change2))))
|
(commit-change change2))))
|
||||||
|
|
||||||
|
|
||||||
(defn add-component-instance
|
|
||||||
[state params]
|
|
||||||
|
|
||||||
(let [{:keys [component-id file-id frame-id page-id]}
|
|
||||||
(check-add-component-instance params)
|
|
||||||
|
|
||||||
file-id
|
|
||||||
(or file-id (get state ::current-file-id))
|
|
||||||
|
|
||||||
frame-id
|
|
||||||
(or frame-id (get state ::current-frame-id))
|
|
||||||
|
|
||||||
page-id
|
|
||||||
(or page-id (get state ::current-page-id))
|
|
||||||
|
|
||||||
change
|
|
||||||
{:type :mod-obj
|
|
||||||
:id frame-id
|
|
||||||
:page-id page-id
|
|
||||||
:operations
|
|
||||||
[{:type :set :attr :component-root :val true}
|
|
||||||
{:type :set :attr :component-id :val component-id}
|
|
||||||
{:type :set :attr :component-file :val file-id}]}]
|
|
||||||
|
|
||||||
(commit-change state change)))
|
|
||||||
|
|
||||||
(defn delete-shape
|
(defn delete-shape
|
||||||
[file id]
|
[file id]
|
||||||
(commit-change
|
(commit-change
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
## 1.0.1
|
## 1.0.1
|
||||||
|
|
||||||
- Make the library generate a .penpot file compatible with penpot 2.7.x
|
- Make the library generate a .penpot file compatible with penpot 2.7.x
|
||||||
|
- Remove useless method `addComponentInstance`
|
||||||
|
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
|
@ -230,16 +230,6 @@
|
||||||
(catch :default cause
|
(catch :default cause
|
||||||
(handle-exception cause))))
|
(handle-exception cause))))
|
||||||
|
|
||||||
:addComponentInstance
|
|
||||||
(fn [params]
|
|
||||||
(try
|
|
||||||
(let [params (-> (decode-params params)
|
|
||||||
(fb/decode-add-component-instance))]
|
|
||||||
(-> (swap! state fb/add-component-instance params)
|
|
||||||
(get-last-id)))
|
|
||||||
(catch :default cause
|
|
||||||
(handle-exception cause))))
|
|
||||||
|
|
||||||
:addFileMedia
|
:addFileMedia
|
||||||
(fn [params blob]
|
(fn [params blob]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue