Editor
A text editor component for Universal Apps.
The editor component is based on Editor.js. 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.
Creating an Editor
To create a basic editor, use the New-UDEditor
cmdlet.
The editor will be available and you can add new blocks by clicking the plus button.
![](https://docs.powershelluniversal.com/~gitbook/image?url=https%3A%2F%2F1373299915-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F8F6PrkNTG8Y34hADzKOL%252Fuploads%252Fgit-blob-2958d5ad81363966d3e45ce4fa1e0b2ab5f8e7a6%252Fimage%2520%28262%29.png%3Falt%3Dmedia&width=768&dpr=4&quality=100&sign=bb999e4&sv=1)
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.
You can also use the HTML render plugin by specifying the -Format
parameter.
To specify the default data for the editor, use the -Data
parameter. You need to specify the JSON block format.
Image Support
In order to support images, you will need to provide a published folder 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.
API
New-UDEditor
Name | Type | Description | Required |
---|---|---|---|
Id | string | The ID of this component. | |
Data | Hashtable | The Editor.JS data for this component | |
OnChange | ScriptBlock | The script block event handler to call when the editor data changes. | |
Format | string | Whether to return either json or html in the OnChange script block. |
Last updated