Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return function(dispatch /* getState */) {
let items = [
{
text: "Remove Edit",
onClick: function() {
dispatch({
type: "REPLACEMENT_LAYER_DELETE",
meta,
payload: { ...annotation }
});
}
}
];
showContextMenu(items, undefined, event);
};
}
const showTabRightClickContextMenu = (e, id) => {
const tabIdToUse = id || activePanelId;
showContextMenu(
[
{
onClick: () => {
panelsToShow.length > 1
? collapseSplitScreen(tabIdToUse)
: expandTabToSplitScreen(tabIdToUse);
},
text:
panelsToShow.length > 1
? "Collapse Split Screen"
: "View in Split Screen"
},
{
onClick: () => {
togglePanelFullScreen(tabIdToUse);
},
selectionLayerRightClicked: ({ event }) => {
showContextMenu(
[
{
text: "Copy Selection of All Alignments as Fasta",
className: "copyAllAlignmentsFastaClipboardHelper",
hotkey: "cmd+c",
willUnmount: () => {
this.copyAllAlignmentsFastaClipboardHelper &&
this.copyAllAlignmentsFastaClipboardHelper.destroy();
},
didMount: () => {
this.copyAllAlignmentsFastaClipboardHelper = new Clipboard(
`.copyAllAlignmentsFastaClipboardHelper`,
{
action: "copyAllAlignmentsFasta",
text: () => {
return this.getAllAlignmentsFastaText();
return opts => {
const lastFocusedEl = document.activeElement;
const { rightClickOverrides = {} } = this.props;
const items = action(opts);
const e = (items && items._event) || opts.event || opts;
e.preventDefault && e.preventDefault();
e.stopPropagation && e.stopPropagation();
//override hook here
const override = rightClickOverrides[key];
showContextMenu(
override ? override(items, opts, this.props) : items,
[this.commandEnhancer],
e,
() => {
if (
lastFocusedEl &&
document.activeElement &&
(document.activeElement.classList.contains(
"bp3-popover-enter-done"
) ||
(document.activeElement.type === "textarea" && //this is the clipboard textarea created by clipboardjs
document.activeElement.offsetLeft === -9999))
) {
lastFocusedEl.focus();
}
},