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

Window 10 Crash Debug #262

Open
pohsiu opened this issue May 16, 2024 · 0 comments
Open

Window 10 Crash Debug #262

pohsiu opened this issue May 16, 2024 · 0 comments

Comments

@pohsiu
Copy link

pohsiu commented May 16, 2024

Hi, I am wondering is there anyway to debug my website through inserting the log before crash or catch the exception if editor goes wrong.

Jodit Version: 4.2.21

Browser: Chrome 124.0
OS: Windows NT 10.0
Is React App: True

Code

// A *self-contained* demonstration of the problem follows...

import React, { Suspense, lazy, useRef, useState, useMemo, useEffect } from 'react'
import style from './editor.css'

const JoditEditor = lazy(() => import('jodit-react'))

const Editor = ({ defaultValue, onChange, required }) => {
  const editor = useRef(null)
  const [content, setContent] = useState('')

  const config = useMemo(
    () => ({
      useSearch: false,
      height: 400,
      readonly: false,
      placeholder: '請輸入商品描述...',
      language: 'zh_tw',
      askBeforePasteHTML: false,
      askBeforePasteFromWord: false,
      buttons:
     'eraser,|,bold,italic,underline,strikethrough,|,fontsize,|,brush,lineHeight,|,image,table,link,|,indent,outdent,|,left,center,right,|,source,fullsize',
    }),
    []
  )

  const onChangeHandler = (newContent) => {
    // setContent(newContent)
    onChange(newContent)
  }

  useEffect(() => {
    setContent(defaultValue)
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [])

  return (
    <div className={style.container} id="jodit-container" data-required={required}>
      <Suspense fallback={<div>Loading...</div>}>
        <JoditEditor
          id="jodit-editor"
          ref={editor}
          value={content}
          config={config}
          tabIndex={1}
          onChange={onChangeHandler}
        />
      </Suspense>
    </div>
  )
}

export default Editor

Expected behavior:
Ctrl + A (Select all) -> Clear format -> click toolbar bold btn -> Formatted to bold
Actual behavior:
Ctrl + A (Select all) -> Clear format -> click toolbar bold btn -> Browser Chrome Crashed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant