mirror of
https://github.com/penpot/penpot.git
synced 2025-06-24 20:56:58 +02:00
✨ Exposes board clipContent and showInViewMode properties in plugins
This commit is contained in:
parent
29466b47fe
commit
ed0c84a069
1 changed files with 33 additions and 0 deletions
|
@ -1231,6 +1231,39 @@
|
|||
|
||||
(cond-> (cfh/frame-shape? data)
|
||||
(-> (crc/add-properties!
|
||||
{:name "clipContent"
|
||||
:get
|
||||
(fn [self]
|
||||
(-> self u/proxy->shape :show-content not))
|
||||
|
||||
:set
|
||||
(fn [_ value]
|
||||
(cond
|
||||
(not (boolean? value))
|
||||
(u/display-not-valid :clipContent value)
|
||||
|
||||
(not (r/check-permission plugin-id "content:write"))
|
||||
(u/display-not-valid :clipContent "Plugin doesn't have 'content:write' permission")
|
||||
|
||||
:else
|
||||
(st/emit! (dwsh/update-shapes [id] #(assoc % :show-content (not value))))))}
|
||||
|
||||
{:name "showInViewMode"
|
||||
:get
|
||||
(fn [self]
|
||||
(-> self u/proxy->shape :hide-in-viewer not))
|
||||
:set
|
||||
(fn [_ value]
|
||||
(cond
|
||||
(not (boolean? value))
|
||||
(u/display-not-valid :showInViewMode value)
|
||||
|
||||
(not (r/check-permission plugin-id "content:write"))
|
||||
(u/display-not-valid :showInViewMode "Plugin doesn't have 'content:write' permission")
|
||||
|
||||
:else
|
||||
(st/emit! (dwsh/update-shapes [id] #(assoc % :hide-in-viewer (not value))))))}
|
||||
|
||||
{:name "grid"
|
||||
:get
|
||||
(fn [self]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue