Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/@vuepress/plugin-medium-zoom/clientRootMixin.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global SELECTOR */
/* global SELECTOR, OPTIONS */

import './style.css'
import zoom from 'medium-zoom'
Expand All @@ -20,7 +20,7 @@ export default {
if (this.zoom) {
this.zoom.detach()
}
this.zoom = zoom(SELECTOR)
this.zoom = zoom(SELECTOR, OPTIONS)
}, 1000)
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/@vuepress/plugin-medium-zoom/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
2 changes: 1 addition & 1 deletion packages/@vuepress/plugin-medium-zoom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"generator"
],
"dependencies": {
"medium-zoom": "^0.4.0"
"medium-zoom": "^1.0.4"
},
"author": "ULIVZ <chl814@foxmail.com>",
"license": "MIT",
Expand Down
23 changes: 23 additions & 0 deletions packages/docs/docs/plugin/official/plugin-medium-zoom.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).