Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Warning block plugin

Callout block with editable title and message fields.

Install and register

npm install @shelamkoff/rector
import { createEditor } from '@shelamkoff/rector'
import { Warning } from '@shelamkoff/rector/plugins/warning'

const editor = createEditor({
  holder: document.querySelector('#editor'),
  plugins: [new Warning()],
})

The registered block type is warning. The class is also exported by the complete @shelamkoff/rector/plugins preset and can be loaded through @shelamkoff/rector/plugins/async.

Data

{ "title": "Note", "message": "Important details" }

Field reference

Field Required Meaning and constraints
title yes String containing sanitized inline HTML; it may be empty.
message yes String containing sanitized inline HTML; it may be empty.

At least one of title and message must be non-blank. Both fields support inline-widget marshaling.

Configuration

Every built-in block plugin accepts two style ownership options: injectStyles?: boolean defaults to true; set it to false when the host bundles that plugin's CSS. css?: string adds one host-provided stylesheet URL after the plugin default, or acts as the replacement URL when default injection is disabled.

Capabilities

Inline formatting; editable title/message; merge; validation; export for conversion.

Undo, lifecycle, and styles

User actions exposed by the plugin enter the command pipeline through the supplied context.mutate() capability, so each completed action is one undo/redo step. The editor reference-counts the plugin's declared stylesheet URLs. Removing a block calls its cleanup hook; removing the editor calls destroy() for every remaining block and then releases shared plugin resources.

Do not remove the editor holder without first calling editor.destroy().

Document output

Use the matching renderer from @shelamkoff/rector/renderer/renderers/warning. The VitePress guide documents configuration, commands and history, extension contracts, document migrations, styling, security, and lifecycle in a sequential form.