]> _ Git - fluidbook-html5.git/commitdiff
wait #2506 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 14 Jan 2019 17:23:33 +0000 (18:23 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 14 Jan 2019 17:23:33 +0000 (18:23 +0100)
js/libs/fluidbook/fluidbook.menu.js
js/libs/fluidbook/fluidbook.utils.js

index 76c8b86654649379f34d2a5fc12747a7986ac410..c85bdd1c442379af5953d94cb495706383c4a93c 100644 (file)
@@ -197,14 +197,13 @@ FluidbookMenu.prototype = {
 
         var t = $("#view .iframeContainer").data('type');
         $("#view").find('.iframeHolder,.content,.mview').attr('data-type', t);
-        
+
         $("#view .iframeContainer iframe").on('load', function () {
             try {
-                var cw = $(this).get(0).contentWindow;
-                cw.document.style.maxWidth = '100%';
-                cw.document.style.overflow = 'auto';
-            }catch (e) {
-                
+                var doc = getIframeDocument(this);
+                doc.body.style.maxWidth = '100%';
+                doc.body.style.overflow = 'auto';
+            } catch (e) {
             }
             $this.resize();
         });
@@ -639,6 +638,11 @@ FluidbookMenu.prototype = {
 
                 var iframe = $("#view .iframeHolder iframe");
                 iframe.css('width', w);
+                try {
+                    var doc = getIframeDocument(iframe);
+                    doc.body.style.maxWidth = w + 'px';
+                } catch (e) {
+                }
                 if (!fullscreen) {
                     var ih = -1;
                     try {
index 8c1a89f52f457f9832fae89426b002ee2f3ea791..0af9816293ba652b99331d08a9e4e6e537efdc2d 100644 (file)
@@ -100,3 +100,12 @@ function array_diff(a, b) {
         return b.indexOf(i) < 0;
     });
 }
+
+function getIframeDocument(iframe){
+    iframe = $(iframe).get(0);
+    var doc = iframe.contentWindow || iframe.contentDocument;
+    if (doc.document) {
+        doc = doc.document;
+    }
+    return doc;
+}
\ No newline at end of file