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

Commit

Permalink
Fix PDFJS viewer resizing in minisite mode
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Mar 12, 2015
1 parent 1bfd68f commit e2987e4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
28 changes: 25 additions & 3 deletions core/src/plugins/editor.pdfjs/class.PDFJSViewer.js
Expand Up @@ -52,10 +52,10 @@ Class.create("PDFJSViewer", AbstractEditor, {
var pdfurl = encodeURIComponent(url+'/'+ajxpBootstrap.parameters.get('ajxpServerAccess')+'&action=get_content&file='+fileName);

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

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

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

// Set the tab label.
this.updateTitle(getBaseName(fileName));
}

},
resize : function(size){
if(size){
this.contentMainContainer.setStyle({height:size+'px'});
if(this.IEorigWidth) this.contentMainContainer.setStyle({width:this.IEorigWidth});
}else{
if(this.fullScreenMode){
fitHeightToBottom(this.contentMainContainer, this.element);
if(this.IEorigWidth) this.contentMainContainer.setStyle({width:this.element.getWidth()});
}else{
if(this.editorOptions.context.elementName){
fitHeightToBottom(this.contentMainContainer, $(this.editorOptions.context.elementName), 5);
}else{
fitHeightToBottom($(this.element));
fitHeightToBottom($(this.contentMainContainer), $(this.element));
}
if(this.IEorigWidth) this.contentMainContainer.setStyle({width:this.IEorigWidth});
}
}
this.element.fire("editor:resize", size);
}

});
2 changes: 1 addition & 1 deletion core/src/plugins/editor.pdfjs/manifest.xml
Expand Up @@ -15,7 +15,7 @@
</resources>
</client_settings>
<clientForm id="pdf_box"><![CDATA[
<div id="pdf_box" class="editor_container pdfjs_viewer"><iframe></iframe></div>
<div id="pdf_box" box_width="90%" box_height="90%" box_resize="true" box_padding="5" class="editor_container pdfjs_viewer"><iframe></iframe></div>
]]></clientForm>
<dependencies>
<!-- Stream Wrapper Access -->
Expand Down

0 comments on commit e2987e4

Please sign in to comment.