@silexlabs/grapesjs-notifications
Version:
This GrapesJs plugin is designed to enhance the user experience within the editor by providing a robust notification system. This plugin captures and displays various types of notifications including errors, warnings, and activities, thereby facilitating
34 lines (32 loc) • 958 B
text/typescript
import { NOTIFICATION_ADD, NOTIFICATION_CLEAR, NOTIFICATION_LIST } from './commands'
export function registerCapabilities(addCapability: (def: Record<string, unknown>) => void) {
addCapability({
id: NOTIFICATION_ADD,
command: NOTIFICATION_ADD,
description: 'Show notification to user',
inputSchema: {
type: 'object',
required: ['type', 'message'],
properties: {
type: { type: 'string', enum: ['info', 'warning', 'error', 'success'] },
message: { type: 'string' },
group: { type: 'string' },
},
},
tags: ['notifications'],
})
addCapability({
id: NOTIFICATION_CLEAR,
command: NOTIFICATION_CLEAR,
description: 'Clear all notifications',
destructive: true,
tags: ['notifications'],
})
addCapability({
id: NOTIFICATION_LIST,
command: NOTIFICATION_LIST,
description: 'List all notifications',
readOnly: true,
tags: ['notifications'],
})
}