Skip to content

Commit 42f19e0

Browse files
committed
fix($plugin-medium-zoom): doesn't work with default plugin options in default theme
1 parent 54bb2f3 commit 42f19e0

File tree

3 files changed

+41
-6
lines changed

3 files changed

+41
-6
lines changed

packages/@vuepress/plugin-medium-zoom/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { path } = require('@vuepress/shared-utils')
22

33
module.exports = (options, context) => ({
44
define: {
5-
SELECTOR: options.selector || '.content img',
5+
SELECTOR: options.selector || '.theme-default-content img',
66
OPTIONS: options.options
77
},
88
clientRootMixin: path.resolve(__dirname, 'clientRootMixin.js')

packages/docs/docs/plugin/official/plugin-medium-zoom.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ module.exports = {
3131
plugins: {
3232
'@vuepress/medium-zoom': {
3333
selector: 'img.zoom-custom-imgs',
34-
35-
// medium-zoom options here (https://github.com/francoischalifour/medium-zoom#options)
34+
// medium-zoom options here
35+
// See: https://github.com/francoischalifour/medium-zoom#options
3636
options: {
3737
margin: 16
3838
}
@@ -46,8 +46,13 @@ module.exports = {
4646
### selector
4747

4848
- Type: `string`
49-
- Default: `.content img`
49+
- Default: `.theme-default-content img`
50+
51+
Note that `.theme-default-content` is the class name of [`<Content />`](../../guide/using-vue.md#content) component in default theme.
5052

5153
### options
5254

53-
Other `medium-zoom` options. [See documentation](https://github.com/francoischalifour/medium-zoom#options).
55+
- Type: `object`
56+
- Default: `undefined`
57+
58+
[Options](https://github.com/francoischalifour/medium-zoom#options) for [medium-zoom](https://github.com/francoischalifour/medium-zoom).

packages/docs/docs/zh/plugin/official/plugin-medium-zoom.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,45 @@ yarn add -D @vuepress/plugin-medium-zoom@next
1616

1717
## 使用
1818

19+
## Usage
20+
21+
**简单使用**:
22+
1923
```javascript
2024
module.exports = {
2125
plugins: ['@vuepress/medium-zoom']
2226
}
2327
```
2428

29+
**自定义选项**:
30+
31+
```javascript
32+
module.exports = {
33+
plugins: {
34+
'@vuepress/medium-zoom': {
35+
selector: 'img.zoom-custom-imgs',
36+
// medium-zoom options here
37+
// See: https://github.com/francoischalifour/medium-zoom#options
38+
options: {
39+
margin: 16
40+
}
41+
}
42+
}
43+
}
44+
```
45+
2546
## 选项
2647

2748
### selector
2849

2950
- 类型: `string`
30-
- 默认值: `.content img`
51+
- 默认值: `.theme-default-content img`
52+
53+
值得注意的是, `.theme-default-content` 是默认主题添加给 [`<Content />`](../../guide/using-vue.md#content) 组件的 class name。
54+
55+
### options
56+
57+
- 类型: `object`
58+
- 默认值: `undefined`
59+
60+
[medium-zoom](https://github.com/francoischalifour/medium-zoom)[选项](https://github.com/francoischalifour/medium-zoom#options)

0 commit comments

Comments
 (0)