Every extension

suggestion

Behaviour takes options 0.54 kB gzipped

A behaviour in @matrajs/core.

Adding it

import { createEditor, document, paragraph, text, suggestion } from '@matrajs/core'

const editor = createEditor({
  extensions: [document, paragraph, text, suggestion({ … })],
  element: document.querySelector('#editor'),
})

There is no separate package · suggestion is already in @matrajs/core, and an extension you do not import is not in your bundle. document, paragraph and text are the floor every document needs.

Options

Field Type
char required string The character that opens it. `@` for mentions, `/` for commands.
name string Extension name, and therefore the key `editor.extensionState` is read by. Two suggestions on one editor need two names.
startOfLine boolean Only fire at the start of a block. What `/` menus usually want.
allowSpaces boolean Let the query contain spaces. Names have spaces; commands do not.
maxLength number Give up after this many characters, so a stray `@` stops matching.
decorationClass string Class on the decoration over the active range, for positioning a popup.

Commands

Keys

Styles

This one needs a stylesheet to look right, and ships the minimum as a string rather than a file · nothing is loaded unless you load it.


          import { suggestionCSS } from '@matrajs/core'

const style = document.createElement('style')
style.textContent = suggestionCSS
document.head.append(style)
        

← All 81 extensions

Edit this page on GitHub