Merge remote-tracking branch 'origin/staging' into staging

pull/1/head
David Benqué 5 years ago
commit 7e4ceeb192

@ -8,6 +8,7 @@ www/common/jquery-ui/
www/common/onlyoffice/sdkjs www/common/onlyoffice/sdkjs
www/common/onlyoffice/web-apps www/common/onlyoffice/web-apps
www/common/onlyoffice/x2t www/common/onlyoffice/x2t
www/common/onlyoffice/v1
server.js server.js
www/common/old-media-tag.js www/common/old-media-tag.js

@ -55,6 +55,7 @@ define([
var CHECKPOINT_INTERVAL = 50; var CHECKPOINT_INTERVAL = 50;
var DISPLAY_RESTORE_BUTTON = false; var DISPLAY_RESTORE_BUTTON = false;
var NEW_VERSION = 2;
var debug = function (x) { var debug = function (x) {
if (!window.CP_DEV_MODE) { return; } if (!window.CP_DEV_MODE) { return; }
@ -79,7 +80,8 @@ define([
var content = { var content = {
hashes: {}, hashes: {},
ids: {}, ids: {},
mediasSources: {} mediasSources: {},
version: NEW_VERSION
}; };
var oldHashes = {}; var oldHashes = {};
var oldIds = {}; var oldIds = {};
@ -270,11 +272,23 @@ define([
}; };
oldHashes = JSON.parse(JSON.stringify(content.hashes)); oldHashes = JSON.parse(JSON.stringify(content.hashes));
content.saveLock = undefined; content.saveLock = undefined;
// If this is a migration, set the new version
if (APP.migrate) {
delete content.migration;
content.version = NEW_VERSION;
}
APP.onLocal(); APP.onLocal();
APP.realtime.onSettle(function () { APP.realtime.onSettle(function () {
fixSheets(); fixSheets();
UI.log(Messages.saved); UI.log(Messages.saved);
APP.realtime.onSettle(function () { APP.realtime.onSettle(function () {
if (APP.migrate) {
UI.removeModals();
UI.alert(Messages.oo_sheetMigration_complete, function () {
common.gotoURL();
});
return;
}
if (ev.callback) { if (ev.callback) {
return void ev.callback(); return void ev.callback();
} }
@ -313,6 +327,7 @@ define([
APP.FM.handleFile(blob, data); APP.FM.handleFile(blob, data);
}; };
var makeCheckpoint = function (force) { var makeCheckpoint = function (force) {
if (!common.isLoggedIn()) { return; }
var locked = content.saveLock; var locked = content.saveLock;
if (!locked || !isUserOnline(locked) || force) { if (!locked || !isUserOnline(locked) || force) {
content.saveLock = myOOId; content.saveLock = myOOId;
@ -520,6 +535,16 @@ define([
type: "documentOpen", type: "documentOpen",
data: {"type":"open","status":"ok","data":{"Editor.bin":obj.openCmd.url}} data: {"type":"open","status":"ok","data":{"Editor.bin":obj.openCmd.url}}
}); });
if (APP.migrate && !readOnly) {
var div = h('div.cp-oo-x2tXls', [
h('span.fa.fa-spin.fa-spinner'),
h('span', Messages.oo_sheetMigration_loading)
]);
UI.openCustomModal(UI.dialog.customModal(div, {buttons: []}));
setTimeout(function () {
makeCheckpoint(true);
}, 1000);
}
// Update current index // Update current index
var last = ooChannel.queue.pop(); var last = ooChannel.queue.pop();
if (last) { ooChannel.lastHash = last.hash; } if (last) { ooChannel.lastHash = last.hash; }
@ -696,7 +721,7 @@ define([
var startOO = function (blob, file) { var startOO = function (blob, file) {
if (APP.ooconfig) { return void console.error('already started'); } if (APP.ooconfig) { return void console.error('already started'); }
var url = URL.createObjectURL(blob); var url = URL.createObjectURL(blob);
var lock = readOnly;// || !common.isLoggedIn(); var lock = readOnly || APP.migrate;
// Config // Config
APP.ooconfig = { APP.ooconfig = {
@ -748,7 +773,13 @@ define([
'#file-menu-panel { top: 28px !important; }' + // Position of the "File" menu '#file-menu-panel { top: 28px !important; }' + // Position of the "File" menu
'#left-btn-spellcheck, #left-btn-about { display: none !important; }'+ '#left-btn-spellcheck, #left-btn-about { display: none !important; }'+
'div.btn-users.dropdown-toggle { display: none; !important }'; 'div.btn-users.dropdown-toggle { display: none; !important }';
if (readOnly) {
css += '#toolbar { display: none !important; }';
}
$('<style>').text(css).appendTo($tb); $('<style>').text(css).appendTo($tb);
setTimeout(function () {
$(window).trigger('resize');
});
if (UI.findOKButton().length) { if (UI.findOKButton().length) {
UI.findOKButton().on('focusout', function () { UI.findOKButton().on('focusout', function () {
window.setTimeout(function () { UI.findOKButton().focus(); }); window.setTimeout(function () { UI.findOKButton().focus(); });
@ -1360,7 +1391,7 @@ define([
}); });
$rightside.append($forget); $rightside.append($forget);
var helpMenu = common.createHelpMenu(['beta', 'oo']); var helpMenu = APP.helpMenu = common.createHelpMenu(['beta', 'oo']);
$('#cp-app-oo-editor').prepend(common.getBurnAfterReadingWarning()); $('#cp-app-oo-editor').prepend(common.getBurnAfterReadingWarning());
$('#cp-app-oo-editor').prepend(helpMenu.menu); $('#cp-app-oo-editor').prepend(helpMenu.menu);
toolbar.$drawer.append(helpMenu.button); toolbar.$drawer.append(helpMenu.button);
@ -1402,6 +1433,28 @@ define([
Title.updateTitle(Title.defaultTitle); Title.updateTitle(Title.defaultTitle);
} }
var version = '';
// Old version detected: use the old OO and start the migration if we can
if (content && !content.version) {
version = 'v1/';
APP.migrate = true;
// Registedred users can start the migration
if (common.isLoggedIn()) {
content.migration = true;
APP.onLocal();
} else {
var msg = h('div.alert.alert-warning.cp-burn-after-reading', Messages.oo_sheetMigration_anonymousEditor);
$(APP.helpMenu.menu).after(msg);
readOnly = true;
}
}
var s = h('script', {
type:'text/javascript',
src: '/common/onlyoffice/'+version+'web-apps/apps/api/documents/api.js'
});
$('#cp-app-oo-editor').append(s);
if (metadataMgr.getPrivateData().burnAfterReading && content && content.channel) { if (metadataMgr.getPrivateData().burnAfterReading && content && content.channel) {
sframeChan.event('EV_BURN_PAD', content.channel); sframeChan.event('EV_BURN_PAD', content.channel);
} }
@ -1423,6 +1476,7 @@ define([
}); });
}; };
var reloadPopup = false;
config.onRemote = function () { config.onRemote = function () {
if (initializing) { return; } if (initializing) { return; }
var userDoc = APP.realtime.getUserDoc(); var userDoc = APP.realtime.getUserDoc();
@ -1430,6 +1484,9 @@ define([
if (json.metadata) { if (json.metadata) {
metadataMgr.updateMetadata(json.metadata); metadataMgr.updateMetadata(json.metadata);
} }
var wasMigrating = content.migration;
content = json.content; content = json.content;
if (content.hashes) { if (content.hashes) {
var latest = getLastCp(true); var latest = getLastCp(true);
@ -1451,6 +1508,15 @@ define([
handleNewLocks(oldLocks, content.locks); handleNewLocks(oldLocks, content.locks);
oldLocks = JSON.parse(JSON.stringify(content.locks)); oldLocks = JSON.parse(JSON.stringify(content.locks));
} }
if (content.migration) {
setEditable(false);
}
if (wasMigrating && !content.migration && !reloadPopup) {
reloadPopup = true;
UI.alert(Messages.oo_sheetMigration_complete, function () {
common.gotoURL();
});
}
pinImages(); pinImages();
}; };

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

@ -0,0 +1,110 @@
@charset "UTF-8";
/*
* Worksheet canvas
* --------------------------------------------------------
*/
#ws-canvas-outer {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
}
#ws-canvas {
border: 0;
}
#ws-canvas-overlay, #ws-canvas-graphic, #ws-canvas-graphic-overlay {
border: 0;
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
/*
* Worksheet scroll bars
* --------------------------------------------------------
*/
#ws-v-scrollbar {
position: absolute;
right: 0;
width: 19px;
top: -1px;
bottom: 18px;
overflow: hidden;
z-index: 10;
}
#ws-v-scroll-helper {
width: 1px;
}
#ws-h-scrollbar {
position: absolute;
bottom: 0;
height: 19px;
left: 0;
right: 18px;
overflow: hidden;
z-index: 10;
}
#ws-h-scroll-helper {
height: 1px;
}
#ws-scrollbar-corner {
position: absolute;
right: 0;
bottom: 0;
width: 18px;
height: 18px;
background-color: #DCE2E8;
border: 0;
z-index: 10;
}
/* Scrollbars common */
#ws-v-scrollbar .jspVerticalBar,
#ws-h-scrollbar .jspHorizontalBar,
#ws-v-scrollbar .jspTrack,
#ws-h-scrollbar .jspTrack {
background-color: #DCE2E8;
}
#ws-v-scrollbar .jspDrag,
#ws-h-scrollbar .jspDrag {
background-color: #C0C0C0;
}
#ws-v-scrollbar .jspDrag.jspHover,
#ws-v-scrollbar .jspDrag.jspActive,
#ws-h-scrollbar .jspDrag.jspHover,
#ws-h-scrollbar .jspDrag.jspActive {
background-color: #808080;
}
/* Vertical scrollbar */
#ws-v-scrollbar .jspVerticalBar {
width: 7px;
border-left: 1px solid #C1C6CC;
}
#ws-v-scrollbar .jspTrack {
width: 8px;
}
/* Horizontal scrollbar */
#ws-h-scrollbar .jspHorizontalBar {
height: 7px;
border-top: 1px solid #C1C6CC;
}
#ws-h-scrollbar .jspTrack {
height: 8px;
}

@ -0,0 +1,156 @@
@charset "UTF-8";
/*
* Worksheet canvas
* --------------------------------------------------------
*/
#ws-canvas-outer {
position: absolute;
left: 0;
top: 0;
right: 14px;
bottom: 14px;
overflow: hidden;
}
#ws-canvas {
border: 0;
-webkit-user-select: none;
}
#ws-canvas-overlay, #ws-canvas-graphic, #ws-canvas-graphic-overlay {
-webkit-user-select: none;
border: 0;
position: absolute;
left: 0;
top: 0;
z-index: 1;
}
/*
* Worksheet scroll bars
* --------------------------------------------------------
*/
#ws-v-scrollbar {
position: absolute;
right: 0;
width: 14px;
top: 0px;
bottom: 14px;
overflow: hidden;
z-index: 10;
background-color: #f1f1f1;
}
#ws-v-scroll-helper {
width: 1px;
}
#ws-h-scrollbar {
position: absolute;
bottom: 0;
height: 14px;
left: 0px;
right: 14px;
overflow: hidden;
z-index: 10;
background-color: #f1f1f1;
}
#ws-h-scroll-helper {
height: 1px;
}
#ws-scrollbar-corner {
position: absolute;
right: 0;
bottom: 0;
width: 14px;
height: 14px;
background-color: #F4F4F4;
border: 0;
z-index: 10;
}
/* Scrollbars common */
#ws-v-scrollbar .jspVerticalBar,
#ws-h-scrollbar .jspHorizontalBar,
#ws-v-scrollbar .jspTrack,
#ws-h-scrollbar .jspTrack {
background-color: #DCE2E8;
}
#ws-v-scrollbar .jspDrag,
#ws-h-scrollbar .jspDrag {
background-color: #C0C0C0;
}
#ws-v-scrollbar .jspDrag.jspHover,
#ws-v-scrollbar .jspDrag.jspActive,
#ws-h-scrollbar .jspDrag.jspHover,
#ws-h-scrollbar .jspDrag.jspActive {
background-color: #808080;
}
/* Vertical scrollbar */
#ws-v-scrollbar .jspVerticalBar {
width: 7px;
border-left: 1px solid #C1C6CC;
}
#ws-v-scrollbar .jspTrack {
width: 8px;
}
/* Horizontal scrollbar */
#ws-h-scrollbar .jspHorizontalBar {
height: 7px;
border-top: 1px solid #C1C6CC;
}
#ws-h-scrollbar .jspTrack {
height: 8px;
}
/*
* Cell editor
* --------------------------------------------------------
*/
#ce-canvas-outer {
position: absolute;
border: 0;
overflow: hidden;
}
#ce-canvas,
#ce-canvas-overlay {
border: 0;
position: absolute;
left: 0;
top: 0;
}
#ce-cursor {
position: absolute;
background-color: #000;
width: 1px;
height: 11pt;
cursor: text;
}
#apiPopUpSelector {
position: absolute;
}
#apiPopUpList {
width: 100%;
height: 100%;
max-height: 210px;
overflow: hidden;
position: relative;
}
#apiPopUpList li {
max-width: 500px;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 358 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

@ -0,0 +1,17 @@
plus.png
x:6 y:6
plus_2x.png
x:12 y:12
plus_copy.png
x:6 y:12
plus_copy_2x.png
x:12 y:25
text_copy.png
x:2 y:11
text_copy_2x.png
x:5 y:23

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save