mirror of
https://github.com/penpot/penpot.git
synced 2025-06-06 16:31:39 +02:00
✨ New plugins permissions dialog
This commit is contained in:
parent
fbce59e81f
commit
741bf3b666
15 changed files with 291 additions and 84 deletions
|
@ -6,7 +6,6 @@
|
|||
|
||||
(ns app.plugins.events
|
||||
(:require
|
||||
[app.common.data.macros :as dm]
|
||||
[app.main.store :as st]
|
||||
[app.plugins.file :as file]
|
||||
[app.plugins.page :as page]
|
||||
|
@ -24,25 +23,19 @@
|
|||
|
||||
(defmethod handle-state-change "filechange"
|
||||
[_ plugin-id old-val new-val]
|
||||
(let [old-file (:workspace-file old-val)
|
||||
new-file (:workspace-file new-val)
|
||||
old-data (:workspace-data old-val)
|
||||
new-data (:workspace-data new-val)]
|
||||
(if (and (identical? old-file new-file)
|
||||
(identical? old-data new-data))
|
||||
(let [old-file-id (:current-file-id old-val)
|
||||
new-file-id (:current-file-id new-val)]
|
||||
(if (identical? old-file-id new-file-id)
|
||||
::not-changed
|
||||
(file/file-proxy plugin-id (:id new-file)))))
|
||||
(file/file-proxy plugin-id new-file-id))))
|
||||
|
||||
(defmethod handle-state-change "pagechange"
|
||||
[_ plugin-id old-val new-val]
|
||||
(let [file-id (:current-file-id new-val)
|
||||
old-page-id (:current-page-id old-val)
|
||||
new-page-id (:current-page-id new-val)
|
||||
old-page (dm/get-in old-val [:workspace-data :pages-index old-page-id])
|
||||
new-page (dm/get-in new-val [:workspace-data :pages-index new-page-id])]
|
||||
(if (identical? old-page new-page)
|
||||
(let [old-page-id (:current-page-id old-val)
|
||||
new-page-id (:current-page-id new-val)]
|
||||
(if (identical? old-page-id new-page-id)
|
||||
::not-changed
|
||||
(page/page-proxy plugin-id file-id new-page-id))))
|
||||
(page/page-proxy plugin-id (:current-file-id new-val) new-page-id))))
|
||||
|
||||
(defmethod handle-state-change "selectionchange"
|
||||
[_ _ old-val new-val]
|
||||
|
@ -75,7 +68,10 @@
|
|||
(fn [_ _ old-val new-val]
|
||||
(let [result (handle-state-change type plugin-id old-val new-val)]
|
||||
(when (not= ::not-changed result)
|
||||
(callback result)))))
|
||||
(try
|
||||
(callback result)
|
||||
(catch :default cause
|
||||
(.error js/console cause)))))))
|
||||
|
||||
;; return the generated key
|
||||
key))
|
||||
|
|
|
@ -60,23 +60,6 @@
|
|||
(declare shape-proxy)
|
||||
(declare shape-proxy?)
|
||||
|
||||
#_(defn parse-command
|
||||
[entry]
|
||||
(update entry
|
||||
:command
|
||||
#(case %
|
||||
"M" :move-to
|
||||
"Z" :close-path
|
||||
"L" :line-to
|
||||
"H" :line-to-horizontal
|
||||
"V" :line-to-vertical
|
||||
"C" :curve-to
|
||||
"S" :smooth-curve-to
|
||||
"Q" :quadratic-bezier-curve-to
|
||||
"T" :smooth-quadratic-bezier-curve-to
|
||||
"A" :elliptical-arc
|
||||
(keyword %))))
|
||||
|
||||
(defn- shadow-defaults
|
||||
[shadow]
|
||||
(d/patch-object
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue