mirror of
https://github.com/penpot/penpot.git
synced 2026-04-25 11:18:36 +00:00
✨ Add version property to plugins API (#8676)
This commit is contained in:
parent
1b91bbe64d
commit
a4ad940177
@ -18,6 +18,7 @@
|
|||||||
[app.common.types.shape :as cts]
|
[app.common.types.shape :as cts]
|
||||||
[app.common.types.text :as txt]
|
[app.common.types.text :as txt]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
|
[app.config :as cf]
|
||||||
[app.main.data.changes :as ch]
|
[app.main.data.changes :as ch]
|
||||||
[app.main.data.common :as dcm]
|
[app.main.data.common :as dcm]
|
||||||
[app.main.data.helpers :as dsh]
|
[app.main.data.helpers :as dsh]
|
||||||
@ -84,6 +85,10 @@
|
|||||||
:$plugin {:enumerable false :get (fn [] plugin-id)}
|
:$plugin {:enumerable false :get (fn [] plugin-id)}
|
||||||
|
|
||||||
;; Public properties
|
;; Public properties
|
||||||
|
:version
|
||||||
|
{:this true
|
||||||
|
:get (constantly (:base cf/version))}
|
||||||
|
|
||||||
:root
|
:root
|
||||||
{:this true
|
{:this true
|
||||||
:get #(.getRoot ^js %)}
|
:get #(.getRoot ^js %)}
|
||||||
|
|||||||
@ -1,6 +1,11 @@
|
|||||||
## 1.5.0 (Unreleased)
|
## 1.5.0 (Unreleased)
|
||||||
|
|
||||||
- **plugin-types**: Added a flags subcontexts with the flag `naturalChildrenOrdering`
|
- **plugin-types**: Added a flags subcontexts with the flag `naturalChildrenOrdering`
|
||||||
|
- **plugins-runtime**: Added `version` field that returns the current version
|
||||||
|
- **plugin-types**: Fix penpot.openPage() to navigate in same tab by default
|
||||||
|
- **plugin-types**: Added `createVariantFromComponents`
|
||||||
|
- **plugin-types**: Change return type of `combineAsVariants`
|
||||||
|
- **plugin-types**: Added `textBounds` property for text shapes
|
||||||
|
|
||||||
## 1.4.2 (2026-01-21)
|
## 1.4.2 (2026-01-21)
|
||||||
|
|
||||||
|
|||||||
5
plugins/libs/plugin-types/index.d.ts
vendored
5
plugins/libs/plugin-types/index.d.ts
vendored
@ -768,6 +768,11 @@ export interface CommonLayout {
|
|||||||
* Represents the context of Penpot, providing access to various Penpot functionalities and data.
|
* Represents the context of Penpot, providing access to various Penpot functionalities and data.
|
||||||
*/
|
*/
|
||||||
export interface Context {
|
export interface Context {
|
||||||
|
/**
|
||||||
|
* Returns the current penpot version.
|
||||||
|
*/
|
||||||
|
readonly version: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The root shape in the current Penpot context. Requires `content:read` permission.
|
* The root shape in the current Penpot context. Requires `content:read` permission.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -165,6 +165,10 @@ export function createApi(
|
|||||||
|
|
||||||
// Penpot State API
|
// Penpot State API
|
||||||
|
|
||||||
|
get version(): string {
|
||||||
|
return plugin.context.version;
|
||||||
|
},
|
||||||
|
|
||||||
get root(): Shape | null {
|
get root(): Shape | null {
|
||||||
checkPermission('content:read');
|
checkPermission('content:read');
|
||||||
return plugin.context.root;
|
return plugin.context.root;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user