> For the complete documentation index, see [llms.txt](https://docs.devolutions.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.devolutions.net/powershell-universal/apps/components/inputs/editor.md).

# Editor

Add a block based rich text editor to PowerShell Universal apps for capturing text, links, lists, code, and images with JSON or HTML output.

The editor component is based on [Editor.js](https://editorjs.io/). It's a block editor that accepts text, links, lists, code and images.

When working with the editor, you can receive data about the current document via the `OnChange` parameter. By default, data is returned in the Editor.js [JSON format](https://editorjs.io/saving-data).

## Creating an Editor

To create a basic editor, use the `New-UDEditor` cmdlet.

```
New-UDEditor
```

The editor will be available and you can add new blocks by clicking the plus button.

## Working with Data

If you define a script block for the `-OnChange` event handler. The `$EventData` variable will contain the current status of the editor. By default, this returns the Editor.JS [JSON block format](https://editorjs.io/saving-data).

```
New-UDEditor -OnChange {
    Show-UDToast $EventData
}
```

You can also use the HTML render plugin by specifying the `-Format` parameter.

```
New-UDEditor -OnChange {
    Show-UDToast $EventData
} -Format 'html'
```

To specify the default data for the editor, use the `-Data` parameter. You need to specify the JSON block format.

```
New-UDEditor -Data $Data
```

## Image Support

In order to support images, you will need to provide a [published folder](/powershell-universal/platform/published-folders.md) in which to upload the images. Once a published folder is defined, images can be uploaded directly in the editor. They will be placed within the directory and then served through the request path.

```powershell
New-UDEditor -PublishedFolder 'MyImages'
```

## API

### New-UDEditor

<table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>Id</td><td>string</td><td>The ID of this component.</td><td>false</td></tr><tr><td>Data</td><td>Hashtable</td><td>The Editor.JS data for this component</td><td>false</td></tr><tr><td>OnChange</td><td>ScriptBlock</td><td>The script block event handler to call when the editor data changes.</td><td>false</td></tr><tr><td>Format</td><td>string</td><td>Whether to return either json or html in the OnChange script block.</td><td>false</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.devolutions.net/powershell-universal/apps/components/inputs/editor.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
