add recent webodf-debug.js; use it - and cleanup

This commit is contained in:
Tobias Hintze 2013-07-12 22:50:39 +02:00
parent 84f3b6ec78
commit 5448d8d9ec
3 changed files with 13200 additions and 1756 deletions

File diff suppressed because one or more lines are too long

View File

@ -15,12 +15,17 @@ var officeMain = {
onStartup: function() { onStartup: function() {
"use strict"; "use strict";
OC.addScript('office', 'webodf_bootstrap', function() { OC.addScript('office', 'webodf_bootstrap', function() {
require({}, ["dojo/ready"], function(ready) { OC.addScript('office', 'webodf-debug').done(function() {
ready(function(){ require({}, ["dojo/ready"], function(ready) {
// dojo.config = officeMain.dojoConfig; ready(function(){
alert("dojo loaded"); require({}, ["webodf/editor/Editor"], function(Editor) {
require({}, ["webodf/editor/Editor"], function(Editor) { if (Editor && typeof(Editor) === 'function') {
alert("Editor loaded: "+Editor); officeMain.initialized = 1;
} else {
alert("initialization of webodf/editor/Editor\n"+
"failed somehow...");
}
});
}); });
}); });
}); });
@ -28,48 +33,51 @@ var officeMain = {
}, },
onView: function(dir, file) { onView: function(dir, file) {
"use strict"; "use strict";
OC.addScript('office', 'webodf').done(function() { if (officeMain.initialized === undefined) {
OC.addScript('office', 'boot_editor').done(function() { alert("WebODF Editor not yet initialized...");
var doclocation = fileDownloadPath(dir, file); return;
}
OC.addScript('office', 'boot_editor').done(function() {
var doclocation = fileDownloadPath(dir, file);
// fade out files menu and add odf menu // fade out files menu and add odf menu
$('.documentslist').fadeOut('slow').promise().done(function() { $('.documentslist').fadeOut('slow').promise().done(function() {
// odf action toolbar // odf action toolbar
var odfToolbarHtml = var odfToolbarHtml =
'<div id="odf-toolbar">' + '<div id="odf-toolbar">' +
'<button id="odf_close">' + t('files_odfviewer', 'Close') + '<button id="odf_close">' + t('files_odfviewer', 'Close') +
'</button></div>'; '</button></div>';
$('#controls').append(odfToolbarHtml); $('#controls').append(odfToolbarHtml);
}); });
// fade out file list and show WebODF canvas // fade out file list and show WebODF canvas
$('table').fadeOut('slow').promise().done(function() { $('table').fadeOut('slow').promise().done(function() {
var odfelement, odfcanvas, canvashtml = '<div id = "mainContainer" style="display: none;">'+ var odfelement, odfcanvas, canvashtml =
'<div id = "editor">'+ '<div id = "mainContainer" style="display: none;">'+
'<div id = "editor">'+
'<span id = "toolbar"></span>'+ '<span id = "toolbar"></span>'+
'<div id = "container">'+ '<div id = "container">'+
'<div id="canvas"></div>'+ '<div id="canvas"></div>'+
'</div>'+ '</div>'+
'</div>'+ '</div>'+
'</div>'; '</div>';
$('table').after(canvashtml); $('table').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
// $('#preview').html(canvashtml); // $('#preview').html(canvashtml);
webodfEditor.boot( webodfEditor.boot(
{ {
collaborative: 0, collaborative: 0,
docUrl: doclocation, docUrl: doclocation,
callback: function() { alert('live!'); } callback: function() { alert('webodf/editor/Editor initialized!'); }
} }
); );
// odfelement = document.getElementById("odf-canvas"); // odfelement = document.getElementById("odf-canvas");
// odfcanvas = new odf.OdfCanvas(odfelement); // odfcanvas = new odf.OdfCanvas(odfelement);
// odfcanvas.load(doclocation); // odfcanvas.load(doclocation);
}); });
});
}); });
}, },
onClose: function() { onClose: function() {

13152
js/webodf-debug.js Normal file

File diff suppressed because one or more lines are too long