This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch wicket-8.x
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/wicket-8.x by this push:
     new 80102de  add more modal customisations (#347)
80102de is described below

commit 80102de049bada29a00871473c7bbfb25ba2a30b
Author: Andrew Kondratev <andru...@gmail.com>
AuthorDate: Tue Mar 5 18:58:27 2019 +1300

    add more modal customisations (#347)
    
    WICKET-6640 Add settings for customizing the ModalWindow's spacing, header 
height and overflow
    
    (cherry picked from commit edf01e8f3883a9a5e33ba45d4217f1622a795aad)
---
 .../extensions/ajax/markup/html/modal/res/modal.js  | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
index 7f95529..b4293c5 100644
--- 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
+++ 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js
@@ -148,6 +148,11 @@
                                width: 600,  /* initial width */
                                height: 300, /* may be null for non-iframe, 
non-resizable window (automatic height) */
 
+                               modalSpacing: 10, /* spacing between the modal 
and viewport border when modal is wider than viewport */
+                               headerHeight: 40,
+
+                               overflow: "auto",
+
                                resizable: true,
 
                                widthUnit: "px", /* valid only if not resizable 
*/
@@ -173,6 +178,8 @@
                                        return false;
                                }, this), /* called when close button is 
clicked */
 
+                               afterInit: function() { },
+
                                onClose: function() { }, /* called when window 
is closed */
 
                                mask: "semi-transparent", /* or "transparent" */
@@ -354,12 +361,12 @@
                        var modalWidth = this.window.offsetWidth;
                        var modalHeight = this.window.offsetHeight;
 
-                       if (modalWidth > width - 10) {
-                               this.window.style.width = (width - 10) + "px";
+                       if (modalWidth > width - this.settings.modalSpacing) {
+                               this.window.style.width = (width - 
this.settings.modalSpacing) + "px";
                                modalWidth = this.window.offsetWidth;
                        }
-                       if (modalHeight > height - 40) {
-                               this.content.style.height = (height - 40) + 
"px";
+                       if (modalHeight > height - this.settings.headerHeight) {
+                               this.content.style.height = (height - 
this.settings.headerHeight) + "px";
                                modalHeight = this.window.offsetHeight;
                        }
 
@@ -529,7 +536,7 @@
                                this.content.appendChild(this.settings.element);
 
                                // set the overflow style so that scrollbars 
are shown when the element is bigger than window
-                               this.content.style.overflow="auto";
+                               this.content.style.overflow = 
this.settings.overflow;
                        }
 
                        // bind the events
@@ -601,6 +608,8 @@
 
                        // create the mask that covers the background
                        this.createMask();
+
+                       this.settings.afterInit(this);
                },
 
                onbeforeunload: function() {
@@ -1015,7 +1024,7 @@
 
                        targetWindow.style.width = newWidth;
 
-                       targetContent.style.overflow = 'auto';
+                       targetContent.style.overflow = this.settings.overflow;
                }
        };
 

Reply via email to