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.

Error: [SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"table")

See original GitHub issue

Describe the bug When i clicked table button on toolbar i got this error: Error: [SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:“table”)

To Reproduce Steps to reproduce the behavior:

  1. Load editor
  2. Click on Table button
  3. See error

My codes Show a view to set numbers of column and rows

Screenshots ảnh

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Firefox: 99.0b8
  • “suneditor”: “^2.42.0”,
  • “suneditor-react”: “^3.4.0”,
  • “next”: “10.2.0”,

Additional context

import React from 'react';
import dynamic from 'next/dynamic';

const plugins = dynamic(() => import('suneditor/src/plugins'), {
  ssr: false,
});
const SunEditor = dynamic(() => import('suneditor-react'), {
  ssr: false,
});

export const options = {
  plugins: [plugins],
  height: 300,
  buttonList: [
    // Default
    ['undo', 'redo'],
    ['font', 'fontSize', 'formatBlock'],
    ['paragraphStyle', 'blockquote'],
    ['bold', 'underline', 'italic', 'strike', 'subscript', 'superscript'],
    ['fontColor', 'hiliteColor', 'textStyle'],
    ['removeFormat'],
    ['outdent', 'indent'],
    ['align', 'horizontalRule', 'list', 'lineHeight'],
    ['table', 'link', 'image', 'video', 'audio'],
    ['imageGallery'],
    ['fullScreen', 'showBlocks', 'codeView'],
    ['preview', 'print'],
    ['template'],
  ],
};

const RichTextEditor = function () {
  return (
    <SunEditor setOptions={options} setAllPlugins={false} />
  );
};
export default RichTextEditor;

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
nguyenduythuccommented, Apr 14, 2022

I used dynamic import inside useEffect and it worked

import React, { useEffect } from 'react';
import dynamic from 'next/dynamic';
import { toolbar } from './Config';

const SunEditor = dynamic(() => import('suneditor-react'), {
  ssr: false,
});

const RichTextEditor = function () {
  const [options, setOptions] = React.useState(null);
  useEffect(() => {
    import('suneditor/src/plugins').then((plugins) => setOptions(() => ({ ...toolbar, plugins })));
  }, []);
  return (
      <SunEditor setOptions={options} setAllPlugins={false} />
  );
};
export default RichTextEditor;

Thank @JiHong88 for your support 😃

0reactions
nguyenduythuccommented, Apr 13, 2022

Thank for the answer. I think i found out what’s happening. When my application is loaded i clicked table icon and error fired like above. Then i

  1. Change const options = dynamic(() => import('suneditor/src/plugins'), { ssr: false, }); to const options = require('suneditor/src/plugins')
  2. Then i saved changes
  3. The application’s hot reloaded
  4. I clicked table button again and it worked I think plugins doesn’t load correctly when using dynamic import. If i use const options = require('suneditor/src/plugins') for the first time the application loading, i’ll get error like below
ảnh

Hoping it can make you understand what’s happening

Read more comments on GitHub >

github_iconTop Results From Across the Web

setting plugins · Issue #162 · JiHong88/SunEditor - GitHub
Uncaught Error : [SUNEDITOR.core.callPlugin.fail] The called plugin does not exist or is in an invalid format. (pluginName:"align")
Read more >
Suneditor - npm.io
The Suneditor is a lightweight, flexible, customizable WYSIWYG text editor for your web applications. Pasting from Microsoft Word and Excel.
Read more >
JSDoc - SunEditor
It can be accessed from object's "core" property returned after editor creation. ... If the plugin is not added, add the plugin and...
Read more >
suneditor-react - npm
There are 18 other projects in the npm registry using suneditor-react. ... Note: suneditor-react doesn't expose the core object in the ...
Read more >
suneditor/README.md - UNPKG
18, > - Can use CodeMirror, KaTeX. 19, > - And.. many other features :) 20. 21 ![WYSIWYG HTML Editor](http://suneditor.com/docs/screen-main-w.png?v=2700).
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