带有 Vue 的 TinyMCE - 外部插件 - 未捕获类型错误:tinymce.get()[0] 未定义

问题描述 投票:0回答:0

首先请大家多多包涵,我是新人。如果我的要求有什么不对的地方,请告诉我,我会尽快改正。

我正在写一个应用程序

  • Vue.js v3
  • TinyMCE v6 包含在我的一个组件中
  • flmnger-tinymce 插件

我的组件的摘录(以避免不必要的行)是:

<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
          }
        }
      }
    }
    ...
  }

当我编译我的 Vue 项目时,我收到以下错误消息:

 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
  ...

我通过在我的文件管理器插件中添加

/* global tinymce */
命令来避免。

但是,在我的 Firefox 控制台中,我得到:

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

我很确定它必须来自在 tinymce 准备好之前被初始化的插件但是,由于一切都是由其他人而不是我完成的,我不确定我是否应该修改它们......

我搜索了几个小时但没有成功。 你们能帮帮我吗? 你有什么想法吗??

提前致谢, 弗雷德

vue.js plugins vuejs3 tinymce tinymce-6
© www.soinside.com 2019 - 2024. All rights reserved.