Merge branch 'staging' into remove-triple-dot-button-drive-mobile

This commit is contained in:
yflory 2025-06-13 16:39:32 +02:00
commit 0e49b96686
10 changed files with 32 additions and 53 deletions

3
.gitignore vendored
View File

@ -35,6 +35,9 @@ www/common/onlyoffice/v*
www/common/worker.bundle.js
_build
FUNDING.json
funding.json
# ---> Node
# Logs
logs

View File

@ -2830,7 +2830,6 @@ define([
var selected = 0; // Selected template in the list (highlighted)
var TEMPLATES_DISPLAYED = big ? 6 : 3; // Max templates displayed per page
var next = function () {}; // Function called when pressing tab to highlight the next template
var i = 0; // Index of the first template displayed in the current page
sframeChan.query("Q_CREATE_TEMPLATES", type, function (err, res) {
if (!res.data || !Array.isArray(res.data)) {
@ -2939,27 +2938,6 @@ define([
redraw(0);
}
// Change template selection when Tab is pressed
next = function (revert) {
var max = $creation.find('.cp-creation-template-element').length;
if (selected + 1 === max && !revert) {
selected = i + TEMPLATES_DISPLAYED < allData.length ? 0 : max;
return void redraw(i + TEMPLATES_DISPLAYED);
}
if (selected === 0 && revert) {
selected = i - TEMPLATES_DISPLAYED >= 0 ? TEMPLATES_DISPLAYED - 1 : 0;
return void redraw(i - TEMPLATES_DISPLAYED);
}
selected = revert ?
(--selected < 0 ? 0 : selected) :
++selected >= max ? max-1 : selected;
$creation.find('.cp-creation-template-element')
.removeClass('cp-creation-template-selected');
$($creation.find('.cp-creation-template-element').get(selected))
.addClass('cp-creation-template-selected');
};
$w.on('resize', function () {
var _big = $w.width() > 800;
if (big === _big) { return; }

View File

@ -1181,7 +1181,6 @@ define([
return;
}
let rtChannel, lastVersion, answersChannel;
let attributes = {};
nThen(function (waitFor) {
if (parsed.hashData.type !== 'pad') { return; }

View File

@ -306,6 +306,10 @@ define([
return;
}
delete hashes[lastIndex];
APP.onLocal();
APP.realtime.onSettle(function () {
UI.log(Messages.saved);
});
};
var rtChannel = {
@ -642,20 +646,6 @@ define([
});
}
};
var deleteLastCp = function () {
var hashes = content.hashes;
if (!hashes || !Object.keys(hashes).length) { return; }
var i = 0;
var idx = Object.keys(hashes).map(Number).sort(function (a, b) {
return a-b;
});
var lastIndex = idx[idx.length - 1 - i];
delete content.hashes[lastIndex];
APP.onLocal();
APP.realtime.onSettle(function () {
UI.log(Messages.saved);
});
};
var restoreLastCp = function () {
content.saveLock = myOOId;
APP.onLocal();
@ -2136,6 +2126,19 @@ define([
}
};
const copy = (a, b) => {
Object.keys(b).forEach(k => {
if (k === "user") { return; } // Don't change user values
if (a[k]) {
if (typeof(a[k]) === "object" && typeof(b[k]) === "object") {
copy(a[k], b[k]);
}
return;
}
a[k] = b[k];
});
};
const createOOConfig = function(blob, file, lock, fromContent, lang, force) {
const url = URL.createObjectURL(blob);
let username = Util.find(privateData, ['integrationConfig', 'user', 'name'])
@ -2185,18 +2188,6 @@ define([
}
};
let copy = (a, b) => {
Object.keys(b).forEach(k => {
if (k === "user") { return; } // Don't change user values
if (a[k]) {
if (typeof(a[k]) === "object" && typeof(b[k]) === "object") {
copy(a[k], b[k]);
}
return;
}
a[k] = b[k];
});
};
if (integrationConfig) {
let ec = integrationConfig.editorConfig;
let c = ooconfig.editorConfig.customization;

View File

@ -776,8 +776,13 @@ define([
};
var setFileImporter = function (options, fi, async) {
if (readOnly) { return; }
const priv = cpNfInner.metadataMgr.getPrivateData();
const isReadOnlyIntegration = priv.isNewFile &&
Boolean(priv.integrationConfig) &&
priv.initialState;
if (readOnly && !isReadOnlyIntegration) { return; }
fileImporter = function (c, f) {
console.error(state, STATE.READY, unsyncMode);
if (state !== STATE.READY || unsyncMode) {
return void UI.warn(Messages.disconnected);
}

View File

@ -799,7 +799,7 @@ define([
origin: window.location.origin,
pathname: window.location.pathname,
fileHost: ApiConfig.fileHost,
readOnly: readOnly,
readOnly: cfg?.integrationConfig?.readOnly || readOnly,
isTemplate: isTemplate,
newTemplate: Array.isArray(Cryptpad.initialPath)
&& Cryptpad.initialPath[0] === "template",

View File

@ -427,7 +427,7 @@ MessengerUI, Messages, Pages, PadTypes) {
$span.append($rightCol);
}, data.uid);
$span.data('uid', data.uid);
if (false && data.badge && data.edPublic) { // XXX 2025.6
if (data.badge && data.edPublic) {
const addBadge = (badge) => {
let i = Badges.render(badge);
if (!i) { return; }

View File

@ -135,6 +135,7 @@
document: blob,
ext: config.document.fileType,
autosave: config.events.onSave && (config.autosave || 10),
readOnly: config.mode === 'view',
editorConfig: config.editorConfig || {},
_config: serializedConfig()
}, function (obj) {
@ -269,6 +270,7 @@
* @param {function} events.onNewKey (data, callback) The function called when a new key is used.
* @param {function} events.onInsertImage (data, callback) The function called the user wants to add an image.
* @param {string} config.documentType The editor to load in CryptPad.
* @param {string} config.mode The editing state of the document to load ("view" or "edit", defaults to edit).
* @return {promise}
*/
var init = function (cryptpadURL, containerId, config) {

View File

@ -240,6 +240,7 @@ define([
href: href,
initialState: blob,
config: {
readOnly: data.readOnly,
fileName: data.name,
fileType: data.ext,
autosave: data.autosave,

View File

@ -654,7 +654,7 @@ define([
addLink($rightside);
addFriendRequest($rightside);
addMuteButton($rightside);
//addBadges($rightside); // XXX 2025.6
addBadges($rightside);
addPublicKey($rightside);
addCopyData($rightside);
addViewButton($rightside);