Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit e2987e4

Browse files
committed
Fix PDFJS viewer resizing in minisite mode
1 parent 1bfd68f commit e2987e4

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

core/src/plugins/editor.pdfjs/class.PDFJSViewer.js

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ Class.create("PDFJSViewer", AbstractEditor, {
5252
var pdfurl = encodeURIComponent(url+'/'+ajxpBootstrap.parameters.get('ajxpServerAccess')+'&action=get_content&file='+fileName);
5353

5454
// Hide the Pydio action bar.
55-
this.element.getElementsByClassName('editor_action_bar')[0].style.display = 'none';
55+
this.element.down('.editor_action_bar').setStyle({display:'none'});
5656

5757
// Set up the main container and load the PDF file.
58-
this.contentMainContainer = this.element.getElementsByTagName('iframe')[0];
58+
this.contentMainContainer = this.element.down('iframe');
5959
this.contentMainContainer.src = 'plugins/editor.pdfjs/pdfjs/web/viewer.html?file=' + pdfurl;
6060

6161
this.contentMainContainer.observe("focus", function(){
@@ -67,5 +67,27 @@ Class.create("PDFJSViewer", AbstractEditor, {
6767

6868
// Set the tab label.
6969
this.updateTitle(getBaseName(fileName));
70-
}
70+
71+
},
72+
resize : function(size){
73+
if(size){
74+
this.contentMainContainer.setStyle({height:size+'px'});
75+
if(this.IEorigWidth) this.contentMainContainer.setStyle({width:this.IEorigWidth});
76+
}else{
77+
if(this.fullScreenMode){
78+
fitHeightToBottom(this.contentMainContainer, this.element);
79+
if(this.IEorigWidth) this.contentMainContainer.setStyle({width:this.element.getWidth()});
80+
}else{
81+
if(this.editorOptions.context.elementName){
82+
fitHeightToBottom(this.contentMainContainer, $(this.editorOptions.context.elementName), 5);
83+
}else{
84+
fitHeightToBottom($(this.element));
85+
fitHeightToBottom($(this.contentMainContainer), $(this.element));
86+
}
87+
if(this.IEorigWidth) this.contentMainContainer.setStyle({width:this.IEorigWidth});
88+
}
89+
}
90+
this.element.fire("editor:resize", size);
91+
}
92+
7193
});

core/src/plugins/editor.pdfjs/manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</resources>
1616
</client_settings>
1717
<clientForm id="pdf_box"><![CDATA[
18-
<div id="pdf_box" class="editor_container pdfjs_viewer"><iframe></iframe></div>
18+
<div id="pdf_box" box_width="90%" box_height="90%" box_resize="true" box_padding="5" class="editor_container pdfjs_viewer"><iframe></iframe></div>
1919
]]></clientForm>
2020
<dependencies>
2121
<!-- Stream Wrapper Access -->

0 commit comments

Comments
 (0)