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:
parent
1aafde443b
commit
9d12c920b5
@ -1,3 +1,4 @@
|
|||||||
|
/* globals FileList, FileActions, oc_debug */
|
||||||
var odfViewer = {
|
var odfViewer = {
|
||||||
isDocuments : false,
|
isDocuments : false,
|
||||||
supportedMimesRead: [
|
supportedMimesRead: [
|
||||||
@ -71,45 +72,35 @@ 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
|
|
||||||
var odfToolbarHtml =
|
|
||||||
'<div id="odf-toolbar">' +
|
|
||||||
'<button id="odf_close">' + t('documents', 'Close') +
|
|
||||||
'</button></div>';
|
|
||||||
if (odfViewer.isDocuments){
|
|
||||||
$(attachToolbarTo).prepend(odfToolbarHtml);
|
|
||||||
$('#odf-toolbar').css({position:'fixed'});
|
|
||||||
} else {
|
|
||||||
$(attachToolbarTo).append(odfToolbarHtml);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// fade out file list and show pdf canvas
|
// odf action toolbar
|
||||||
$('table, #documents-content').fadeOut('slow').promise().done(function() {
|
var odfToolbarHtml =
|
||||||
var canvashtml = '<div id="odf-canvas"></div>';
|
'<div id="odf-toolbar">' +
|
||||||
$(attachTo).after(canvashtml);
|
'<button id="odf_close">' + t('documents', 'Close') +
|
||||||
// in case we are on the public sharing page we shall display the odf into the preview tag
|
'</button></div>';
|
||||||
$('#preview').html(canvashtml);
|
if (odfViewer.isDocuments){
|
||||||
|
$(attachToolbarTo).prepend(odfToolbarHtml);
|
||||||
|
$('#odf-toolbar').css({position:'fixed'});
|
||||||
|
} else {
|
||||||
|
$(attachToolbarTo).append(odfToolbarHtml);
|
||||||
|
}
|
||||||
|
|
||||||
var odfelement = document.getElementById("odf-canvas");
|
var canvashtml = '<div id="odf-canvas"></div>';
|
||||||
var odfcanvas = new odf.OdfCanvas(odfelement);
|
$(attachTo).after(canvashtml);
|
||||||
odfcanvas.load(location);
|
// in case we are on the public sharing page we shall display the odf into the preview tag
|
||||||
});
|
$('#preview').html(canvashtml);
|
||||||
|
|
||||||
|
var odfelement = document.getElementById("odf-canvas");
|
||||||
|
var odfcanvas = new odf.OdfCanvas(odfelement);
|
||||||
|
odfcanvas.load(location);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onClose: function() {
|
onClose: function() {
|
||||||
// Fade out odf-toolbar
|
FileList.setViewerMode(false);
|
||||||
$('#odf-toolbar').fadeOut('slow');
|
$('#odf-toolbar').remove();
|
||||||
// Fade out editor
|
$('#odf-canvas').remove();
|
||||||
$('#odf-canvas').fadeOut('slow', function() {
|
|
||||||
$('#odf-toolbar').remove();
|
|
||||||
$('#odf-canvas').remove();
|
|
||||||
$('#controls div').not('.hidden').fadeIn('slow');
|
|
||||||
$('table, #documents-content').fadeIn('slow');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user