Skip to content

Cannot read properties of null (reading 'content') #21

Description

@Pahkho

My version of docusaurus is 3.6.3,
After configuring according to the tutorial, an error is reported when running.

Here is my docusaurus.config.js configuration.
`
import {themes as prismThemes} from 'prism-react-renderer';

const config = {

presets: [
[
'classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
routeBasePath: '/',
sidebarPath: './sidebars.js',

    },
    theme: {
      customCss: './src/css/custom.css',
    },
  }),
],

],

plugins: [
'plugin-image-zoom'
],

themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({

  imageZoom: {
    // CSS selector to apply the plugin to, defaults to '.markdown img'
    selector: '.markdown img',
    // Optional medium-zoom options
    // see: https://www.npmjs.com/package/medium-zoom#options
    options: {
      margin: 24,
      background: '#BADA55',
      scrollOffset: 0,
      container: '#zoom-container',
      template: '#zoom-template',
    },
  },

};

export default config;`

My markdown document is as follows: it is in md format, not mdx format. In fact, I have tried both formats and still get the same error.
![试试](./img/部门-新增.png)

When running the project locally, it can be successfully compiled and run. When I click on the picture, an error will be reported. The complete error is as follows
ERROR
Cannot read properties of null (reading 'content')
TypeError: Cannot read properties of null (reading 'content')
at eval (webpack-internal:///./node_modules/medium-zoom/dist/medium-zoom.esm.js:391:46)
at new Promise ()
at open (webpack-internal:///./node_modules/medium-zoom/dist/medium-zoom.esm.js:346:12)
at toggle (webpack-internal:///./node_modules/medium-zoom/dist/medium-zoom.esm.js:537:12)
at HTMLDocument._handleClick (webpack-internal:///./node_modules/medium-zoom/dist/medium-zoom.esm.js:135:5)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions