Rich text / foldkit-richtext-dom/editor

slashQuery

function · packages/richtext-dom/src/editor.ts:170

function slashQuery(textBefore: string): string | undefined

The query the caret is in, or undefined when the text before it is not a slash command. A command opens at a block's start or after whitespace — see /head opens, see/head is text — and reads letters, digits, and -, so the query is a word rather than everything typed since the slash.