Code Monkey home page Code Monkey logo

context-menu's People

Contributors

zikaari avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

wooldoughnut310

context-menu's Issues

Onclick not working on react

On click not working on react

example code

const menudata = [ [ {label: 'Open link in the new tab', onClick() { console.log('Warning'); }}, {label: 'Copy Link', onClick() {}}, {label: 'Open Link in new window', onClick() {}}, ], ]; ContextMenu.showMenu(menudata);

Context menu positioning doesn't take into account the window.scrollX/Y value.

When the browser window is small enough to scroll the entire page, the context menu is placed away from the curser by a factor of the scrollX/scrollY values.

The issue seems to be in adjustContextMenuClippingAndShow.

I have monkey-patched our code to temporarily fix this:

ContextMenu.prototype.adjustContextMenuClippingAndShow = function () {
    const rootMenu = this.rootContextMenu;
    rootMenu.style.visibility = 'hidden';
    rootMenu.style.display = 'block';
    const rootMenuBox = rootMenu.getBoundingClientRect();
    let { x, y } = this.pos;
    if (y + rootMenuBox.height > window.innerHeight - window.scrollY) {
        y -= rootMenuBox.height + window.scrollY;
    }

    if (x + rootMenuBox.width > window.innerWidth - window.scrollX) {
        x -= rootMenuBox.width + window.scrollX;
    }

    rootMenu.style.top = `${y}px`;
    rootMenu.style.left = `${x}px`;
    rootMenu.style.visibility = '';
};

There might be a better fix than what I proposed above so I wasn't comefortable creating a PR.

Cannot find module '@angular/cdk/a11y'.

ERROR in node_modules/ngx-contextmenu/lib/contextMenu.item.directive.d.ts(1,31): error TS2307: Cannot find module '@angular/cdk/a11y'.
node_modules/ngx-contextmenu/lib/contextMenu.service.d.ts(1,60): error TS2307: Cannot find module '@angular/cdk/overlay'.
node_modules/ngx-contextmenu/lib/contextMenuContent.component.d.ts(2,28): error TS2307: Cannot find module '@angular/cdk/overlay'.

Am getting this error after installing ngx-contextmenu package can any one help?
Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.