Skip to content

Commit

Permalink
Merge branch 'dev-docs' into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
imzbf committed Aug 5, 2024
2 parents 5a03dbc + 0b3553e commit 940b143
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "md-editor-v3",
"version": "4.17.4",
"version": "4.18.0",
"keywords": [
"vue",
"vue3",
Expand Down Expand Up @@ -40,7 +40,7 @@
"markdown-it-anchor": "^9.0.1",
"markdown-it-link-attributes": "^4.0.1",
"markdown-it-mark": "^4.0.0",
"md-editor-v3": "^4.17.4",
"md-editor-v3": "^4.18.0",
"nprogress": "^0.2.0",
"vue": "3.2.47",
"vue-router": "^4.3.0",
Expand Down
28 changes: 28 additions & 0 deletions public/demo-en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,34 @@ config({
});
```

### ☑️ Toggleable status task list

```js
import { config } from 'md-editor-v3';
config({
markdownItPlugins(plugins, { editorId }) {
return plugins.map((item) => {
if (item.type === 'taskList') {
return {
...item,
options: {
...item.options,
enabled: true
// If you just want to enable this feature for a certain editor
// enabled: editorId === 'myId'
}
};
}
return item;
});
}
});
```

```vue
<MdEditor editorId="myId" v-model="text" />
```

## 🧻 Edit This Page

[demo-en-US](https://github.com/imzbf/md-editor-v3/blob/dev-docs/public/demo-en-US.md)
28 changes: 28 additions & 0 deletions public/demo-zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,34 @@ config({
});
```

### ☑️ 可切换状态的任务列表

```js
import { config } from 'md-editor-v3';
config({
markdownItPlugins(plugins, { editorId }) {
return plugins.map((item) => {
if (item.type === 'taskList') {
return {
...item,
options: {
...item.options,
enabled: true
// 如果只是想对某个编辑器开启这个功能
// enabled: editorId === 'myId'
}
};
}
return item;
});
}
});
```

```vue
<MdEditor editorId="myId" v-model="text" />
```

## 🧻 编辑此页面

[demo-zh-CN](https://github.com/imzbf/md-editor-v3/blob/dev-docs/public/demo-zh-CN.md)
2 changes: 2 additions & 0 deletions public/grammar-en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ According to the understanding of other editors, no other editors currently empl
- [x] Sunday
```

[Example](https://imzbf.github.io/md-editor-v3/en-US/demo#☑%EF%B8%8F%20Toggleable%20status%20task%20list) that supports toggling task status in the preview module.

---

## 🐮 Table
Expand Down
2 changes: 2 additions & 0 deletions public/grammar-zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ import 'md-editor-v3/lib/style.css';
- [x] 周天
```

支持在预览模块切换任务状态的[示例](https://imzbf.github.io/md-editor-v3/zh-CN/demo#☑%EF%B8%8F%20可切换状态的任务列表)

---

## 🐮 表格
Expand Down
16 changes: 14 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,21 @@ import ZH_TW from '@vavt/cm-extension/dist/locale/zh-TW';
import '@vavt/cm-extension/dist/previewTheme/arknights.css';

config({
markdownItPlugins(plugins) {
markdownItPlugins(plugins, { editorId }) {
return [
...plugins,
...plugins.map((item) => {
if (item.type === 'taskList') {
return {
...item,
options: {
...item.options,
enabled: editorId === 'editor-preview'
}
};
}

return item;
}),
{
type: 'mark',
plugin: MarkExtension,
Expand Down
14 changes: 4 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3192,11 +3192,6 @@ markdown-it-mark@^4.0.0:
resolved "https://registry.npmjs.org/markdown-it-mark/-/markdown-it-mark-4.0.0.tgz#c19cbc87d9cb9fd1a495e8fe31b740b6d9ebf8c8"
integrity sha512-YLhzaOsU9THO/cal0lUjfMjrqSMPjjyjChYM7oyj4DnyaXEzA8gnW6cVJeyCrCVeyesrY2PlEdUYJSPFYL4Nkg==

markdown-it-task-lists@^2.1.1:
version "2.1.1"
resolved "https://registry.npmjs.org/markdown-it-task-lists/-/markdown-it-task-lists-2.1.1.tgz#f68f4d2ac2bad5a2c373ba93081a1a6848417088"
integrity sha512-TxFAc76Jnhb2OUu+n3yz9RMu4CwGfaT788br6HhEDlvWfdeJcLUsxk1Hgw2yJio0OXsxv7pyIPmvECY7bMbluA==

markdown-it@^14.0.0:
version "14.1.0"
resolved "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz#3c3c5992883c633db4714ccb4d7b5935d98b7d45"
Expand All @@ -3214,10 +3209,10 @@ marked@*:
resolved "https://registry.npmjs.org/marked/-/marked-13.0.2.tgz#d5d05bd2683a85cb9cc6afbe5240e3a8bffcb92a"
integrity sha512-J6CPjP8pS5sgrRqxVRvkCIkZ6MFdRIjDkwUwgJ9nL2fbmM6qGQeB2C16hi8Cc9BOzj6xXzy0jyi0iPIfnMHYzA==

md-editor-v3@^4.17.4:
version "4.17.4"
resolved "https://registry.npmjs.org/md-editor-v3/-/md-editor-v3-4.17.4.tgz#1abd3bab74202e28078b6761bbf456b788d7eddf"
integrity sha512-g7fDBFNfahS0bNHbweVLepd1e8BnZtHNSobduSIa3nTEiGHCD0VzQtf+JyHsDYdGhDwZrBGReGpHxK+/9AZb/w==
md-editor-v3@^4.18.0:
version "4.18.0"
resolved "https://registry.npmjs.org/md-editor-v3/-/md-editor-v3-4.18.0.tgz#adea0c2488cadc09dabb3ce025b9310f5b468dc9"
integrity sha512-lKGPTTqPM6BDuidcMXw9G/Lh9UXOAV7XRlUbOHnaiLVeJzwMhwXGqugtq3GgSJiNKvz9r1QpVgH6jYyT8zpPNQ==
dependencies:
"@codemirror/lang-markdown" "^6.2.5"
"@codemirror/language-data" "^6.5.1"
Expand All @@ -3228,7 +3223,6 @@ md-editor-v3@^4.17.4:
lru-cache "^10.2.0"
markdown-it "^14.0.0"
markdown-it-image-figures "^2.1.1"
markdown-it-task-lists "^2.1.1"
medium-zoom "^1.1.0"
punycode "^2.3.1"
xss "^1.0.15"
Expand Down

0 comments on commit 940b143

Please sign in to comment.