Skip to content

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

[#45782] added comments to global emitting drag events

Eric Schubert0a9651dd1b17
diff --git a/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.ts b/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.ts
index 82df969f600..126a90d241d 100644
--- a/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.ts
+++ b/frontend/src/app/shared/components/editor/components/ckeditor/op-ckeditor.component.ts
@@ -217,10 +217,17 @@ export class OpCkeditorComponent implements OnInit, OnDestroy {
watchdog.editor.on('op:source-code-enabled', () => this.enableManualMode());
watchdog.editor.on('op:source-code-disabled', () => this.disableManualMode());
+ // Emit global dragend events for other drop zones to react.
+ // This is needed, as CKEditor does not bubble any drag events
const model = watchdog.editor.model as unknown&{ on:(ev:string, callback:() => unknown) => void };
model.on('op:attachment-added', () => document.body.dispatchEvent(new DragEvent('dragend')));
model.on('op:attachment-removed', () => document.body.dispatchEvent(new DragEvent('dragend')));
+ // Emitting a global dragleave on every dragleave of the ckeditor element
+ // IMPORTANT: This emits much more dragleave events then dragenter events.
+ // In the end, this leads to a break in every drop zone that listens to those two global events
+ // to determine its state. Without it, if no dragleave is fired, the drop zones enter a failed state,
+ // not vanishing after ending the drag.
this.$element.on('dragleave', () => document.body.dispatchEvent(new DragEvent('dragleave')));
this.onInitialized.emit(watchdog.editor);
diff --git a/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.html b/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.html
index 88436ad2a71..60cdcb8a94a 100644
--- a/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.html
+++ b/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.html
@@ -4,7 +4,7 @@
active && '-active' || '',
wrapperClasses || '-small'
]"
- (dragover)="startDragOverActivation($event)">
+ (dragover)="startDragActivation($event)">
<div #editContainer
[hidden]="!active">
diff --git a/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.ts b/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.ts
index 860ba00a513..0c8e48f8d38 100644
--- a/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field/editable-attribute-field.component.ts
@@ -127,14 +127,13 @@ export class EditableAttributeFieldComponent extends UntilDestroyedMixin impleme
}
// Open the field when its closed and relay drag & drop events to it.
- public startDragOverActivation(event:JQuery.TriggeredEvent):boolean {
+ public startDragActivation(event:DragEvent):void {
if (!this.isDropTarget || !this.isEditable || this.active) {
- return true;
+ return;
}
this.handleUserActivate(null);
event.preventDefault();
- return false;
}
public render():void {