Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

medium-zoom not functional if base URL is a sub path #84

Closed
nicpitsch opened this issue Mar 28, 2021 · 3 comments
Closed

medium-zoom not functional if base URL is a sub path #84

nicpitsch opened this issue Mar 28, 2021 · 3 comments
Labels
bug Something isn't working package:theme-default

Comments

@nicpitsch
Copy link

nicpitsch commented Mar 28, 2021

Bug report

Description

medium-zoom Plugin isn't functional if base in config.ts is set to a sub path like base: '/bar/'.

Steps to reproduce

  • Set base: '/bar/' in config.ts.
  • Add an image to folder ./.vuepress/public/images, like myimage.jpg.
  • Reference that image within a readme.md several times and start npm run docs:dev:
    1. ![myimage](/images/myimage.jpg) → image doesn't display, as expected.
    2. ![myimage](/bar/images/myimage.jpg) → image displays and medium-zoom is functional, but we have 'hardcoded' the relative path.
    3. <img :src="$withBase('/images/myimage.jpg')" alt=""> → image displays but medium-zoom is not functional, that's the issue.

Expected behavior

medium-zoom Plugin should be functional together with $withBase, means when clicking on image with option iii above the image should be zoomed.

Environment info

  • Browser: Edge
  • npm run docs:dev: vuepress2@1.0.0
  • package.json: "vuepress": "^2.0.0-beta.6"
@meteorlxy meteorlxy added bug Something isn't working package:theme-default labels Mar 28, 2021
@meteorlxy
Copy link
Member

It's not related to the base.

The reason is the medium-zoom selector was set to .theme-default-content :not(a) > img

However, using <img> tag directly in markdown will result in .theme-default-content > img.

@nicpitsch
Copy link
Author

Shouldn't the first css-child selector within your commit 832bd6f be omitted? Correct selector to:

selector:
  '.theme-default-content img, .theme-default-content :not(a) > img',

Thanks a lot for your great contribution to vuepress-next.

@meteorlxy
Copy link
Member

@nicpitsch If so, the second selector will have no effects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package:theme-default
Projects
None yet
Development

No branches or pull requests

2 participants