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

Use dom-autoscroller for meeting agenda items

Mir Bhatia33c3b5d86425
diff --git a/frontend/src/stimulus/controllers/dynamic/meeting-agenda-item-drag-and-drop.controller.ts b/frontend/src/stimulus/controllers/dynamic/meeting-agenda-item-drag-and-drop.controller.ts
index e3e1c0f1d32..458894bf438 100644
--- a/frontend/src/stimulus/controllers/dynamic/meeting-agenda-item-drag-and-drop.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/meeting-agenda-item-drag-and-drop.controller.ts
@@ -36,6 +36,24 @@ import { debugLog } from 'core-app/shared/helpers/debug_output';
export default class extends Controller {
drake:Drake|undefined;
+ autoScroll() {
+ // options copied from generic-drag-and-drop.controller for consistency
+ void window.OpenProject.getPluginContext().then((pluginContext) => {
+ // eslint-disable-next-line no-new
+ new pluginContext.classes.DomAutoscrollService(
+ [
+ document.getElementById('content-wrapper') as HTMLElement,
+ ],
+ {
+ margin: 25,
+ maxSpeed: 10,
+ scrollWhenOutside: true,
+ autoScroll: () => this.drake?.dragging,
+ },
+ );
+ });
+ }
+
connect() {
this.drake = dragula(
[this.containerTarget],
@@ -43,6 +61,8 @@ export default class extends Controller {
)
// eslint-disable-next-line @typescript-eslint/no-misused-promises
.on('drop', this.drop.bind(this));
+
+ this.autoScroll();
}
get containerTarget():HTMLElement {