mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-04-07 14:06:16 +08:00
Fill forms in embed mode
This commit is contained in:
@ -961,49 +961,52 @@
|
||||
'cell': 'spreadsheeteditor',
|
||||
'slide': 'presentationeditor',
|
||||
'pdf': 'pdfeditor',
|
||||
'checker': config.document && config.document.isForm ? 'documenteditor' :
|
||||
config.document && config.document.isForm===false ? 'pdfeditor' : 'common'
|
||||
'common': 'common'
|
||||
},
|
||||
appType = 'word';
|
||||
appType = 'word',
|
||||
type,
|
||||
fillForms = false,
|
||||
isForm = false;
|
||||
if (config.document) {
|
||||
if (typeof config.document.fileType === 'string')
|
||||
type = /^(?:(pdf)|(djvu|xps|oxps)|(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp))$/
|
||||
.exec(config.document.fileType);
|
||||
|
||||
if (typeof config.documentType === 'string') {
|
||||
appType = config.documentType.toLowerCase();
|
||||
if (config.type !== 'mobile' && config.type !== 'embedded' && !!config.document && typeof config.document.fileType === 'string') {
|
||||
var type = /^(?:(pdf)|(djvu|xps|oxps))$/.exec(config.document.fileType);
|
||||
if (type && typeof type[2] === 'string')
|
||||
appType = 'pdf';
|
||||
if (type && typeof type[1] === 'string')
|
||||
appType = 'checker';
|
||||
}
|
||||
} else if (!!config.document && typeof config.document.fileType === 'string') {
|
||||
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(pdf)|(djvu|xps|oxps))$/
|
||||
.exec(config.document.fileType);
|
||||
if (type) {
|
||||
if (typeof type[1] === 'string') appType = 'cell'; else
|
||||
if (typeof type[2] === 'string') appType = 'slide'; else
|
||||
if (typeof type[4] === 'string' && config.type !== 'mobile' && config.type !== 'embedded') appType = 'pdf'; else
|
||||
if (typeof type[3] === 'string' && config.type !== 'mobile' && config.type !== 'embedded') appType = 'checker';
|
||||
if (config.document.permissions)
|
||||
fillForms = (config.document.permissions.fillForms===undefined ? config.document.permissions.edit !== false : config.document.permissions.fillForms) &&
|
||||
config.editorConfig && (config.editorConfig.mode !== 'view');
|
||||
}
|
||||
if (type && typeof type[2] === 'string') { // djvu|xps|oxps
|
||||
appType = config.type === 'mobile' || config.type === 'embedded' ? 'word' : 'pdf';
|
||||
} else if (type && typeof type[1] === 'string') { // pdf - need check
|
||||
isForm = config.document ? config.document.isForm : undefined;
|
||||
if (config.type === 'embedded')
|
||||
appType = fillForms && isForm===undefined ? 'common' : 'word';
|
||||
else if (config.type !== 'mobile')
|
||||
appType = isForm===undefined ? 'common' : isForm ? 'word' : 'pdf';
|
||||
} else {
|
||||
if (typeof config.documentType === 'string')
|
||||
appType = config.documentType.toLowerCase();
|
||||
else {
|
||||
if (type && typeof type[3] === 'string') appType = 'cell'; else
|
||||
if (type && typeof type[4] === 'string') appType = 'slide';
|
||||
}
|
||||
}
|
||||
if (appType === 'pdf' && (config.type === 'mobile' || config.type === 'embedded')) {
|
||||
appType = 'word';
|
||||
}
|
||||
path += appMap[appType];
|
||||
|
||||
path += appMap[appType] + "/";
|
||||
const path_type = config.type === "mobile"
|
||||
? "mobile" : (config.type === "embedded")
|
||||
? "embed" : "main";
|
||||
const path_type = config.type === "mobile" ? "mobile" :
|
||||
config.type === "embedded" ? (fillForms && isForm ? "forms" : "embed") : "main";
|
||||
if (appType !== 'common')
|
||||
path += "/" + path_type;
|
||||
|
||||
path += path_type;
|
||||
var index = "/index.html";
|
||||
if (config.editorConfig && path_type!=="forms") {
|
||||
if (config.editorConfig && path_type!=="forms" && appType!=='common') {
|
||||
var customization = config.editorConfig.customization;
|
||||
if ( appType!=='checker' && typeof(customization) == 'object' && ( customization.toolbarNoTabs ||
|
||||
(config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
|
||||
if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs ||
|
||||
(config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
|
||||
index = "/index_loader.html";
|
||||
} else if (config.editorConfig.mode === 'editdiagram' || config.editorConfig.mode === 'editmerge' || config.editorConfig.mode === 'editole')
|
||||
index = "/index_internal.html";
|
||||
|
||||
}
|
||||
path += index;
|
||||
return path;
|
||||
@ -1040,6 +1043,9 @@
|
||||
if (config.editorConfig && (config.editorConfig.mode == 'editdiagram' || config.editorConfig.mode == 'editmerge' || config.editorConfig.mode == 'editole'))
|
||||
params += "&internal=true";
|
||||
|
||||
if (config.type)
|
||||
params += "&type=" + config.type;
|
||||
|
||||
if (config.frameEditorId)
|
||||
params += "&frameEditorId=" + config.frameEditorId;
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<link rel="icon" href="resources/img/favicon.ico" type="image/x-icon">
|
||||
|
||||
<style type="text/css">
|
||||
.loadmask {
|
||||
@ -41,20 +40,22 @@
|
||||
}
|
||||
|
||||
var params = getUrlParams(),
|
||||
postfix = params["indexPostfix"] || '';
|
||||
postfix = params["indexPostfix"] || '',
|
||||
embed = params["type"]==='embedded';
|
||||
window.frameEditorId = params["frameEditorId"];
|
||||
window.parentOrigin = params["parentOrigin"];
|
||||
</script>
|
||||
<script src="lib/util/themeinit.js"></script>
|
||||
<script src="main/lib/util/themeinit.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script src="lib/util/htmlutils.js"></script>
|
||||
<script type="text/javascript" src="../checkExtendedPDF.js"></script>
|
||||
<script src="main/lib/util/htmlutils.js"></script>
|
||||
<script type="text/javascript" src="checkExtendedPDF.js"></script>
|
||||
<div id="loading-mask" class="loadmask"></div>
|
||||
<script>
|
||||
listenApiMsg(function (isform) {
|
||||
var match = window.location.href.match(/(.*)common\/main\/index.html/i);
|
||||
match && window.location.replace(match[1] + (!!isform ? 'documenteditor' : 'pdfeditor') + '/main/index' + postfix + '.html' + window.location.search + ("&isForm=" + !!isform));
|
||||
var match = window.location.href.match(/(.*)common\/index.html/i);
|
||||
match && window.location.replace(match[1] + (isform || embed ? 'documenteditor' : 'pdfeditor') + '/' + (isform && embed ? 'forms' : embed ? 'embed' : 'main') + '/index' + postfix + '.html' +
|
||||
window.location.search + ("&isForm=" + !!isform));
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
@ -5,7 +5,6 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
||||
<link rel="icon" href="resources/img/favicon.ico" type="image/x-icon">
|
||||
|
||||
<style type="text/css">
|
||||
.loadmask {
|
||||
@ -41,20 +40,22 @@
|
||||
}
|
||||
|
||||
var params = getUrlParams(),
|
||||
postfix = params["indexPostfix"] || '';
|
||||
postfix = params["indexPostfix"] || '',
|
||||
embed = params["type"]==='embedded';
|
||||
window.frameEditorId = params["frameEditorId"];
|
||||
window.parentOrigin = params["parentOrigin"];
|
||||
</script>
|
||||
<script src="../../../../../apps/common/main/lib/util/themeinit.js?__inline=true"></script>
|
||||
<script src="../../../../apps/common/main/lib/util/themeinit.js?__inline=true"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script src="../../../../../apps/common/main/lib/util/htmlutils.js?__inline=true"></script>
|
||||
<script src="../../../../../apps/common/checkExtendedPDF.js?__inline=true"></script>
|
||||
<script src="../../../../apps/common/main/lib/util/htmlutils.js?__inline=true"></script>
|
||||
<script src="../../../../apps/common/checkExtendedPDF.js?__inline=true"></script>
|
||||
<div id="loading-mask" class="loadmask"></div>
|
||||
<script>
|
||||
listenApiMsg(function (isform) {
|
||||
var match = window.location.href.match(/(.*)common\/main\/index.html/i);
|
||||
match && window.location.replace(match[1] + (!!isform ? 'documenteditor' : 'pdfeditor') + '/main/index' + postfix + '.html' + window.location.search + ("&isForm=" + !!isform));
|
||||
var match = window.location.href.match(/(.*)common\/index.html/i);
|
||||
match && window.location.replace(match[1] + (isform || embed ? 'documenteditor' : 'pdfeditor') + '/' + (isform && embed ? 'forms' : embed ? 'embed' : 'main') + '/index' + postfix + '.html' +
|
||||
window.location.search + ("&isForm=" + !!isform));
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
@ -106,10 +106,10 @@
|
||||
},
|
||||
"indexhtml": {
|
||||
"expand": true,
|
||||
"cwd": "../apps/common/main",
|
||||
"cwd": "../apps/common",
|
||||
"src": "*.html.deploy",
|
||||
"ext": ".html",
|
||||
"dest": "../deploy/web-apps/apps/common/main"
|
||||
"dest": "../deploy/web-apps/apps/common"
|
||||
}
|
||||
},
|
||||
"imagemin": {
|
||||
|
||||
Reference in New Issue
Block a user