diff --git a/common/src/app/common/files/changes_builder.cljc b/common/src/app/common/files/changes_builder.cljc index 865ed2fa7..5a8d8a920 100644 --- a/common/src/app/common/files/changes_builder.cljc +++ b/common/src/app/common/files/changes_builder.cljc @@ -770,15 +770,6 @@ (update :undo-changes conj {:type :del-component :id id :main-instance main-instance}))) -(defn ignore-remote - [changes] - (letfn [(add-ignore-remote - [change-list] - (->> change-list - (mapv #(assoc % :ignore-remote? true))))] - (-> changes - (update :redo-changes add-ignore-remote) - (update :undo-changes add-ignore-remote)))) (defn reorder-grid-children [changes ids] diff --git a/frontend/src/app/main/data/workspace/notifications.cljs b/frontend/src/app/main/data/workspace/notifications.cljs index 39808e7f3..330aa2ee0 100644 --- a/frontend/src/app/main/data/workspace/notifications.cljs +++ b/frontend/src/app/main/data/workspace/notifications.cljs @@ -207,40 +207,16 @@ (-deref [_] {:changes changes}) ptk/WatchEvent - (watch [_ state _] - (let [page-id (:current-page-id state) - - position-data-operation? - (fn [{:keys [type attr]}] - (and (= :set type) - (= attr :position-data))) - - update-position-data - (fn [change] - ;; Remove the position data from remote operations. Will be changed localy, otherwise - ;; creates a strange "out-of-sync" behaviour. - (cond-> change - (and (= page-id (:page-id change)) - (= :mod-obj (:type change))) - (update :operations #(d/removev position-data-operation? %)))) - - ;; We update `position-data` from the incoming message - changes (->> changes - (map update-position-data) - (remove (fn [change] - (and (= page-id (:page-id change)) - (:ignore-remote? change)))) - (vec))] - - ;; The commit event is responsible to apply the data localy - ;; and update the persistence internal state with the updated - ;; file-revn - (rx/of (dch/commit {:file-id file-id - :file-revn revn - :save-undo? false - :source :remote - :redo-changes changes - :undo-changes []})))))) + (watch [_ _ _] + ;; The commit event is responsible to apply the data localy + ;; and update the persistence internal state with the updated + ;; file-revn + (rx/of (dch/commit {:file-id file-id + :file-revn revn + :save-undo? false + :source :remote + :redo-changes (vec changes) + :undo-changes []}))))) (def ^:private schema:handle-library-change diff --git a/frontend/src/app/main/data/workspace/shapes.cljs b/frontend/src/app/main/data/workspace/shapes.cljs index 81c12872a..fecb3f8e0 100644 --- a/frontend/src/app/main/data/workspace/shapes.cljs +++ b/frontend/src/app/main/data/workspace/shapes.cljs @@ -46,8 +46,8 @@ (defn update-shapes ([ids update-fn] (update-shapes ids update-fn nil)) - ([ids update-fn {:keys [reg-objects? save-undo? stack-undo? attrs ignore-tree page-id ignore-remote? ignore-touched undo-group with-objects?] - :or {reg-objects? false save-undo? true stack-undo? false ignore-remote? false ignore-touched false with-objects? false}}] + ([ids update-fn {:keys [reg-objects? save-undo? stack-undo? attrs ignore-tree page-id ignore-touched undo-group with-objects?] + :or {reg-objects? false save-undo? true stack-undo? false ignore-touched false with-objects? false}}] (dm/assert! "expected a valid coll of uuid's" @@ -84,8 +84,7 @@ changes (add-undo-group changes state)] (rx/concat (if (seq (:redo-changes changes)) - (let [changes (cond-> changes reg-objects? (pcb/resize-parents ids)) - changes (cond-> changes ignore-remote? (pcb/ignore-remote))] + (let [changes (cond-> changes reg-objects? (pcb/resize-parents ids))] (rx/of (dch/commit-changes changes))) (rx/empty)) diff --git a/frontend/src/app/main/data/workspace/texts.cljs b/frontend/src/app/main/data/workspace/texts.cljs index d1e55e027..89024cdc0 100644 --- a/frontend/src/app/main/data/workspace/texts.cljs +++ b/frontend/src/app/main/data/workspace/texts.cljs @@ -391,7 +391,6 @@ (rx/of (dwu/start-undo-transaction undo-id) (dwsh/update-shapes ids update-fn {:reg-objects? true :stack-undo? true - :ignore-remote? true :ignore-touched true}) (ptk/data-event :layout/update {:ids ids}) (dwu/commit-undo-transaction undo-id)))))))) @@ -536,7 +535,7 @@ (fn [shape] (-> shape (assoc :position-data (get position-data (:id shape))))) - {:stack-undo? true :reg-objects? false :ignore-remote? true})) + {:stack-undo? true :reg-objects? false})) (rx/of (fn [state] (dissoc state ::update-position-data-debounce ::update-position-data)))))))) diff --git a/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs b/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs index e9a413714..681dffd37 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs @@ -29,7 +29,8 @@ [promesa.core :as p] [rumext.v2 :as mf])) -(defn fix-position [shape] +(defn fix-position + [shape] (if-let [modifiers (:modifiers shape)] (let [shape' (gsh/transform-shape shape modifiers)