mirror of
https://github.com/penpot/penpot.git
synced 2026-03-24 20:30:47 +01:00
✨ Add version property to plugins API (#8676)
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
[app.common.types.shape :as cts]
|
||||
[app.common.types.text :as txt]
|
||||
[app.common.uuid :as uuid]
|
||||
[app.config :as cf]
|
||||
[app.main.data.changes :as ch]
|
||||
[app.main.data.common :as dcm]
|
||||
[app.main.data.helpers :as dsh]
|
||||
@@ -84,6 +85,10 @@
|
||||
:$plugin {:enumerable false :get (fn [] plugin-id)}
|
||||
|
||||
;; Public properties
|
||||
:version
|
||||
{:this true
|
||||
:get (constantly (:base cf/version))}
|
||||
|
||||
:root
|
||||
{:this true
|
||||
:get #(.getRoot ^js %)}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
## 1.5.0 (Unreleased)
|
||||
|
||||
- **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)
|
||||
|
||||
|
||||
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.
|
||||
*/
|
||||
export interface Context {
|
||||
/**
|
||||
* Returns the current penpot version.
|
||||
*/
|
||||
readonly version: string;
|
||||
|
||||
/**
|
||||
* The root shape in the current Penpot context. Requires `content:read` permission.
|
||||
*
|
||||
|
||||
@@ -165,6 +165,10 @@ export function createApi(
|
||||
|
||||
// Penpot State API
|
||||
|
||||
get version(): string {
|
||||
return plugin.context.version;
|
||||
},
|
||||
|
||||
get root(): Shape | null {
|
||||
checkPermission('content:read');
|
||||
return plugin.context.root;
|
||||
|
||||
Reference in New Issue
Block a user