Files
WebODF/programs/editor/editor.js
T

101 lines
3.1 KiB
JavaScript
Raw Normal View History

runtime.currentDirectory = function () {
return "../../webodf/lib";
};
runtime.libraryPaths = function () {
return [ runtime.currentDirectory() ];
};
2012-08-08 17:40:09 +05:30
function init() {
runtime.loadClass('odf.OdfCanvas');
2012-08-08 17:40:09 +05:30
// If the URL has a fragment (#...), try to load the file it represents
var location = String(document.location),
pos = location.indexOf('#'),
odfElement = document.getElementById("canvas");
document.odfCanvas = new odf.OdfCanvas(odfElement);
if (pos === -1 || !window) {
return;
2012-08-08 17:40:09 +05:30
}
location = location.substr(pos + 1);
2012-10-04 18:51:03 +05:30
// Editor Widgets and Avatars
document.odfCanvas.addListener("statereadychange", function() {
runtime.setTimeout(function() {
loadWidgets(document);
loadAvatars(document, document.getElementById('peopleList'));
}, 100);
});
2012-08-08 17:40:09 +05:30
document.odfCanvas.load(location);
2012-10-04 18:00:30 +05:30
document.odfCanvas.setEditable(false);
var filename = location.replace(/^.*[\\\/]/, '');
document.getElementById('topPane').innerHTML = "<h1> <a href = '" + location + "''>" + filename + "</a></h1>";
2012-08-23 19:13:02 +05:30
// App Widgets
require(["dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojox/layout/ExpandoPane"], function(BorderContainer, ContentPane, ExpandoPane) {
var mainContainer = new BorderContainer({}, 'mainContainer');
2012-08-23 18:09:12 +05:30
var collabContainer = new BorderContainer({}, 'collabContainer');
var topPane = new ContentPane({
region: 'top'
}, 'topPane');
var editorPane = new ContentPane({
region: 'center'
}, 'editor');
var collabPane = new ExpandoPane({
region: 'trailing',
2012-08-23 19:13:02 +05:30
splitter: 'true',
title: 'Collaboration Pane'
}, 'collaboration');
2012-08-23 18:09:12 +05:30
var peoplePane = new ContentPane({
region: 'top',
2012-08-23 19:13:02 +05:30
splitter: 'true',
title: 'People'
2012-08-23 18:09:12 +05:30
}, 'people');
var chatPane = new ContentPane({
2012-08-23 19:13:02 +05:30
region: 'center',
title: 'Chat'
2012-08-23 18:09:12 +05:30
}, 'chat');
mainContainer.addChild(topPane);
mainContainer.addChild(editorPane);
mainContainer.addChild(collabPane);
2012-08-23 18:09:12 +05:30
collabContainer.addChild(peoplePane);
collabContainer.addChild(chatPane);
collabPane.addChild(collabContainer);
mainContainer.startup();
2012-08-23 18:09:12 +05:30
collabContainer.startup();
2012-08-23 19:13:02 +05:30
require(["dijit/form/TextBox", "dijit/form/Button"], function(TextBox, Button) {
// People Box
// User's Editable Name
var nameBox = new TextBox({
value: '',
2012-08-24 04:32:24 +05:30
placeHolder: 'Type your name...',
2012-08-23 19:13:02 +05:30
style: 'text-align: center;'
}, 'nameEdit');
var inviteButton = new Button({
label: 'Invite People',
}, 'inviteButton');
2012-08-24 04:32:24 +05:30
// Chat Box
// Chat Input
var chatInput = new TextBox({
value: '',
placeHolder: 'Start typing to chat...',
style: 'text-align: center;'
}, 'chatInput');
2012-08-23 19:13:02 +05:30
});
});
2012-08-08 17:40:09 +05:30
}
2012-09-12 22:09:53 +05:30
window.onload = init;