Skip to content

Commit

Permalink
[BUGFIX] Allow adding multiple files / folders via element browser
Browse files Browse the repository at this point in the history
This prevents the element browser from closing
as soon as one file or folder was added. This
restores previous behaviour, allowing the user
to add multiple references without having to
open the browser again and again.

Resolves: #103369
Releases: main, 12.4
Change-Id: Id57ebe3ed115c0929beb06fd7dd136fe0f08e415
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83434
Reviewed-by: Jochen Roth <rothjochen@gmail.com>
Tested-by: Andreas Kienast <a.fernandez@scripting-base.de>
Reviewed-by: Andreas Kienast <a.fernandez@scripting-base.de>
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Jochen Roth <rothjochen@gmail.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
  • Loading branch information
o-ba committed Mar 13, 2024
1 parent 0133a5e commit f5a6bbb
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 7 deletions.
3 changes: 2 additions & 1 deletion Build/Sources/TypeScript/filelist/browse-files.ts
Expand Up @@ -29,6 +29,7 @@ class BrowseFiles {
new RegularEvent(FileListActionEvent.primary, (event: CustomEvent): void => {
event.preventDefault();
const detail: FileListActionDetail = event.detail;
detail.originalAction = FileListActionEvent.primary;
detail.action = FileListActionEvent.select;
document.dispatchEvent(new CustomEvent(FileListActionEvent.select, { detail: detail }));
}).bindTo(document);
Expand All @@ -38,7 +39,7 @@ class BrowseFiles {
const detail: FileListActionDetail = event.detail;
const resource = detail.resources[0];
if (resource.type === 'file') {
BrowseFiles.insertElement(resource.name, resource.uid, true);
BrowseFiles.insertElement(resource.name, resource.uid, detail.originalAction === FileListActionEvent.primary);
}
if (resource.type === 'folder') {
this.loadContent(resource);
Expand Down
3 changes: 2 additions & 1 deletion Build/Sources/TypeScript/filelist/browse-folders.ts
Expand Up @@ -29,6 +29,7 @@ class BrowseFolders {
new RegularEvent(FileListActionEvent.primary, (event: CustomEvent): void => {
event.preventDefault();
const detail: FileListActionDetail = event.detail;
detail.originalAction = FileListActionEvent.primary;
detail.action = FileListActionEvent.select;
document.dispatchEvent(new CustomEvent(FileListActionEvent.select, { detail: detail }));
}).bindTo(document);
Expand All @@ -38,7 +39,7 @@ class BrowseFolders {
const detail: FileListActionDetail = event.detail;
const resource = detail.resources[0];
if (resource.type === 'folder') {
BrowseFolders.insertElement(resource.identifier, true);
BrowseFolders.insertElement(resource.identifier, detail.originalAction === FileListActionEvent.primary);
}
}).bindTo(document);

Expand Down
3 changes: 2 additions & 1 deletion Build/Sources/TypeScript/filelist/context-menu-actions.ts
Expand Up @@ -54,7 +54,8 @@ class ContextMenuActions {
trigger: null,
action: FileListActionEvent.rename,
resources: [resource],
url: null
url: null,
originalAction: null
};
document.dispatchEvent(new CustomEvent(FileListActionEvent.rename, { detail: detail }));
})();
Expand Down
2 changes: 2 additions & 0 deletions Build/Sources/TypeScript/filelist/file-list-actions.ts
Expand Up @@ -20,6 +20,7 @@ export interface FileListActionDetail {
resources: [ResourceInterface, ...ResourceInterface[]];
trigger: HTMLElement | null;
url: string | null;
originalAction: string | null;
}

export enum FileListActionEvent {
Expand Down Expand Up @@ -120,6 +121,7 @@ class FileListActions {
action: action,
resources: [resource],
url: target.dataset.filelistActionUrl ?? null,
originalAction: null
};
return detail;
}
Expand Down

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

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

0 comments on commit f5a6bbb

Please sign in to comment.