question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

plugin cannot be used in nuxt

See original GitHub issue

Summary

plugin cannot be used in nuxt error message: self is not defined

Screenshots

image

Version:

Code

/plugins/tui-editor.js

import Vue from 'vue'
import { Viewer } from '@toast-ui/vue-editor'
import '@toast-ui/editor/dist/toastui-editor.css'
Vue.component('Viewer', Viewer)

/nuxt.config.js

... // other
plugins: [
  { src: '@/plugins/tui-editor.js', mode: 'client' }
}
... // other

Viewer.vue

<template>
  <client-only>
    <viewer :initial-value="value" :height="height" :options="editorOptions" />
  </client-only>
</template>

<script>
import chart from '@toast-ui/editor-plugin-chart'
import colorSyntax from '@toast-ui/editor-plugin-color-syntax'
import tableMergedCell from '@toast-ui/editor-plugin-table-merged-cell'
import codeSyntaxHighlight from '@toast-ui/editor-plugin-code-syntax-highlight'

export default {
  name: 'MarkDownViewer',
  props: {
    value: {
      type: String,
      default: ''
    },
    height: {
      type: String,
      default: '100%'
    }
  },
  data() {
    return {
      chartOptions: {
        minWidth: 100,
        maxWidth: 600,
        minHeight: 100,
        maxHeight: 300
      }
    }
  },
  computed: {
    editorOptions() {
      return {
        minHeight: '500px',
        plugins: [
          [chart, this.chartOptions],
          codeSyntaxHighlight,
          colorSyntax,
          tableMergedCell
        ]
      }
    }
  }
}
</script>

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
js87zzcommented, Nov 17, 2021

@jianweigit @JakeStanger Sorry for late replying. we has not yet officially supported SSR. There are many requests for this, so I will work on the next minor version.

0reactions
JakeStangercommented, Apr 9, 2022

Guys please if you’re going to make posts like these can you avoid tagging everyone in the quotes, we do get notified still.

It’ll happen when the dev gets to it, if you need it that badly submit a PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plugins directory - Nuxt
The plugins directory contains your Javascript plugins that you want to run before instantiating the root Vue.js Application. This is the place to...
Read more >
Unable to use standard Vue plugin with Nuxt - Stack Overflow
It is a usual vuew plugin package, but I'm not sure how to get it to work with nuxt. Any help very greatly...
Read more >
Problems With Server-Side Plugins in Nuxt.js
When you use server-side rendering in Nuxt, you can create highly dynamic and performant experiences. But, it relies on a node server which...
Read more >
Nuxt Third Party Code Is Poison: Cure It In 3 Easy Steps
#1 Move All External Integrations To Plugins ... The standard way to add scripts to Nuxt sites is to use head(). This may...
Read more >
How to create a global custom plugin in Nuxt.js
You can use this component to implement different types of functionalities in your application, and it comes in handy when you can't find...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found