[DE] Fix Bug 51557
This commit is contained in:
parent
8635e274e5
commit
b539a87cf1
|
@ -43,7 +43,8 @@ DE.ApplicationController = new(function(){
|
||||||
labelDocName,
|
labelDocName,
|
||||||
appOptions = {},
|
appOptions = {},
|
||||||
btnSubmit,
|
btnSubmit,
|
||||||
_submitFail, $submitedTooltip, $requiredTooltip;
|
_submitFail, $submitedTooltip, $requiredTooltip,
|
||||||
|
$listControlMenu, listControlItems = [], listObj;
|
||||||
|
|
||||||
var LoadingDocument = -256;
|
var LoadingDocument = -256;
|
||||||
|
|
||||||
|
@ -273,6 +274,97 @@ DE.ApplicationController = new(function(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onShowContentControlsActions(obj, x, y) {
|
||||||
|
switch (obj.type) {
|
||||||
|
case Asc.c_oAscContentControlSpecificType.Picture:
|
||||||
|
if (obj.pr && obj.pr.get_Lock) {
|
||||||
|
var lock = obj.pr.get_Lock();
|
||||||
|
if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock==Asc.c_oAscSdtLockType.ContentLocked)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
api.asc_addImage(obj);
|
||||||
|
setTimeout(function(){
|
||||||
|
api.asc_UncheckContentControlButtons();
|
||||||
|
}, 500);
|
||||||
|
break;
|
||||||
|
case Asc.c_oAscContentControlSpecificType.DropDownList:
|
||||||
|
case Asc.c_oAscContentControlSpecificType.ComboBox:
|
||||||
|
onShowListActions(obj, x, y);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onHideContentControlsActions() {
|
||||||
|
$listControlMenu && $listControlMenu.hide();
|
||||||
|
api.asc_UncheckContentControlButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
function onShowListActions(obj, x, y) {
|
||||||
|
var type = obj.type,
|
||||||
|
props = obj.pr,
|
||||||
|
specProps = (type == Asc.c_oAscContentControlSpecificType.ComboBox) ? props.get_ComboBoxPr() : props.get_DropDownListPr(),
|
||||||
|
isForm = !!props.get_FormPr();
|
||||||
|
|
||||||
|
var menuContainer = DE.ApplicationView.getMenuForm();
|
||||||
|
|
||||||
|
if (!$listControlMenu) {
|
||||||
|
$listControlMenu = menuContainer.find('ul');
|
||||||
|
$listControlMenu.on('click', 'li', function(e) {
|
||||||
|
var value = $(e.target).attr('value');
|
||||||
|
if (value) {
|
||||||
|
value = parseInt(value);
|
||||||
|
setTimeout(function(){
|
||||||
|
(value!==-1) && api.asc_SelectContentControlListItem(listControlItems[value], listObj.get_InternalId());
|
||||||
|
}, 1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#editor_sdk').on('click', function(e){
|
||||||
|
if (e.target.localName == 'canvas') {
|
||||||
|
if (me._preventClick)
|
||||||
|
me._preventClick = false;
|
||||||
|
else {
|
||||||
|
$listControlMenu && $listControlMenu.hide();
|
||||||
|
api.asc_UncheckContentControlButtons();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$listControlMenu.find('li').remove();
|
||||||
|
listControlItems = [];
|
||||||
|
listObj = props;
|
||||||
|
|
||||||
|
if (specProps) {
|
||||||
|
var k = 0;
|
||||||
|
if (isForm){ // for dropdown and combobox form control always add placeholder item
|
||||||
|
var text = props.get_PlaceholderText();
|
||||||
|
$listControlMenu.append('<li><a tabindex="-1" type="menuitem" style="opacity: 0.6" value="0">' +
|
||||||
|
((text.trim()!=='') ? text : me.txtEmpty) +
|
||||||
|
'</a></li>');
|
||||||
|
listControlItems.push('');
|
||||||
|
}
|
||||||
|
var count = specProps.get_ItemsCount();
|
||||||
|
k = listControlItems.length;
|
||||||
|
for (var i=0; i<count; i++) {
|
||||||
|
if (specProps.get_ItemValue(i)!=='' || !isForm) {
|
||||||
|
$listControlMenu.append('<li><a tabindex="-1" type="menuitem" value="' + (i+k) + '">' +
|
||||||
|
common.utils.htmlEncode(specProps.get_ItemDisplayText(i)) +
|
||||||
|
'</a></li>');
|
||||||
|
listControlItems.push(specProps.get_ItemValue(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isForm && listControlItems.length<1) {
|
||||||
|
$listControlMenu.append('<li><a tabindex="-1" type="menuitem" value="0">' +
|
||||||
|
me.txtEmpty +
|
||||||
|
'</a></li>');
|
||||||
|
listControlItems.push(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
menuContainer.css({left: x, top : y});
|
||||||
|
me._preventClick = true;
|
||||||
|
$listControlMenu.show();
|
||||||
|
}
|
||||||
|
|
||||||
function hidePreloader() {
|
function hidePreloader() {
|
||||||
$('#loading-mask').fadeOut('slow');
|
$('#loading-mask').fadeOut('slow');
|
||||||
}
|
}
|
||||||
|
@ -350,6 +442,10 @@ DE.ApplicationController = new(function(){
|
||||||
api.asc_registerCallback('asc_onPrint', onPrint);
|
api.asc_registerCallback('asc_onPrint', onPrint);
|
||||||
api.asc_registerCallback('asc_onPrintUrl', onPrintUrl);
|
api.asc_registerCallback('asc_onPrintUrl', onPrintUrl);
|
||||||
api.asc_registerCallback('sync_onAllRequiredFormsFilled', onFillRequiredFields);
|
api.asc_registerCallback('sync_onAllRequiredFormsFilled', onFillRequiredFields);
|
||||||
|
if (appOptions.canFillForms) {
|
||||||
|
api.asc_registerCallback('asc_onShowContentControlsActions', onShowContentControlsActions);
|
||||||
|
api.asc_registerCallback('asc_onHideContentControlsActions', onHideContentControlsActions);
|
||||||
|
}
|
||||||
|
|
||||||
Common.Gateway.on('processmouse', onProcessMouse);
|
Common.Gateway.on('processmouse', onProcessMouse);
|
||||||
Common.Gateway.on('downloadas', onDownloadAs);
|
Common.Gateway.on('downloadas', onDownloadAs);
|
||||||
|
@ -812,6 +908,7 @@ DE.ApplicationController = new(function(){
|
||||||
textAnonymous: 'Anonymous',
|
textAnonymous: 'Anonymous',
|
||||||
textRequired: 'Fill all required fields to send form.',
|
textRequired: 'Fill all required fields to send form.',
|
||||||
textGotIt: 'Got it',
|
textGotIt: 'Got it',
|
||||||
errorForceSave: "An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later."
|
errorForceSave: "An error occurred while saving the file. Please use the 'Download as' option to save the file to your computer hard drive or try again later.",
|
||||||
|
txtEmpty: '(Empty)'
|
||||||
}
|
}
|
||||||
})();
|
})();
|
|
@ -36,6 +36,7 @@ if (DE === undefined) {
|
||||||
|
|
||||||
DE.ApplicationView = new(function(){
|
DE.ApplicationView = new(function(){
|
||||||
var $btnTools;
|
var $btnTools;
|
||||||
|
var $menuForm;
|
||||||
|
|
||||||
// Initialize view
|
// Initialize view
|
||||||
|
|
||||||
|
@ -63,11 +64,23 @@ DE.ApplicationView = new(function(){
|
||||||
return $btnTools.parent().find(name);
|
return $btnTools.parent().find(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getMenuForm() {
|
||||||
|
if (!$menuForm) {
|
||||||
|
$menuForm = $('<div id="menu-container-form" style="position: absolute; z-index: 10000;" data-value="prevent-canvas-click">' +
|
||||||
|
'<div class="dropdown-toggle" data-toggle="dropdown"></div>' +
|
||||||
|
'<ul class="dropdown-menu" oo_editor_input="true" role="menu" style="right: 0; left: auto;max-height: 200px; overflow-y: auto;"></ul>' +
|
||||||
|
'</div>');
|
||||||
|
$('#editor_sdk').append($menuForm);
|
||||||
|
}
|
||||||
|
return $menuForm;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
create: createView
|
create: createView
|
||||||
, tools: {
|
, tools: {
|
||||||
get: getTools
|
get: getTools
|
||||||
},
|
},
|
||||||
|
getMenuForm: getMenuForm,
|
||||||
|
|
||||||
txtDownload: 'Download',
|
txtDownload: 'Download',
|
||||||
txtPrint: 'Print',
|
txtPrint: 'Print',
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
"DE.ApplicationController.unknownErrorText": "Unknown error.",
|
"DE.ApplicationController.unknownErrorText": "Unknown error.",
|
||||||
"DE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.",
|
"DE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.",
|
||||||
"DE.ApplicationController.waitText": "Please, wait...",
|
"DE.ApplicationController.waitText": "Please, wait...",
|
||||||
|
"DE.ApplicationController.txtEmpty": "(Empty)",
|
||||||
"DE.ApplicationView.txtDownload": "Download",
|
"DE.ApplicationView.txtDownload": "Download",
|
||||||
"DE.ApplicationView.txtDownloadDocx": "Download as docx",
|
"DE.ApplicationView.txtDownloadDocx": "Download as docx",
|
||||||
"DE.ApplicationView.txtDownloadPdf": "Download as pdf",
|
"DE.ApplicationView.txtDownloadPdf": "Download as pdf",
|
||||||
|
|
Loading…
Reference in a new issue