mirror of
https://github.com/penpot/penpot.git
synced 2025-02-08 08:09:14 -05:00
Merge branch 'main' into develop
This commit is contained in:
commit
d946aceacb
3 changed files with 67 additions and 13 deletions
45
backend/resources/emails/feedback/en.html
Normal file
45
backend/resources/emails/feedback/en.html
Normal file
|
@ -0,0 +1,45 @@
|
|||
<!doctype html>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
<strong>Feedback from:</strong><br />
|
||||
{% if profile %}
|
||||
<span>
|
||||
<span>Name: </span>
|
||||
<span><code>{{profile.fullname}}</code></span>
|
||||
</span>
|
||||
<br />
|
||||
|
||||
<span>
|
||||
<span>Email: </span>
|
||||
<span>{{profile.email}}</span>
|
||||
</span>
|
||||
<br />
|
||||
|
||||
<span>
|
||||
<span>ID: </span>
|
||||
<span><code>{{profile.id}}</code></span>
|
||||
</span>
|
||||
{% else %}
|
||||
<span>
|
||||
<span>Email: </span>
|
||||
<span>{{profile.email}}</span>
|
||||
</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
<p>
|
||||
<strong>Subject:</strong><br />
|
||||
<span>{{subject}}</span>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Message:</strong><br />
|
||||
{{content|linebreaks-br|safe}}
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -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])))
|
||||
|
|
|
@ -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("$$$");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue