Jump to content
  • Status: Moved to Github

Hello, we have a really basic extension for our own, more advanced canned responses:

var obj =  {
  restrictions: [""],
  addButtons() {
    return {
      test1: {
        /*isAvailable: editor => editor.options.restrictions.has('ipsCustomExtension__g17editorcannedresponse__'),
        isActive: editor => editor.options.restrictions.has('ipsCustomExtension__g17editorcannedresponse__'),*/
        html: '<span><i class="fa-solid fa-message"></i></span>',

        command: function (editor) {
          Debug.log(editor);
          var url = ips.getSetting('baseURL') + '?app=g17mediaaddons&module=cannedresponse&do=editor&editorId=' + editor.editor.options.name;
          var title = "Canned Response";
          this.storage.dialog = ips.ui.dialog.create({
            title: title,
            fixed: false,
            url: url,
            forceReload: true,
            remoteSubmit: false,
            remoteVerify: false
          });
          this.storage.dialog.show();
        },

        // This puts the button before bold, after the 'link' button, inside the `...` menu and at the end of the toolbar
        locations: [null],
      }
    }
  },
};

ips.ui.editorv5.registerExtension('g17editorcannedresponse', obj);

This works absolutely fine, adds the button, and opens the dialog mentioned when clicked. There's later logic for the dialog to then insert content into the editor externally, but that's beyond the scope here.

However, if a second instance of the editor is booted on the page (like hitting Edit on a multi-post topic after playing with the editor at the bottom of the page), you cannot edit the text, the editor will briefly show, then disappear with the following JS error:

main-R_MZN_ry.js?v=6701dc1d9f1739874311:40 TypeError: Cannot destructure property 'command' of 'r.options.ipsPlugins.buttons[e]' as it is undefined.

at J6 (main-R_MZN_ry.js?v=6701dc1d9f1739874311:200:87924)

at zT (main-R_MZN_ry.js?v=6701dc1d9f1739874311:38:17029)

at eD (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:44058)

at Xw (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:39790)

at nH (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:39718)

at $_ (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:39570)

at pS (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:35934)

at Kw (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:34883)

at I (main-R_MZN_ry.js?v=6701dc1d9f1739874311:25:1569)

at MessagePort.de (main-R_MZN_ry.js?v=6701dc1d9f1739874311:25:1938)

eS @ main-R_MZN_ry.js?v=6701dc1d9f1739874311:40

n.callback @ main-R_MZN_ry.js?v=6701dc1d9f1739874311:40

UN @ main-R_MZN_ry.js?v=6701dc1d9f1739874311:38

JN @ main-R_MZN_ry.js?v=6701dc1d9f1739874311:40

qw @ main-R_MZN_ry.js?v=6701dc1d9f1739874311:40

JY @ main-R_MZN_ry.js?v=6701dc1d9f1739874311:40

iH @ main-R_MZN_ry.js?v=6701dc1d9f1739874311:40

As @ main-R_MZN_ry.js?v=6701dc1d9f1739874311:40

Kw @ main-R_MZN_ry.js?v=6701dc1d9f1739874311:40

I @ main-R_MZN_ry.js?v=6701dc1d9f1739874311:25

de @ main-R_MZN_ry.js?v=6701dc1d9f1739874311:25

main-R_MZN_ry.js?v=6701dc1d9f1739874311:200 Uncaught TypeError: Cannot destructure property 'command' of 'r.options.ipsPlugins.buttons[e]' as it is undefined.

at J6 (main-R_MZN_ry.js?v=6701dc1d9f1739874311:200:87924)

at zT (main-R_MZN_ry.js?v=6701dc1d9f1739874311:38:17029)

at eD (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:44058)

at Xw (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:39790)

at nH (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:39718)

at $_ (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:39570)

at pS (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:35934)

at Kw (main-R_MZN_ry.js?v=6701dc1d9f1739874311:40:34883)

at I (main-R_MZN_ry.js?v=6701dc1d9f1739874311:25:1569)

at MessagePort.de (main-R_MZN_ry.js?v=6701dc1d9f1739874311:25:1938)

I thought of reporting this one as it should be easy to reproduce (it doesn't require any of the other parts working to reproduce). I'm not sure if it affects all third-party extensions or whether this is a fault of me using the not currently hugely documented editor extension system.

User Feedback

Recommended Comments

Matt Finger

Invision Community Team

Can confirm it's a bug affecting all third-party editor buttons, we'll be sure to have a fix by the next release