Merge branch 'insert-onlyoffice-api' into 2025.3.1-rc

This commit is contained in:
yflory 2025-05-13 18:23:21 +02:00
commit ba7db13499
7 changed files with 161 additions and 156 deletions

View File

@ -4,6 +4,11 @@ SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and cont
SPDX-License-Identifier: AGPL-3.0-or-later
-->
# Release (2025.3.1)
> [!NOTE]
> The new version of OnlyOffice is much bigger than the previous versions. When installing version 8.3 with `install-onlyoffice.sh` ~830MB additional disk space is needed.
# 💐 Spring 2025 release (2025.3.0)
## Goals

View File

@ -140,7 +140,6 @@ define(req, function(AppConfig, Default, Language) {
Messages.badges_premium = "Premium user";
Messages.badges_error = "Error while validating this user's data";
Messages.profile_badges = "Badges";
return Messages;
});

View File

@ -18,7 +18,7 @@ main() {
# clean build env in case a previous build has failed
rm -rf "$BUILDS_DIR"
mkdir -p "$CONF_DIR"
load_props
@ -32,70 +32,14 @@ main() {
set_prop oldest_needed_version v1
mkdir -p "$OO_DIR"
echo "Do you want to install all available OnlyOffice versions? (Y/N)"
read -r install_all
declare -a selected_versions
if [[ "$install_all" =~ ^[Yy] ]]; then
selected_versions=(v1 v2b v4 v5 v6 v7 v8 x2t)
else
echo "Select which versions to install (space-separated), options are:"
echo " v1 v2b v4 v5 v6 v7 v8 x2t"
read -ra selected_versions
fi
for version in "${selected_versions[@]}"; do
case $version in
v1)
set_prop oldest_needed_version v1; install_old_version v1 4f370beb
# We delete 'help' from previous versions as they are useless and take up storage
rm -rf "$OO_DIR/v1/web-apps/apps/documenteditor/main/resources/help"
rm -rf "$OO_DIR/v1/web-apps/apps/presentationeditor/main/resources/help"
rm -rf "$OO_DIR/v1/web-apps/apps/spreadsheeteditor/main/resources/help"
;;
v2b)
install_old_version v2b d9da72fd
rm -rf "$OO_DIR/v2b/web-apps/apps/documenteditor/main/resources/help"
rm -rf "$OO_DIR/v2b/web-apps/apps/presentationeditor/main/resources/help"
rm -rf "$OO_DIR/v2b/web-apps/apps/spreadsheeteditor/main/resources/help"
;;
v4)
install_old_version v4 6ebc6938
rm -rf "$OO_DIR/v4/web-apps/apps/documenteditor/main/resources/help"
rm -rf "$OO_DIR/v4/web-apps/apps/presentationeditor/main/resources/help"
rm -rf "$OO_DIR/v4/web-apps/apps/spreadsheeteditor/main/resources/help"
;;
v5)
install_old_version v5 88a356f0
rm -rf "$OO_DIR/v5/web-apps/apps/documenteditor/main/resources/help"
rm -rf "$OO_DIR/v5/web-apps/apps/presentationeditor/main/resources/help"
rm -rf "$OO_DIR/v5/web-apps/apps/spreadsheeteditor/main/resources/help"
;;
v6)
install_old_version v6 abd8a309
rm -rf "$OO_DIR/v6/web-apps/apps/documenteditor/main/resources/help"
rm -rf "$OO_DIR/v6/web-apps/apps/presentationeditor/main/resources/help"
rm -rf "$OO_DIR/v6/web-apps/apps/spreadsheeteditor/main/resources/help"
;;
v7)
install_version v7 v7.3.3.60+10 be3c926d534b0c77aa1ed83b170a38b9e56ebbbfd73a1a968f523d63c5ed69ecdb063fad08740812de82c1e79af7309faf67ffdd81b45451adce539192f3414c
rm -rf "$OO_DIR/v7/web-apps/apps/documenteditor/main/resources/help"
rm -rf "$OO_DIR/v7/web-apps/apps/presentationeditor/main/resources/help"
rm -rf "$OO_DIR/v7/web-apps/apps/spreadsheeteditor/main/resources/help"
rm -rf "$OO_DIR/v7/web-apps/apps/common/main/resources/help/"
# From all the older versions only v7 has 'dictionaries', we remove it for the same reasons
rm -rf "$OO_DIR/v7/dictionaries/"
;;
v8) install_version v8 v8.3.0.83+3 fbf77671ea8b960b6c65fdad025980894dfc9ed0b79d9540951f56c79871d0bde3361f29a35b9653764f7802ec74df01601b6c9961e0f3118988422667563470 ;;
x2t) install_x2t v7.3+1 ab0c05b0e4c81071acea83f0c6a8e75f5870c360ec4abc4af09105dd9b52264af9711ec0b7020e87095193ac9b6e20305e446f2321a541f743626a598e5318c1 ;;
*)
echo "Unknown version: $version"
exit 1
;;
esac
done
install_old_version v1 4f370beb
install_old_version v2b d9da72fd
install_old_version v4 6ebc6938
install_old_version v5 88a356f0
install_old_version v6 abd8a309
install_version v7 v7.3.3.60+10 be3c926d534b0c77aa1ed83b170a38b9e56ebbbfd73a1a968f523d63c5ed69ecdb063fad08740812de82c1e79af7309faf67ffdd81b45451adce539192f3414c
install_version v8 v8.3.3.23+1 b9647468ef26c915788da3b2528e0496ba5fa78d5e7acb85eca11241cc325478d94f5508fdcf085b42adf0cad8eda830d71be87c58918d1f01a86c979da6f4e5
install_x2t v7.3+1 ab0c05b0e4c81071acea83f0c6a8e75f5870c360ec4abc4af09105dd9b52264af9711ec0b7020e87095193ac9b6e20305e446f2321a541f743626a598e5318c1
rm -rf "$BUILDS_DIR"

