|
|
@ -66,12 +66,18 @@ define([
|
|
|
|
config.onRemote();
|
|
|
|
config.onRemote();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var getContent = function () {
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
return window.frames[0].frames[0].editor.asc_nativeGetFile();
|
|
|
|
|
|
|
|
} catch (e) { return null; }
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var saveDocument = APP.saveDocument = function () {
|
|
|
|
var saveDocument = APP.saveDocument = function () {
|
|
|
|
var defaultName = "text.oot";
|
|
|
|
var defaultName = "text.oot";
|
|
|
|
UI.prompt(Messages.exportPrompt, defaultName, function (filename) {
|
|
|
|
UI.prompt(Messages.exportPrompt, defaultName, function (filename) {
|
|
|
|
if (!(typeof(filename) === 'string' && filename)) { return; }
|
|
|
|
if (!(typeof(filename) === 'string' && filename)) { return; }
|
|
|
|
console.log("In saveDocument");
|
|
|
|
console.log("In saveDocument");
|
|
|
|
var content = window.frames[0].frames[0].editor.asc_nativeGetFile();
|
|
|
|
var content = getContent();
|
|
|
|
var blob = new Blob([content], {type: "text/plain;charset=utf-8"});
|
|
|
|
var blob = new Blob([content], {type: "text/plain;charset=utf-8"});
|
|
|
|
saveAs(blob, filename);
|
|
|
|
saveAs(blob, filename);
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -132,7 +138,7 @@ define([
|
|
|
|
console.log("Cannot access editor");
|
|
|
|
console.log("Cannot access editor");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var data = window.frames[0].frames[0].editor.asc_nativeGetFile();
|
|
|
|
var data = getContent();
|
|
|
|
console.log('onLocal, data avalable');
|
|
|
|
console.log('onLocal, data avalable');
|
|
|
|
data = '';
|
|
|
|
data = '';
|
|
|
|
var content = stringifyInner(data);
|
|
|
|
var content = stringifyInner(data);
|
|
|
@ -240,7 +246,7 @@ define([
|
|
|
|
// force readonly to prevent interlacing
|
|
|
|
// force readonly to prevent interlacing
|
|
|
|
readOnly = true;
|
|
|
|
readOnly = true;
|
|
|
|
|
|
|
|
|
|
|
|
var previousData = window.frames[0].frames[0].editor.asc_nativeGetFile();
|
|
|
|
var previousData = getContent();
|
|
|
|
var userDoc = APP.realtime.getUserDoc();
|
|
|
|
var userDoc = APP.realtime.getUserDoc();
|
|
|
|
|
|
|
|
|
|
|
|
var json = JSON.parse(userDoc);
|
|
|
|
var json = JSON.parse(userDoc);
|
|
|
|