ckeditor-nuxt icon indicating copy to clipboard operation
ckeditor-nuxt copied to clipboard

ReferenceError: window is not defined

Open mushonnip opened this issue 5 years ago • 10 comments

 ERROR  [Vue warn]: Failed to resolve async component: () => Promise.resolve(/*! import() */).then(__webpack_require__.t.bind(null, /*! @blowstack/ckeditor-nuxt */ "@blowstack/ckeditor-nuxt", 7))
Reason: ReferenceError: window is not defined

mushonnip avatar Dec 10 '20 13:12 mushonnip

where it's displayed? In browser console or in system console?

blowstack avatar Dec 10 '20 14:12 blowstack

where it's displayed? In browser console or in system console?

in the system console

mushonnip avatar Dec 10 '20 15:12 mushonnip

I assume it's shown when you refresh the page. It shouldn't affect anything really. Does the editor work?

blowstack avatar Dec 10 '20 15:12 blowstack

I assume it's shown when you refresh the page. It shouldn't affect anything really. Does the editor work?

The editor is work but it's like rendered slowly

mushonnip avatar Dec 10 '20 18:12 mushonnip

Yes, it's quite slow because It has mplemented all free plugins from ckeditor (except ckfinder). You can try to exclude plugins that you don't need passing a proper config. For example to disable Title plugin you can pass sth like this:

editorConfig: {
       removePlugins: ['Title'],
     }

If it doesn't help I recommend making your own custom build with selected plugins that way you shoud get a lighter version.

blowstack avatar Dec 10 '20 19:12 blowstack

Yes, it's quite slow because It has mplemented all free plugins from ckeditor (except ckfinder). You can try to exclude plugins that you don't need passing a proper config. For example to disable Title plugin you can pass sth like this:

editorConfig: {
       removePlugins: ['Title'],
     }

If it doesn't help I recommend making your own custom build with selected plugins that way you shoud get a lighter version.

Can we get the state when the ckeditor is ready? For content loader usage

mushonnip avatar Dec 12 '20 16:12 mushonnip

Have this problem too! That what I see in terminal when use npm run dev? Снимок экрана 2021-02-02 в 10 48 15

andymark-by avatar Feb 02 '21 09:02 andymark-by

Have this problem too! That what I see in terminal when use npm run dev? Снимок экрана 2021-02-02 в 10 48 15

I found the answer! You need to add the process.client check like this, and the error will disappear.

export default {
  components: {
    'ckeditor-nuxt': () => { if (process.client) { return import('@blowstack/ckeditor-nuxt') } },
  },
}

andymark-by avatar Feb 02 '21 11:02 andymark-by

@andymark-by Good job. I've just merged your pull request. thx

blowstack avatar Feb 02 '21 18:02 blowstack

@blowstack Thank you for the good module.

andymark-by avatar Feb 02 '21 18:02 andymark-by