@ -29,10 +29,13 @@ define([
{
{
var saveAs = window . saveAs ;
var saveAs = window . saveAs ;
/ *
var ooReady = window . frames [ 0 ] && window . frames [ 0 ] . frames [ 0 ] && window . frames [ 0 ] . frames [ 0 ] . editor ;
var ooReady = window . frames [ 0 ] && window . frames [ 0 ] . frames [ 0 ] && window . frames [ 0 ] . frames [ 0 ] . editor ;
window . onOOReady = function ( ) {
window . onOOReady = function ( ) {
console . log ( 'ready!' ) ;
ooReady = true ;
ooReady = true ;
} ;
} ;
* /
var APP = window . APP = {
var APP = window . APP = {
$ : $
$ : $
@ -77,9 +80,12 @@ define([
var loadDocument = APP . loadDocument = function ( content , file ) {
var loadDocument = APP . loadDocument = function ( content , file ) {
console . log ( "Read " + content ) ;
console . log ( "Read " + content ) ;
return ;
return ;
/ *
// TODO: load a document from server here
window . frames [ 0 ] . frames [ 0 ] . editor . asc _CloseFile ( ) ;
window . frames [ 0 ] . frames [ 0 ] . editor . asc _CloseFile ( ) ;
var openResult = { bSerFormat : true , data : content , url : "http://localhost:3000/onlyoffice/" , changes : null } ;
var openResult = { bSerFormat : true , data : content , url : "http://localhost:3000/onlyoffice/" , changes : null } ;
window . frames [ 0 ] . frames [ 0 ] . editor . openDocument ( openResult ) ;
window . frames [ 0 ] . frames [ 0 ] . editor . openDocument ( openResult ) ;
* /
} ;
} ;
var readOnly = false ;
var readOnly = false ;
@ -119,7 +125,6 @@ define([
} ;
} ;
APP . onLocal = config . onLocal = function ( ) {
APP . onLocal = config . onLocal = function ( ) {
console . log ( initializing , readOnly ) ;
if ( initializing ) { return ; }
if ( initializing ) { return ; }
if ( readOnly ) { return ; }
if ( readOnly ) { return ; }
@ -127,8 +132,9 @@ define([
console . log ( "Cannot access editor" ) ;
console . log ( "Cannot access editor" ) ;
return ;
return ;
}
}
console . log ( 'ok' ) ;
var data = window . frames [ 0 ] . frames [ 0 ] . editor . asc _nativeGetFile ( ) ;
var data = window . frames [ 0 ] . frames [ 0 ] . editor . asc _nativeGetFile ( ) ;
console . log ( 'onLocal, data avalable' ) ;
data = '' ;
var content = stringifyInner ( data ) ;
var content = stringifyInner ( data ) ;
APP . realtime . contentUpdate ( content ) ;
APP . realtime . contentUpdate ( content ) ;
} ;
} ;
@ -169,14 +175,9 @@ define([
var $import = common . createButton ( 'import' , true , { } , loadDocument ) ;
var $import = common . createButton ( 'import' , true , { } , loadDocument ) ;
$rightside . append ( $import ) ;
$rightside . append ( $import ) ;
var $save = common . createButton ( 'save' , true , { } , saveToServer ) ;
var $save = common . createButton ( 'save' , true , { } , saveToServer ) ;
$save . click ( function ( ) {
saveToServer ( ) ;
} ) ;
$rightside . append ( $save ) ;
$rightside . append ( $save ) ;
var $remote = common . createButton ( 'remote' , true , { } , callRemote ) ;
var $remote = common . createButton ( 'remote' , true , { } , callRemote ) ;
$remote . click ( function ( ) {
$remote . attr ( 'title' , 'call onRemote' ) ;
callRemote ( ) ;
} ) ;
$rightside . append ( $remote ) ;
$rightside . append ( $remote ) ;
if ( common . isLoggedIn ( ) ) {
if ( common . isLoggedIn ( ) ) {
@ -293,9 +294,11 @@ define([
var common ;
var common ;
nThen ( function ( waitFor ) {
nThen ( function ( waitFor ) {
/ *
if ( ! ooReady ) {
if ( ! ooReady ) {
window . onOOReady = waitFor ( ) ;
window . onOOReady = waitFor ( ) ;
}
}
* /
$ ( waitFor ( function ( ) {
$ ( waitFor ( function ( ) {
UI . addLoadingScreen ( ) ;
UI . addLoadingScreen ( ) ;
} ) ) ;
} ) ) ;