MCPcopy Create free account
hub / github.com/TechJeeper/Printventory / addContextMenuHandler

Function addContextMenuHandler

renderer.js:16130–16171  ·  view source on GitHub ↗
(fileElement, filePath)

Source from the content-addressed store, hash-verified

16128 closeButton.addEventListener('click', (e) => {
16129 e.stopPropagation();
16130 menu.remove();
16131 });
16132 menu.appendChild(closeButton);
16133 }
16134
16135 // Create menu items
16136 menuData.items.forEach((item, index) => {
16137 if (item.type === 'separator') {
16138 const separator = document.createElement('div');
16139 separator.style.cssText = 'height: 1px; background-color: #555; margin: 4px 0;';
16140 menu.appendChild(separator);
16141 return;
16142 }
16143
16144 const menuItem = document.createElement('div');
16145 menuItem.style.cssText = `
16146 padding: 6px 20px;
16147 color: ${item.enabled ? '#fff' : '#666'};
16148 cursor: ${item.enabled ? 'pointer' : 'default'};
16149 user-select: none;
16150 position: relative;
16151 `;
16152 menuItem.textContent = item.label;
16153
16154 if (item.enabled) {
16155 menuItem.addEventListener('mouseenter', () => {
16156 menuItem.style.backgroundColor = '#3d3d3d';
16157 });
16158 menuItem.addEventListener('mouseleave', () => {
16159 menuItem.style.backgroundColor = 'transparent';
16160 });
16161
16162 // Handle submenus
16163 if (item.submenu) {
16164 menuItem.style.paddingRight = '30px';
16165 const arrow = document.createElement('span');
16166 arrow.textContent = '▶';
16167 arrow.style.cssText = 'position: absolute; right: 8px; font-size: 10px;';
16168 menuItem.appendChild(arrow);
16169
16170 let submenuElement = null;
16171 let submenuTimeout = null;
16172 let isSubmenuHovered = false;
16173
16174 menuItem.addEventListener('mouseenter', () => {

Callers 3

renderFileFunction · 0.85
createModelItemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected