Uploaded image for project: 'Nuxeo Studio'
  1. Nuxeo Studio
  2. NXS-5343

Fix duplicate events in Designer Layout Editor

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.12.1
    • Fix Version/s: 3.15.0
    • Component/s: Studio Designer

      Description

      In Designer, on any configured layout of any Document Type (for example, the create layout of the File Document Type):

      • From the right panel, drag and drop any field in any mode to the layout (for example, the dublincore title field).
      • The field is correctly added to the layout, but the following error appears on the console:
        nuxeo-view-designer.html:71796 Uncaught TypeError: Cannot read property 'getElementForField' of undefined
            at HTMLElement.<anonymous> (nuxeo-view-designer.html:71796)
            at Array.forEach (<anonymous>)
            at HTMLElement._onElementAdd (nuxeo-view-designer.html:71795)
            at HTMLElement.<anonymous> (nuxeo-view-designer.html:71717)
            at HTMLElement.fire (nuxeo-view-designer.html:9904)
            at HTMLElement.onElementDragDrop (nuxeo-view-designer.html:101546)
            at HTMLElement.handler (nuxeo-view-designer.html:2417)
            at HTMLElement._dispatchDragAndDropEvent (nuxeo-view-designer.html:76604)
            at HTMLElement._onFieldsSelected (nuxeo-view-designer.html:76617)
            at HTMLElement.handler (nuxeo-view-designer.html:2417)
        
      • When deleting any of the fields already in the layout, another error is shown on the console:
        nuxeo-view-designer.html:71906 Uncaught TypeError: Cannot read property 'contentDocument' of undefined
            at HTMLElement.get previewDocument [as previewDocument] (nuxeo-view-designer.html:71906)
            at HTMLElement.executeCommand (nuxeo-view-designer.html:71931)
            at HTMLElement.executeCommand (nuxeo-view-designer.html:72204)
            at HTMLElement.executeCommand (nuxeo-view-designer.html:101207)
            at HTMLElement._onViewCommand (nuxeo-view-designer.html:214359)
            at HTMLElement.handler (nuxeo-view-designer.html:2417)
            at HTMLElement.fire (nuxeo-view-designer.html:9904)
            at HTMLElement._onElementRemove (nuxeo-view-designer.html:71810)
            at HTMLElement.<anonymous> (nuxeo-view-designer.html:71720)
            at HTMLElement.fire (nuxeo-view-designer.html:9904)
        

      This seems to be caused by two different editors (nuxeo-layout-editor and nuxeo-layout-blocks-editor) trying to catch the same events. In this case, the nuxeo-view-editor is firing the nuxeo-element-add and nuxeo-element-remove events, which have global listeners (at the window level) defined in the nuxeo-view. Due to the Layout Blocks Editor not being initialized, it is causing this error, but there is the possibility that this editor can execute undesired commands in the background, without printing any errors.

      The goal of this ticket is to fix this issue by reviewing the flow of the events in Designer, trying to avoid catching these events at a global level.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours
                2h