Review main Merged

71318[TASK] Get rid of inline JavaScript in new content element wizard

Oli Bartsch CR +2 V +2 Hard +491 −381 updated 10/02/21, 13:41

Commit message

This patch cleans up the NewContentElementController, used
for the "new content element wizard". All inline JavaScript
is removed, in favour of a custom web component and an improved
JavaScript module, handling the two modes (create content
with known colPos and create content while selecting the
desired colPos).

Previously, the wizard was triggered by a t3js-* class.
Since e.g. the fluid based page module related templates
might be overridden in extension code, a fallback layer
is present to still support this way of initialization
in v11.

Due to the necessary refactoring, some related bugs are fixed:

* Accessing the wizard via the context menu now works correctly
* The "saveAndClose" feature is now also respected in case the
  user has to choose the desired colPos
* Using a custom wizard endpoint (mod.newContentElementWizard.override)
  does no longer initialize the TYPO3 related JavaScript, which
  previously led to a JavaScript TypeError
* A duplicated clear "icon" in the elements filter is removed

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Hader +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oliver Hader +1
    • core-ci +1 CI

Issues 3

Files 25

Show 5 more files

Review log 1825

  1. Oli Bartsch uploaded patch set 1 09/27/21, 13:45

  2. core-ci voted on patch set 1 V -1 09/27/21, 14:00 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17228

  3. Oli Bartsch uploaded patch set 2 09/27/21, 16:12

  4. core-ci voted on patch set 2 V -1 09/27/21, 16:24 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17233

  5. Oli Bartsch uploaded patch set 3 09/27/21, 18:12

  6. core-ci voted on patch set 3 V -1 09/27/21, 18:27 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17238

  7. Oli Bartsch uploaded patch set 4 09/27/21, 20:37

  8. core-ci voted on patch set 4 V +1 09/27/21, 20:51 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17241

  9. Oli Bartsch updated the commit message in patch set 5 09/27/21, 21:05

  10. core-ci voted on patch set 5 V +1 09/27/21, 21:17 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17243

  11. Benni Mack voted on patch set 5 V +1 CR +1 09/28/21, 13:29

  12. Oliver Hader uploaded patch set 6 09/28/21, 20:05

  13. Oliver Hader commented on patch set 6 V +1 CR +1 09/28/21, 20:06

    NewContentElementWizard.ts:41

    Can we get rid of `default`? It might be (I guess it actually is) breaking with current requireJS invocation if omitted... But I don't think other external components are using `NewContentElementWizard`...

    NewContentElementWizard.ts:60

    Naming nitpick: Actually would be `ClassNames.wizardWindow` and `querySelector('.' + ClassNames.wizardWindow)` - as a selector also might be (in theory) something like `'#my-identifier'` (not a CSS class-name)

    NewContentElementWizardButton.ts:28

    I think we used `endpoint` already, but actually `url` or even `href` would be (semantically) nice.

    PageActions.ts:234

    if (`element instanceof HTMLAnchorElement`) would avoid later (`element as ...`) hint
  14. core-ci voted on patch set 6 V +1 09/28/21, 20:22 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17279

  15. Oli Bartsch commented on patch set 6 V -1 09/28/21, 21:28

    On it.
  16. Oli Bartsch uploaded patch set 7 09/28/21, 22:10

  17. Oli Bartsch commented on patch set 7 09/28/21, 22:12

    NewContentElementWizard.ts:41 Reply

    Done

    NewContentElementWizard.ts:60 Reply

    Added this specific use case as ClassNames.wizardWindow now.

    NewContentElementWizardButton.ts:28 Reply

    Done

    PageActions.ts:234 Reply

    Done
  18. core-ci voted on patch set 7 V +1 09/28/21, 22:30 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17285

  19. Oliver Hader voted on patch set 7 CR +1 09/29/21, 06:50

  20. Oliver Hader voted on patch set 7 V +1 09/29/21, 06:59

  21. Oliver Hader wrote 09/29/21, 06:59

    Topic set to inline-javascript
  22. Benni Mack voted on patch set 7 V +2 CR +2 09/29/21, 07:39

  23. Benni Mack merged patch set 8 09/29/21, 07:39

  24. Benjamin Franzke commented on patch set 8 10/01/21, 20:31

    FYI, caused a regression: https://forge.typo3.org/issues/95440
  25. Oliver Hader commented on patch set 8 10/02/21, 13:41

    Reply

    Fixed. Thx for taking care!