Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface AutoformatBlockRule

Hierarchy

Index

Properties

Optional allowSameTypeAbove

allowSameTypeAbove: boolean

If true, allow to autoformat even if there is a block of the same type above the selected block.

default

false

Optional format

format: (editor: TEditor<AnyObject>) => void

Custom formatting function.

default

setNodes(editor, { type }, { match: (n) => Editor.isBlock(editor, n) })

Type declaration

Optional insertTrigger

insertTrigger: boolean

If true, insert the triggering character after autoformatting.

default:

false

match

match: string | string[]

The rule applies when the trigger and the text just before the cursor matches. For mode: 'block': lookup for the end match(es) before the cursor. For mode: 'text': lookup for the end match(es) before the cursor. If format is an array, also lookup for the start match(es). For mode: 'mark': lookup for the start and end matches. Note: '_*', ['_*'] and { start: '_*', end: '*_' } are equivalent.

mode

mode: "block"
  • text: insert text.
  • block: set block type or custom format.
  • mark: insert mark(s) between matches.
default

'text'

Optional preFormat

preFormat: (editor: TEditor<AnyObject>) => void

Function called just before format. Generally used to reset the selected block.

Type declaration

Optional query

query: (editor: TEditor<AnyObject>, options: AutoformatQueryOptions) => boolean

Query to allow autoformat.

Type declaration

Optional trigger

trigger: string | string[]

Triggering character to autoformat.

default

the last character of match or match.end

Optional triggerAtBlockStart

triggerAtBlockStart: boolean

If true, the trigger should be at block start to allow autoformatting.

default

true

Optional type

type: string

For mode: 'block': set block type. If format is defined, this field is ignored. For mode: 'mark': Mark(s) to add.

Generated using TypeDoc