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