prosekit/extensions/placeholder
Interfaces
Section titled “Interfaces”PlaceholderOptions
Section titled “PlaceholderOptions”Properties
Section titled “Properties”-
placeholder:
string
| (state
:EditorState
) =>string
-
The placeholder to use. It can be a static string or a function that receives the current editor state and returns a string.
-
strategy?:
"doc"
|"block"
| (state
:EditorState
) =>boolean
-
By default, the placeholder text will be shown whenever the current text cursor is in an empty text node and it’s not inside a code block or a table node.
If you only want to show the placeholder when the whole doc is empty, you can set this option to ‘doc’.
You can also pass a function that receives the current editor state and returns a boolean value to determine whether the placeholder should be shown.
Default
Section titled “Default”'block'
Functions
Section titled “Functions”definePlaceholder()
Section titled “definePlaceholder()”-
function definePlaceholder(
options
:PlaceholderOptions
):PlainExtension
-
Add a placeholder text to the editor when the current block or document is empty.