# @gitee/tide
## Introduction
This package provides an easy-to-use editor component for React.
## Installation
> If you do not want to enable syntax highlighting for code blocks, you can choose not to install `highlight.js`.
```bash
npm install --save @gitee/tide @gitee/tide-starter-kit highlight.js
# or
yarn add @gitee/tide @gitee/tide-starter-kit highlight.js
# or
pnpm add @gitee/tide @gitee/tide-starter-kit highlight.js
```
## Usage
```tsx
import React, { useState } from 'react';
import { EditorRender, useEditor } from '@gitee/tide';
import { StarterKit } from '@gitee/tide-starter-kit';
import '@gitee/tide/dist/style.css';
import 'highlight.js/styles/default.css';
function App() {
const editor = useEditor({
extensions: [StarterKit],
content: '# Hello World!',
onChange: (doc) => console.log('onChange', doc),
});
// Update editor content
// editor.setContent('Changed content');
return <EditorRender editor={editor} />;
}
```
To customize the styles, you can refer to the CSS variables in `@gitee/tide-theme/dist/variable.less`.
## Configuration
### useEditor Options
| Option | Description | Type | Default |
| -------------------- | --------------------------------------------------- | -------------------------------------------------------- | ------- |
| content | The content of the editor | `HTMLContent \| JSONContent \| JSONContent[] \| null` | - |
| autofocus | Whether to focus automatically | `'start' \| 'end' \| 'all' \| number \| boolean \| null` | `false` |
| editable | Whether to allow editing | `boolean` | `true` |
| fullscreen | Whether to enable full-screen mode | `boolean` | `false` |
| readOnlyEmptyView | The view when there is no content in read-only mode | `ReactNode` | `null` |
| readOnlyShowMenu | Whether to show the menu bar in read-only mode | `boolean` | `false` |
| menuEnableUndoRedo | Whether to enable undo/redo in the menu bar | `boolean` | `true` |
| menuEnableFullscreen | Whether to enable full-screen mode in the menu bar | `boolean` | `true` |
| onFullscreenChange | Callback function when full-screen mode changes | `(fullscreen: boolean) => void` | - |
| onReady | Callback function after initialization is complete | `(editor: TideEditor) => void` | - |
| onChange | Callback function when content changes | `(doc: JSONContent, editor: TideEditor) => void` | - |
More options can be found in the interface definition of `TideEditorOptions`.
### EditorRenderProps
| Property | Description | Type | Default |
| ---------------- | --------------------------------------- | --------------- | ------- |
| className | Custom `className` for the container | `string` | - |
| style | Custom `style` for the container | `CSSProperties` | - |
| menuClassName | Custom `className` for the menu bar | `string` | - |
| menuStyle | Custom `style` for the menu bar | `CSSProperties` | - |
| contentClassName | Custom `className` for the content area | `string` | - |
| contentStyle | Custom `style` for the content area | `CSSProperties` | - |
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
扩展性强、支持 Markdown 语法、基础功能完善的 React 富文本编辑器。基于 JSON 格式存储。支持 Markdown 快捷语法(标题;引用;代码块;表格;超链接;图片;分割线;粗体、斜体、删除线;无序列表、有序列表、任务列表)。支持粘贴 Markdown 文本。支持功能增强的 Table 表格。支持粘贴、拖拽图片。支持 Emoji 表情选择。内建菜单栏。支持多主题
资源推荐
资源详情
资源评论



格式:zip 资源大小:1.8MB

格式:zip 资源大小:211.0KB






格式:docx 资源大小:17.3KB 页数:10












格式:zip 资源大小:281.9KB







收起资源包目录





































































































共 461 条
- 1
- 2
- 3
- 4
- 5
资源评论


Java程序员-张凯
- 粉丝: 1w+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 毕业设计零件的数控铣床铣削编程与设计.doc
- 氧化沟工艺概述.doc
- 任务19道路立体交叉.ppt
- 基于文化元素的建筑设计论文.doc
- A3-Fiberead-36kr开放日分享PTT.pptx
- 单片机LED点阵设计方案.doc
- 电力行业生产管理部主任关键业绩考核指标(KPI).doc
- 深度解读中国大数据产业发展.docx
- 可编程控制器原理及应用复习要点.ppt
- 施工合同承包方的常见风险与防范.doc
- 材料失效原因分析.doc
- 小班主题活动《快乐的南瓜节》.doc
- BIM在铁路行业的风险分析.docx
- 玻璃钢管道施工工法.doc
- 玻璃幕墙的主要性能指标.docx
- 全矿井智能化防尘监测监控系统.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
