> 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/it/app/components/inputs/editor.md).

# Editor

Il componente editor è basato su [Editor.js](https://editorjs.io/). È un editor a blocchi che accetta testo, link, elenchi, codice e immagini.

Quando si lavora con l'editor, è possibile ricevere dati sul documento corrente tramite il parametro `OnChange`. Per impostazione predefinita, i dati vengono restituiti nel [formato JSON](https://editorjs.io/saving-data) di Editor.js.

## Creazione di un editor

Per creare un editor di base, utilizzi il cmdlet `New-UDEditor`.

```
New-UDEditor
```

L'editor sarà disponibile e potrà aggiungere nuovi blocchi facendo clic sul pulsante più.

![](/files/LlS3rZSPsxFoT6c4mpZN)

## Utilizzo dei dati

Se definisce un blocco di script per il gestore di evento `-OnChange`. La variabile `$EventData` conterrà lo stato corrente dell'editor. Per impostazione predefinita, questo restituisce il [formato JSON a blocchi](https://editorjs.io/saving-data) di Editor.JS.

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

Può anche utilizzare il plugin di rendering HTML specificando il parametro `-Format`.

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

Per specificare i dati predefiniti per l'editor, utilizzi il parametro `-Data`. È necessario specificare il formato JSON a blocchi.

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

## Supporto delle immagini

Per supportare le immagini, dovrà fornire una [cartella pubblicata](/powershell-universal/it/piattaforma/published-folders.md) in cui caricare le immagini. Una volta definita una cartella pubblicata, le immagini possono essere caricate direttamente nell'editor. Verranno collocate all'interno della directory e quindi servite tramite il percorso della richiesta.

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

## API

### New-UDEditor

<table><thead><tr><th>Nome</th><th>Tipo</th><th>Descrizione</th><th data-type="checkbox">Obbligatorio</th></tr></thead><tbody><tr><td>Id</td><td>string</td><td>L'ID di questo componente.</td><td>false</td></tr><tr><td>Data</td><td>Hashtable</td><td>I dati Editor.JS per questo componente</td><td>false</td></tr><tr><td>OnChange</td><td>ScriptBlock</td><td>Il gestore di evento a blocco di script da richiamare quando i dati dell'editor cambiano.</td><td>false</td></tr><tr><td>Format</td><td>string</td><td>Se restituire json o html nel blocco di script OnChange.</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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
