Project

General

Profile

Actions

Bug #95263

open

Selecting files in ElementBrowser does not work when editing records via info modal in filelist module

Added by Tilman Justen over 2 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Backend JavaScript
Target version:
-
Start date:
2021-09-17
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
ElementBrowser Recordlist
Complexity:
Is Regression:
Sprint Focus:

Description

Currently it is not possible to select a file as field value when editing a record via info modal. The value will be sent to the list_frame instead of the modal_frame where the record editing happens.

Steps to reproduce:

  1. Navigate to the filelist module
  2. Open info modal of file that has a list of references
  3. Edit reference via info modal
  4. Edit file field which opens the BrowseFiles/ElementBrowser modal
  5. Select another file

Expected
BrowsFiles/ElementBrowser modal will be closed and selected file is used as value of the file field.

What actually happens
BrowsFiles/ElementBrowser modal will be closed, selected file is not used as value of the file field.

Possible solution

The selection of the opener (message target) within the getParent() method of the typo3/sysext/recordlist/Resources/Public/JavaScript/ElementBrowser.js module should check if the BrowseFiles/ElementBrowser was opened by editing a record in another modal.

  const parentFrames = window.parent ? Array.from(window.parent.frames) : [];
  const modalFrames = parentFrames.filter(frame => frame.name === 'modal_frame');
  const editDocumentFrame = modalFrames.filter(frame => null !== frame.document.querySelector('#EditDocumentController')).pop();

  getParent() {
      if (this.opener === null) {
        if (editDocumentFrame) {
          this.opener = editDocumentFrame;
        }
        ...
      }
    ...
  }

No data to display

Actions

Also available in: Atom PDF