Skip to content

Commit 37bd40c

Browse files
committed
Merge branch 'master' of github.com:cycleccc/wangEditor-next
2 parents bb844ab + 4b56542 commit 37bd40c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+987
-23
lines changed

.github/workflows/coverage.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161

6262
# 上传覆盖率报告到 Codecov
6363
- name: Upload coverage reports to Codecov
64-
uses: codecov/codecov-action@v5.2.0
64+
uses: codecov/codecov-action@v5.3.1
6565
with:
6666
token: ${{ secrets.CODECOV_TOKEN }}
6767
- name: Upload test results to Codecov

packages/editor/CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
## 5.6.31
4+
5+
### Patch Changes
6+
7+
- 3f6d567: fix(table): allow parsing for TH elements in table module
8+
- Updated dependencies [3f6d567]
9+
- @wangeditor-next/table-module@1.6.42
10+
311
## 5.6.30
412

513
### Patch Changes

packages/editor/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wangeditor-next/editor",
3-
"version": "5.6.30",
3+
"version": "5.6.31",
44
"description": "Web rich text editor, Web 富文本编辑器",
55
"keywords": [
66
"wangeditor",
@@ -59,7 +59,7 @@
5959
"@wangeditor-next/code-highlight": "~1.3.29",
6060
"@wangeditor-next/core": "~1.7.32",
6161
"@wangeditor-next/list-module": "~1.1.38",
62-
"@wangeditor-next/table-module": "~1.6.41",
62+
"@wangeditor-next/table-module": "~1.6.42",
6363
"@wangeditor-next/upload-image-module": "~1.1.35",
6464
"@wangeditor-next/video-module": "~1.3.38",
6565
"dom7": "^4.0.0",

packages/plugin-float-image/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @wangeditor-next/plugin-float-image
22

3+
## 1.0.16
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [3f6d567]
8+
- @wangeditor-next/editor@5.6.31
9+
310
## 1.0.15
411

512
### Patch Changes

packages/plugin-float-image/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wangeditor-next/plugin-float-image",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"description": "wangEditor float image plugin",
55
"author": "cycleccc <2991205548@qq.com>",
66
"type": "module",
@@ -41,7 +41,7 @@
4141
"url": "https://github.com/wangeditor-next/wangeditor-next/issues"
4242
},
4343
"peerDependencies": {
44-
"@wangeditor-next/editor": "5.6.30",
44+
"@wangeditor-next/editor": "5.6.31",
4545
"dom7": "^3.0.0 || ^4.0.0",
4646
"slate": "^0.72.0",
4747
"snabbdom": "^3.1.0"

packages/plugin-formula/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @wangeditor-next/plugin-formula
22

3+
## 1.0.16
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [3f6d567]
8+
- @wangeditor-next/editor@5.6.31
9+
310
## 1.0.15
411

512
### Patch Changes

packages/plugin-formula/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wangeditor-next/plugin-formula",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"description": "wangEditor next formula 公式",
55
"author": "cycleccc <2991205548@qq.com>",
66
"type": "module",
@@ -44,7 +44,7 @@
4444
"katex": "^0.16.0"
4545
},
4646
"peerDependencies": {
47-
"@wangeditor-next/editor": "5.6.30",
47+
"@wangeditor-next/editor": "5.6.31",
4848
"katex": "^0.16.0",
4949
"snabbdom": "^3.1.0"
5050
},

packages/plugin-link-card/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @wangeditor-next/plugin-link-card
22

3+
## 1.0.16
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [3f6d567]
8+
- @wangeditor-next/editor@5.6.31
9+
310
## 1.0.15
411

512
### Patch Changes

