Vue 中自定义 CKEditor5 错误:编译失败

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

我想在我的 vue 应用程序中实现自定义 CKEditor5,但我收到一个

failed to compile
错误。

我使用 ckeditor 在线工具创建了自定义构建。之后,我将文件放入项目根文件夹中的新文件夹

ckeditor
中。 然后我在我的代码中实现了ckeditor:

<template>
   <ckeditor :editor="newsEditor" :config="editorConfig" class="form-control" v-model="text"></ckeditor>
</template>

<script>
import Editor from 'ckeditor5-custom-build/build/ckeditor'
export default {
  data() {
    return  {
      newsEditor: Editor,
    }
  }
}
</script>

但是如果我重新加载页面,则会出现以下错误:

Failed to compile.

./ckeditor5/build/ckeditor.js
Module Error (from ./node_modules/eslint-loader/index.js):

/usr/src/app/ghp_board_frontend/ckeditor5/build/ckeditor.js
  5:131     error  'define' is not defined                                          no-undef
  5:142     error  'define' is not defined                                          no-undef
  5:245496  error  Unsafe usage of ThrowStatement                                   no-unsafe-finally
  5:246941  error  Unexpected constant condition                                    no-constant-condition
  5:249266  error  'globalThis' is not defined                                      no-undef
  5:250788  error  'f' is defined but never used                                    no-unused-vars
  5:251168  error  'k' is assigned a value but never used                           no-unused-vars
  5:252113  error  Expected a conditional expression and instead saw an assignment  no-cond-assign
  5:260513  error  't' is defined but never used                                    no-unused-vars
  5:261546  error  Empty block statement                                            no-empty
  5:264068  error  Empty block statement                                            no-empty
  5:264094  error  Empty block statement                                            no-empty
  5:267027  error  Empty block statement                                            no-empty
  5:269703  error  Empty block statement                                            no-empty
  5:285401  error  'Sa' is defined but never used                                   no-unused-vars
  5:286132  error  'Pa' is defined but never used                                   no-unused-vars
  5:288580  error  'Fa' is defined but never used                                   no-unused-vars
  5:288597  error  'Observable' is not defined                                      no-undef
  5:319940  error  'n' is assigned a value but never used                           no-unused-vars
  5:329983  error  Empty block statement                                            no-empty
  5:331832  error  'e' is defined but never used                                    no-unused-vars
  5:350953  error  'Hh' is assigned a value but never used                          no-unused-vars
  5:350976  error  'jh' is assigned a value but never used                          no-unused-vars
  5:363292  error  Expected a conditional expression and instead saw an assignment  no-cond-assign
  5:378113  error  Empty block statement                                            no-empty
  5:382168  error  Expected a 'break' statement before 'case'                       no-fallthrough
  5:382398  error  Expected a 'break' statement before 'case'                       no-fallthrough
  5:398568  error  'vg' is defined but never used                                   no-unused-vars
  5:398602  error  'Rect' is not defined                                            no-undef
  5:403056  error  Empty block statement                                            no-empty
  5:406146  error  't' is defined but never used                                    no-unused-vars
  5:428349  error  Unexpected constant condition                                    no-constant-condition
  5:512943  error  Unexpected combined character in character class                 no-misleading-character-class
  5:519539  error  'e' is defined but never used                                    no-unused-vars
  5:553093  error  '$k' is assigned a value but never used                          no-unused-vars
  5:553116  error  'Gk' is assigned a value but never used                          no-unused-vars
  5:553514  error  'Jk' is defined but never used                                   no-unused-vars
  5:555178  error  Unnecessary try/catch wrapper                                    no-useless-catch
  5:579103  error  'mw' is defined but never used                                   no-unused-vars
  5:579120  error  'DomEventObserver' is not defined                                no-undef
  5:579373  error  'kw' is defined but never used                                   no-unused-vars
  5:580397  error  'isPlainObject' is not defined                                   no-undef
  5:580643  error  'Position' is not defined                                        no-undef
  5:580697  error  'Position' is not defined                                        no-undef
  5:580753  error  'Position' is not defined                                        no-undef
  5:583544  error  'xw' is defined but never used                                   no-unused-vars
  5:583840  error  'Dw' is defined but never used                                   no-unused-vars
  5:584146  error  'Iw' is defined but never used                                   no-unused-vars
  5:584239  error  'Ow' is defined but never used                                   no-unused-vars
  5:584318  error  'Nw' is defined but never used                                   no-unused-vars
  5:584373  error  'Vw' is defined but never used                                   no-unused-vars
  5:584618  error  'Hw' is defined but never used                                   no-unused-vars
  5:585045  error  'qw' is defined but never used                                   no-unused-vars
  5:585178  error  'Kw' is defined but never used                                   no-unused-vars
  5:585390  error  'getShorthandValues' is not defined                              no-undef
  5:585433  error  'isRepeat' is not defined                                        no-undef
  5:585493  error  'isPosition' is not defined                                      no-undef
  5:585561  error  'isAttachment' is not defined                                    no-undef
  5:585601  error  'isColor' is not defined                                         no-undef
  5:585631  error  'isURL' is not defined                                           no-undef
  5:585839  error  'Zw' is defined but never used                                   no-unused-vars
  5:587744  error  'getBoxSidesValueReducer' is not defined                         no-undef
  5:587813  error  'getBoxSidesValueReducer' is not defined                         no-undef
  5:587882  error  'getBoxSidesValueReducer' is not defined                         no-undef
  5:589336  error  'getBoxSidesValues' is not defined                               no-undef
  5:589363  error  'getBoxSidesValues' is not defined                               no-undef
  5:589390  error  'getBoxSidesValues' is not defined                               no-undef
  5:589706  error  'getBoxSidesValues' is not defined                               no-undef
  5:590059  error  'getShorthandValues' is not defined                              no-undef
  5:590102  error  'isLength' is not defined                                        no-undef
  5:590162  error  'isLineStyle' is not defined                                     no-undef
  5:591051  error  'a_' is defined but never used                                   no-unused-vars
  5:591082  error  'getPositionShorthandNormalizer' is not defined                  no-undef
  5:591418  error  'getBoxSidesValueReducer' is not defined                         no-undef
  5:591551  error  'c_' is defined but never used                                   no-unused-vars
  5:591583  error  'getPositionShorthandNormalizer' is not defined                  no-undef
  5:591929  error  'getBoxSidesValueReducer' is not defined                         no-undef
  5:593542  error  Empty block statement                                            no-empty
  5:602208  error  Expected a conditional expression and instead saw an assignment  no-cond-assign
  5:617894  error  'rv' is assigned a value but never used                          no-unused-vars
  5:617917  error  'sv' is assigned a value but never used                          no-unused-vars
  5:621563  error  'kv' is assigned a value but never used                          no-unused-vars
  5:621586  error  'wv' is assigned a value but never used                          no-unused-vars
  5:627818  error  'Dv' is assigned a value but never used                          no-unused-vars
  5:627841  error  'Sv' is assigned a value but never used                          no-unused-vars
  5:636237  error  'Lv' is defined but never used                                   no-unused-vars
  5:636314  error  'CKEditorError' is not defined                                   no-undef
  5:636447  error  'Hv' is defined but never used                                   no-unused-vars
  5:636464  error  'ContextPlugin' is not defined                                   no-undef
  5:636576  error  'Collection' is not defined                                      no-undef
  5:636696  error  'CKEditorError' is not defined                                   no-undef
  5:636765  error  'Observable' is not defined                                      no-undef
  5:654180  error  'DA' is assigned a value but never used                          no-unused-vars
  5:654203  error  'SA' is assigned a value but never used                          no-unused-vars
  5:656451  error  'RA' is assigned a value but never used                          no-unused-vars
  5:656474  error  'IA' is assigned a value but never used                          no-unused-vars
  5:659118  error  'NA' is assigned a value but never used                          no-unused-vars
  5:659141  error  'FA' is assigned a value but never used                          no-unused-vars
  5:659601  error  'LA' is defined but never used                                   no-unused-vars
  5:659618  error  'ButtonView' is not defined                                      no-undef
  5:659746  error  'checkIcon' is not defined                                       no-undef
  5:660111  error  'qA' is assigned a value but never used                          no-unused-vars
  5:660134  error  'WA' is assigned a value but never used                          no-unused-vars
  5:660159  error  'KA' is defined but never used                                   no-unused-vars
  5:660176  error  'View' is not defined                                            no-undef
  5:660435  error  'FocusTracker' is not defined                                    no-undef
  5:660468  error  'KeystrokeHandler' is not defined                                no-undef
  5:660580  error  'ColorTileView' is not defined                                   no-undef
  5:661366  error  'addKeyboardHandlingForGrid' is not defined                      no-undef
  5:662347  error  'JA' is assigned a value but never used                          no-unused-vars
  5:662370  error  'YA' is assigned a value but never used                          no-unused-vars
  5:665385  error  'nC' is assigned a value but never used                          no-unused-vars
  5:665408  error  'oC' is assigned a value but never used                          no-unused-vars
  5:669869  error  'fC' is assigned a value but never used                          no-unused-vars
  5:669892  error  'gC' is assigned a value but never used                          no-unused-vars
  5:677592  error  'CC' is assigned a value but never used                          no-unused-vars
  5:677615  error  'yC' is assigned a value but never used                          no-unused-vars
  5:679252  error  'BC' is assigned a value but never used                          no-unused-vars
  5:679275  error  'RC' is assigned a value but never used                          no-unused-vars
  5:679416  error  'OC' is assigned a value but never used                          no-unused-vars
  5:679439  error  'MC' is assigned a value but never used                          no-unused-vars
  5:681702  error  'JC' is assigned a value but never used                          no-unused-vars
  5:681725  error  'YC' is assigned a value but never used                          no-unused-vars
  5:682038  error  'ey' is assigned a value but never used                          no-unused-vars
  5:682061  error  'ny' is assigned a value but never used                          no-unused-vars
  5:684680  error  'ly' is assigned a value but never used                          no-unused-vars
  5:684703  error  'dy' is assigned a value but never used                          no-unused-vars
  5:684728  error  'hy' is defined but never used                                   no-unused-vars
  5:684745  error  'View' is not defined                                            no-undef
  5:685029  error  'View' is not defined                                            no-undef
  5:685292  error  'gy' is assigned a value but never used                          no-unused-vars
  5:685315  error  'py' is assigned a value but never used                          no-unused-vars
  5:685340  error  'my' is defined but never used                                   no-unused-vars
  5:685357  error  'View' is not defined                                            no-undef
  5:685592  error  'FocusTracker' is not defined                                    no-undef
  5:686666  error  'ky' is defined but never used                                   no-unused-vars
  5:686683  error  'InputView' is not defined                                       no-undef
  5:686797  error  'wy' is defined but never used                                   no-unused-vars
  5:686814  error  'InputView' is not defined                                       no-undef
  5:687087  error  '_y' is defined but never used                                   no-unused-vars
  5:687104  error  'View' is not defined                                            no-undef
  5:687502  error  'Cy' is assigned a value but never used                          no-unused-vars
  5:687525  error  'yy' is assigned a value but never used                          no-unused-vars
  5:687550  error  'xy' is defined but never used                                   no-unused-vars
  5:687567  error  'View' is not defined                                            no-undef
  5:687632  error  'uid' is not defined                                             no-undef
  5:687680  error  'uid' is not defined                                             no-undef
  5:688689  error  'LabelView' is not defined                                       no-undef
  5:688794  error  'View' is not defined                                            no-undef
  5:689143  error  'Ey' is defined but never used                                   no-unused-vars
  5:689165  error  'InputTextView' is not defined                                   no-undef
  5:689423  error  'Dy' is defined but never used                                   no-unused-vars
  5:689445  error  'InputNumberView' is not defined                                 no-undef
  5:689725  error  'Sy' is defined but never used                                   no-unused-vars
  5:689743  error  'createDropdown' is not defined                                  no-undef
  5:689843  error  'Ty' is defined but never used                                   no-unused-vars
  5:689860  error  'ContextPlugin' is not defined                                   no-undef
  5:690678  error  'Iy' is assigned a value but never used                          no-unused-vars
  5:690701  error  'zy' is assigned a value but never used                          no-unused-vars
  5:690842  error  'Ny' is assigned a value but never used                          no-unused-vars
  5:690865  error  'Fy' is assigned a value but never used                          no-unused-vars
  5:690908  error  'Ly' is defined but never used                                   no-unused-vars
  5:691226  error  'BalloonPanelView' is not defined                                no-undef
  5:691746  error  'CKEditorError' is not defined                                   no-undef
  5:692271  error  'CKEditorError' is not defined                                   no-undef
  5:693045  error  'CKEditorError' is not defined                                   no-undef
  5:695311  error  'View' is not defined                                            no-undef
  5:695438  error  'FocusTracker' is not defined                                    no-undef
  5:695508  error  'prevIcon' is not defined                                        no-undef
  5:695571  error  'nextIcon' is not defined                                        no-undef
  5:696298  error  'ButtonView' is not defined                                      no-undef
  5:696392  error  'View' is not defined                                            no-undef
  5:697014  error  'View' is not defined                                            no-undef
  5:697315  error  'Rect' is not defined                                            no-undef
  5:697528  error  'Ky' is assigned a value but never used                          no-unused-vars
  5:697551  error  '$y' is assigned a value but never used                          no-unused-vars
  5:699778  error  'Jy' is defined but never used                                   no-unused-vars
  5:699879  error  'ContextualBalloon' is not defined                               no-undef
  5:699942  error  'normalizeToolbarConfig' is not defined                          no-undef
  5:700062  error  'FocusTracker' is not defined                                    no-undef
  5:700365  error  'ContextualBalloon' is not defined                               no-undef
  5:700419  error  'debounce' is not defined                                        no-undef
  5:701163  error  'Rect' is not defined                                            no-undef
  5:701492  error  'ToolbarView' is not defined                                     no-undef
  5:702453  error  'Rect' is not defined                                            no-undef
  5:702957  error  'env' is not defined                                             no-undef
  5:702971  error  'env' is not defined                                             no-undef
  5:702991  error  'generatePositions' is not defined                               no-undef
  5:703032  error  'BalloonPanelView' is not defined                                no-undef
  5:703120  error  'BalloonPanelView' is not defined                                no-undef
  5:703992  error  'tx' is assigned a value but never used                          no-unused-vars
  5:704015  error  'ex' is assigned a value but never used                          no-unused-vars
  5:704058  error  'ox' is defined but never used                                   no-unused-vars
  5:704075  error  'ButtonView' is not defined                                      no-undef
  5:704375  error  'rx' is defined but never used                                   no-unused-vars
  5:704494  error  'normalizeToolbarConfig' is not defined                          no-undef
  5:704706  error  'clickOutsideHandler' is not defined                             no-undef
  5:706273  error  'ToolbarView' is not defined                                     no-undef
  5:706528  error  'BalloonPanelView' is not defined                                no-undef
  5:706822  error  'BlockButtonView' is not defined                                 no-undef
  5:706905  error  'pilcrow' is not defined                                         no-undef
  5:706975  error  'env' is not defined                                             no-undef
  5:708365  error  'Rect' is not defined                                            no-undef
  5:708512  error  'getOptimalPosition' is not defined                              no-undef
  5:708860  error  'Rect' is not defined                                            no-undef
  5:708880  error  'Rect' is not defined                                            no-undef
  5:710477  error  'lx' is assigned a value but never used                          no-unused-vars
  5:710500  error  'dx' is assigned a value but never used                          no-unused-vars
  5:725087  error  'Gx' is defined but never used                                   no-unused-vars
  5:725481  error  'keyCodes' is not defined                                        no-undef
  5:725520  error  'keyCodes' is not defined                                        no-undef
  5:734541  error  '_E' is assigned a value but never used                          no-unused-vars
  5:734564  error  'vE' is assigned a value but never used                          no-unused-vars
  5:744367  error  'XE' is defined but never used                                   no-unused-vars
  5:745525  error  'hD' is assigned a value but never used                          no-unused-vars
  5:745548  error  'uD' is assigned a value but never used                          no-unused-vars
  5:756478  error  'TD' is assigned a value but never used                          no-unused-vars
  5:756501  error  'PD' is assigned a value but never used                          no-unused-vars
  5:761008  error  'VD' is assigned a value but never used                          no-unused-vars
  5:761031  error  'LD' is assigned a value but never used                          no-unused-vars
  5:779202  error  'AS' is assigned a value but never used                          no-unused-vars
  5:779225  error  'CS' is assigned a value but never used                          no-unused-vars
  5:779250  error  'yS' is defined but never used                                   no-unused-vars
  5:779267  error  'View' is not defined                                            no-undef
  5:779463  error  'FocusTracker' is not defined                                    no-undef
  5:779496  error  'KeystrokeHandler' is not defined                                no-undef
  5:779603  error  'DocumentColorCollection' is not defined                         no-undef
  5:779675  error  'ViewCollection' is not defined                                  no-undef
  5:779712  error  'FocusCycler' is not defined                                     no-undef
  5:780965  error  'Template' is not defined                                        no-undef
  5:781032  error  'LabelView' is not defined                                       no-undef
  5:781522  error  'ButtonView' is not defined                                      no-undef
  5:781559  error  'icons' is not defined                                           no-undef
  5:781815  error  'ColorGridView' is not defined                                   no-undef
  5:781980  error  'Template' is not defined                                        no-undef
  5:782047  error  'ColorGridView' is not defined                                   no-undef
  5:782254  error  'ColorTileView' is not defined                                   no-undef
  5:782780  error  'ES' is assigned a value but never used                          no-unused-vars
  5:782802  error  'DS' is assigned a value but never used                          no-unused-vars
  5:782823  error  'SS' is assigned a value but never used                          no-unused-vars
  5:783062  error  'PS' is defined but never used                                   no-unused-vars
  5:783105  error  'BS' is defined but never used                                   no-unused-vars
  5:783208  error  'RS' is defined but never used                                   no-unused-vars
  5:783341  error  'ColorTableView' is not defined                                  no-undef
  5:786857  error  'US' is assigned a value but never used                          no-unused-vars
  5:786880  error  'ZS' is assigned a value but never used                          no-unused-vars
  5:789754  error  'oT' is defined but never used                                   no-unused-vars
  5:789873  error  'ButtonView' is not defined                                      no-undef
  5:789953  error  'icon' is not defined                                            no-undef
  5:792377  error  'hT' is assigned a value but never used                          no-unused-vars
  5:792400  error  'uT' is assigned a value but never used                          no-unused-vars
  5:797523  error  'AT' is assigned a value but never used                          no-unused-vars
  5:797546  error  'CT' is assigned a value but never used                          no-unused-vars
  5:800228  error  'ST' is defined but never used                                   no-unused-vars
  5:800282  error  'ContextualBalloon' is not defined                               no-undef
  5:801106  error  'logWarning' is not defined                                      no-undef
  5:801209  error  'ToolbarView' is not defined                                     no-undef
  5:801312  error  'CKEditorError' is not defined                                   no-undef
  5:802923  error  'BalloonPanelView' is not defined                                no-undef
  5:803219  error  'isWidget' is not defined                                        no-undef
  5:803238  error  'RT' is defined but never used                                   no-unused-vars
  5:803255  error  'Observable' is not defined                                      no-undef
  5:803788  error  'Rect' is not defined                                            no-undef
  5:804494  error  'Rect' is not defined                                            no-undef
  5:805014  error  'FT' is defined but never used                                   no-unused-vars
  5:805031  error  'View' is not defined                                            no-undef
  5:805786  error  'VT' is defined but never used                                   no-unused-vars
  5:805803  error  'Observable' is not defined                                      no-undef
  5:807061  error  'ResizeState' is not defined                                     no-undef
  5:807544  error  'Rect' is not defined                                            no-undef
  5:807621  error  'Rect' is not defined                                            no-undef
  5:808301  error  'Rect' is not defined                                            no-undef
  5:808446  error  'compareArrays' is not defined                                   no-undef
  5:809983  error  'Template' is not defined                                        no-undef
  5:810109  error  'SizeView' is not defined                                        no-undef
  5:810471  error  'KT' is assigned a value but never used                          no-unused-vars
  5:810494  error  '$T' is assigned a value but never used                          no-unused-vars
  5:810519  error  'GT' is defined but never used                                   no-unused-vars
  5:810762  error  'MouseObserver' is not defined                                   no-undef
  5:810796  error  'DomEmitter' is not defined                                      no-undef
  5:811084  error  'throttle' is not defined                                        no-undef
  5:812115  error  'Resizer' is not defined                                         no-undef
  5:812845  error  'Resizer' is not defined                                         no-undef
  5:814025  error  'tP' is assigned a value but never used                          no-unused-vars
  5:814048  error  'eP' is assigned a value but never used                          no-unused-vars
  5:829745  error  'BP' is defined but never used                                   no-unused-vars
  5:830150  error  'zP' is defined but never used                                   no-unused-vars
  5:842828  error  'dB' is defined but never used                                   no-unused-vars
  5:842908  error  'upcastStyleToAttribute' is not defined                          no-undef
  5:842965  error  'downcastAttributeToStyle' is not defined                        no-undef
  5:875598  error  'NR' is assigned a value but never used                          no-unused-vars
  5:875621  error  'FR' is assigned a value but never used                          no-unused-vars
  5:879286  error  'WR' is assigned a value but never used                          no-unused-vars
  5:879309  error  'KR' is assigned a value but never used                          no-unused-vars
  5:886709  error  'eI' is assigned a value but never used                          no-unused-vars
  5:886732  error  'nI' is assigned a value but never used                          no-unused-vars
  5:900758  error  'wI' is assigned a value but never used                          no-unused-vars
  5:900781  error  '_I' is assigned a value but never used                          no-unused-vars

✖ 298 problems (298 errors, 0 warnings)

有人知道我做错了什么以及如何解决这个问题吗?

javascript vue.js ckeditor5
1个回答
0
投票

如您所见,这是 linter 错误。我通过将 ignorePatterns 添加到 .eslintrc.js

解决了这个问题

看起来就是这样:

module.exports = {
  ...
  ignorePatterns: ["ckeditor5/*"],
}
© www.soinside.com 2019 - 2024. All rights reserved.