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 is not defined" On Next.js 14.0.0 with App Router #385

Open
Iulian-Dragomirescu opened this issue Oct 31, 2023 · 1 comment
Open

Comments

@Iulian-Dragomirescu
Copy link

Hi, my code is like this:

import FroalaEditorComponent from "react-froala-wysiwyg";
import { Controller } from "react-hook-form";

// Load a plugin.
import "froala-editor/css/froala_editor.pkgd.min.css";
import "froala-editor/css/froala_style.min.css";
import "froala-editor/js/plugins/char_counter.min.js";
import "froala-editor/js/plugins/colors.min.js";
import "froala-editor/js/plugins/font_size.min.js";
import "froala-editor/js/plugins/lists.min.js";

export default function Editor({ control, errors }) {
  let config = {
    heightMin: 300,
    placeholderText: `Edit Your Content Here!`,
    charCounterCount: true,
  };

  return (
    <>
      <Controller
        name="description"
        control={control}
        rules={{
          required: true,
        }}
        render={({ field }) => (
          <FroalaEditorComponent
            tag="textarea"
            config={config}
            model={field.value}
            onModelChange={field.onChange}
          />
        )}
      />
    </>
  );
}

And the miraculous error..

null
 ✓ Compiled in 1030ms (800 modules)
 ⨯ node_modules\react-froala-wysiwyg\index.js (1:321) @ eval
 ⨯ ReferenceError: window is not defined
[...]

Any idea to fix this? Thanks!

@Iulian-Dragomirescu Iulian-Dragomirescu changed the title "window is not defined" On Next.js 14.0.0 witt App Router "window is not defined" On Next.js 14.0.0 with App Router Oct 31, 2023
@nugthan
Copy link

nugthan commented Nov 4, 2023

Question answered on #212

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

2 participants