Ui
User interface manipulation and handling
showNotification(name, title, message, sticky)
Show a notification
Parameters
Param | Type | Description |
name |
| Required - The plugin ID of the plugin that sent the notification |
title |
| Required - Notification title |
message |
| Required - Notification message |
sticky |
| Required - Optional, default false, if true notification stays till user closes it |
showDialog(contentComponent, props, options)
Display a dialog with the specified content.
Supported dialog actions:
`dialog:enablePrimaryBtn`Enables the primary button
`dialog:disablePrimaryBtn`Disables the primary button |
See: component/dialogComponent
Parameters
Param | Type | Description |
contentComponent |
| Required - A substance component or tool that will be rendered inside the dialog |
props |
| Required - A object that will be passed as props to contentComponent |
options |
| Required - Options passed to dialog |
options.title |
| Dialog title |
options.primary |
| Primary button caption, default is i18n representation of Ok, set to false to disable button |
options.secondary |
| Secondary button caption, default is i18n representation of Cancel, set to false to disable button |
options.tertiary |
| Third button |
options.center |
| As default the dialog is centered over the editor area, set to true to center over the full writer |
Example
showAuthDialog(authComponent, authProps, authOptions)
Display a Auth dialog (401/402) above any other dialogs.
Parameters
Param | Type | Description |
authComponent |
| Required - A substance component or tool that will be rendered inside the dialog |
authProps |
| Required - A object that will be passed as props to contentComponent |
authOptions |
| Required - Options passed to dialog |
authOptions.title |
| Dialog title |
authOptions.primary |
| Primary button caption, default is i18n representation of Ok, set to false to disable button |
authOptions.secondary |
| Secondary button caption, default is i18n representation of Cancel, set to false to disable button |
authOptions.tertiary |
| Third button |
authOptions.center |
| As default the dialog is centered over the editor area, set to true to center over the full writer |
showMessageDialog(messages, cbContinue, cbCancel, [heading])
Display a number of messages and different options depending on the severity on each message. Messages can be of type info, warning or error.
If there are error messages the user will not be able to continue. If there are warnings the user can continue but suggested to cancel. If only info messages only a continue is possible.
Parameters
Param | Type | Description |
messages |
| Required - An array of message objects. Each object have the properties type (string: info, warning, error), plugin (string: the plugin name) and message (string) |
cbContinue |
| Required - Callback function for when the user press continue |
cbCancel |
| Required - Callback function for when the user press cancel |
heading |
| Additional text to display above the messages |
Example
showConfirmDialog(title, message, buttons)
Display a simple confirmation dialog
Parameters
Param | Type | Description |
title |
| Required - dialog heading |
message |
| Required - dialog message |
buttons |
| Required - object with primary/secondary objects for button specifics |
Example
showBottomPanel(pluginName, component, [props], [sticky])
Renders a supplied component in a screen-wide panel which smoothly animates from the bottom of the screen.
Parameters
Param | Type | Default | Description |
pluginName |
| Required - Name of plugin that called the function | |
component |
| Required - Component class to be rendered in the Panel | |
props |
| Object which is sent as props to the component class. Defaults to empty object. | |
sticky |
|
| Set to true to prevent Panel from closing when clicking outside of the Panel. Defaults to false. |
Example
showOverlay(pluginName, component, [props])
Renders a supplied component in a "fullscreen" overlay.
Parameters
Param | Type | Description |
pluginName |
| Required - Name of plugin that called the function |
component |
| Required - Component class to be rendered in the Overlay |
props |
| Object which is sent as props to the component class. Defaults to empty object. |
Example
hideOverlay(pluginName)
Hides the overlay. Useful to call this in a component that rendered as and overlay component.
Parameters
Param | Type | Description |
pluginName |
| Required - Name of plugin that called the function |
Example
~~getComponent() ~~
Deprecated
Deprecated, use import {UIComponent} from 'writer'
statements for UIComponents instead
Last updated