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.

Unable to use after upgrade

See original GitHub issue

Describe the bug

After upgrading from an old version, I can’t use it normally. An error is reported

Uncaught TypeError: pluginInfo is undefined node_modules toast-ui/editor/dist/toastui-editor.js:3841 node_modules toast-ui/editor/dist/toastui-editor.js:3837 node_modules toast-ui/editor/dist/toastui-editor.js:27771 <anonymous> http://localhost/wp-content/plugins/WP-ReliableMD/js/WPReliableMD_Admin.js?ver=1.0:417 jQuery 2 toastui-editor.js:3841:22 getPluginInfo http://localhost/wp-content/plugins/WP-ReliableMD/node_modules/@toast-ui/editor/dist/toastui-editor.js:3841 reduce self-hosted:276 getPluginInfo http://localhost/wp-content/plugins/WP-ReliableMD/node_modules/@toast-ui/editor/dist/toastui-editor.js:3837 ToastUIEditor http://localhost/wp-content/plugins/WP-ReliableMD/node_modules/@toast-ui/editor/dist/toastui-editor.js:27771 <anonymous> http://localhost/wp-content/plugins/WP-ReliableMD/js/WPReliableMD_Admin.js?ver=1.0:417 jQuery 2

To Reproduce

Use the following code:

// Start the main app logic.
//requirejs(['jquery', 'tui-editor', 'editor-mathsupport', 'htmlToText', 'MarkdowConvertor'], function ($, Editor, mathsupport, htmlToText, MarkdowConvertor) {
//requirejs(['jquery', 'tui-editor', 'tui-chart', 'tui-code-syntax-highlight', 'tui-color-syntax', 'tui-table-merged-cell', 'tui-uml', 'htmlToText', 'MarkdowConvertor', 'editor-mathsupport', 'tui-mathsupport'], function ($, Editor, chart, codeSyntaxHighlight, colorSyntax, TableMergedCell, Uml, htmlToText, MarkdowConvertor, mathsupport, viewerMathsupport) {
requirejs(
  [
    'jquery',
    'tui-editor',
    'tui-chart',
    'tui-code-syntax-highlight',
    'tui-color-syntax',
    'tui-table-merged-cell',
    'tui-uml',
    'htmlToText',
    'editor-mathsupport',
    'tui-mathsupport',
  ],
  function (
    $,
    Editor,
    chart,
    codeSyntaxHighlight,
    colorSyntax,
    TableMergedCell,
    Uml,
    htmlToText,
    mathsupport,
    viewerMathsupport
  ) {
    var $_GET = (function () {
      var url = window.document.location.href.toString();
      var u = url.split('?');
      if (typeof u[1] === 'string') {
        u = u[1].split('&');
        var get = {};
        for (var i in u) {
          var j = u[i].split('=');
          get[j[0]] = j[1];
        }
        return get;
      } else {
        return {};
      }
    })();

    var initsatus = {
      result: true,
    };

    $(document).ready(function () {
      var editor;
      var content = '';
      var post_id = ReliableMD.post_id;
      if (typeof $_GET['post'] !== 'undefined') {
        content = '';
        $.get(ReliableMD.api_root + 'wp/v2/posts/' + post_id, function (apost) {
          console.log(apost);
          var raw_md = apost.markdown
            ? apost.content.markdown
            : htmlToText(apost.content.rendered);
          content = ['# ' + apost.title.rendered, raw_md].join('\n');
          editor.setMarkdown(content);
        });
      } else {
        content = '# Your title here';
      }

      var post = function (draft_button = true) {
        var raw = editor.getMarkdown();
        var title = 'no title';
        if (raw.indexOf('#') === 0) {
          raw.replace(/^# *(.+)/, function (s, value) {
            title = value;
          });
          raw = raw.split('\n').slice(1).join('\n');
        }

        var post_status;

        var data = {
          title: title,
          content: raw,
          markdown: true,
        };

        if (data !== false) {
          $.ajax({
            url: ReliableMD.api_root + 'wp/v2/posts/' + post_id,
            //url: ReliableMD.root + 'WPReliableMD/posts/' + post_id,
            method: 'POST',
            beforeSend: function (xhr) {
              xhr.setRequestHeader('X-WP-Nonce', ReliableMD.nonce);
            },
            data: data,
          }).done(function (response) {
            console.log(response);
            post_id = response.id;
            alert('Posted passage:' + data.status);
          });
          return true;
        } else {
          console.warn(
            'Illegal call, callback function chain call failed, may be parameter error!'
          );
          return false;
        }
      };
      window.tagBox.init();

      const chartOptions = {
        minWidth: 100,
        maxWidth: 600,
        minHeight: 100,
        maxHeight: 300,
      };

      editor = new Editor({
        el: document.querySelector('#editSection'),
        previewStyle: 'vertical',
        height: '600px',
        initialEditType: 'markdown',
        useCommandShortcut: true,
        initialValue: content,
        plugins: [
          [chart, chartOptions],
          codeSyntaxHighlight,
          TableMergedCell,
          Uml,
          mathsupport,
        ],
        //customConvertor: MarkdowConvertor
      });

      console.log(editor.preview.eventManager);

      //editor.preview.eventManager.listen('convertorAfterMarkdownToHtmlConverted', viewerMathsupport.viewerRender)

      editor.preview.eventManager.listen(
        'previewRenderAfter',
        viewerMathsupport.previewRender
      );
    });
  }
);

Screenshots

图片

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jack9603301commented, Jul 30, 2020

@seonim-ryu The problem has been solved. There is a problem with one of my plug-ins, which returned undefined. But I think there is still room for improvement in error handling in Tui. Can I stop loading plug-ins and report an error or warning when there is an error when loading some plug-ins

0reactions
seonim-ryucommented, Jul 30, 2020

@jack9603301 Then, solving the loading problem will also solve the issue? I’m not sure I understood what you said. 🤔

Read more comments on GitHub >

github_iconTop Results From Across the Web

Get help with Windows upgrade and installation errors
See some of the most common upgrade and installation errors for Windows 10 and Windows 11, and what you can do to try...
Read more >
7 Solutions to Fix Windows 10 Won't Update. #6 Is Fantastic
We just list some factors may lead to Windows 10 update failed. ... you can try to use the following 7 methods to...
Read more >
What to Do When Windows Update Keeps Failing on ...
In this guide, we'll show you the top 6 tricks you can try if your Windows update keeps failing on Windows 10. Click...
Read more >
If your iPhone or iPad won't update - Apple Support
If you can't reach the update server or can't verify the update · Update your device using a Mac with macOS Catalina or...
Read more >
Windows 10 Update Failed? Here's How to Fix That - Lifewire
Use the Windows 10 troubleshooting tool. Windows 10 includes a troubleshooter app that can help fix a lot of update problems. Try running...
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