packages/plugin-link-card/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wangeditor-next/plugin-link-card",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"description": "wangEditor link card plugin",
55
"author": "cycleccc <2991205548@qq.com>",
66
"type": "module",
@@ -41,7 +41,7 @@
4141
"url": "https://github.com/wangeditor-next/wangeditor-next/issues"
4242
},
4343
"peerDependencies": {
44-
"@wangeditor-next/editor": "5.6.30",
44+
"@wangeditor-next/editor": "5.6.31",
4545
"dom7": "^3.0.0 || ^4.0.0",
4646
"slate": "^0.72.0",
4747
"snabbdom": "^3.1.0"

packages/plugin-markdown/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @wangeditor-next/plugin-markdown
22

3+
## 1.0.16
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [3f6d567]
8+
- @wangeditor-next/editor@5.6.31
9+
310
## 1.0.15
411

512
### Patch Changes

packages/plugin-markdown/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@wangeditor-next/plugin-markdown",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"description": "wangEditor markdown plugin",
55
"author": "cycleccc <2991205548@qq.com>",
66
"type": "module",
@@ -41,7 +41,7 @@
4141
"url": "https://github.com/wangeditor-next/wangeditor-next/issues"
4242
},
4343
"peerDependencies": {
44-
"@wangeditor-next/editor": "5.6.30",
44+
"@wangeditor-next/editor": "5.6.31",
4545
"dom7": "^3.0.0 || ^4.0.0",
4646
"slate": "^0.72.0",
4747
"snabbdom": "^3.1.0"

packages/plugin-mention/CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# @wangeditor-next/plugin-mention
2+
3+
## 1.0.1
4+
5+
### Patch Changes
6+
7+
- 140d22c: feat(plugin-mention): add mention plugin

packages/plugin-mention/README-en.md

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# wangEditor mention plugin
2+
3+
[中文文档](./README.md)
4+
5+
## Introduction
6+
7+
[wangeditor-next](https://github.com/cycleccc/wangEditor-next) mention plugin, like `@James`.
8+
9+
![](./_img/demo.png)
10+
11+
## Installation
12+
13+
```shell
14+
yarn add @wangeditor-next/plugin-mention
15+
```
16+
17+
## Usage
18+
19+
[Vue demo source code](https://github.com/wangfupeng1988/vue2-wangeditor-demo/blob/master/src/components/MyEditorWithMention.vue)
20+
21+
### Use in editor
22+
23+
```ts
24+
import { IDomEditor, Boot, IEditorConfig } from '@wangeditor-next/editor'
25+
import mentionModule, { MentionElement } from '@wangeditor-next/plugin-mention'
26+
27+
// Register
28+
// You should register this before create editor, and register only once (not repeatedly).
29+
Boot.registerModule(mentionModule)
30+
31+
// Show your modal
32+
function showModal(editor: IDomEditor) {
33+
// Get cursor's position info, to set modal position
34+
const domSelection = document.getSelection()
35+
const domRange = domSelection.getRangeAt(0)
36+
if (domRange == null) return
37+
const selectionRect = domRange.getBoundingClientRect()
38+
39+
// Get editor container's position info, maybe help to get right modal position
40+
const containerRect = editor.getEditableContainer().getBoundingClientRect()
41+
42+
// Show your modal, and set position
43+
// PS: You must implement the modal yourself, use <div> or Vue React component
44+
45+
46+
// Insert mention node when emit some event.
47+
function insertMention() {
48+
const mentionNode: MentionElement = {
49+
type: 'mention', // must be 'mention'
50+
value: 'James', // text
51+
info: { x: 1, y: 2 }, // extended info
52+
children: [{ text: '' }], // must have an empty text node in children
53+
}
54+
55+
editor.restoreSelection()
56+
editor.deleteBackward('character') // delete '@'
57+
editor.insertNode(mentionNode)
58+
editor.move(1) // move curser
59+
}
60+
}
61+
62+
// hide your modal
63+
function hideModal(editor: IDomEditor) {
64+
// hide your modal
65+
}
66+
67+
// editor config
68+
const editorConfig: Partial<IEditorConfig> = {
69+
EXTEND_CONF: {
70+
mentionConfig: {
71+
showModal, // required
72+
hideModal, // required
73+
},
74+
},
75+
76+
// others...
77+
}
78+
79+
// Then create editor and toolbar, you will use `editorConfig`
80+
```
81+
82+
### Render HTML
83+
84+
You will get a mention's HTML format like this. You need to `decodeURIComponent` the value of `data-info`.
85+
86+
```html
87+
<span data-w-e-type="mention" data-w-e-is-void data-w-e-is-inline data-value="James" data-info="%7B%22x%22%3A10%7D">@James</span>
88+
```
89+
90+

packages/plugin-mention/README.md

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# wangEditor mention 插件
2+
3+
[English Documentation](./README-en.md)
4+
5+
## 介绍
6+
7+
[wangeditor-next](https://github.com/cycleccc/wangEditor-next) mention 插件,如 `@张三`
8+
9+
![](./_img/demo.png)
10+
11+
## 安装
12+
13+
```shell
14+
yarn add @wangeditor-next/plugin-mention
15+
```
16+
17+
## 使用
18+
19+
[Vue 示例源码](https://github.com/wangfupeng1988/vue2-wangeditor-demo/blob/master/src/components/MyEditorWithMention.vue)
20+
21+
### 注册到编辑器
22+
23+
```ts
24+
import { IDomEditor, Boot, IEditorConfig } from '@wangeditor-next/editor'
25+
import mentionModule, { MentionElement } from '@wangeditor-next/plugin-mention'
26+
27+
// 注册。要在创建编辑器之前注册,且只能注册一次,不可重复注册。
28+
Boot.registerModule(mentionModule)
29+
30+
// 显示弹框
31+
function showModal(editor: IDomEditor) {
32+
// 获取光标位置,定位 modal
33+
const domSelection = document.getSelection()
34+
const domRange = domSelection.getRangeAt(0)
35+
if (domRange == null) return
36+
const selectionRect = domRange.getBoundingClientRect()
37+
38+
// 获取编辑区域 DOM 节点的位置,以辅助定位
39+
const containerRect = editor.getEditableContainer().getBoundingClientRect()
40+
41+
// 显示 modal 弹框,并定位
42+
// PS:modal 需要自定义,如 <div> 或 Vue React 组件
43+
44+
45+
// 当触发某事件(如点击一个按钮)时,插入 mention 节点
46+
function insertMention() {
47+
const mentionNode: MentionElement = {
48+
type: 'mention', // 必须是 'mention'
49+
value: '张三', // 文本
50+
info: { x: 1, y: 2 }, // 其他信息,自定义
51+
children: [{ text: '' }], // 必须有一个空 text 作为 children
52+
}
53+
54+
editor.restoreSelection() // 恢复选区
55+
editor.deleteBackward('character') // 删除 '@'
56+
editor.insertNode(mentionNode) // 插入 mention
57+
editor.move(1) // 移动光标
58+
}
59+
}
60+
61+
// 隐藏弹框
62+
function hideModal(editor: IDomEditor) {
63+
// 隐藏 modal
64+
}
65+
66+
// 编辑器配置
67+
const editorConfig: Partial<IEditorConfig> = {
68+
EXTEND_CONF: {
69+
mentionConfig: {
70+
showModal, // 必须
71+
hideModal, // 必须
72+
},
73+
},
74+
75+
// 其他...
76+
}
77+
78+
// 创建创建和工具栏,会用到 editorConfig 。具体查看 wangEditor 文档
79+
```
80+
81+
### 显示 HTML
82+
83+
mention 节点返回的 HTML 格式如下,其中 `data-info` 的值需要 `decodeURIComponent` 解析。
84+
85+
```html
86+
<span data-w-e-type="mention" data-w-e-is-void data-w-e-is-inline data-value="张三" data-info="%7B%22x%22%3A10%7D">@张三</span>
87+
```

packages/plugin-mention/_img/demo.png

93.1 KB
Loading

packages/plugin-mention/package.json

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"name": "@wangeditor-next/plugin-mention",
3+
"version": "1.0.1",
4+
"description": "wangEditor mention plugin",
5+
"author": "cycleccc <2991205548@qq.com>",
6+
"type": "module",
7+
"homepage": "https://github.com/wangeditor-next/wangEditor-next#readme",
8+
"license": "MIT",
9+
"types": "dist/plugin-mention/src/index.d.ts",
10+
"main": "dist/index.js",
11+
"module": "dist/index.mjs",
12+
"exports": {
13+
".": {
14+
"types": "./dist/plugin-mention/src/index.d.ts",
15+
"import": "./dist/index.mjs",
16+
"require": "./dist/index.js"
17+
},
18+
"./dist/css/style.css": "./dist/css/style.css"
19+
},
20+
"directories": {
21+
"lib": "dist"
22+
},
23+
"files": [
24+
"dist"
25+
],
26+
"publishConfig": {
27+
"access": "public"
28+
},
29+
"repository": {
30+
"type": "git",
31+
"url": "git+https://github.com/wangeditor-next/wangEditor-next.git"
32+
},
33+
"scripts": {
34+
"dev": "cross-env NODE_ENV=development rollup -c rollup.config.js",
35+
"dev-watch": "cross-env NODE_ENV=development rollup -c rollup.config.js -w",
36+
"build": "cross-env NODE_ENV=production rollup -c rollup.config.js",
37+
"dev-size-stats": "cross-env NODE_ENV=development:size_stats rollup -c rollup.config.js",
38+
"size-stats": "cross-env NODE_ENV=production:size_stats rollup -c rollup.config.js"
39+
},
40+
"bugs": {
41+
"url": "https://github.com/wangeditor-next/wangeditor-next/issues"
42+
},
43+
"peerDependencies": {
44+
"@wangeditor-next/editor": "5.6.31",
45+
"snabbdom": "^3.1.0"
46+
}
47+
}

0 commit comments

Comments
 (0)