Web: Added new editor.requestClose param to client config
(cherry picked from commit 70a18018c3104f9d400fa53a57f37eb9bdbc6d71)
This commit is contained in:
parent
b911f0aa19
commit
f40940f73c
@ -594,6 +594,28 @@ function Editor({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onSDKRequestClose = () => {
|
||||||
|
const backUrl = getBackUrl();
|
||||||
|
window.location.replace(backUrl);
|
||||||
|
};
|
||||||
|
|
||||||
|
const getBackUrl = () => {
|
||||||
|
if (!fileInfo) return;
|
||||||
|
|
||||||
|
let backUrl = "";
|
||||||
|
|
||||||
|
if (fileInfo.rootFolderType === FolderType.Rooms) {
|
||||||
|
backUrl = `/rooms/shared/${fileInfo.folderId}/filter?folder=${fileInfo.folderId}`;
|
||||||
|
} else {
|
||||||
|
backUrl = `/rooms/personal/filter?folder=${fileInfo.folderId}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const url = window.location.href;
|
||||||
|
const origin = url.substring(0, url.indexOf("/doceditor"));
|
||||||
|
|
||||||
|
return `${combineUrl(origin, backUrl)}`;
|
||||||
|
};
|
||||||
|
|
||||||
const init = () => {
|
const init = () => {
|
||||||
try {
|
try {
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
@ -601,20 +623,9 @@ function Editor({
|
|||||||
}
|
}
|
||||||
|
|
||||||
let goBack;
|
let goBack;
|
||||||
const url = window.location.href;
|
|
||||||
const search = window.location.search;
|
const search = window.location.search;
|
||||||
|
|
||||||
if (fileInfo) {
|
if (fileInfo) {
|
||||||
let backUrl = "";
|
|
||||||
|
|
||||||
if (fileInfo.rootFolderType === FolderType.Rooms) {
|
|
||||||
backUrl = `/rooms/shared/${fileInfo.folderId}/filter?folder=${fileInfo.folderId}`;
|
|
||||||
} else {
|
|
||||||
backUrl = `/rooms/personal/filter?folder=${fileInfo.folderId}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const origin = url.substring(0, url.indexOf("/doceditor"));
|
|
||||||
|
|
||||||
const editorGoBack = new URLSearchParams(search).get("editorGoBack");
|
const editorGoBack = new URLSearchParams(search).get("editorGoBack");
|
||||||
|
|
||||||
goBack =
|
goBack =
|
||||||
@ -622,10 +633,15 @@ function Editor({
|
|||||||
? {}
|
? {}
|
||||||
: {
|
: {
|
||||||
blank: window.DocSpaceConfig?.editor?.openOnNewPage ?? true,
|
blank: window.DocSpaceConfig?.editor?.openOnNewPage ?? true,
|
||||||
requestClose: false,
|
requestClose:
|
||||||
|
window.DocSpaceConfig?.editor?.requestClose ?? false,
|
||||||
text: t("FileLocation"),
|
text: t("FileLocation"),
|
||||||
url: `${combineUrl(origin, backUrl)}`,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!window.DocSpaceConfig?.editor?.requestClose) {
|
||||||
|
goBack.blank = window.DocSpaceConfig?.editor?.openOnNewPage ?? true;
|
||||||
|
goBack.url = getBackUrl();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config.editorConfig.customization = {
|
config.editorConfig.customization = {
|
||||||
@ -642,6 +658,8 @@ function Editor({
|
|||||||
// config.document.info.favorite = null;
|
// config.document.info.favorite = null;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
const url = window.location.href;
|
||||||
|
|
||||||
if (url.indexOf("anchor") !== -1) {
|
if (url.indexOf("anchor") !== -1) {
|
||||||
const splitUrl = url.split("anchor=");
|
const splitUrl = url.split("anchor=");
|
||||||
const decodeURI = decodeURIComponent(splitUrl[1]);
|
const decodeURI = decodeURIComponent(splitUrl[1]);
|
||||||
@ -663,7 +681,8 @@ function Editor({
|
|||||||
onRequestReferenceData,
|
onRequestReferenceData,
|
||||||
onRequestUsers,
|
onRequestUsers,
|
||||||
onRequestSendNotify,
|
onRequestSendNotify,
|
||||||
onRequestCreateNew;
|
onRequestCreateNew,
|
||||||
|
onRequestClose;
|
||||||
|
|
||||||
if (successAuth && !user.isVisitor) {
|
if (successAuth && !user.isVisitor) {
|
||||||
if (
|
if (
|
||||||
@ -726,6 +745,10 @@ function Editor({
|
|||||||
onRequestSendNotify = onSDKRequestSendNotify;
|
onRequestSendNotify = onSDKRequestSendNotify;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (window.DocSpaceConfig?.editor?.requestClose) {
|
||||||
|
onRequestClose = onSDKRequestClose;
|
||||||
|
}
|
||||||
|
|
||||||
const events = {
|
const events = {
|
||||||
events: {
|
events: {
|
||||||
onRequestReferenceData,
|
onRequestReferenceData,
|
||||||
@ -751,6 +774,7 @@ function Editor({
|
|||||||
onRequestUsers,
|
onRequestUsers,
|
||||||
onRequestSendNotify,
|
onRequestSendNotify,
|
||||||
onRequestCreateNew,
|
onRequestCreateNew,
|
||||||
|
onRequestClose,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"wrongPortalNameUrl": "https://teamlab.info/wrongportalname.aspx?Site_Testing=4testing",
|
"wrongPortalNameUrl": "https://teamlab.info/wrongportalname.aspx?Site_Testing=4testing",
|
||||||
"thumbnails1280x720": false,
|
"thumbnails1280x720": false,
|
||||||
"editor": {
|
"editor": {
|
||||||
"openOnNewPage": false
|
"openOnNewPage": false,
|
||||||
|
"requestClose": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user