文档

引用块

将一段文字设为引用。

试一试

把光标放进示例段落,点击 引用 后会得到 <blockquote>给工具栏起名比做工具栏还费时间。</blockquote>。

交互示例
示例结果

添加到编辑器

启用 Blockquote 并调用 toggleBlockquote。

import { EditorContent, EditorProvider, Blockquote, useEditor, useIsActive } from 'yurich';

export function BlockquoteEditor() {
  const editor = useEditor({
    extensions: [Blockquote],
    initialValue: "<p>给工具栏起名比做工具栏还费时间。</p>",
  });
  const active = useIsActive(editor, 'toggleBlockquote');

  return (
    <EditorProvider editor={editor}>
      <button
        type="button"
        aria-pressed={active}
        onMouseDown={event => event.preventDefault()}
        onClick={() => editor.execute('toggleBlockquote')}
      >
        引用
      </button>
      <EditorContent ariaLabel="编辑器" />
    </EditorProvider>
  );
}

行为说明

引用样式由应用设置。列表项变成引用时会移出列表。

功能