From 808e024aac27b79a0dc024a036f8bebeb4db59b5 Mon Sep 17 00:00:00 2001 From: quinntracy Date: Thu, 16 Oct 2025 11:33:05 +0200 Subject: [PATCH 01/14] Review Index and Packaging your extension --- .../studio-pro-11/extensibility-api/_index.md | 4 ++-- .../packaging-your-extension.md | 20 ++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/_index.md b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/_index.md index f688d280e74..6a8b08132e9 100644 --- a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/_index.md +++ b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/_index.md @@ -20,6 +20,6 @@ For information on new releases of the Extensibility API see: ## Introduction -Extensions are self-contained modules which users can add to Studio Pro. This means that with extensibility you can add new features and functionality to Studio Pro. The Extensibility API is an API that allows developers to interact with a curated list of internal systems of Studio Pro. This documentation provides guides and reference documentation for the Extensibility API. +Extensions are self-contained modules that enhance Studio Pro by adding new features and functionality. The Extensibility API allows developers to interact with a curated set of internal systems, making it easier to customize and expand Studio Pro’s capabilities. -The API is provided in two flavors, depending which language you are developing in. C# and web based (via Typescript): +The API is provided in two sections, depending on the language you are developing in: diff --git a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/packaging-your-extension.md b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/packaging-your-extension.md index 48b63611260..7b74759b7fe 100644 --- a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/packaging-your-extension.md +++ b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/packaging-your-extension.md @@ -4,26 +4,32 @@ url: /apidocs-mxsdk/apidocs/extensibility-api-11/packaging-your-extension weight: 30 --- -# Packaging your extension +# Packaging Your Extension -Once you have finished development on your extension, you might want to package it into an add-on module so that others can start using it. Once you have created the add-on module, it can then be published to the Mendix Marketplace for your extension users to download into their Studio Pro app. +After completing development on your extension, you can package it into an add-on module so others can use it. Once packaged, the module can be published to the Mendix Marketplace, allowing other users to download it into their Studio Pro apps. -To package your extension, you will still need the `--enable-extension-development` command line option turned on. Create a new module in your Studio Pro app containing your dev extension, give it an appropriate name. Open the module's settings form and set it to be an Add-on module. In the `Extension name` dropdown, select the extension you want to package into it. +To package your extension, follow the steps below: + +1. Make sure the`--enable-extension-development` command-line option is enabled. +2. In your Studio Pro app, create a new module and include your development extension. +3. Give the module a name. +4. Open the module's settings and in the **Export** tab, choose **Add-on module**. +5. In the **Extension name** drop-down, select the extension you want to package into it. ![Extension Add-on Module](/attachments/apidocs-mxsdk/apidocs/extensibility-api/extensionAddOnModule.png) -After you've created your add-on module with its extension, you can now export it, by right-clicking the module in the App Explorer and choosing `Export add-on module package`, as shown below. +After you have created your add-on module with its extension, you can export it by right-clicking the module in the **App Explorer** and selecting **Export add-on module package**. ![Export Module](/attachments/apidocs-mxsdk/apidocs/extensibility-api/exportAddOnModule.png) You can now save the add-on module to a location of your choice. -# Importing the extension add-on module +# Importing the Extension Add-on Module -Once the add-on module is available to a Studio Pro user, they are now able to add it in their application. They can so so by right-clicking the app in the App Explorer and choosing `Import module package`, as shown below. +When the add-on module is available to a Studio Pro user, they are now able to add it in their application. This is done by right-clicking the app in the **App Explorer** and selecting **Import module package**. ![Import Module](/attachments/apidocs-mxsdk/apidocs/extensibility-api/importAddOnModule.png) -Once an add-on module containing an extension is imported in the app, Studio Pro will show a warning to the user, asking to trust the extension contained in it. If the user does not choose to trust, the module will still be imported but the extension inside it won't be loaded. +When an add-on module containing an extension is imported in the app, Studio Pro will show a warning to the user, asking to trust the extension contained in it. If the user does not choose to trust, the module will still be imported but the extension inside it will not be loaded. ![Trust Extension](/attachments/apidocs-mxsdk/apidocs/extensibility-api/trustExtension.png) From 22e5866fa4050aeab4beaaaf7338c8fb77b0a6d3 Mon Sep 17 00:00:00 2001 From: quinntracy Date: Thu, 16 Oct 2025 11:37:01 +0200 Subject: [PATCH 02/14] Review index --- .../studio-pro-11/extensibility-api/web/_index.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/_index.md b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/_index.md index fe6b31c59d8..97c0996d8ba 100644 --- a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/_index.md +++ b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/_index.md @@ -13,23 +13,25 @@ weight: 20 ## Introduction -Extensions can be written in Typescript or other web languages, described here, or using a C# API which is documented separately in [Extensibility API for C# Developers](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/). +Extensions can be written in TypeScript or other web languages, described here, or using a C# API, which is documented in [Extensibility API for C# Developers](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/). {{% alert color="info" %}} -Please note that extension development is only possible by starting Studio Pro with the `--enable-extension-development` feature flag. +At this time, extension development is only possible with the `--enable-extension-development` feature flag. {{% /alert %}} For more detailed information on the web API, see the [Mendix Studio Pro Web Extensibility API reference documentation](http://apidocs.rnd.mendix.com/11/extensions-api/index.html). ## Prerequisites -* You need at least a basic understanding of the Mendix platform. -* You need some understanding of the Mendix Model. -* You need to have some TypeScript development experience. +To use the Web Extensibility API, you must have: + +* A basic understanding of the Mendix platform +* Some understanding of the Mendix Model +* Some TypeScript development experience ## Getting Started -For detailed explanation on how to get started with extensions, check out [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). +For detailed information on how to get started with extensions, see [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). ## How-tos From b54c33d2a85d51695999d838f7d22f89314ebd96 Mon Sep 17 00:00:00 2001 From: quinntracy Date: Thu, 16 Oct 2025 11:43:09 +0200 Subject: [PATCH 03/14] Review Get Started --- .../extensibility-api/web/get-started.md | 35 +++++++------------ 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/get-started.md b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/get-started.md index dd7e9868c62..9b9ae959c51 100644 --- a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/get-started.md +++ b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/get-started.md @@ -7,7 +7,7 @@ weight: 2 ## Introduction -Studio Pro extensions can be developed using TypeScript and use standard web development technologies to extend the Studio Pro development environment. This guide shows you how to set up a basic development environment for building an extension using the web extensibility API. +Studio Pro extensions can be developed using TypeScript and use standard web development technologies to extend the Studio Pro development environment. This document describes how to set up a basic development environment for building an extension using the web extensibility API. For more detailed information, see the [Mendix Studio Pro Web Extensibility API reference documentation](http://apidocs.rnd.mendix.com/11/extensions-api/index.html). @@ -16,11 +16,11 @@ For more detailed information, see the [Mendix Studio Pro Web Extensibility API You will need the following prerequisites: * [Mendix Studio Pro](https://marketplace.mendix.com/link/studiopro) version 11.2.0 or higher. -* A development IDE to develop your extensions. We recommend using [Visual Studio Code](https://code.visualstudio.com/). -* Install the latest version 22.x.x of Node: https://nodejs.org/en/download. +* A development IDE to develop your extensions. Mendix recommends using [Visual Studio Code](https://code.visualstudio.com/). +* The latest version 22.x.x of Node: https://nodejs.org/en/download. {{% alert color="info" %}} -Extensions can be built on any operating system as the underlying framework is cross-platform. +Extensions can be built on any operating system, as the underlying framework is cross-platform. {{% /alert %}} {{% alert color="info" %}} @@ -35,28 +35,26 @@ This section will show you how to build and test an extension. Create a new app using the **Blank Web App** template. -{{% alert color="info" %}} You can also open the application directory containing the application `.mpr` file by clicking the **App** menu > **Show App Directory in Explorer** (or **Show App Directory in Finder**) in Studio Pro. -{{% /alert %}} ### Creating the Extension -To accelerate your extension development, we provide an extension generator that creates a customizable sample extension. +To accelerate your extension development, Mendix provides an extension generator that creates a customizable sample extension. To use the generator, navigate to your desired source code directory and run the command `npm create @mendix/extension`. You may be prompted by `npm` to grant permission to install the generator. After installation, you will be guided through a series of questions to help configure your extension. You will be asked the following: -* Select the programming language (TypeScript is used in our tutorials) +* Select the programming language (TypeScript is used in the tutorials) * Specify the extension name -* Choose if you will use React for the extension’s UI +* Choose if you will use React for the extension’s UI -The next two questions, while optional, are highly recommended, as they enable direct debugging and deployment from Visual Studio Code. +The next two questions, while optional, are highly recommended, as they enable direct debugging and deployment from Visual Studio Code: * Specify the path to the Studio Pro executable (this allows Visual Studio Code to automatically attach to Studio Pro for debugging) -* Specify the location of the application `.mpr` package. (This allows for automatic deployment of your extension build to your app) +* Specify the location of the application `.mpr` package (this allows for automatic deployment of your extension build to your app) - The final question allows you to select the Studio Pro version you are targeting; we recommend you choose version 11. + The last question allows you to select the Studio Pro version you are targeting; Mendix recommends choosing version 11. {{% alert color="info" %}} On a Windows machine, the Studio Pro executable is typically located at `C:\Program Files\Mendix\\modeler\studiopro.exe`. To find the exact path, follow these steps: @@ -155,17 +153,8 @@ If the last two questions of the extension generator were answered and you have This will run Studio Pro in extension development mode and open the configured application. You will see a new `Extensions` item in the top menu. -## Conclusion - -Using this guide we have: - -* Created a new app -* Used the extension generator to get started with extension development -* Built the extension and installed it in our app -* Tested and debugged our extension from within Visual Studio Code - ## Extensibility Feedback -If you would like to provide us with some additional feedback you can complete a small [Survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback) +If you would like to provide additional feedback, you can complete a small [survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback). -Any feedback is much appreciated. +Any feedback is appreciated. From c9ec0798899d44a9df1306af3b63e4bd403f169f Mon Sep 17 00:00:00 2001 From: quinntracy Date: Thu, 16 Oct 2025 11:47:37 +0200 Subject: [PATCH 04/14] Review App Explorer --- .../web-extensions-howtos/app-explorer-api.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/app-explorer-api.md b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/app-explorer-api.md index a6954e93e3f..c1fb1f2b64d 100644 --- a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/app-explorer-api.md +++ b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/app-explorer-api.md @@ -6,15 +6,19 @@ url: /apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/ ## Introduction -This how-to describes how to interact with the App Explorer in Studio Pro. +This how-to describes how to interact with the App Explorer in Studio Pro. In this example, you create a menu which will show for each microflow in the App Explorer. ## Prerequisites -This how-to uses the results of [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). Please complete that how-to before starting this one. You should also be familiar with command registration as described in [Register a Command Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/command-api/). +Before starting this how-to, make sure you have completed the following prerequisites: + +* This how-to uses the results of [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). Complete that how-to before starting this one. +* Make sure you are familiar with command registration, as described in [Register a Command Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/command-api/). ## Creating a Context Menu -In this example, you will create a menu which will show for each microflow in the App Explorer. Use the full name of the document type to specify which type of document a menu should belong to (for example, `Microflows$Microflow` for microflows or `Pages$Page` for pages). The documentation for these document type names can be found at [Access a Mendix Model Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/model-api/). +{{% alert color="info" %}} +Use the full name of the document type to specify which type of document a menu should belong to (for example, `Microflows$Microflow` for microflows or `Pages$Page` for pages). For more information about these document type names, see [Access a Mendix Model Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/model-api/). The code below does the following: @@ -55,12 +59,8 @@ The payload of the command must be an object containing a document Id (`{ docume The command must be registered before creating the menu. {{% /alert %}} -## Conclusion - -You have seen how to create context menus for a document node in the App Explorer. The menu executes a previously registered command. - ## Extensibility Feedback -If you would like to provide us with additional feedback, you can complete a small [survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback). +If you would like to provide additional feedback, you can complete a small [survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback). Any feedback is appreciated. From 9b8926ba5d77a92f6657d27312ae948537abb582 Mon Sep 17 00:00:00 2001 From: quinntracy Date: Thu, 16 Oct 2025 11:54:41 +0200 Subject: [PATCH 05/14] Review Command API --- .../web/web-extensions-howtos/command-api.md | 37 ++++++++++++------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/command-api.md b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/command-api.md index 11bcac12f3b..2b01572629b 100644 --- a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/command-api.md +++ b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/command-api.md @@ -10,24 +10,23 @@ This how-to describes how to register a command in Studio Pro from an extension. ## Prerequisites -This how-to uses the results of [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). Please complete that how-to before starting this one. You should also be familiar with creating menus as described in [Create a Menu Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/menu-api/). +Before starting this how-to, make sure you have completed the following prerequisites: + +* This how-to uses the results of [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). Complete that how-to before starting this one. +* Make sure you are familiar with creating menus as described in [Create a Menu Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/menu-api/). ## Register Commands -The Commands API allows users to register a reusable command. These commands can be attached to menus and context menus. At this time, two APIs make use of this feature: +The Commands API allows you to register a reusable command that can be attached to menus and context menus. At this time, two APIs support this feature: * [Documents API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/) * [App Explorer API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/) -To register commands, you can call the Commands API `registerCommand`. - -In the sample code below, we register a command, then attach it to a menu by setting the property `commandId` to the `Menu` object. +## Using `registerCommand` API -{{% alert color="info" %}} -The `registerCommand` requires a generic type for the command payload once executed. For standalone menus that have a command without payload, you can register it with ``. When using `void`, the generic type declaration can also be left out (for example, `registerCommand(commandId...)` becomes `registerCommand(commandId...)`). -{{% /alert %}} +To register commands, use the Commands API `registerCommand`. -For commands that require payload, you must make sure you register the command with the exact expected payload object type. See the [App Explorer API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/) and [Documents API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/documents-api/) documentation for clear examples. +In the sample code below, we register a command, then attach it to a menu by setting the property `commandId` to the `Menu` object. ```typescript import { ComponentContext, IComponent, Menu, StudioProApi, getStudioProApi } from "@mendix/extensions-api"; @@ -55,20 +54,30 @@ export const component: IComponent = { } ``` -It is also possible to create a context menu that belongs to a document in the App Explorer or a document editor, and that menu can have a registered command attached to it. To do so, you can use the [App Explorer API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/) or the [Documents API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/documents-api/). +## Payloads + +The `registerCommand` requires a generic type for the command payload once executed. + +* For commands without payload, use ``. When using `void`, the generic type declaration can also be left out (for example, `registerCommand(commandId...)` becomes `registerCommand(commandId...)`). +* For commands that require payload, make sure the payload type matches the expected structure. -The command registration for commands that interact with documents are slightly different. They require a payload of type `{ documentId: string }`; the backend will return the menu when it is clicked. The `documentId` is the id of the exact document that was interacted with by the menu. +See the [App Explorer API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/) and [Documents API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/documents-api/) documentation for examples. + +## Context Menu Integration {{% alert color="info" %}} The command must be registered before creating any menus that might be attached to it. {{% /alert %}} -## Conclusion +You can attach registered commands to context menus in: + +* [App Explorer API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/app-explorer-api/) +* [Documents API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/documents-api/). -You have seen how to register commands that can be attached to menus in Studio Pro. +The command registration for commands that interact with documents require a payload of type `{ documentId: string }`. The `documentId` is the id of the exact document that was interacted with by the menu. The backend will return the menu when it is clicked. ## Extensibility Feedback -If you would like to provide us with additional feedback, you can complete a small [survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback). +If you would like to provide additional feedback, you can complete a small [survey](https://survey.alchemer.eu/s3/90801191/Extensibility-Feedback). Any feedback is appreciated. From 2ea46ded72d87cccb15453adfd5fba82d1a06ca1 Mon Sep 17 00:00:00 2001 From: quinntracy Date: Thu, 16 Oct 2025 11:59:36 +0200 Subject: [PATCH 06/14] Review Dialog API --- .../web/web-extensions-howtos/dialog-api.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/dialog-api.md b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/dialog-api.md index c596982eec2..dcb527196cd 100644 --- a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/dialog-api.md +++ b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/dialog-api.md @@ -10,7 +10,10 @@ This how-to describes how to open a modal dialog in Studio Pro from an extension ## Prerequisites -This how-to uses the results of [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). Please complete that how-to before starting this one. You should also be familiar with creating menus as described in [Create a Menu Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/menu-api/). +Before starting this how-to, make sure you have completed the following prerequisites: + +* This how-to uses the results of [Get Started with the Web Extensibility API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/getting-started/). Complete that how-to before starting this one. +* Make sure you are familiar with creating menus as described in [Create a Menu Using Web API](/apidocs-mxsdk/apidocs/web-extensibility-api-11/menu-api/). ## Opening a Modal Dialog @@ -26,7 +29,7 @@ In a listener event called `menuItemActivated`, the `studioPro.ui.dialogs.showMo * `queryParams` (optional) — a key-value pair object for passing data to your web content inside the dialog {{% alert color="info" %}} -When the dialog's API `showModal` method is called, a `Promise` of `unknown` or `null` is returned. This return value represents anything the web content determines should be returned when the dialog gets closed. It is currently unknown by the API, since it can be anything. +When the dialog's API `showModal` method is called, a `Promise` of `unknown` or `null` is returned. This return value represents anything the web content determines should be returned when the dialog is closed. It is currently unknown by the API, since it can be anything. In the example below, the dialog will contain a form where an object is modified, then returned at closing time. {{% /alert %}} @@ -93,8 +96,7 @@ In the previous example, the `uiEntryPoint` property of the `` object ha } ``` -1. Update `build-extension.mjs` to match the manifest with an entry for the new dialog entry point. Specifically, you need to add -the `src/ui/dialog.tsx` endpoint to your build script and make sure the variable `appDir` stays unaltered. For example: +1. Update `build-extension.mjs` to match the manifest with an entry for the new dialog entry point. Specifically, add the `src/ui/dialog.tsx` endpoint to your build script and make sure the variable `appDir` stays unaltered. For example: ```typescript{hl_lines=["16-19"]} import * as esbuild from 'esbuild' @@ -207,7 +209,7 @@ After building and installing the extension in Studio Pro, the dialog opens when ## Modifying a Modal Dialog -You can also modify the dimensions of a dialog using the dialog API's `update` method. To do this, add a button to the form contained in `dialog.tsx` file, as follows: +You can modify the dimensions of a dialog using the dialog API's `update` method. To do this, add a button to the form contained in `dialog.tsx` file, as follows: ```typescript + + +

