提交 54bb2f3e 编写于 作者: A Alexey 提交者: ULIVZ

feat($plugin-medium-zoom): custom options (#1649)

Also update medium-zoom to v1.0.4
上级 6c60e540
/* global SELECTOR */
/* global SELECTOR, OPTIONS */
import './style.css'
import zoom from 'medium-zoom'
......@@ -20,7 +20,7 @@ export default {
if (this.zoom) {
this.zoom.detach()
}
this.zoom = zoom(SELECTOR)
this.zoom = zoom(SELECTOR, OPTIONS)
}, 1000)
}
}
......
......@@ -2,7 +2,8 @@ const { path } = require('@vuepress/shared-utils')
module.exports = (options, context) => ({
define: {
SELECTOR: options.selector || '.content img'
SELECTOR: options.selector || '.content img',
OPTIONS: options.options
},
clientRootMixin: path.resolve(__dirname, 'clientRootMixin.js')
})
......@@ -18,7 +18,7 @@
"generator"
],
"dependencies": {
"medium-zoom": "^0.4.0"
"medium-zoom": "^1.0.4"
},
"author": "ULIVZ <chl814@foxmail.com>",
"license": "MIT",
......
......@@ -16,15 +16,38 @@ yarn add -D @vuepress/plugin-medium-zoom@next
## Usage
**Simple**:
```javascript
module.exports = {
plugins: ['@vuepress/medium-zoom']
}
```
**With options**:
```javascript
module.exports = {
plugins: {
'@vuepress/medium-zoom': {
selector: 'img.zoom-custom-imgs',
// medium-zoom options here (https://github.com/francoischalifour/medium-zoom#options)
options: {
margin: 16
}
}
}
}
```
## Options
### selector
- Type: `string`
- Default: `.content img`
### options
Other `medium-zoom` options. [See documentation](https://github.com/francoischalifour/medium-zoom#options).
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册