mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
SDA-1395 - Disable context menu for action buttons (#858)
This commit is contained in:
parent
6e71292332
commit
21b7e20e9e
@ -16,6 +16,7 @@ exports[`windows title bar should render correctly 1`] = `
|
|||||||
<button
|
<button
|
||||||
className="hamburger-menu-button"
|
className="hamburger-menu-button"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
|
onContextMenu={[Function]}
|
||||||
onMouseDown={[Function]}
|
onMouseDown={[Function]}
|
||||||
title="Menu"
|
title="Menu"
|
||||||
>
|
>
|
||||||
@ -93,6 +94,7 @@ exports[`windows title bar should render correctly 1`] = `
|
|||||||
<button
|
<button
|
||||||
className="title-bar-button"
|
className="title-bar-button"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
|
onContextMenu={[Function]}
|
||||||
onMouseDown={[Function]}
|
onMouseDown={[Function]}
|
||||||
title="Minimize"
|
title="Minimize"
|
||||||
>
|
>
|
||||||
@ -115,6 +117,7 @@ exports[`windows title bar should render correctly 1`] = `
|
|||||||
<button
|
<button
|
||||||
className="title-bar-button"
|
className="title-bar-button"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
|
onContextMenu={[Function]}
|
||||||
onMouseDown={[Function]}
|
onMouseDown={[Function]}
|
||||||
title="Maximize"
|
title="Maximize"
|
||||||
>
|
>
|
||||||
@ -136,6 +139,7 @@ exports[`windows title bar should render correctly 1`] = `
|
|||||||
<button
|
<button
|
||||||
className="title-bar-button"
|
className="title-bar-button"
|
||||||
onClick={[Function]}
|
onClick={[Function]}
|
||||||
|
onContextMenu={[Function]}
|
||||||
onMouseDown={[Function]}
|
onMouseDown={[Function]}
|
||||||
title="Close"
|
title="Close"
|
||||||
>
|
>
|
||||||
|
@ -20,6 +20,7 @@ export default class WindowsTitleBar extends React.Component<{}, IState> {
|
|||||||
onMinimize: () => this.minimize(),
|
onMinimize: () => this.minimize(),
|
||||||
onShowMenu: () => this.showMenu(),
|
onShowMenu: () => this.showMenu(),
|
||||||
onUnmaximize: () => this.unmaximize(),
|
onUnmaximize: () => this.unmaximize(),
|
||||||
|
onDisableContextMenu: (event) => this.disableContextMenu(event),
|
||||||
};
|
};
|
||||||
private observer: MutationObserver | undefined;
|
private observer: MutationObserver | undefined;
|
||||||
|
|
||||||
@ -83,6 +84,7 @@ export default class WindowsTitleBar extends React.Component<{}, IState> {
|
|||||||
title={i18n.t('Menu', TITLE_BAR_NAMESPACE)()}
|
title={i18n.t('Menu', TITLE_BAR_NAMESPACE)()}
|
||||||
className='hamburger-menu-button'
|
className='hamburger-menu-button'
|
||||||
onClick={this.eventHandlers.onShowMenu}
|
onClick={this.eventHandlers.onShowMenu}
|
||||||
|
onContextMenu={this.eventHandlers.onDisableContextMenu}
|
||||||
onMouseDown={this.handleMouseDown}
|
onMouseDown={this.handleMouseDown}
|
||||||
>
|
>
|
||||||
<svg x='0px' y='0px' viewBox='0 0 15 10'>
|
<svg x='0px' y='0px' viewBox='0 0 15 10'>
|
||||||
@ -101,6 +103,7 @@ export default class WindowsTitleBar extends React.Component<{}, IState> {
|
|||||||
className='title-bar-button'
|
className='title-bar-button'
|
||||||
title={i18n.t('Minimize', TITLE_BAR_NAMESPACE)()}
|
title={i18n.t('Minimize', TITLE_BAR_NAMESPACE)()}
|
||||||
onClick={this.eventHandlers.onMinimize}
|
onClick={this.eventHandlers.onMinimize}
|
||||||
|
onContextMenu={this.eventHandlers.onDisableContextMenu}
|
||||||
onMouseDown={this.handleMouseDown}
|
onMouseDown={this.handleMouseDown}
|
||||||
>
|
>
|
||||||
<svg x='0px' y='0px' viewBox='0 0 14 1'>
|
<svg x='0px' y='0px' viewBox='0 0 14 1'>
|
||||||
@ -116,6 +119,7 @@ export default class WindowsTitleBar extends React.Component<{}, IState> {
|
|||||||
className='title-bar-button'
|
className='title-bar-button'
|
||||||
title={i18n.t('Close', TITLE_BAR_NAMESPACE)()}
|
title={i18n.t('Close', TITLE_BAR_NAMESPACE)()}
|
||||||
onClick={this.eventHandlers.onClose}
|
onClick={this.eventHandlers.onClose}
|
||||||
|
onContextMenu={this.eventHandlers.onDisableContextMenu}
|
||||||
onMouseDown={this.handleMouseDown}
|
onMouseDown={this.handleMouseDown}
|
||||||
>
|
>
|
||||||
<svg x='0px' y='0px' viewBox='0 0 14 10.2'>
|
<svg x='0px' y='0px' viewBox='0 0 14 10.2'>
|
||||||
@ -143,6 +147,7 @@ export default class WindowsTitleBar extends React.Component<{}, IState> {
|
|||||||
className='title-bar-button'
|
className='title-bar-button'
|
||||||
title={i18n.t('Restore', TITLE_BAR_NAMESPACE)()}
|
title={i18n.t('Restore', TITLE_BAR_NAMESPACE)()}
|
||||||
onClick={this.eventHandlers.onUnmaximize}
|
onClick={this.eventHandlers.onUnmaximize}
|
||||||
|
onContextMenu={this.eventHandlers.onDisableContextMenu}
|
||||||
onMouseDown={this.handleMouseDown}
|
onMouseDown={this.handleMouseDown}
|
||||||
>
|
>
|
||||||
<svg x='0px' y='0px' viewBox='0 0 14 10.2'>
|
<svg x='0px' y='0px' viewBox='0 0 14 10.2'>
|
||||||
@ -159,6 +164,7 @@ export default class WindowsTitleBar extends React.Component<{}, IState> {
|
|||||||
className='title-bar-button'
|
className='title-bar-button'
|
||||||
title={i18n.t('Maximize', TITLE_BAR_NAMESPACE)()}
|
title={i18n.t('Maximize', TITLE_BAR_NAMESPACE)()}
|
||||||
onClick={this.eventHandlers.onMaximize}
|
onClick={this.eventHandlers.onMaximize}
|
||||||
|
onContextMenu={this.eventHandlers.onDisableContextMenu}
|
||||||
onMouseDown={this.handleMouseDown}
|
onMouseDown={this.handleMouseDown}
|
||||||
>
|
>
|
||||||
<svg x='0px' y='0px' viewBox='0 0 14 10.2'>
|
<svg x='0px' y='0px' viewBox='0 0 14 10.2'>
|
||||||
@ -306,6 +312,16 @@ export default class WindowsTitleBar extends React.Component<{}, IState> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables context menu for action buttons
|
||||||
|
*
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
private disableContextMenu(event): boolean {
|
||||||
|
event.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the state with the give value
|
* Updates the state with the give value
|
||||||
* @param state
|
* @param state
|
||||||
|
Loading…
Reference in New Issue
Block a user