From a8565dc2c2f082690a834a7d8c674ec1906f189e Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 14 Apr 2021 08:32:06 +0200 Subject: [PATCH 1/2] :bug: Fix typography unlinking. --- .../src/app/main/data/workspace/texts.cljs | 27 +++++++++---------- .../workspace/sidebar/options/menus/text.cljs | 23 ++++++++-------- frontend/src/app/util/text_editor.cljs | 9 ++++--- frontend/src/app/util/text_editor_impl.js | 10 +++++-- 4 files changed, 39 insertions(+), 30 deletions(-) diff --git a/frontend/src/app/main/data/workspace/texts.cljs b/frontend/src/app/main/data/workspace/texts.cljs index dba5c2ace..d5334e539 100644 --- a/frontend/src/app/main/data/workspace/texts.cljs +++ b/frontend/src/app/main/data/workspace/texts.cljs @@ -176,22 +176,21 @@ (defn update-text-attrs [{:keys [id attrs]}] - (let [attrs (d/without-nils attrs)] - (ptk/reify ::update-text-attrs - ptk/UpdateEvent - (update [_ state] - (d/update-in-when state [:workspace-editor-state id] ted/update-editor-current-inline-styles attrs)) + (ptk/reify ::update-text-attrs + ptk/UpdateEvent + (update [_ state] + (d/update-in-when state [:workspace-editor-state id] ted/update-editor-current-inline-styles attrs)) - ptk/WatchEvent - (watch [_ state stream] - (when-not (some? (get-in state [:workspace-editor-state id])) - (let [objects (dwc/lookup-page-objects state) - shape (get objects id) + ptk/WatchEvent + (watch [_ state stream] + (when-not (some? (get-in state [:workspace-editor-state id])) + (let [objects (dwc/lookup-page-objects state) + shape (get objects id) - update-fn #(update-shape % txt/is-text-node? attrs/merge attrs) - shape-ids (cond (= (:type shape) :text) [id] - (= (:type shape) :group) (cp/get-children id objects))] - (rx/of (dwc/update-shapes shape-ids update-fn)))))))) + update-fn #(update-shape % txt/is-text-node? attrs/merge attrs) + shape-ids (cond (= (:type shape) :text) [id] + (= (:type shape) :group) (cp/get-children id objects))] + (rx/of (dwc/update-shapes shape-ids update-fn))))))) ;; --- RESIZE UTILS diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs index 0ff2b3d38..d7fd7d887 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/text.cljs @@ -240,18 +240,19 @@ (when-not (empty? attrs) (st/emit! (dwt/update-text-attrs {:id id :attrs attrs}))))) - typography (cond - (and (:typography-ref-id values) - (not= (:typography-ref-id values) :multiple) - (not= (:typography-ref-file values) file-id)) - (-> shared-libs - (get-in [(:typography-ref-file values) :data :typographies (:typography-ref-id values)]) - (assoc :file-id (:typography-ref-file values))) + typography + (cond + (and (:typography-ref-id values) + (not= (:typography-ref-id values) :multiple) + (not= (:typography-ref-file values) file-id)) + (-> shared-libs + (get-in [(:typography-ref-file values) :data :typographies (:typography-ref-id values)]) + (assoc :file-id (:typography-ref-file values))) - (and (:typography-ref-id values) - (not= (:typography-ref-id values) :multiple) - (= (:typography-ref-file values) file-id)) - (get typographies (:typography-ref-id values))) + (and (:typography-ref-id values) + (not= (:typography-ref-id values) :multiple) + (= (:typography-ref-file values) file-id)) + (get typographies (:typography-ref-id values))) on-convert-to-typography (mf/use-callback diff --git a/frontend/src/app/util/text_editor.cljs b/frontend/src/app/util/text_editor.cljs index 31db83fe1..33b28f3e4 100644 --- a/frontend/src/app/util/text_editor.cljs +++ b/frontend/src/app/util/text_editor.cljs @@ -10,14 +10,15 @@ (ns app.util.text-editor "Draft related abstraction functions." (:require - ["draft-js" :as draft] ["./text_editor_impl.js" :as impl] + ["draft-js" :as draft] [app.common.attrs :as attrs] - [app.common.text :as txt] [app.common.data :as d] - [app.util.transit :as t] + [app.common.text :as txt] + [app.common.uuid :as uuid] [app.util.array :as arr] [app.util.object :as obj] + [app.util.transit :as t] [clojure.walk :as walk] [cuerdas.core :as str])) @@ -26,6 +27,7 @@ (defn encode-style-value [v] (cond + (uuid? v) (str "u:" v) (string? v) (str "s:" v) (number? v) (str "n:" v) (keyword? v) (str "k:" (name v)) @@ -41,6 +43,7 @@ "n:" (js/Number (subs v 2)) "k:" (keyword (subs v 2)) "m:" (t/decode (subs v 2)) + "u:" (uuid/uuid (subs v 2)) "z:" nil "o:" (subs v 2) v))) diff --git a/frontend/src/app/util/text_editor_impl.js b/frontend/src/app/util/text_editor_impl.js index e81e06375..48c7b055f 100644 --- a/frontend/src/app/util/text_editor_impl.js +++ b/frontend/src/app/util/text_editor_impl.js @@ -109,12 +109,18 @@ export function applyInlineStyle(state, styles) { let content = null; for (let style of styles) { - const [p, k, _] = style.split("$$$"); + console.log("applyInlineStyle", style); + + const [p, k, v] = style.split("$$$"); const prefix = [p, k, ""].join("$$$"); content = state.getCurrentContent(); content = removeInlineStylePrefix(content, selection, prefix); - content = Modifier.applyInlineStyle(content, selection, style); + + if (v !== "z:null") { + content = Modifier.applyInlineStyle(content, selection, style); + } + state = EditorState.push(state, content, "change-inline-style"); } From ba0f9360f9f6f3d8c15b5b976153b47704380840 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 14 Apr 2021 13:50:11 +0200 Subject: [PATCH 2/2] :paperclip: Set version to 1.4.1-alpha. --- CHANGES.md | 12 ++++++++++++ version.txt | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 7ee739567..65cd4e7f4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,18 @@ ### :heart: Community contributions by (Thank you!) +## 1.4.1-alpha + +### :bug: Bugs fixed + +- Fix typography unlinking. +- Fix incorrect measures on shapes outside artboard. +- Fix issues on svg parsing related to numbers with exponents. +- Fix some race conditions on removing shape from workspace. +- Fix incorrect state management of user lang selection. +- Fix email validation usability issue on team invitation lightbox. + + ## 1.4.0-alpha ### :sparkles: New features diff --git a/version.txt b/version.txt index 06c33719e..2662b507a 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -1.4.0-alpha +1.4.1-alpha