clearml-docs/src/zoom-plugin/zoom.js
2021-05-14 02:48:51 +03:00

47 lines
1.0 KiB
JavaScript

/**
* Copyright (c) 2017-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import siteConfig from '@generated/docusaurus.config';
import mediumZoom from 'medium-zoom'
const {themeConfig} = siteConfig;
export default (function () {
if (typeof window === 'undefined') {
return null;
}
const selector = (themeConfig && themeConfig.zoomSelector) || '.markdown img';
setTimeout(() => {
mediumZoom(selector, {
margin: 48,
background: '#00000090',
}
);
}, 1000);
return {
onRouteUpdate({location}) {
if (location && location.hash && location.hash.length) {
return;
}
setTimeout(() => {
mediumZoom(selector, {
margin: 48,
background: '#00000090',
});
}, 1000);
},
};
})();