Cannot read properties of undefined (reading 'localsInner')

Đang mở
#665 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
42/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
markdown, react, typescript, webpack
Lĩnh vực
build-system, frontend

Hướng nghiên cứu

Start with webpack.config.js, the dependency versions in package.json, and App.tsx to reproduce the localsInner failure in a minimal React application. Compare the module versions and imports used in issue #409, then run the development build to confirm the runtime error is gone. Also verify how the default preset enables the table toolbar command in WYSIWYG mode.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I have the same problem that was described here earlier. But nothing changed for me after switching package managers (npm, yarn, pnpm, etc.).
I changed the versions of your package, used your examples to create a React application, but this error always remains.

there're my configs:

webpack.config.js

const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");

module.exports = {
  mode: "development",
  entry: "./src/index.tsx",
  output: {
    path: path.resolve(__dirname, "dist"),
    filename: "bundle.js",
  },
  module: {
    rules: [
      {
        test: /\.(js|jsx)$/,
        exclude: /node_modules/,
        loader: "esbuild-loader",
          options: {
            loader: 'jsx',
            target: 'es2020',
            format: "cjs",
        },
      },
      {
         test: /\.(ts|tsx)$/,
         loader: "esbuild-loader",
         options: {
           loader: "tsx",
           target: "esnext",
           format: "cjs",
         },
         exclude: /node_modules/,
       },
      {
         test: /\.css$/,
         use: ["style-loader", "css-loader"],
       },
    ],
  },
  resolve: {
   fallback: {
      http: false,
      https: false,
      stream: false,
      fs: false,
      process: false,
      path: false,
      url: false,
      punycode: false,
      buffer: false,
    },
    extensions: [".js",".jsx",".ts",".tsx"],
  },
  plugins: [
    new CleanWebpackPlugin(),
    new HtmlWebpackPlugin({
      template: "./public/index.html",
    }),
  ],
  devServer: {
    static: path.join(__dirname, "dist"),
    compress: true,
    port: 3001,
  },
};

tsconfig.json

{
   "compilerOptions": {
     "target": "ESNext",
     "module": "ESNext",
     "jsx": "react-jsx",
     "strict": true,
     "esModuleInterop": true,
     "skipLibCheck": true,
     "forceConsistentCasingInFileNames": true,
     "moduleResolution": "bundler"
   },
   "include": ["src"]
}

dependencies in package.json

"@diplodoc/transform": "^4.47.2",
    "@gravity-ui/markdown-editor": "^15.1.0",
    "@gravity-ui/uikit": "^7.4.0",
    "highlight.js": "^11.11.1",
    "lodash": "^4.17.21",
    "lowlight": "^3.3.0",
    "patch-package": "^8.0.0",
    "postinstall-postinstall": "^2.1.0",
    "react": "^18.0.2",
    "react-dom": "^18.0.2"

and my App.tsx

import React from 'react';
import { ThemeProvider, ToasterProvider, configure } from '@gravity-ui/uikit';
import { toaster } from '@gravity-ui/uikit/toaster-singleton';
import { useMarkdownEditor, MarkdownEditorView } from '@gravity-ui/markdown-editor';
import '@gravity-ui/uikit/styles/styles.css';

function Editor({ onSubmit }: any) {

  const editor = useMarkdownEditor({
    preset: "default",
    md: {
      html: false,
    },
    initial: {
      markup: content,
      mode: "wysiwyg",
      toolbarVisible: true,
      splitModeEnabled: true
    }
  });
  
  React.useEffect(() => {
    function submitHandler() {
      // Serialize current content to markdown markup
      const value = editor.getValue();
      onSubmit(value);
    }

    editor.on('submit', submitHandler);
    return () => {
      editor.off('submit', submitHandler);
    };
  }, [onSubmit]);

  return  <MarkdownEditorView stickyToolbar autofocus editor={editor} />;
}

export default function App() {
  return (
        <ThemeProvider>
        <ToasterProvider toaster={toaster}>
          <Editor onSubmit={(value: any) => console.log(value)} />
        </ToasterProvider>
      </ThemeProvider>
  );
}

To better understand the situation, I can create a repository with the project.

And additionally, I would like to ask. You have a preset for working with pure Markdown, specifically the "default" preset, which should also include a table, but it's not in the toolbar and it's unclear how to create it in WYSIWYG mode?

Ngôn ngữ chính
TypeScript
Star
428
Fork
48
Merge trung bình
5 ngày 15 giờ
Pull request đã merge (30 ngày)
47

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của gravity-ui/markdown-editor

Tất cả issue của gravity-ui/markdown-editor

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.