Skip to content

Commit

Permalink
[BUGFIX] Fix Drag+Drop in Page Module in Workspaces
Browse files Browse the repository at this point in the history
When using Drag+Drop in Page Module a different
functionality is used than using Clipboard (Move+Paste)
while moving a record in the page module.

This results in a different behaviour when dealing in Workspaces.

The patch uses the same "cmd" instead of "data"
for DataHandler now for Drag+Drop than in Clipboard.

Resolves: #92849
Releases: master, 10.4
Change-Id: Idb8566b166a18c514d149e53699489b7b9eb9247
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69126
Tested-by: core-ci <typo3@b13.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
bmack committed May 17, 2021
1 parent 268aa62 commit 3b0fffb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 27 deletions.
Expand Up @@ -200,30 +200,24 @@ class DragDrop {
if (targetPid !== 0) {
colPos = newColumn;
}
parameters.cmd = {tt_content: {}};
parameters.data = {tt_content: {}};

const copyAction = (evt && (<JQueryInputEventObject>evt.originalEvent).ctrlKey || $droppableElement.hasClass('t3js-paste-copy'));
if (copyAction) {
parameters.cmd.tt_content[contentElementUid] = {
copy: {
action: 'paste',
target: targetPid,
update: {
colPos: colPos,
sys_language_uid: language,
},
},
};
} else {
parameters.data.tt_content[contentElementUid] = {
colPos: colPos,
sys_language_uid: language,
};
parameters.cmd.tt_content[contentElementUid] = {move: targetPid};
}
const isCopyAction = (evt && (<JQueryInputEventObject>evt.originalEvent).ctrlKey || $droppableElement.hasClass('t3js-paste-copy'));
const datahandlerCommand = isCopyAction ? 'copy' : 'move';
parameters.cmd = {
tt_content: {
[contentElementUid]: {
[datahandlerCommand]: {
action: 'paste',
target: targetPid,
update: {
colPos: colPos,
sys_language_uid: language,
},
}
}
}
};

DragDrop.ajaxAction($droppableElement, $draggableElement, parameters, copyAction).then((): void => {
DragDrop.ajaxAction($droppableElement, $draggableElement, parameters, isCopyAction).then((): void => {
const $languageDescriber = $(`.t3-page-column-lang-name[data-language-uid="${language}"]`);
if ($languageDescriber.length === 0) {
return;
Expand All @@ -248,10 +242,10 @@ class DragDrop {
* @param {JQuery} $droppableElement
* @param {JQuery} $draggableElement
* @param {Parameters} parameters
* @param {boolean} copyAction
* @param {boolean} isCopyAction
* @private
*/
public static ajaxAction($droppableElement: JQuery, $draggableElement: JQuery, parameters: Parameters, copyAction: boolean): Promise<any> {
public static ajaxAction($droppableElement: JQuery, $draggableElement: JQuery, parameters: Parameters, isCopyAction: boolean): Promise<any> {
return DataHandler.process(parameters).then((result: ResponseInterface): void => {
if (result.hasErrors) {
throw result.messages;
Expand All @@ -265,7 +259,7 @@ class DragDrop {
$draggableElement.detach().css({top: 0, left: 0})
.insertAfter($droppableElement.closest(DragDrop.contentIdentifier));
}
if (copyAction) {
if (isCopyAction) {
self.location.reload();
}
});
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3b0fffb

Please sign in to comment.