Set viewer mode to filelist when viewing ODF file

Now calling FileList.setViewerMode() to properly toggle viewer mode.
This will hide the sidebar and actions automatically.
This commit is contained in:
Vincent Petry 2014-05-19 10:39:37 +02:00
parent 1aafde443b
commit 9d12c920b5

View File

@ -1,3 +1,4 @@
/* globals FileList, FileActions, oc_debug */
var odfViewer = {
isDocuments : false,
supportedMimesRead: [
@ -71,8 +72,8 @@ var odfViewer = {
OC.addStyle('documents', 'viewer/odfviewer');
OC.addScript('documents', '3rdparty/webodf/' + webodfSource, function() {
// fade out files menu and add odf menu
$('#controls div').fadeOut('slow').promise().done(function() {
FileList.setViewerMode(true);
// odf action toolbar
var odfToolbarHtml =
'<div id="odf-toolbar">' +
@ -84,10 +85,7 @@ var odfViewer = {
} else {
$(attachToolbarTo).append(odfToolbarHtml);
}
});
// fade out file list and show pdf canvas
$('table, #documents-content').fadeOut('slow').promise().done(function() {
var canvashtml = '<div id="odf-canvas"></div>';
$(attachTo).after(canvashtml);
// in case we are on the public sharing page we shall display the odf into the preview tag
@ -97,19 +95,12 @@ var odfViewer = {
var odfcanvas = new odf.OdfCanvas(odfelement);
odfcanvas.load(location);
});
});
},
onClose: function() {
// Fade out odf-toolbar
$('#odf-toolbar').fadeOut('slow');
// Fade out editor
$('#odf-canvas').fadeOut('slow', function() {
FileList.setViewerMode(false);
$('#odf-toolbar').remove();
$('#odf-canvas').remove();
$('#controls div').not('.hidden').fadeIn('slow');
$('table, #documents-content').fadeIn('slow');
});
}
};