+ ); - studioPro.ui.messageBoxes.show("info", "Saving HelloWorld.txt"); - }; - - const loadFile = async () => { - const message = await studioPro.app.files.getFile("HelloWorld.txt"); - studioPro.ui.messageBoxes.show( - "info", - `Loaded HelloWorld.txt it contained: ${message}` - ); - }; - - const deleteFile = async () => { - await studioPro.app.files.deleteFile("HelloWorld.txt"); - studioPro.ui.messageBoxes.show("info", "Deleted HelloWorld.txt"); - }; - - createRoot(document.getElementById("root")!).render( - -

Mendix Studio Pro Extension

-

Hello from an extension!

-

- - - -

-
- ); - }, -}; -``` - -## Code Descriptions {code-descriptions} - -The following sections explain the various parts of the code. - -### saveFile - -The `saveFile` callback calls the `putFile` API. It sets the file name to `HelloWorld.txt` and the content to `Hello world from a file!`. - -```typescript -const saveFile = async () => { - await studioPro.app.files.putFile( - "HelloWorld.txt", - "Hello world from a file!" - ); - studioPro.ui.messageBoxes.show("info", "Saving HelloWorld.txt"); -}; -``` - -### loadFile - -The `loadFile` callback calls the `getFile` API. It requests to load `HelloWorld.txt`, then shows a message box that displays the content of the file. - -```typescript -const loadFile = async () => { - const message = await studioPro.app.files.getFile("HelloWorld.txt"); - studioPro.ui.messageBoxes.show( - "info", - `Loaded HelloWorld.txt it contained: ${message}` + }, + }; + ``` + + ## Code Descriptions {#code-descriptions} + + The following sections explain the various parts of the code. + + ### saveFile + + The `saveFile` callback calls the `putFile` API. It sets the file name to `HelloWorld.txt` and the content to `Hello world from a file!`. + + ```typescript + const saveFile = async () => { + await studioPro.app.files.putFile( + "HelloWorld.txt", + "Hello world from a file!" + ); + studioPro.ui.messageBoxes.show("info", "Saving HelloWorld.txt"); + }; + ``` + + ### loadFile + + The `loadFile` callback calls the `getFile` API. It requests to load `HelloWorld.txt`, then shows a message box that displays the content of the file. + + ```typescript + const loadFile = async () => { + const message = await studioPro.app.files.getFile("HelloWorld.txt"); + studioPro.ui.messageBoxes.show( + "info", + `Loaded HelloWorld.txt it contained: ${message}` + ); + }; + ``` + + ### deleteFile + + The `deleteFile` callback calls the `deleteFile` API. It requests to delete `HelloWorld.txt`. + + ```typescript + const deleteFile = async () => { + await studioPro.app.files.deleteFile("HelloWorld.txt"); + studioPro.ui.messageBoxes.show("info", "Deleted HelloWorld.txt"); + }; + ``` + + ### Adding Buttons + + The final part of the code adds three new buttons which, when clicked, call the callbacks described above. + + ```typescript + createRoot(document.getElementById("root")!).render( + +

Mendix Studio Pro Extension

+

Hello from an extension!

+

+ + + +

+
); -}; -``` - -### deleteFile - -The `deleteFile` callback calls the `deleteFile` API. It requests to delete `HelloWorld.txt`. - -```typescript -const deleteFile = async () => { - await studioPro.app.files.deleteFile("HelloWorld.txt"); - studioPro.ui.messageBoxes.show("info", "Deleted HelloWorld.txt"); -}; -``` - -### Adding Buttons - -The final part of the code adds three new buttons which, when clicked, call the callbacks described above. - -```typescript -createRoot(document.getElementById("root")!).render( - -

Mendix Studio Pro Extension

-

Hello from an extension!

-

- - - -

-
-); -``` + ``` ## Restrictions diff --git a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/tab-api.md b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/tab-api.md index 271de542d4d..07c2c44e247 100644 --- a/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/tab-api.md +++ b/content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/web/web-extensions-howtos/tab-api.md @@ -131,7 +131,7 @@ If you want multiple tabs in your extension, you need to structure the folders a In this example, you will add three tabs: **tab1**, **tab2**, and **tab3**. - {{< figure src="/attachments/apidocs-mxsdk/apidocs/extensibility-api/web/tabs/ui_folder_structure.png" >}} + {{< figure src="/attachments/apidocs-mxsdk/apidocs/extensibility-api/web/tabs/ui_folder_structure.png" width="200" >}} 5. Create listener events in the `Main` class to open each of the three tabs. The `Main` class will then look like this: