zikaari / context-menu Goto Github PK
View Code? Open in Web Editor NEWCustom context menu for React web apps
License: MIT License
Custom context menu for React web apps
License: MIT License
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);
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.
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
Hi,
Is there a way to create a label only with an image ( clickable or not ) ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.