mirror of
https://github.com/penpot/penpot.git
synced 2025-07-17 00:36:13 +02:00
🐛 Fix small problems in plugins
This commit is contained in:
parent
b50fcee079
commit
cf705e352b
2 changed files with 29 additions and 21 deletions
|
@ -232,8 +232,9 @@
|
||||||
(not (contains? #{"vertical" "horizontal"} orientation))
|
(not (contains? #{"vertical" "horizontal"} orientation))
|
||||||
(u/display-not-valid :addRulerGuide "Orientation should be either 'vertical' or 'horizontal'")
|
(u/display-not-valid :addRulerGuide "Orientation should be either 'vertical' or 'horizontal'")
|
||||||
|
|
||||||
(or (not (shape/shape-proxy? board))
|
(and (some? shape)
|
||||||
(not (cfh/frame-shape? shape)))
|
(or (not (shape/shape-proxy? board))
|
||||||
|
(not (cfh/frame-shape? shape))))
|
||||||
(u/display-not-valid :addRulerGuide "The shape is not a board")
|
(u/display-not-valid :addRulerGuide "The shape is not a board")
|
||||||
|
|
||||||
(not (r/check-permission $plugin "content:write"))
|
(not (r/check-permission $plugin "content:write"))
|
||||||
|
@ -265,12 +266,14 @@
|
||||||
|
|
||||||
(addCommentThread
|
(addCommentThread
|
||||||
[_ content position board]
|
[_ content position board]
|
||||||
(let [shape (when board (u/proxy->shape board))]
|
(let [shape (when board (u/proxy->shape board))
|
||||||
|
position (parser/parse-point position)]
|
||||||
(cond
|
(cond
|
||||||
(or (not (string? content)) (empty? content))
|
(or (not (string? content)) (empty? content))
|
||||||
(u/display-not-valid :addCommentThread "Content not valid")
|
(u/display-not-valid :addCommentThread "Content not valid")
|
||||||
|
|
||||||
(or (not (us/safe-number? (:x position))) (not (us/safe-number? (:y position))))
|
(or (not (us/safe-number? (:x position)))
|
||||||
|
(not (us/safe-number? (:y position))))
|
||||||
(u/display-not-valid :addCommentThread "Position not valid")
|
(u/display-not-valid :addCommentThread "Position not valid")
|
||||||
|
|
||||||
(and (some? board) (or (not (shape/shape-proxy? board)) (not (cfh/frame-shape? shape))))
|
(and (some? board) (or (not (shape/shape-proxy? board)) (not (cfh/frame-shape? shape))))
|
||||||
|
@ -280,22 +283,27 @@
|
||||||
(u/display-not-valid :addCommentThread "Plugin doesn't have 'content:write' permission")
|
(u/display-not-valid :addCommentThread "Plugin doesn't have 'content:write' permission")
|
||||||
|
|
||||||
:else
|
:else
|
||||||
(p/create
|
(let [position
|
||||||
(fn [resolve]
|
(cond-> position
|
||||||
(st/emit!
|
(some? board)
|
||||||
(dc/create-thread-on-workspace
|
(-> (update :x - (:x board))
|
||||||
{:file-id $file
|
(update :y - (:y board))))]
|
||||||
:page-id $id
|
(p/create
|
||||||
:position (gpt/point (parser/parse-point position))
|
(fn [resolve]
|
||||||
:content content}
|
(st/emit!
|
||||||
|
(dc/create-thread-on-workspace
|
||||||
|
{:file-id $file
|
||||||
|
:page-id $id
|
||||||
|
:position (gpt/point position)
|
||||||
|
:content content}
|
||||||
|
|
||||||
(fn [data]
|
(fn [data]
|
||||||
(->> (rp/cmd! :get-team-users {:file-id $file})
|
(->> (rp/cmd! :get-team-users {:file-id $file})
|
||||||
(rx/subs!
|
(rx/subs!
|
||||||
(fn [users]
|
(fn [users]
|
||||||
(let [users (d/index-by :id users)]
|
(let [users (d/index-by :id users)]
|
||||||
(resolve (pc/comment-thread-proxy $plugin $file $id users data)))))))
|
(resolve (pc/comment-thread-proxy $plugin $file $id users data)))))))
|
||||||
false)))))))
|
false))))))))
|
||||||
|
|
||||||
(removeCommentThread
|
(removeCommentThread
|
||||||
[_ thread]
|
[_ thread]
|
||||||
|
|
|
@ -93,7 +93,7 @@
|
||||||
{:name "bounds"
|
{:name "bounds"
|
||||||
:get
|
:get
|
||||||
(fn [_]
|
(fn [_]
|
||||||
(let [vport (dm/get-in @st/state [:workspace-local :vport])]
|
(let [vbox (dm/get-in @st/state [:workspace-local :vbox])]
|
||||||
(.freeze js/Object (format/format-bounds vport))))}))
|
(.freeze js/Object (format/format-bounds vbox))))}))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue