|
|
@ -8,6 +8,7 @@ define([
|
|
|
|
'/common/common-hash.js',
|
|
|
|
'/common/common-hash.js',
|
|
|
|
'/common/common-util.js',
|
|
|
|
'/common/common-util.js',
|
|
|
|
'/common/common-ui-elements.js',
|
|
|
|
'/common/common-ui-elements.js',
|
|
|
|
|
|
|
|
'/common/hyperscript.js',
|
|
|
|
'/api/config',
|
|
|
|
'/api/config',
|
|
|
|
'/customize/messages.js',
|
|
|
|
'/customize/messages.js',
|
|
|
|
'/customize/application_config.js',
|
|
|
|
'/customize/application_config.js',
|
|
|
@ -33,6 +34,7 @@ define([
|
|
|
|
Hash,
|
|
|
|
Hash,
|
|
|
|
Util,
|
|
|
|
Util,
|
|
|
|
UIElements,
|
|
|
|
UIElements,
|
|
|
|
|
|
|
|
h,
|
|
|
|
ApiConfig,
|
|
|
|
ApiConfig,
|
|
|
|
Messages,
|
|
|
|
Messages,
|
|
|
|
AppConfig,
|
|
|
|
AppConfig,
|
|
|
@ -65,6 +67,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
var toolbar;
|
|
|
|
var toolbar;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var andThen = function (common) {
|
|
|
|
var andThen = function (common) {
|
|
|
|
var Title;
|
|
|
|
var Title;
|
|
|
|
var sframeChan = common.getSframeChannel();
|
|
|
|
var sframeChan = common.getSframeChannel();
|
|
|
@ -898,6 +901,8 @@ define([
|
|
|
|
result = x2t.FS.readFile('/working/' + fileName + "." + outputFormat);
|
|
|
|
result = x2t.FS.readFile('/working/' + fileName + "." + outputFormat);
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
debug("Failed reading converted file");
|
|
|
|
debug("Failed reading converted file");
|
|
|
|
|
|
|
|
UI.removeModals();
|
|
|
|
|
|
|
|
UI.warn(Messages.error);
|
|
|
|
return "";
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
@ -919,6 +924,7 @@ define([
|
|
|
|
xlsData = x2tConvertDataInternal(x2t, data, filename, extension);
|
|
|
|
xlsData = x2tConvertDataInternal(x2t, data, filename, extension);
|
|
|
|
if (xlsData) {
|
|
|
|
if (xlsData) {
|
|
|
|
var blob = new Blob([xlsData], {type: "application/bin;charset=utf-8"});
|
|
|
|
var blob = new Blob([xlsData], {type: "application/bin;charset=utf-8"});
|
|
|
|
|
|
|
|
UI.removeModals();
|
|
|
|
saveAs(blob, finalFilename);
|
|
|
|
saveAs(blob, finalFilename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -957,7 +963,7 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
if (typeof(Atomics) === "undefined") {
|
|
|
|
if (typeof(Atomics) === "undefined") {
|
|
|
|
ext = ['.bin'];
|
|
|
|
ext = ['.bin'];
|
|
|
|
warning = 'Use chrome'; // XXX tell the user they can export as Office format with Chrome?
|
|
|
|
warning = '<div class="alert alert-info">'+Messages.oo_exportChrome+'</div>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var types = ext.map(function (val) {
|
|
|
|
var types = ext.map(function (val) {
|
|
|
@ -980,8 +986,7 @@ define([
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var $select = UIElements.createDropdown(dropdownConfig);
|
|
|
|
var $select = UIElements.createDropdown(dropdownConfig);
|
|
|
|
|
|
|
|
|
|
|
|
var warningText = warning ? ('<br>' + warning) : '';
|
|
|
|
UI.prompt(Messages.exportPrompt+warning, Util.fixFileName(suggestion), function (filename) {
|
|
|
|
UI.prompt(Messages.exportPrompt+warningText, Util.fixFileName(suggestion), function (filename) {
|
|
|
|
|
|
|
|
// $select.getValue()
|
|
|
|
// $select.getValue()
|
|
|
|
if (!(typeof(filename) === 'string' && filename)) { return; }
|
|
|
|
if (!(typeof(filename) === 'string' && filename)) { return; }
|
|
|
|
var ext = ($select.getValue() || '').slice(1);
|
|
|
|
var ext = ($select.getValue() || '').slice(1);
|
|
|
@ -991,7 +996,15 @@ define([
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var content = h('div.cp-oo-x2tXls', [
|
|
|
|
|
|
|
|
h('span.fa.fa-spin.fa-spinner'),
|
|
|
|
|
|
|
|
h('span', Messages.oo_exportInProgress)
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
var modal = UI.openCustomModal(UI.dialog.customModal(content, {buttons: []}));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
x2tSaveAndConvertData(text, "filename.bin", ext, filename+'.'+ext);
|
|
|
|
x2tSaveAndConvertData(text, "filename.bin", ext, filename+'.'+ext);
|
|
|
|
|
|
|
|
}, 100);
|
|
|
|
}, {
|
|
|
|
}, {
|
|
|
|
typeInput: $select[0]
|
|
|
|
typeInput: $select[0]
|
|
|
|
}, true);
|
|
|
|
}, true);
|
|
|
@ -1092,15 +1105,18 @@ define([
|
|
|
|
return nId.length === 32;
|
|
|
|
return nId.length === 32;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (m.length > 1) {
|
|
|
|
if (m.length > 1) {
|
|
|
|
|
|
|
|
UI.removeModals();
|
|
|
|
return void UI.alert(Messages.oo_cantUpload);
|
|
|
|
return void UI.alert(Messages.oo_cantUpload);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!content) {
|
|
|
|
if (!content) {
|
|
|
|
return void UI.alert(Messages.error); // XXX?
|
|
|
|
UI.removeModals();
|
|
|
|
|
|
|
|
return void UI.alert(Messages.oo_invalidFormat);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var blob = new Blob([content], {type: 'plain/text'});
|
|
|
|
var blob = new Blob([content], {type: 'plain/text'});
|
|
|
|
var file = getFileType();
|
|
|
|
var file = getFileType();
|
|
|
|
blob.name = (metadataMgr.getMetadataLazy().title || file.doc) + '.' + file.type;
|
|
|
|
blob.name = (metadataMgr.getMetadataLazy().title || file.doc) + '.' + file.type;
|
|
|
|
var uploadedCallback = function() {
|
|
|
|
var uploadedCallback = function() {
|
|
|
|
|
|
|
|
UI.removeModals();
|
|
|
|
UI.confirm(Messages.oo_uploaded, function (yes) {
|
|
|
|
UI.confirm(Messages.oo_uploaded, function (yes) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
window.frames[0].editor.setViewModeDisconnect();
|
|
|
|
window.frames[0].editor.setViewModeDisconnect();
|
|
|
@ -1124,6 +1140,12 @@ define([
|
|
|
|
if (ext === "bin") {
|
|
|
|
if (ext === "bin") {
|
|
|
|
return void importFile(content);
|
|
|
|
return void importFile(content);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var div = h('div.cp-oo-x2tXls', [
|
|
|
|
|
|
|
|
h('span.fa.fa-spin.fa-spinner'),
|
|
|
|
|
|
|
|
h('span', Messages.oo_importInProgress)
|
|
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
var modal = UI.openCustomModal(UI.dialog.customModal(div, {buttons: []}));
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
require(['/common/onlyoffice/x2t/x2t.js'], function() {
|
|
|
|
require(['/common/onlyoffice/x2t/x2t.js'], function() {
|
|
|
|
var x2t = window.Module;
|
|
|
|
var x2t = window.Module;
|
|
|
|
x2t.run();
|
|
|
|
x2t.run();
|
|
|
@ -1143,6 +1165,7 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}, 100);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
var loadLastDocument = function () {
|
|
|
|
var loadLastDocument = function () {
|
|
|
|