Merge branch 'develop' into feature/remove-history-close-restore

This commit is contained in:
Rina Taygunova
2023-12-15 18:16:04 +03:00
committed by GitHub
9 changed files with 315 additions and 289 deletions

View File

@ -258,6 +258,43 @@
document.location.reload();
}
var onRequestUsers = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "protect":
var users = {{ usersForProtect | safe }};
break;
case "info":
users = [];
var allUsers = {{ usersInfo | safe }};
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
default:
users = {{ usersForMentions | safe }};
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
var onRequestSendNotify = function(event) { // the user is mentioned in a comment
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
var connectEditor = function () {
config = {{ cfg | safe }}
@ -272,11 +309,7 @@
'onMetaChange': onMetaChange,
'onRequestInsertImage': onRequestInsertImage,
'onRequestSelectDocument': onRequestSelectDocument,
"onRequestSelectSpreadsheet": onRequestSelectSpreadsheet,
'onRequestRestore': onRequestRestore,
'onRequestHistory': onRequestHistory,
'onRequestHistoryData': onRequestHistoryData,
'onRequestHistoryClose': onRequestHistoryClose
"onRequestSelectSpreadsheet": onRequestSelectSpreadsheet
};
@ -288,40 +321,9 @@
if (config.editorConfig.user.id) {
// add mentions for not anonymous users
config.events['onRequestUsers'] = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = {{ usersInfo | safe }};
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = {{ usersForProtect | safe }};
break;
default:
users = {{ usersForMentions | safe }};
}
docEditor.setUsers({
"c": c,
"users": users,
})
};
config.events['onRequestUsers'] = onRequestUsers;
// the user is mentioned in a comment
config.events['onRequestSendNotify'] = function (event) {
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
config.events['onRequestSendNotify'] = onRequestSendNotify;
// prevent file renaming for anonymous users
config.events['onRequestRename'] = onRequestRename;
config.events['onRequestReferenceData'] = onRequestReferenceData;
@ -329,6 +331,10 @@
// prevent switch the document from the viewing into the editing mode for anonymous users
config.events['onRequestEditRights'] = onRequestEditRights;
config.events['onRequestOpen'] = onRequestOpen;
config.events['onRequestRestore'] = onRequestRestore;
config.events['onRequestHistory'] = onRequestHistory;
config.events['onRequestHistoryData'] = onRequestHistoryData;
config.events['onRequestHistoryClose'] = onRequestHistoryClose;
}
if (config.editorConfig.createUrl) {