plone / plone.app.mosaic

Plone Mosaic main repository
https://pypi.python.org/pypi/plone.app.mosaic
GNU General Public License v2.0
34 stars 26 forks source link

Refactor properties and tile setting modal. #577

Closed petschki closed 11 months ago

petschki commented 11 months ago

Code cleanup and more sanity in handling properties modal. Also the multiple event registration on the original edit form node is fixed. (Sorry for the prettier stuff which isn't separated in the commits)

petschki commented 11 months ago

@jensens @gogobd I've though once more about the modal strategy.

tl;dr

Handling this with DOM manipulation is currently too complex, because the hidden form inside .mosaic-original-content gets wrapped with the disable-pattern css class "too late", so there are initialized patterns which would need to get "destroyed" before we move the node into the modal. There is a PR in Patternslib which would give us the option sort_early in pat-layout so it would be executed "earlier" before the other patterns and the "disable-patterns" class would bei wrapped in time (https://github.com/Patternslib/Patterns/pull/1154/commits/c357b23801ab7cf0cb70328130bf516292715035) ...

Due to that the current strategy of properties modal is as follows:

  1. Load original edit form with AJAX into the modal
  2. remove the hidden original form from the DOM inside .mosaic-original-content completely to fix duplicated IDs
  3. when hiding the modal form (afters save/close/cancel) load the original form markup into the hidden DOM again.

This now has the only downside, that editing the properties now is persistently saved on the context, even if you cancel the mosaic editor afterwards. But the widgets are now working as expected inside the modal.

NOTE: TinyMCE inline mode is still broken inside the modal, but that's offtopic here, because its a general mockup issue.

jensens commented 11 months ago

@petschki We (me and @gogobd) tested this branch on the project. It fixes some problems, but the "ordered select input widget" is still broken (as desribed in #578).

petschki commented 11 months ago

See related issue https://github.com/plone/plone.app.z3cform/issues/184