0

First, please excuse me in advance, I'm a newbee. If anything isn't correct in my request, please tell it to me, I'll do my best to correct it asap.

I'm writing an application with

  • Vue.js v3
  • TinyMCE v6 included in one of my components
  • flmnger-tinymce plugin

An extract (to avoid unnecessary lines) of my component is:

<template>
  <div id="article">
      <editor :init="init"
              @undo="undo" 
              @dirty="dirty" 
      />
  </div>
</template>

<script>

  import tinymce from 'tinymce'
  import Editor from '@tinymce/tinymce-vue'

  import 'tinymce/plugins/charmap'
  ...
  import '@/js/file-manager/plugin.js'

  export default {
    name: 'knArticle', 
    props: ['nodeRef'],  
    components: {
      'editor': Editor 
    },
    data: function() {
      return {
        init: {
           inline: true
           ...
          ,external_plugins: {
            'file-manager': '/js/file-manager/plugin.js' 
          } 
          ,Flmngr: { 
            apiKey: 'FLMNFLMN',                                  // default free key
            urlFileManager: 'https://fm.flmngr.com/fileManager', // demo server
            urlFiles: 'https://fm.flmngr.com/files'              // demo file storage
          }
        }
      }
    }
    ...
  }

When I compile my Vue project, I get the following error message:

 ERROR  Failed to compile with 1 error                                                                                                                         19:07:47

[eslint] 
/.../src/js/file-manager/plugin.js
  27:5   error  'tinymce' is not defined  no-undef
  29:23  error  'tinymce' is not defined  no-undef
  44:14  error  'tinymce' is not defined  no-undef
  45:15  error  'tinymce' is not defined  no-undef
  ...

which I avoid via adding the /* global tinymce */ command in my file-manager plugin.

But then, in my Firefox console, I get:

Uncaught TypeError: tinymce.get()[0] is undefined
    getOption plugin.js:31
    <anonymous> plugin.js:38
    ...

I'm quite sure it must come from the plugin being initialized before tinymce is ready but, as everything is done by other people than me, I'm not sure I should modify them...

There are hours I'm searching but without any success. Could some of you help me? Do you have an idea??

Thanks in advance, Fred

0 Answers0