Tui.editor: @toast-ui/vue-editor window is not defined

Created on 24 Mar 2020  路  10Comments  路  Source: nhn/tui.editor

How to resolve it?

Bug Vue

Most helpful comment

@farshidrezaei

Can you check this repo?

  1. create plugins\tui_editor.client.js code
  2. add plugins to nuxt.config.js code
  // ...
  plugins: [
    '~/plugins/tui_editor.client.js'
  ],
  // ...
  1. using like this everywhere you want. code
<!-- in template -->
<client-only>
  <editor />
</client-only>

image

I usually use tui.editor this way. I think you will get better answer from authors. good luck 馃槃

All 10 comments

@Hxmic I just don't know what's wrong with this.. Could you explain it in more detail?

In vue page, import it, "window is not defined".

I resolved it, in nuxt.

NUXT

first mkdir tui-editor.js , import vue-editor and vue , then vue use it.

seond import tui-editor.js , in config.index.js

In vue page, import it, "window is not defined".

I resolved it, in nuxt.

NUXT

first mkdir tui-editor.js , import vue-editor and vue , then vue use it.

seond import tui-editor.js , in config.index.js

@ChangJoo-Park

i do like you , but i get this error:
Uncaught TypeError: Cannot read property 'install' of undefined

@farshidrezaei, are you using Nuxt too?

@ChangJoo-Park

yes. i use nuxt.

@farshidrezaei

Can you check this repo?

  1. create plugins\tui_editor.client.js code
  2. add plugins to nuxt.config.js code
  // ...
  plugins: [
    '~/plugins/tui_editor.client.js'
  ],
  // ...
  1. using like this everywhere you want. code
<!-- in template -->
<client-only>
  <editor />
</client-only>

image

I usually use tui.editor this way. I think you will get better answer from authors. good luck 馃槃

@ChangJoo-Park it's worked. thank you.

@ChangJoo-Park I also tried your way in nuxt, but it only works in 'spa' mode, not in 'universal', although add the 'client-only'. this is very strange.

@HarrisonLee1998 Please check my repo here

It is universal nuxt application using npx create-nuxt-app

In nuxt
first: image

second:
image

@HarrisonLee1998

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oguera picture oguera  路  3Comments

cyberjacob picture cyberjacob  路  4Comments

Gilles-GitHub picture Gilles-GitHub  路  4Comments

hellojsna picture hellojsna  路  4Comments

koliyo picture koliyo  路  4Comments