diff --git a/common/src/app/common/files/builder.cljc b/common/src/app/common/files/builder.cljc index 9bdbef8ec1..56ad3fa903 100644 --- a/common/src/app/common/files/builder.cljc +++ b/common/src/app/common/files/builder.cljc @@ -133,20 +133,6 @@ (def decode-add-component (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 [:map [:group-id ::sm/uuid] @@ -452,33 +438,6 @@ (commit-change change1) (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 [file id] (commit-change diff --git a/library/CHANGES.md b/library/CHANGES.md index 0a9be39b6a..80f1b50ca9 100644 --- a/library/CHANGES.md +++ b/library/CHANGES.md @@ -3,6 +3,7 @@ ## 1.0.1 - Make the library generate a .penpot file compatible with penpot 2.7.x +- Remove useless method `addComponentInstance` ## 1.0.0 diff --git a/library/src/lib/builder.cljs b/library/src/lib/builder.cljs index df9b909cb3..f77f6f8ae5 100644 --- a/library/src/lib/builder.cljs +++ b/library/src/lib/builder.cljs @@ -230,16 +230,6 @@ (catch :default 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 (fn [params blob]