> 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/da/apps/components/inputs/editor.md).

# Editor

Tilføj en blokbaseret rigteksteditor til PowerShell Universal-apps til registrering af tekst, links, lister, kode og billeder med JSON- eller HTML-output.

Editorkomponenten er baseret på [Editor.js](https://editorjs.io/). Det er en blokeditor, der accepterer tekst, links, lister, kode og billeder.

Når De arbejder med editoren, kan De modtage data om det aktuelle dokument via parameteren `OnChange`. Som standard returneres data i Editor.js [JSON-format](https://editorjs.io/saving-data).

## Oprettelse af en editor

Brug cmdletten `New-UDEditor` til at oprette en grundlæggende editor.

```
New-UDEditor
```

Editoren vil være tilgængelig, og De kan tilføje nye blokke ved at klikke på plusknappen.

## Arbejde med data

Hvis De definerer en scriptblok til hændelseshandleren `-OnChange`. Variablen `$EventData` indeholder den aktuelle status for editoren. Som standard returnerer dette Editor.JS-[JSON-blokformatet](https://editorjs.io/saving-data).

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

De kan også bruge HTML-gengivelsespluginet ved at angive parameteren `-Format`.

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

For at angive standarddataene for editoren skal De bruge parameteren `-Data`. De skal angive JSON-blokformatet.

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

## Billedsupport

For at understøtte billeder skal De angive en [publiceret mappe](/powershell-universal/da/platform/published-folders.md), som billederne kan uploades til. Når en publiceret mappe er defineret, kan billeder uploades direkte i editoren. Billederne placeres i kataloget og udleveres derefter via anmodningsstien.

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

## API

### New-UDEditor

<table><thead><tr><th>Navn</th><th>Type</th><th>Beskrivelse</th><th data-type="checkbox">Påkrævet</th></tr></thead><tbody><tr><td>Id</td><td>string</td><td>Id for denne komponent.</td><td>false</td></tr><tr><td>Data</td><td>Hashtable</td><td>Editor.JS-dataene til denne komponent</td><td>false</td></tr><tr><td>OnChange</td><td>ScriptBlock</td><td>Den scriptblok, der skal kaldes som hændelseshandler, når editorens data ændres.</td><td>false</td></tr><tr><td>Format</td><td>string</td><td>Om der skal returneres enten json eller html i OnChange-scriptblokken.</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/da/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.
