typo3-typescript-sources 13.4.37 → 13.4.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.last-synced-tag
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
v13.4.
|
|
1
|
+
v13.4.39
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ npm install github:maikschneider/typo3-typescript-sources#main
|
|
|
23
23
|
|
|
24
24
|
- **Original Repository:** [TYPO3/typo3](https://github.com/TYPO3/typo3)
|
|
25
25
|
- **Source Path:** `Build/Sources/TypeScript/`
|
|
26
|
-
- **Current TYPO3 Version:** `v13.4.
|
|
26
|
+
- **Current TYPO3 Version:** `v13.4.39`
|
|
27
27
|
|
|
28
28
|
## 🌿 Branches
|
|
29
29
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import DragDropUtility from '@typo3/backend/utility/drag-drop-utility.js';
|
|
2
|
+
import { expect } from '@open-wc/testing';
|
|
3
|
+
import { stub, type SinonStub } from 'sinon';
|
|
4
|
+
import type { } from 'mocha';
|
|
5
|
+
|
|
6
|
+
type DragEventState = {
|
|
7
|
+
dropEffect: DataTransfer['dropEffect'],
|
|
8
|
+
effectAllowed?: DataTransfer['effectAllowed'],
|
|
9
|
+
ctrlKey?: boolean,
|
|
10
|
+
altKey?: boolean,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
function createDragEvent(state: DragEventState): DragEvent {
|
|
14
|
+
return {
|
|
15
|
+
ctrlKey: state.ctrlKey ?? false,
|
|
16
|
+
altKey: state.altKey ?? false,
|
|
17
|
+
dataTransfer: {
|
|
18
|
+
dropEffect: state.dropEffect,
|
|
19
|
+
effectAllowed: state.effectAllowed ?? 'copyMove',
|
|
20
|
+
},
|
|
21
|
+
} as unknown as DragEvent;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
describe('@typo3/backend/utility/drag-drop-utility', () => {
|
|
25
|
+
let userAgentStub: SinonStub;
|
|
26
|
+
|
|
27
|
+
afterEach(() => {
|
|
28
|
+
userAgentStub?.restore();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
function emulatePlatform(userAgent: string): void {
|
|
32
|
+
userAgentStub = stub(navigator, 'userAgent').get(() => userAgent);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
describe('on Windows', () => {
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
emulatePlatform('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/156.0.0.0 Safari/537.36');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('detects a copy intention when Ctrl is held although the browser preset dropEffect to "move"', () => {
|
|
41
|
+
const event = createDragEvent({ dropEffect: 'move', ctrlKey: true });
|
|
42
|
+
expect(DragDropUtility.isCopyModifierFromEvent(event)).to.equal(true);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('detects a move intention without modifier', () => {
|
|
46
|
+
const event = createDragEvent({ dropEffect: 'move' });
|
|
47
|
+
expect(DragDropUtility.isCopyModifierFromEvent(event)).to.equal(false);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('keeps the copy intention propagated by dropEffect', () => {
|
|
51
|
+
const event = createDragEvent({ dropEffect: 'copy' });
|
|
52
|
+
expect(DragDropUtility.isCopyModifierFromEvent(event)).to.equal(true);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('reflects the copy intention in dropEffect', () => {
|
|
56
|
+
const event = createDragEvent({ dropEffect: 'move', ctrlKey: true });
|
|
57
|
+
DragDropUtility.updateEventAndTooltipToReflectCopyMoveIntention(event);
|
|
58
|
+
expect(event.dataTransfer.dropEffect).to.equal('copy');
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe('on macOS', () => {
|
|
63
|
+
beforeEach(() => {
|
|
64
|
+
emulatePlatform('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/156.0.0.0 Safari/537.36');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('detects a copy intention when Option is held although the browser preset dropEffect to "move"', () => {
|
|
68
|
+
const event = createDragEvent({ dropEffect: 'move', altKey: true });
|
|
69
|
+
expect(DragDropUtility.isCopyModifierFromEvent(event)).to.equal(true);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('detects a copy intention when the platform restricted the operation to copy', () => {
|
|
73
|
+
const event = createDragEvent({ dropEffect: 'none', effectAllowed: 'copy' });
|
|
74
|
+
expect(DragDropUtility.isCopyModifierFromEvent(event)).to.equal(true);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('ignores Ctrl', () => {
|
|
78
|
+
const event = createDragEvent({ dropEffect: 'move', ctrlKey: true });
|
|
79
|
+
expect(DragDropUtility.isCopyModifierFromEvent(event)).to.equal(false);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
@@ -20,17 +20,13 @@ import type { DragTooltipMetadata } from '@typo3/backend/drag-tooltip';
|
|
|
20
20
|
*/
|
|
21
21
|
export default class DragDropUtility {
|
|
22
22
|
public static isCopyModifierFromEvent(event: DragEvent): boolean {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (event.dataTransfer.dropEffect === 'move') {
|
|
28
|
-
return false;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return navigator.userAgent.includes('Mac')
|
|
23
|
+
// Browsers may preset dropEffect to "move" regardless of pressed modifiers
|
|
24
|
+
// (e.g. Chrome on Windows), therefore the modifier takes precedence.
|
|
25
|
+
const isCopyModifierPressed = navigator.userAgent.includes('Mac')
|
|
32
26
|
? (event.dataTransfer.effectAllowed === 'copy' || event.altKey)
|
|
33
27
|
: event.ctrlKey;
|
|
28
|
+
|
|
29
|
+
return isCopyModifierPressed || event.dataTransfer.dropEffect === 'copy';
|
|
34
30
|
}
|
|
35
31
|
|
|
36
32
|
public static updateEventAndTooltipToReflectCopyMoveIntention(event: DragEvent): void {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typo3-typescript-sources",
|
|
3
|
-
"version": "13.4.
|
|
3
|
+
"version": "13.4.39",
|
|
4
4
|
"description": "TYPO3 Core TypeScript Sources - Extracted from TYPO3/typo3 repository",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"typo3": {
|
|
30
30
|
"sourceRepository": "https://github.com/TYPO3/typo3",
|
|
31
|
-
"sourceTag": "v13.4.
|
|
31
|
+
"sourceTag": "v13.4.39",
|
|
32
32
|
"sourcePath": "Build/Sources/TypeScript"
|
|
33
33
|
}
|
|
34
34
|
}
|