mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-02-10 18:05:10 +08:00
feat(java): close editor. Fix Bug 69915
This commit is contained in:
@ -0,0 +1,47 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2024
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package entities;
|
||||
|
||||
public class Close {
|
||||
private String text;
|
||||
private Boolean visible;
|
||||
|
||||
public Close() { }
|
||||
|
||||
public Close(final String textParam, final Boolean visibleParam) {
|
||||
this.text = textParam;
|
||||
this.visible = visibleParam;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(final String textParam) {
|
||||
this.text = textParam;
|
||||
}
|
||||
|
||||
public Boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(final Boolean visibleParam) {
|
||||
this.visible = visibleParam;
|
||||
}
|
||||
}
|
||||
@ -124,6 +124,10 @@ public class FileModel {
|
||||
.setBlank(user.getGoback().getBlank());
|
||||
}
|
||||
|
||||
if (user.getClose() != null) {
|
||||
editorConfig.getCustomization().setClose(user.getClose());
|
||||
}
|
||||
|
||||
changeType(mode, type, user, fileName);
|
||||
}
|
||||
|
||||
@ -566,6 +570,7 @@ public class FileModel {
|
||||
// customization parameters
|
||||
public class Customization {
|
||||
private Goback goback;
|
||||
private Close close;
|
||||
private Boolean forcesave;
|
||||
private Boolean submitForm;
|
||||
private Boolean about;
|
||||
@ -576,18 +581,27 @@ public class FileModel {
|
||||
this.submitForm = submitFormParam;
|
||||
}
|
||||
|
||||
public void setClose(final Close closeParam) {
|
||||
this.close = closeParam;
|
||||
}
|
||||
|
||||
public Customization() {
|
||||
about = true;
|
||||
comments = true;
|
||||
feedback = true;
|
||||
forcesave = false;
|
||||
goback = new Goback();
|
||||
close = new Close();
|
||||
}
|
||||
|
||||
public Goback getGoback() {
|
||||
return goback;
|
||||
}
|
||||
|
||||
public Close getClose() {
|
||||
return close;
|
||||
}
|
||||
|
||||
public Boolean getForcesave() {
|
||||
return forcesave;
|
||||
}
|
||||
|
||||
@ -34,12 +34,14 @@ public class User {
|
||||
private final List<String> userInfoGroups;
|
||||
private final Boolean avatar;
|
||||
private final Goback goback;
|
||||
private final Close close;
|
||||
|
||||
public User(final String idParam, final String nameParam, final String emailParam, final String groupParam,
|
||||
final List<String> reviewGroupsParam, final CommentGroups commentGroupsParam,
|
||||
final List<String> userInfoGroupsParam, final Boolean favoriteParam,
|
||||
final List<String> deniedPermissionsParam, final List<String> descriptionsParam,
|
||||
final Boolean templatesParam, final Boolean avatarParam, final Goback gobackParam) {
|
||||
final Boolean templatesParam, final Boolean avatarParam, final Goback gobackParam,
|
||||
final Close closeParam) {
|
||||
this.id = idParam;
|
||||
this.name = nameParam;
|
||||
this.email = emailParam;
|
||||
@ -53,6 +55,7 @@ public class User {
|
||||
this.userInfoGroups = userInfoGroupsParam;
|
||||
this.avatar = avatarParam;
|
||||
this.goback = gobackParam;
|
||||
this.close = closeParam;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
@ -106,4 +109,8 @@ public class User {
|
||||
public Goback getGoback() {
|
||||
return goback;
|
||||
}
|
||||
|
||||
public Close getClose() {
|
||||
return close;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
package helpers;
|
||||
|
||||
import entities.Close;
|
||||
import entities.CommentGroups;
|
||||
import entities.Goback;
|
||||
import entities.User;
|
||||
@ -88,20 +89,21 @@ public final class Users {
|
||||
private static List<User> users = new ArrayList<User>() {{
|
||||
add(new User("uid-1", "John Smith", "smith@example.com",
|
||||
"", null, new CommentGroups(), null,
|
||||
null, new ArrayList<String>(), descriptionUserFirst, true, true, new Goback(null, false)));
|
||||
null, new ArrayList<String>(), descriptionUserFirst, true, true, new Goback(null, false),
|
||||
new Close(null, false)));
|
||||
add(new User("uid-2", "Mark Pottato", "pottato@example.com",
|
||||
"group-2", Arrays.asList("group-2", ""), new CommentGroups(null,
|
||||
Arrays.asList("group-2", ""), Arrays.asList("group-2")), Arrays.asList("group-2", ""),
|
||||
true, new ArrayList<String>(), descriptionUserSecond, false, true,
|
||||
new Goback("Go to Documents", false)));
|
||||
new Goback("Go to Documents", false), new Close(null, true)));
|
||||
add(new User("uid-3", "Hamish Mitchell", null,
|
||||
"group-3", Arrays.asList("group-2"), new CommentGroups(Arrays.asList("group-3", "group-2"),
|
||||
Arrays.asList("group-2"), null), Arrays.asList("group-2"),
|
||||
false, Arrays.asList("copy", "download", "print"),
|
||||
descriptionUserThird, false, false, null));
|
||||
descriptionUserThird, false, false, null, new Close(null, true)));
|
||||
add(new User("uid-0", null, null,
|
||||
"", null, null, null,
|
||||
null, Arrays.asList("protect"), descriptionUserZero, false, false, null));
|
||||
null, Arrays.asList("protect"), descriptionUserZero, false, false, null, null));
|
||||
}};
|
||||
|
||||
private Users() { }
|
||||
|
||||
@ -96,6 +96,11 @@
|
||||
docEditor.setActionLink(replaceActionLink(location.href, linkParam)); // set the link to the document which contains a bookmark
|
||||
};
|
||||
|
||||
var onRequestClose = function () { // close editor
|
||||
docEditor.destroyEditor();
|
||||
innerAlert("Document editor closed successfully");
|
||||
};
|
||||
|
||||
// the meta information of the document is changed via the meta command
|
||||
var onMetaChange = function (event) {
|
||||
if (event.data.favorite !== undefined) {
|
||||
@ -315,6 +320,7 @@
|
||||
};
|
||||
|
||||
if (config.editorConfig.user.id) {
|
||||
config.events['onRequestClose'] = onRequestClose;
|
||||
// add mentions for not anonymous users
|
||||
config.events['onRequestUsers'] = onRequestUsers;
|
||||
config.events['onRequestSaveAs'] = onRequestSaveAs;
|
||||
|
||||
Reference in New Issue
Block a user