Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Add toolbar buttons for iframe API #7525

Merged
merged 1 commit into from
Jul 21, 2017
Merged

[NEW] Add toolbar buttons for iframe API #7525

merged 1 commit into from
Jul 21, 2017

Conversation

sampaiodiego
Copy link
Member

@RocketChat/core

Closes #7433

This PR adds two new external commands: set-toolbar-button and remove-toolbar-button.

To add/set a button at the top toolbar:

document.querySelector('iframe').contentWindow.postMessage({
  externalCommand: 'set-toolbar-button',
  id: 'resize',
  icon: 'icon-resize-small'
}, '*')

image

A button can be updated using the same id:

document.querySelector('iframe').contentWindow.postMessage({
  externalCommand: 'set-toolbar-button',
  id: 'resize',
  icon: 'icon-resize-full'
}, '*')

To remove a toolbar button:

document.querySelector('iframe').contentWindow.postMessage({
  externalCommand: 'remove-toolbar-button',
  id: 'resize'
}, '*')

When a button is clicked, the parent window will receive a postMessage called click-toolbar-button and an object with button's id

@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-7525 July 18, 2017 20:45 Inactive
@gdelavald
Copy link
Contributor

Having multiple buttons can end up hiding the channel name in some cases (for smaller screens), but I think that's the viable solution anyway.
image

@rodrigok rodrigok added this to the 0.58.0 milestone Jul 21, 2017
@rodrigok rodrigok merged commit 9e98a85 into develop Jul 21, 2017
@rodrigok rodrigok deleted the toolbar-buttons branch July 21, 2017 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add minimize function to header when using iFrame integration
4 participants