How to use the teselagen-react-components.showContextMenu function in teselagen-react-components

To help you get started, we’ve selected a few teselagen-react-components examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TeselaGen / openVectorEditor / src / redux / selectedAnnotations.js View on Github external
return function(dispatch /* getState */) {
    let items = [
      {
        text: "Remove Edit",
        onClick: function() {
          dispatch({
            type: "REPLACEMENT_LAYER_DELETE",
            meta,
            payload: { ...annotation }
          });
        }
      }
    ];

    showContextMenu(items, undefined, event);
  };
}
github TeselaGen / openVectorEditor / src / Editor / index.js View on Github external
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);
              },
github TeselaGen / openVectorEditor / src / AlignmentView / index.js View on Github external
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();
github TeselaGen / openVectorEditor / src / withEditorInteractions / index.js View on Github external
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();
            }
          },