Merge remote-tracking branch 'origin/staging' into develop

This commit is contained in:
Andrey Antukh 2025-05-15 09:52:31 +02:00
commit a00e7c1061
71 changed files with 169 additions and 94 deletions

View file

@ -34,6 +34,7 @@
[app.common.types.shape :as cts]
[app.common.types.shape-tree :as ctst]
[app.common.types.shape.layout :as ctl]
[app.common.types.shape.text :as types.text]
[app.common.types.typography :as ctt]
[app.common.uuid :as uuid]
[app.config :as cf]
@ -2191,27 +2192,27 @@
(ptk/reify ::paste-html-text
ptk/WatchEvent
(watch [_ state _]
(let [root (dwtxt/create-root-from-html html)
content (tc/dom->cljs root)
(let [root (dwtxt/create-root-from-html html)
content (tc/dom->cljs root)]
(when (types.text/valid-content? content)
(let [id (uuid/next)
width (max 8 (min (* 7 (count text)) 700))
height 16
{:keys [x y]} (calculate-paste-position state)
id (uuid/next)
width (max 8 (min (* 7 (count text)) 700))
height 16
{:keys [x y]} (calculate-paste-position state)
shape {:id id
:type :text
:name (txt/generate-shape-name text)
:x x
:y y
:width width
:height height
:grow-type (if (> (count text) 100) :auto-height :auto-width)
:content content}
undo-id (js/Symbol)]
(rx/of (dwu/start-undo-transaction undo-id)
(dwsh/create-and-add-shape :text x y shape)
(dwu/commit-undo-transaction undo-id))))))
shape {:id id
:type :text
:name (txt/generate-shape-name text)
:x x
:y y
:width width
:height height
:grow-type (if (> (count text) 100) :auto-height :auto-width)
:content content}
undo-id (js/Symbol)]
(rx/of (dwu/start-undo-transaction undo-id)
(dwsh/create-and-add-shape :text x y shape)
(dwu/commit-undo-transaction undo-id))))))))
(defn- paste-text
[text]

View file

@ -48,7 +48,7 @@
ptk/UpdateEvent
(update [_ state]
(-> state
(update :workspace-local dissoc :edition)
(update :workspace-local dissoc :edition :edit-path)
(update :workspace-drawing dissoc :tool :object :lock)
(dissoc :workspace-grid-edition)))

View file

@ -22,6 +22,7 @@
[app.main.data.helpers :as dsh]
[app.main.data.modal :as md]
[app.main.data.workspace.collapse :as dwc]
[app.main.data.workspace.edition :as dwe]
[app.main.data.workspace.specialized-panel :as-alias dwsp]
[app.main.data.workspace.undo :as dwu]
[app.main.data.workspace.zoom :as dwz]
@ -305,8 +306,9 @@
(watch [_ state _]
(let [params-without-board (-> (rt/get-params state)
(dissoc :board-id))]
(rx/of ::dwsp/interrupt)
(rx/of (rt/nav :workspace params-without-board {::rt/replace true}))))
(rx/of ::dwsp/interrupt
(dwe/clear-edition-mode)
(rt/nav :workspace params-without-board {::rt/replace true}))))
ptk/UpdateEvent
(update [_ state]

View file

@ -129,6 +129,12 @@
input-ref (mf/use-ref nil)
team (mf/deref refs/team)
permissions (get team :permissions)
display-share-button?
(and (not (:is-default team))
(or (:is-admin permissions)
(:is-owner permissions)))
nav-to-viewer
(mf/use-fn
@ -216,7 +222,7 @@
:on-click toggle-history}
i/history]])
(when (not (:is-default team))
(when display-share-button?
[:a {:class (stl/css :viewer-btn)
:title (tr "workspace.header.share")
:on-click open-share-dialog}