View File

@ -727,6 +727,36 @@ define([
};
};
UI.alertPromise = function (msg, opt) {
return new Promise((resolve) => {
UI.alert(msg, resolve, opt);
});
};
/**
* @callback promptCallback
* @param {string} value - the value the user chose
*/
/**
* Optional parameters for UI.prompt()
* @typedef {Object} PromptParams
* @property {boolean} [password] - if true: ask the user for a password
* @property {Element} [typeInput] - if set: add a dropdown next to the text input field (create it with UIElements.createDropdown())
* @property {Object} [inputOpts] - parameters for dialog.textInput()
* @property {string} [ok] - caption for the OK button
* @property {string} [cancel] - caption for the cancel button
*/
/**
* Show a popup to ask something.
*
* @param {(string|Element)} [msg] - Message/title to show
* @param {string} [def] - the default value
* @param {promptCallback} [cb] - called when the used selected a value
* @param {PromptParams} [opt] - optional settings for the prompt
* @param {boolean} [force] - if true: do not HTML escape msg
*/
UI.prompt = function (msg, def, cb, opt, force) {
cb = cb || function () {};
opt = opt || {};

View File

@ -25,6 +25,7 @@ define([
'/customize/messages.js',
'/customize/pages.js',
'/common/pad-types.js',
'/common/onlyoffice/broken-formats.js',
], function (
$,
ApiConfig,
@ -45,7 +46,8 @@ define([
AppConfig,
Messages,
Pages,
PadTypes)
PadTypes,
BrokenFormats)
{
var APP = window.APP = {
@ -1652,15 +1654,15 @@ define([
if (($(e.target).offset().top + $(e.target).height()) > ($(window).height()-$menu.height())) {
if ( $(e.target).offset().top < $menu.height()) {
menuPositionTop = 0;
} else {
menuPositionTop = ($(e.target).offset().top - $menu.height());
}
menuPositionTop = ($(e.target).offset().top - $menu.height());
}
} else {
menuPositionTop = $(e.target).offset().top + $(e.target).outerHeight();
}
if (($(e.target).offset().left + $(e.target).width()) < $menu.width()) {
menuPositionLeft = $(e.target).offset().left;
menuPositionLeft = $(e.target).offset().left;
} else {
menuPositionLeft = $(e.target).offset().left - ($menu.width() - $(e.target).width()) + 10;
}
@ -4841,7 +4843,7 @@ define([
});
};
var openInApp = function (paths, app) {
var openInApp = async function (paths, app) {
var p = paths[0];
var el = manager.find(p.path);
var path = currentPath;
@ -4854,6 +4856,12 @@ define([
password: _metadata.password,
channel: _metadata.channel,
};
const ext = _simpleData.title.split('.').pop();
if (BrokenFormats.brokenImportFormats.includes(ext)) {
await UI.alertPromise(Messages.oo_unstableMigrationWarning);
}
openIn(app, path, APP.team, _simpleData);
};
@ -5642,4 +5650,3 @@ define([
logError: logError
};
});

View File

@ -0,0 +1,9 @@
// SPDX-FileCopyrightText: 2023 XWiki CryptPad Team <contact@cryptpad.org> and contributors
//
// SPDX-License-Identifier: AGPL-3.0-or-later
define({
brokenExportFormats: ['odt', 'odp'],
brokenImportFormats: ['odp'],
});

View File

@ -24,6 +24,7 @@ define([
'/common/onlyoffice/ooslide_base.js',
'/common/onlyoffice/current-version.js',
'/common/onlyoffice/broken-formats.js',
'/components/file-saver/FileSaver.min.js',
'css!/components/bootstrap/dist/css/bootstrap.min.css',
@ -49,7 +50,8 @@ define([
EmptyCell,
EmptyDoc,
EmptySlide,
OOCurrentVersion)
OOCurrentVersion,
BrokenFormats)
{
var saveAs = window.saveAs;
var APP = window.APP = {
@ -63,7 +65,6 @@ define([
var PENDING_TIMEOUT = 30000;
const HISTORY_KEEPER_INDEX_USER = 1;
const READ_ONLY_INDEX_USER = 2;
//var READONLY_REFRESH_TO = 15000;
var debug = function (x, type) {
@ -1598,8 +1599,8 @@ define([
mediasData: mediasData
}, function (err, obj) {
if (err || !obj || !obj.data) {
UI.warn(Messages.error);
return void cb();
UI.alert(Messages.oo_couldNotConvertDocument, cb);
return;
}
cb(obj.data, obj.images);
}, {
@ -1962,82 +1963,7 @@ define([
APP.UploadImageFiles = function (files, type, id, jwt, cb) {
return void cb();
};
APP.AddImage = function(cb1, cb2) {
APP.AddImageSuccessCallback = cb1;
APP.AddImageErrorCallback = cb2;
common.openFilePicker({
types: ['file'],
where: ['root'],
filter: {
fileType: ['image/']
}
}, function (data) {
if (data.type !== 'file') {
debug("Unexpected data type picked " + data.type);
return;
}
var name = data.name;
// Add image to the list
var mediasSources = getMediasSources();
// Check if name already exists
var getUniqueName = function (name, mediasSources) {
var get = function () {
var s = name.split('.');
if (s.length > 1) {
s[s.length - 2] = s[s.length - 2] + '-' + Util.uid();
name = s.join('.');
} else {
name += '-'+ Util.uid();
}
};
while (mediasSources[name]) { get(); }
return name;
};
if (mediasSources[name]) {
name = getUniqueName(name, mediasSources);
data.name = name;
}
mediasSources[name] = data;
APP.onLocal();
APP.realtime.onSettle(function () {
getImageURL(name).then(function(url) {
debug("CRYPTPAD success add " + name);
common.setPadAttribute('atime', +new Date(), null, data.href);
APP.AddImageSuccessCallback({
name: name,
url: url
});
});
});
});
};
APP.remoteTheme = function () {
/*
APP.themeRemote = true;
*/
};
APP.changeTheme = function (/*id*/) {
/*
// disabled:
Uncaught TypeError: Cannot read property 'calculatedType' of null
at CPresentation.changeTheme (sdk-all.js?ver=4.11.0-1633612942653-1633619288217:15927)
*/
/*
APP.themeChanged = {
id: id
};
*/
};
APP.openURL = function (url) {
common.openUnsafeURL(url);
};
APP.loadingImage = 0;
const getImageURL = function(name) {
return new Promise((resolve) => {
if (name && /^data:image/.test(name)) {
@ -2130,6 +2056,82 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
});
};
APP.AddImage = function(cb1, cb2) {
APP.AddImageSuccessCallback = cb1;
APP.AddImageErrorCallback = cb2;
common.openFilePicker({
types: ['file'],
where: ['root'],
filter: {
fileType: ['image/']
}
}, function (data) {
if (data.type !== 'file') {
debug("Unexpected data type picked " + data.type);
return;
}
var name = data.name;
// Add image to the list
var mediasSources = getMediasSources();
// Check if name already exists
var getUniqueName = function (name, mediasSources) {
var get = function () {
var s = name.split('.');
if (s.length > 1) {
s[s.length - 2] = s[s.length - 2] + '-' + Util.uid();
name = s.join('.');
} else {
name += '-'+ Util.uid();
}
};
while (mediasSources[name]) { get(); }
return name;
};
if (mediasSources[name]) {
name = getUniqueName(name, mediasSources);
data.name = name;
}
mediasSources[name] = data;
APP.onLocal();
APP.realtime.onSettle(function () {
getImageURL(name).then(function(url) {
debug("CRYPTPAD success add " + name);
common.setPadAttribute('atime', +new Date(), null, data.href);
APP.AddImageSuccessCallback({
name: name,
url: url
});
});
});
});
};
APP.remoteTheme = function () {
/*
APP.themeRemote = true;
*/
};
APP.changeTheme = function (/*id*/) {
/*
// disabled:
Uncaught TypeError: Cannot read property 'calculatedType' of null
at CPresentation.changeTheme (sdk-all.js?ver=4.11.0-1633612942653-1633619288217:15927)
*/
/*
APP.themeChanged = {
id: id
};
*/
};
APP.openURL = function (url) {
common.openUnsafeURL(url);
};
APP.loadingImage = 0;
// Always hide right menu
try {
localStorage?.original?.removeItem('sse-hide-right-settings');
@ -2185,7 +2187,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
saveAs(blob, finalFilename);
return;
}
UI.warn(Messages.error);
UI.alert(Messages.oo_couldNotConvertDocument);
});
};
@ -2230,7 +2232,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
warning
]);
UI.prompt(promptMessage, Util.fixFileName(suggestion), function (filename) {
UI.prompt(promptMessage, Util.fixFileName(suggestion), async function (filename) {
// $select.getValue()
if (!(typeof(filename) === 'string' && filename)) { return; }
var ext = ($select.getValue() || '').slice(1);
@ -2240,6 +2242,10 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
return;
}
if (BrokenFormats.brokenExportFormats.includes(ext)) {
await UI.alertPromise(Messages.oo_unstableMigrationWarning);
}
var content = h('div.cp-oo-x2tXls', [
h('span.fa.fa-spin.fa-spinner'),
h('span', Messages.oo_exportInProgress)
@ -2335,7 +2341,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
if (!content) {
UI.removeModals();
return void UI.alert(Messages.oo_invalidFormat);
   }
}
var blob = new Blob([content], {type: 'plain/text'});
var file = getFileType();
blob.name = (metadataMgr.getMetadataLazy().title || file.doc) + '.' + file.type;
@ -2357,10 +2363,15 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null
APP.FM.handleFile(blob, data);
};
var importXLSXFile = function(content, filename, ext) {
var importXLSXFile = async function(content, filename, ext) {
// Perform the x2t conversion
debug("Filename");
debug(filename);
if (BrokenFormats.brokenImportFormats.includes(ext)) {
await UI.alertPromise(Messages.oo_unstableMigrationWarning);
}
if (ext === "bin") {
return void importFile(content);
}