diff --git a/backend/resources/emails/feedback/en.html b/backend/resources/emails/feedback/en.html
new file mode 100644
index 000000000..478a3cc3c
--- /dev/null
+++ b/backend/resources/emails/feedback/en.html
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+ Feedback from:
+ {% if profile %}
+
+ Name:
+ {{profile.fullname}}
+
+
+
+
+ Email:
+ {{profile.email}}
+
+
+
+
+ ID:
+ {{profile.id}}
+
+ {% else %}
+
+ Email:
+ {{profile.email}}
+
+ {% endif %}
+
+
+ Subject:
+ {{subject}}
+
+
+
+ Message:
+ {{content|linebreaks-br|safe}}
+
+
+
diff --git a/frontend/src/app/main/ui/shapes/text/embed.cljs b/frontend/src/app/main/ui/shapes/text/embed.cljs
index 11b1dc0ff..4e8030497 100644
--- a/frontend/src/app/main/ui/shapes/text/embed.cljs
+++ b/frontend/src/app/main/ui/shapes/text/embed.cljs
@@ -5,6 +5,7 @@
;; Copyright (c) UXBOX Labs SL
(ns app.main.ui.shapes.text.embed
+ (:refer-clojure :exclude [memoize])
(:require
[app.common.data :as d]
[app.common.text :as txt]
@@ -35,7 +36,7 @@
[node]
(let [current-font (if (not (nil? (:font-id node)))
#{(select-keys node [:font-id :font-variant-id])}
- #{})
+ #{(select-keys txt/default-text-attrs [:font-id :font-variant-id])})
children-font (map get-node-fonts (:children node))]
(reduce set/union (conj children-font current-font))))
@@ -87,21 +88,31 @@
replace-text (fn [text [url data]] (str/replace text url data))]
(reduce replace-text css url-to-data))))
+;; NOTE: we can't move this to generic hooks namespace because that
+;; namespace imports some code incompatible with webworkers and this
+;; font embbeding should be able run on browser and webworker
+;; contexts.
+(defn- memoize
+ [val]
+ (let [ref (mf/use-ref #js {})]
+ (when-not (= (mf/ref-val ref) val)
+ (mf/set-ref-val! ref val))
+ (mf/ref-val ref)))
+
(mf/defc embed-fontfaces-style
- {::mf/wrap-props false}
+ {::mf/wrap-props false
+ ::mf/wrap [mf/memo]}
[props]
(let [node (obj/get props "node")
+ fonts (-> node get-node-fonts memoize)
style (mf/use-state nil)]
- (mf/use-effect
- (mf/deps node)
- (fn []
- (let [font-to-embed (get-node-fonts node)
- font-to-embed (if (empty? font-to-embed) #{txt/default-text-attrs} font-to-embed)
- embeded (map embed-font font-to-embed)]
- (-> (p/all embeded)
- (p/then (fn [result]
- (reset! style (str/join "\n" result))))))))
+ (mf/use-effect
+ (mf/deps fonts)
+ (fn []
+ (-> (p/all (map embed-font fonts))
+ (p/then (fn [result]
+ (reset! style (str/join "\n" result)))))))
(when (some? @style)
[:style @style])))
diff --git a/frontend/src/app/util/text_editor_impl.js b/frontend/src/app/util/text_editor_impl.js
index e679f4e6d..9255ec621 100644
--- a/frontend/src/app/util/text_editor_impl.js
+++ b/frontend/src/app/util/text_editor_impl.js
@@ -106,8 +106,6 @@ export function applyInlineStyle(state, styles) {
let content = null;
for (let style of styles) {
- console.log("applyInlineStyle", style);
-
const [p, k, v] = style.split("$$$");
const prefix = [p, k, ""].join("$$$");