0

I’m developing a plugin for Mattermsot which shows an iframe and the contents I need inside the iframe, Currently, I have managed to register this as a product and now it shows in the product switcher, enter image description here

When I click the Iframe button it opens the Iframe in the same window as the channels, What I need is open it from a new tab similar to boards and playbooks in the Mattermost desktop app, in the web browser it can be as it is now.

Thank you for your support.

Here is my plugin code

import React from 'react';


let iframeURL = "https://codepen.io/rdesigncode/details/zYPzaqb"
const customRoute = '/myplugin';


class myplugin{
  

    initialize(registry, store) {

      

      const IframeComponent = () => {
        return (
          <iframe src={iframeURL} height="100%" width="100%" title="myplugin"></iframe> 
        );
      };


    registry.registerProduct(
      customRoute,
      'kanban',
      "IFrame",
      customRoute,
      IframeComponent,
      'headerCentreComponent',
      'headerRightComponent',
      true,
      true,
      true
    );

        }
      }
window.registerPlugin('myplugin', new myplugin());
Drew Reese
  • 165,259
  • 14
  • 153
  • 181
Udara Sampath
  • 55
  • 3
  • 16

1 Answers1

1

When you click the Iframe button, it opens the Iframe in the same window as the channels. You would like to open it from a new tab similar to boards and playbooks in the Mattermost desktop app. Currently this isn't not supported by Mattermost desktop app. one alternative could be to open the contents of your plugin in a new window instead of a new tab, using JavaScript ( open a new window with the desired URL when the user clicks on the Iframe button ) . See below

const openInNewWindow = () => {
    window.open(iframeURL, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');
}

call this function when the user clicks on the Iframe button to open the contents of your plugin in a new window.

user1874594
  • 2,277
  • 1
  • 25
  • 49
  • 1
    Thank you, I have already gone through this kind of a solution and it's not good with my application. After a lot of hours, I understand it's not possible with plugins, I'm looking to create my own MM desktop version now. Thanks again – Udara Sampath Jun 07 '23 at 23:06
  • well u bountied the Q. wait for a better A & see who'd get ....g luck with – user1874594 Jun 07 '23 at 23:35
  • I don't think anyone else will even try , Thank you again btw – Udara Sampath Jun 08 '23 at 23:19
  • well now that ue bounty meter is on.. it should attract passerbys who think they can dabble around a bit. If nothing u won't get your bounty back ❗ so might as well give it way ❗ – user1874594 Jun 09 '23 at 01:54