Merge pull request #4429 from penpot/alotor-bugfix-44

Alotor bugfix 44
This commit is contained in:
Alejandro 2024-04-15 12:38:56 +02:00 committed by GitHub
commit 002772ff0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 41 additions and 18 deletions

View File

@ -21,6 +21,10 @@
flex-direction: column;
}
.public-DraftStyleDefault-block {
white-space: pre;
}
&.align-top {
.DraftEditor-root {
justify-content: flex-start;

View File

@ -1711,8 +1711,14 @@
(process-entry [[type data]]
(case type
:text
(if (str/empty? data)
(cond
(str/empty? data)
(rx/empty)
(re-find #"<svg\s" data)
(rx/of (paste-svg-text data))
:else
(rx/of (paste-text data)))
:transit
@ -1757,8 +1763,7 @@
text-data (some-> pdata wapi/extract-text)
transit-data (ex/ignoring (some-> text-data t/decode-str))]
(cond
(and (string? text-data)
(str/includes? text-data "<svg "))
(and (string? text-data) (re-find #"<svg\s" text-data))
(rx/of (paste-svg-text text-data))
(seq image-data)

View File

@ -1491,9 +1491,22 @@
container
{:type :reg-objects
:shapes all-parents})]))))
(let [roperation {:type :set
(let [;; position-data is a special case because can be affected by :geometry-group and :content-group
;; so, if the position-data changes but the geometry is touched we need to reset the position-data
;; so it's calculated again
reset-pos-data?
(and (cfh/text-shape? origin-shape)
(= attr :position-data)
(not= (get origin-shape attr) (get dest-shape attr))
(touched :geometry-group))
roperation {:type :set
:attr attr
:val (get origin-shape attr)
:val (cond
;; If position data changes and the geometry group is touched
;; we need to put to nil so we can regenerate it
reset-pos-data? nil
:else (get origin-shape attr))
:ignore-touched true}
uoperation {:type :set
:attr attr

View File

@ -69,33 +69,34 @@
on-add
(mf/use-fn
(mf/deps ids)
(mf/deps ids fills)
(fn [_]
(st/emit! (dc/add-fill ids {:color default-color
:opacity 1}))
(when (not (some? (seq fills))) (open-content))))
(when (or (= :multiple fills)
(not (some? (seq fills))))
(open-content))))
on-change
(mf/use-fn
(mf/deps ids)
(fn [index]
(fn [color]
(st/emit! (dc/change-fill ids color index)))))
(fn [index]
(fn [color]
(st/emit! (dc/change-fill ids color index))))
on-reorder
(mf/use-fn
(mf/deps ids)
(fn [new-index]
(fn [index]
(st/emit! (dc/reorder-fills ids index new-index)))))
(fn [new-index]
(fn [index]
(st/emit! (dc/reorder-fills ids index new-index))))
on-remove
(fn [index]
(fn []
(st/emit! (dc/remove-fill ids {:color default-color
:opacity 1} index))
(when (= 1 (count (seq fills))) (close-content))))
(when (or (= :multiple fills)
(= 1 (count (seq fills))))
(close-content))))
on-remove-all
(fn [_]
(st/emit! (dc/remove-all-fills ids {:color clr/black