megahertz / react-simple-wysiwyg

Simple and lightweight React WYSIWYG editor
https://megahertz.github.io/react-simple-wysiwyg/
MIT License
119 stars 21 forks source link

Getting this error when I reload the page. TypeError: Cannot read properties of undefined (reading 'memo') #12

Closed supnim closed 1 year ago

supnim commented 1 year ago

When I navigate to page it's fine and shows and works but when I reload it, it breaks and throws this error.

This is my implementation:

TextEditor.tsx:

import React, { useState } from "react"
import { DefaultEditor } from "react-simple-wysiwyg"

function TextEditor() {
    const [html, setHtml] = useState("my <b>HTML</b>")

    function onChange(e) {
        setHtml(e.target.value)
    }

    return <DefaultEditor value={html} onChange={onChange} />
}
export default TextEditor

post-job.tsx:

import TextEditor from "../components/globals/TextEditor"
...
<TextEditor />
...
image

Any help would be wonderful as this WYSIWYG has been the easiest to implement :)

megahertz commented 1 year ago

Could you help me to reproduce that? Looks like the UMD module can't be loaded properly in your environment.

supnim commented 1 year ago

added you to the repo so you can reproduce the issue :) lmk if I can help in another way

megahertz commented 1 year ago

Thank you, I'll take a look a bit later today.

supnim commented 1 year ago

wonderful! thanks mate - appreciate it :)

megahertz commented 1 year ago

Currently, you can use the following workaround: import { DefaultEditor } from "react-simple-wysiwyg/lib/index.js" I'll try to make a fix in this week.

supnim commented 1 year ago

thanks mate, much appreciated :)

megahertz commented 1 year ago

That issue is fixed in v2.1.1

supnim commented 1 year ago

I have added you to the repo so you can reproduce it :)

On 16 Aug 2022, at 12:20, Alexey Prokhorov @.***> wrote:

Could you help me to reproduce that? Looks like the UMD module can't be loaded properly in your environment.

— Reply to this email directly, view it on GitHub https://github.com/megahertz/react-simple-wysiwyg/issues/12#issuecomment-1216126244, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJFFUQ7AJAIGTCLNPOVPQJTVZMJH3ANCNFSM56UDNRWA. You are receiving this because you authored the thread.

megahertz commented 1 year ago

Does v2.1.1 work fine for you without the workaround?