monsieurbiz / SyliusRichEditorPlugin

This plugin add a rich editor on fields to be able to drag and drop elements and edit it.
MIT License
65 stars 37 forks source link

Enable overflow scroll on edit dialog #100

Closed DieterHolvoet closed 3 years ago

DieterHolvoet commented 3 years ago

Fixes #99.

Guirec commented 3 years ago

Thanks @DieterHolvoet for this!

It's a way to cover the issue. But I'm annoyed that a scroll placed here could hide the actions buttons (save and cancel).

I have a different approach to this problem to suggest.

Right now an empty div is created when the element form is inserted, and this specific div prevent the styles of the parent to apply. It could work if this div has a height of 100% but it has no style or class.

So I think it will be better if we avoid to create an empty div in the script:

diff --git a/assets/js/app.js b/assets/js/app.js
index 93ea492..da05688 100644
--- a/assets/js/app.js
+++ b/assets/js/app.js
@@ -409,12 +409,8 @@ global.MonsieurBizRichEditorManager = class {
   }

   drawEditForm(formHtml, uiElement) {
-    let form = document.createElement('div');
-    form.innerHTML = formHtml;
-
-    let formContainer = this.editPanel.dialog.querySelector('.js-uie-content');
-    formContainer.innerHTML = '';
-    formContainer.append(form);
+    this.editPanel.dialog.querySelector('.js-uie-content').innerHTML = formHtml;
+    let form = this.editPanel.dialog;

     this.wysiwyg.load(form);
     this.initUiCollectionForm(form);

With that, the scroll is applied to the form and not to the entire panel. What do you think about this?

DieterHolvoet commented 3 years ago

Great, that seems to work as well! You know the codebase better than I do :)

jacquesbh commented 3 years ago

Thank you @DieterHolvoet ! 🎉 and @Guirec :)