Line Height
Adjust the height between lines of text.
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>
);
}
安装
npm install @udecode/plate-line-height
使用
import { LineHeightPlugin } from '@udecode/plate-line-height/react';
const plugins = [
// ...otherPlugins,
LineHeightPlugin,
];
插件
LineHeightPlugin
API
setLineHeight
设置编辑器中选定节点的行高。
Parameters
Collapse all
编辑器实例。
设置行高的选项。
API 组件
useLineHeightDropdownMenu
行高下拉菜单的行为钩子。
State
Collapse all
行高值。
Returns
Collapse all
单选组的属性。