Skip to content

Commit

Permalink
docs: update documents
Browse files Browse the repository at this point in the history
  • Loading branch information
imzbf committed Sep 3, 2024
1 parent 4ce53dc commit 4a58c05
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 94 deletions.
66 changes: 18 additions & 48 deletions README-CN.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🎄 md-editor-v3

![](https://img.shields.io/github/package-json/v/imzbf/md-editor-v3) ![](https://img.shields.io/npm/dm/md-editor-v3) ![](https://img.shields.io/github/license/imzbf/md-editor-v3) ![](https://img.shields.io/badge/ssr-%3E1.6.0-brightgreen)
![](https://img.shields.io/github/package-json/v/imzbf/md-editor-v3) ![](https://img.shields.io/npm/dm/md-editor-v3) ![](https://img.shields.io/github/license/imzbf/md-editor-v3) ![](https://img.shields.io/badge/ssr-%3E1.6.0-brightgreen) ![](https://img.shields.io/badge/webcomponent-%3E4.19.0-brightgreen)

[English](https://github.com/imzbf/md-editor-v3) \| 中文

Expand Down Expand Up @@ -400,41 +400,19 @@ onMounted(() => {

监听编辑器内部状态,包括:屏幕全屏、浏览器全屏、预览文本、预览 html、目录等。

- pageFullscreen

```js
editorRef.value?.on('pageFullscreen', (status) => console.log(status));
```
- fullscreen
```js
editorRef.value?.on('fullscreen', (status) => console.log(status));
```
- preview
```js
editorRef.value?.on('preview', (status) => console.log(status));
```
- previewOnly
```js
editorRef.value?.on('previewOnly', (status) => console.log(status));
```
- htmlPreview
```js
editorRef.value?.on('htmlPreview', (status) => console.log(status));
```
- catalog
```ts
type Keys =
| 'pageFullscreen'
| 'fullscreen'
| 'preview'
| 'previewOnly'
| 'htmlPreview'
| 'catalog';
```

```js
editorRef.value?.on('catalog', (status) => console.log(status));
```
```js
editorRef.value?.on('pageFullscreen', (status) => console.log(status));
```
### 💻 togglePageFullscreen
Expand Down Expand Up @@ -486,11 +464,7 @@ editorRef.value?.toggleCatalog(true);
### 💾 triggerSave
触发保存。
```js
editorRef.value?.triggerSave();
```
触发保存操作。
### 💉 insert
Expand Down Expand Up @@ -535,18 +509,10 @@ editorRef.value?.focus(option);
手动重新渲染内容。
```js
editorRef.value?.rerender();
```
### 🔍 getSelectedText
获取当前选中的文字。
```js
console.log(editorRef.value?.getSelectedText());
```
### 🗑 resetHistory
清除当前的历史记录。
Expand All @@ -571,6 +537,10 @@ editorRef.value?.domEventHandlers({
editorRef.value?.execCommand('bold');
```
### 🔖 getEditorView
获取 codemirror 实例。
## 💴 编辑器配置
使用`config(option: ConfigOption)`方法,可以对构建实例进行定制。
Expand Down
64 changes: 18 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🎄 md-editor-v3

![](https://img.shields.io/github/package-json/v/imzbf/md-editor-v3) ![](https://img.shields.io/npm/dm/md-editor-v3) ![](https://img.shields.io/github/license/imzbf/md-editor-v3) ![](https://img.shields.io/badge/ssr-%3E1.6.0-brightgreen)
![](https://img.shields.io/github/package-json/v/imzbf/md-editor-v3) ![](https://img.shields.io/npm/dm/md-editor-v3) ![](https://img.shields.io/github/license/imzbf/md-editor-v3) ![](https://img.shields.io/badge/ssr-%3E1.6.0-brightgreen) ![](https://img.shields.io/badge/webcomponent-%3E4.19.0-brightgreen)

English \| [中文](https://github.com/imzbf/md-editor-v3/blob/develop/README-CN.md)

Expand Down Expand Up @@ -392,41 +392,19 @@ onMounted(() => {

Get the internal state of the editor, including pageFullscreen, fullscreen, preview, htmlPreview, catalog, etc.

- pageFullscreen

```js
editorRef.value?.on('pageFullscreen', (status) => console.log(status));
```
- fullscreen
```js
editorRef.value?.on('fullscreen', (status) => console.log(status));
```
- preview
```js
editorRef.value?.on('preview', (status) => console.log(status));
```
- previewOnly
```js
editorRef.value?.on('previewOnly', (status) => console.log(status));
```
- htmlPreview
```js
editorRef.value?.on('htmlPreview', (status) => console.log(status));
```
- catalog
```ts
type Keys =
| 'pageFullscreen'
| 'fullscreen'
| 'preview'
| 'previewOnly'
| 'htmlPreview'
| 'catalog';
```

```js
editorRef.value?.on('catalog', (status) => console.log(status));
```
```js
editorRef.value?.on('pageFullscreen', (status) => console.log(status));
```
### 💻 togglePageFullscreen
Expand Down Expand Up @@ -478,9 +456,7 @@ editorRef.value?.toggleCatalog(true);
### 💾 triggerSave
```js
editorRef.value?.triggerSave();
```
Save actions will be triggered.
### 💉 insert
Expand Down Expand Up @@ -525,18 +501,10 @@ editorRef.value?.focus(option);
Re render the content.
```js
editorRef.value?.rerender();
```
### 🔍 getSelectedText
Get the currently selected text.
```js
console.log(editorRef.value?.getSelectedText());
```
### 🗑 resetHistory
Clear current history.
Expand All @@ -561,6 +529,10 @@ Insert content into the editor via trigger.
editorRef.value?.execCommand('bold');
```
### 🔖 getEditorView
Get codemirror instance.
## 💴 Config Editor
Use `config(option: ConfigOption)` to reconfigure `markdown-it` and so on.
Expand Down

0 comments on commit 4a58c05

Please sign in to comment.