Highlight

Mark and reference text for review.

Loading...
Files
components/demo.tsx
'use client';

import React from 'react';

import { Plate } from '@udecode/plate-common/react';

import { editorPlugins } from '@/components/editor/plugins/editor-plugins';
import { useCreateEditor } from '@/components/editor/use-create-editor';
import { Editor, EditorContainer } from '@/components/plate-ui/editor';

import { DEMO_VALUES } from './values/demo-values';

export default function Demo({ id }: { id: string }) {
  const editor = useCreateEditor({
    plugins: [...editorPlugins],
    value: DEMO_VALUES[id],
  });

  return (
    <Plate editor={editor}>
      <EditorContainer variant="demo">
        <Editor />
      </EditorContainer>
    </Plate>
  );
}

功能

  • 提供文本标记工具,用于内容审查和引用。
  • 使用内联 <mark> 元素支持标记(背景颜色)。
  • 支持高亮,在审查内容或为未来参考高亮时非常有用。

安装

npm install @udecode/plate-highlight

使用

import { HighlightPlugin } from '@udecode/plate-highlight/react';
 
const plugins = [
  // ...otherPlugins,
  HighlightPlugin,
];

快捷键

KeyDescription
Cmd + Shift + H

将高亮应用于选定文本。

插件

HighlightPlugin