imzbf / md-editor-v3

Markdown editor for vue3, developed in jsx and typescript, dark theme、beautify content by prettier、render articles directly、paste or clip the picture and upload it...
https://imzbf.github.io/md-editor-v3
MIT License
1.63k stars 156 forks source link

Cannot read properties of null (reading 'offsetTop') #565

Closed chapov closed 5 months ago

chapov commented 5 months ago

描述这个Bug

version 4.16.6

paste the code into the editor (eg css) Scroll while viewing. an error appears

image

Cannot read properties of null (reading 'offsetTop')
TypeError: Cannot read properties of null (reading 'offsetTop')
    at getLineNumber (webpack-internal:///./node_modules/md-editor-v3/lib/es/MdEditor.mjs:1344:76)
    at cEleHandler (webpack-internal:///./node_modules/md-editor-v3/lib/es/MdEditor.mjs:1474:25)
    at eval (webpack-internal:///./node_modules/md-editor-v3/lib/es/MdEditor.mjs:1514:7)
    at r (webpack-internal:///./node_modules/@vavt/util/lib/es/index.mjs:95:41)

版本号

node: 18.00 md-editor-v3: 4.16.6 vue: 3.4.27

问题重现链接

import { MdEditor } from 'md-editor-v3';
import 'md-editor-v3/lib/style.css';
export default {
  data() {
    return {
      toolbars: ['bold', 'italic', 'underline', '-', 'quote', 'link', 'code', '-'],
      composeReplyText: '',
      ticket_id: this.$route.params.ticket_id,
    };
  },
  components: {
    MdEditor,
  },
};

<template>
    <MdEditor v-model="composeReplyText" />
</template>
imzbf commented 5 months ago

Fixed in 4.16.7