|
1 |
| -From 2fb0e5b5b10878b804d9845bb7baa186b140396f Mon Sep 17 00:00:00 2001 |
| 1 | +From 1319af7e465beab4a929b18deb55e98e3b886a0d Mon Sep 17 00:00:00 2001 |
2 | 2 | From: Achim Fritz < [email protected]>
|
3 |
| -Date: Mon, 14 Oct 2024 14:35:21 +0200 |
4 |
| -Subject: [PATCH] [PATCH] js-13-main |
| 3 | +Date: Mon, 10 Mar 2025 16:12:13 +0100 |
| 4 | +Subject: [PATCH] [PATH] js-13-main |
5 | 5 |
|
6 |
| -Change-Id: I1b3ee3edd8fe045185268f6b17f98b150f342001 |
| 6 | +Change-Id: I32adb943a879c3ee5b1dbdc8677daefee99919db |
7 | 7 | ---
|
8 |
| - .../backend/layout-module/drag-drop.ts | 32 +++++++++++++------ |
9 |
| - .../TypeScript/backend/layout-module/paste.ts | 23 ++++++++----- |
10 |
| - 2 files changed, 37 insertions(+), 18 deletions(-) |
| 8 | + .../backend/layout-module/drag-drop.ts | 34 +++++++++++++------ |
| 9 | + 1 file changed, 23 insertions(+), 11 deletions(-) |
11 | 10 |
|
12 | 11 | diff --git a/Build/Sources/TypeScript/backend/layout-module/drag-drop.ts b/Build/Sources/TypeScript/backend/layout-module/drag-drop.ts
|
13 |
| -index f14320f9dea..56ab0a01fc4 100644 |
| 12 | +index cb0de0d57d2..e821f8a3e89 100644 |
14 | 13 | --- a/Build/Sources/TypeScript/backend/layout-module/drag-drop.ts
|
15 | 14 | +++ b/Build/Sources/TypeScript/backend/layout-module/drag-drop.ts
|
16 |
| -@@ -15,20 +15,20 @@ |
| 15 | +@@ -15,21 +15,21 @@ |
17 | 16 | * Module: @typo3/backend/layout-module/drag-drop
|
18 | 17 | * this JS code does the drag+drop logic for the Layout module (Web => Page)
|
19 | 18 | */
|
20 | 19 | -import DocumentService from '@typo3/core/document-service';
|
21 | 20 | -import DataHandler from '../ajax-data-handler';
|
22 | 21 | -import Icons from '../icons';
|
23 |
| --import ResponseInterface from '../ajax-data-handler/response-interface'; |
24 | 22 | -import RegularEvent from '@typo3/core/event/regular-event';
|
25 | 23 | -import { DataTransferTypes } from '@typo3/backend/enum/data-transfer-types';
|
26 |
| --import type { DragDropThumbnail, DragTooltipMetadata } from '@typo3/backend/drag-tooltip'; |
27 | 24 | -import BroadcastService from '@typo3/backend/broadcast-service';
|
28 | 25 | -import { BroadcastMessage } from '@typo3/backend/broadcast-message';
|
| 26 | +-import type ResponseInterface from '../ajax-data-handler/response-interface'; |
| 27 | +-import type { DragDropThumbnail, DragTooltipMetadata } from '@typo3/backend/drag-tooltip'; |
| 28 | +-import DragDropUtility from '@typo3/backend/utility/drag-drop-utility'; |
29 | 29 | +import DocumentService from '@typo3/core/document-service.js';
|
30 | 30 | +import DataHandler from '@typo3/backend/ajax-data-handler.js';
|
31 | 31 | +import Icons from '@typo3/backend/icons.js';
|
32 |
| -+import ResponseInterface from '@typo3/backend/ajax-data-handler/response-interface.js'; |
33 | 32 | +import RegularEvent from '@typo3/core/event/regular-event.js';
|
34 | 33 | +import { DataTransferTypes } from '@typo3/backend/enum/data-transfer-types.js';
|
35 |
| -+import type { DragDropThumbnail, DragTooltipMetadata } from '@typo3/backend/drag-tooltip.js'; |
36 | 34 | +import BroadcastService from '@typo3/backend/broadcast-service.js';
|
37 | 35 | +import { BroadcastMessage } from '@typo3/backend/broadcast-message.js';
|
38 |
| - |
| 36 | ++import type ResponseInterface from '@typo3/backend/ajax-data-handler/response-interface.js'; |
| 37 | ++import type { DragDropThumbnail, DragTooltipMetadata } from '@typo3/backend/drag-tooltip.js'; |
| 38 | ++import DragDropUtility from '@typo3/backend/utility/drag-drop-utility.js'; |
| 39 | + |
39 | 40 | interface Parameters {
|
40 | 41 | cmd?: { [key: string]: { [key: string]: any } };
|
41 | 42 | data?: { [key: string]: { [key: string]: any } };
|
42 | 43 | - CB?: { paste: string, update: { colPos: number | boolean, sys_language_uid: number } };
|
43 | 44 | + CB?: { paste: string, update: { colPos: number | boolean, sys_language_uid: number , txContainerParent: number } };
|
44 | 45 | }
|
45 |
| - |
| 46 | + |
46 | 47 | export type ContentElementDragDropData = {
|
47 |
| -@@ -175,6 +175,7 @@ class DragDrop { |
| 48 | +@@ -153,6 +153,7 @@ class DragDrop { |
48 | 49 | }
|
49 |
| - |
| 50 | + |
50 | 51 | const newColumn = this.getColumnPositionForElement(dropContainer);
|
51 | 52 | + const newTxContainerParent = this.getTxContainerParentPositionForElement(dropContainer);
|
52 | 53 | const contentElementDragDropData = JSON.parse(event.dataTransfer.getData(DataTransferTypes.content)) as ContentElementDragDropData;
|
53 |
| - |
| 54 | + |
54 | 55 | draggedElement = document.querySelector(`${Identifiers.content}[data-uid="${contentElementDragDropData.uid}"]`);
|
55 |
| -@@ -204,8 +205,10 @@ class DragDrop { |
| 56 | +@@ -182,8 +183,10 @@ class DragDrop { |
56 | 57 | }
|
57 |
| - |
| 58 | + |
58 | 59 | let colPos: number | boolean = 0;
|
59 | 60 | + let txContainerParent: number = 0;
|
60 | 61 | if (targetPid !== 0) {
|
61 | 62 | colPos = newColumn;
|
62 | 63 | + txContainerParent = newTxContainerParent;
|
63 | 64 | }
|
64 |
| - const isCopyAction = (event.ctrlKey || dropContainer.classList.contains('t3js-paste-copy')); |
| 65 | + const isCopyAction = (DragDropUtility.isCopyModifierFromEvent(event) || dropContainer.classList.contains('t3js-paste-copy')); |
65 | 66 | const datahandlerCommand = isCopyAction ? 'copy' : 'move';
|
66 |
| -@@ -218,6 +221,7 @@ class DragDrop { |
| 67 | +@@ -196,6 +199,7 @@ class DragDrop { |
67 | 68 | update: {
|
68 | 69 | colPos: colPos,
|
69 | 70 | sys_language_uid: language,
|
70 | 71 | + tx_container_parent: txContainerParent,
|
71 | 72 | },
|
72 | 73 | }
|
73 | 74 | }
|
74 |
| -@@ -307,6 +311,14 @@ class DragDrop { |
| 75 | +@@ -285,6 +289,14 @@ class DragDrop { |
75 | 76 | return false;
|
76 | 77 | }
|
77 |
| - |
78 |
| -+ protected getTxContainerParentPositionForElement (element: HTMLElement): number { |
| 78 | + |
| 79 | ++ protected getTxContainerParentPositionForElement(element: HTMLElement): number { |
79 | 80 | + const columnContainer = element.closest('[data-colpos]') as HTMLElement;
|
80 | 81 | + if (columnContainer !== null && columnContainer.dataset.txContainerParent !== undefined) {
|
81 | 82 | + return parseInt(columnContainer.dataset.txContainerParent, 10);
|
|
0 commit comments