the element might be the last in the col, or between too.
The following changed method execute() in paste.js is fixing it.
The comments in the code mark my changes:
execute(element) {
const colPos = Paste.determineColumn(element);
const txContainerParent = Paste.determineTxContainerParent(element);
const closestElement = element.closest(this.elementIdentifier);
const targetFound = closestElement.dataset.uid;
let targetPid;
if (typeof targetFound === 'undefined') {
targetPid = parseInt(closestElement.dataset.page, 10);
}
else {
targetPid = 0 - parseInt(targetFound, 10);
}
const language = parseInt(element.closest('[data-language-uid]').dataset.languageUid, 10);
// CHANGE FROM const TO let:
let parameters = {
CB: {
paste: 'tt_content|' + targetPid,
pad: 'normal',
update: {
colPos: colPos,
sys_language_uid: language,
tx_container_parent: txContainerParent,
},
},
};
// NEW CONDITION to add the sorting parameter:
if (txContainerParent && typeof targetFound === 'undefined') {
parameters.CB.update.sorting = 0;
}
DataHandler.process(parameters).then((result) => {
if (!result.hasErrors) {
window.location.reload();
}
});
}
the element might be the last in the col, or between too.
The following changed method execute() in paste.js is fixing it.
The comments in the code mark my changes: