OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix re-init of context menu service
Oliver Güntherf5e020056458
diff --git a/frontend/src/app/app.module.ts b/frontend/src/app/app.module.tsindex 3869dba7150..0128ef54ff3 100644--- a/frontend/src/app/app.module.ts+++ b/frontend/src/app/app.module.ts@@ -235,22 +235,26 @@ import {} from 'core-app/shared/components/attribute-help-texts/static-attribute-help-text.component';import { appBaseSelector, ApplicationBaseComponent } from 'core-app/core/routing/base/application-base.component';import { SpotSwitchComponent } from 'core-app/spot/components/switch/switch.component';+import { OPContextMenuService } from 'core-app/shared/components/op-context-menu/op-context-menu.service';export function initializeServices(injector:Injector) {return () => {const PreviewTrigger = injector.get(HoverCardTriggerService);const topMenuService = injector.get(TopMenuService);const keyboardShortcuts = injector.get(KeyboardShortcutService);+ const contextMenu = injector.get(OPContextMenuService);// Conditionally add the Revit Add-In settings buttoninjector.get(RevitAddInSettingsButtonService);topMenuService.register();PreviewTrigger.setupListener();+ contextMenu.register();// Re-register on turbo:loaddocument.addEventListener('turbo:load', () => {topMenuService.register();PreviewTrigger.setupListener();+ contextMenu.register();});keyboardShortcuts.register();diff --git a/frontend/src/app/shared/components/op-context-menu/op-context-menu.service.ts b/frontend/src/app/shared/components/op-context-menu/op-context-menu.service.tsindex 068dbe75f97..3caf6146f4f 100644--- a/frontend/src/app/shared/components/op-context-menu/op-context-menu.service.ts+++ b/frontend/src/app/shared/components/op-context-menu/op-context-menu.service.ts@@ -1,15 +1,5 @@-import {- ApplicationRef,- ComponentFactoryResolver,- Injectable,- Injector,-} from '@angular/core';-import {- ComponentPortal,- ComponentType,- DomPortalOutlet,- PortalInjector,-} from '@angular/cdk/portal';+import { ApplicationRef, ComponentFactoryResolver, Injectable, Injector } from '@angular/core';+import { ComponentPortal, ComponentType, DomPortalOutlet, PortalInjector } from '@angular/cdk/portal';import { TransitionService } from '@uirouter/core';import { OpContextMenuHandler } from 'core-app/shared/components/op-context-menu/op-context-menu-handler';import {@@ -40,6 +30,12 @@ export class OPContextMenuService {private $transitions:TransitionService,private injector:Injector,) {+ }++ public register() {+ const existing = document.querySelector('.op-context-menu--overlay');+ existing?.remove();+const hostElement = this.portalHostElement = document.createElement('div');hostElement.classList.add('op-context-menu--overlay');document.body.appendChild(hostElement);@@ -52,7 +48,7 @@ export class OPContextMenuService {);// Close context menus on state change- $transitions.onStart({}, () => this.close());+ this.$transitions.onStart({}, () => this.close());// Listen to keyups on window to close context menusjQuery(window).on('keydown', (evt:JQuery.TriggeredEvent) => {