froala / react-froala-wysiwyg

React component for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
561 stars 130 forks source link

NextJS Version 13.5 brokes #381

Open jspasiuk opened 10 months ago

jspasiuk commented 10 months ago

We just updated NextJS to the latest version (13.5) from 13.4 and froala started crashed (some type issue)

import "froala-editor/css/froala_style.min.css";
import "froala-editor/css/froala_editor.pkgd.min.css";
import FroalaEditorComponent from "react-froala-wysiwyg";
import "froala-editor/js/plugins/font_size.min.js";
import "froala-editor/js/plugins/align.min.js";
import config from "../../../config";

export default function CustomTextEditor({
  initialValue,
  setProp,
}: {
  initialValue: string;
  setProp: any;
}) {
  return (
    <FroalaEditorComponent
      config={{
        key: config.FROALA_KEY,
        initOnClick: true,
        disableRightClick: true,
        toolbarInline: true,
        charCounterCount: false,
        toolbarVisibleWithoutSelection: true,
        reactIgnoreAttrs: ["class", "id"],
        htmlAllowedTags: ["p"],
      }}
      onModelChange={(model: any) => {
        setProp((props: any) => (props.initialValue = model));
      }}
      tag="div"
      model={initialValue}
    />
  );
}

This is our code, and we import the editor using

const CustomTextEditor = dynamic(() => import("./CustomTextEditor.component"), { ssr: false, });

Thanks

TylerNRobertson commented 10 months ago

+1 on this, same for me in our project as well

TylerNRobertson commented 10 months ago

Seems to only happen in a production optimized build, in development mode it works fine

Luyin commented 10 months ago

It's works on NextJS v13.4... hmm

TylerNRobertson commented 10 months ago

@Luyin Yeah this issue is for 13.5, its weird cus it works in 13.5.3 but not any minor version after that

ilyaskarim commented 2 months ago

We just updated NextJS to the latest version (13.5) from 13.4 and froala started crashed (some type issue)

import "froala-editor/css/froala_style.min.css";
import "froala-editor/css/froala_editor.pkgd.min.css";
import FroalaEditorComponent from "react-froala-wysiwyg";
import "froala-editor/js/plugins/font_size.min.js";
import "froala-editor/js/plugins/align.min.js";
import config from "../../../config";

export default function CustomTextEditor({
  initialValue,
  setProp,
}: {
  initialValue: string;
  setProp: any;
}) {
  return (
    <FroalaEditorComponent
      config={{
        key: config.FROALA_KEY,
        initOnClick: true,
        disableRightClick: true,
        toolbarInline: true,
        charCounterCount: false,
        toolbarVisibleWithoutSelection: true,
        reactIgnoreAttrs: ["class", "id"],
        htmlAllowedTags: ["p"],
      }}
      onModelChange={(model: any) => {
        setProp((props: any) => (props.initialValue = model));
      }}
      tag="div"
      model={initialValue}
    />
  );
}

This is our code, and we import the editor using

const CustomTextEditor = dynamic(() => import("./CustomTextEditor.component"), { ssr: false, });

Thanks

Can we get more details about the error you're encountering? Additionally, we've made enhancements to our Type definitions, so you might want to try our latest version to see if it resolves the issue.