Skip to content
GitHub

Blockquote

The blockquote node represents a block of quoted text. It can be used to create a block of text that is quoted from another source.

import 'prosekit/basic/style.css'
import 'prosekit/basic/typography.css'

import { createEditor } from 'prosekit/core'
import { ProseKit } from 'prosekit/react'
import { useMemo } from 'react'

import { defineExtension } from './extension'
import Toolbar from './toolbar'

export default function Editor() {
  const editor = useMemo(() => {
    return createEditor({ extension: defineExtension() })
  }, [])

  return (
    <ProseKit editor={editor}>
      <div className='box-border h-full w-full min-h-36 overflow-y-hidden overflow-x-hidden rounded-md border border-solid border-gray-200 dark:border-gray-700 shadow flex flex-col bg-white dark:bg-gray-950 color-black dark:color-white'>
        <Toolbar />
        <div className='relative w-full flex-1 box-border overflow-y-scroll'>
          <div ref={editor.mount} className='ProseMirror box-border min-h-full px-[max(4rem,_calc(50%-20rem))] py-8 outline-none outline-0 [&_span[data-mention="user"]]:text-blue-500 [&_span[data-mention="tag"]]:text-violet-500'></div>
        </div>
      </div>
    </ProseKit>
  )
}
import { defineBlockquotefunction defineBlockquote(): BlockquoteExtension
@public
} from 'prosekit/extensions/blockquote'
const extensionconst extension: BlockquoteExtension = defineBlockquotefunction defineBlockquote(): BlockquoteExtension
@public
()

Set the selected node to a setBlockquote node.

editorconst editor: Editor<BlockquoteExtension>.commands
Editor<BlockquoteExtension>.commands: ToCommandAction<{
    setBlockquote: [];
    insertBlockquote: [];
    toggleBlockquote: [];
}>
All {@link CommandAction } s defined by the editor.
.setBlockquote
setBlockquote: CommandAction
() => boolean
Execute the current command. Return `true` if the command was successfully executed, otherwise `false`.
()

Insert a new blockquote node.

editorconst editor: Editor<BlockquoteExtension>.commands
Editor<BlockquoteExtension>.commands: ToCommandAction<{
    setBlockquote: [];
    insertBlockquote: [];
    toggleBlockquote: [];
}>
All {@link CommandAction } s defined by the editor.
.insertBlockquote
insertBlockquote: CommandAction
() => boolean
Execute the current command. Return `true` if the command was successfully executed, otherwise `false`.
()

Toggle the selected node between a blockquote node and a default node (e.g. a paragraph node).

editorconst editor: Editor<BlockquoteExtension>.commands
Editor<BlockquoteExtension>.commands: ToCommandAction<{
    setBlockquote: [];
    insertBlockquote: [];
    toggleBlockquote: [];
}>
All {@link CommandAction } s defined by the editor.
.toggleBlockquote
toggleBlockquote: CommandAction
() => boolean
Execute the current command. Return `true` if the command was successfully executed, otherwise `false`.
()
Non-AppleAppleDescription
Ctrl-Shift-BCommand-Shift-BToggle blockquote

Type > and a space at the start of a line. This will create a blockquote node.