diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 5a306ed6a..eedd90822 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -43,7 +43,8 @@ DE.ApplicationController = new(function(){ labelDocName, appOptions = {}, btnSubmit, - _submitFail, $submitedTooltip, $requiredTooltip; + _submitFail, $submitedTooltip, $requiredTooltip, + $listControlMenu, listControlItems = [], listObj; 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('
  • ' + + ((text.trim()!=='') ? text : me.txtEmpty) + + '
  • '); + listControlItems.push(''); + } + var count = specProps.get_ItemsCount(); + k = listControlItems.length; + for (var i=0; i' + + common.utils.htmlEncode(specProps.get_ItemDisplayText(i)) + + ''); + listControlItems.push(specProps.get_ItemValue(i)); + } + } + if (!isForm && listControlItems.length<1) { + $listControlMenu.append('
  • ' + + me.txtEmpty + + '
  • '); + listControlItems.push(-1); + } + } + + menuContainer.css({left: x, top : y}); + me._preventClick = true; + $listControlMenu.show(); + } + function hidePreloader() { $('#loading-mask').fadeOut('slow'); } @@ -350,6 +442,10 @@ DE.ApplicationController = new(function(){ api.asc_registerCallback('asc_onPrint', onPrint); api.asc_registerCallback('asc_onPrintUrl', onPrintUrl); 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('downloadas', onDownloadAs); @@ -812,6 +908,7 @@ DE.ApplicationController = new(function(){ textAnonymous: 'Anonymous', textRequired: 'Fill all required fields to send form.', 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)' } })(); \ No newline at end of file diff --git a/apps/documenteditor/embed/js/ApplicationView.js b/apps/documenteditor/embed/js/ApplicationView.js index 75a8adb04..0f74bdaf0 100644 --- a/apps/documenteditor/embed/js/ApplicationView.js +++ b/apps/documenteditor/embed/js/ApplicationView.js @@ -36,6 +36,7 @@ if (DE === undefined) { DE.ApplicationView = new(function(){ var $btnTools; + var $menuForm; // Initialize view @@ -63,11 +64,23 @@ DE.ApplicationView = new(function(){ return $btnTools.parent().find(name); } + function getMenuForm() { + if (!$menuForm) { + $menuForm = $(''); + $('#editor_sdk').append($menuForm); + } + return $menuForm; + } + return { create: createView , tools: { get: getTools }, + getMenuForm: getMenuForm, txtDownload: 'Download', txtPrint: 'Print', diff --git a/apps/documenteditor/embed/locale/en.json b/apps/documenteditor/embed/locale/en.json index de0c0c291..18212d966 100644 --- a/apps/documenteditor/embed/locale/en.json +++ b/apps/documenteditor/embed/locale/en.json @@ -34,6 +34,7 @@ "DE.ApplicationController.unknownErrorText": "Unknown error.", "DE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.", "DE.ApplicationController.waitText": "Please, wait...", + "DE.ApplicationController.txtEmpty": "(Empty)", "DE.ApplicationView.txtDownload": "Download", "DE.ApplicationView.txtDownloadDocx": "Download as docx", "DE.ApplicationView.txtDownloadPdf": "Download as pdf", diff --git a/apps/documenteditor/main/resources/less/filemenu.less b/apps/documenteditor/main/resources/less/filemenu.less index 03ffa0600..edd7f44ef 100644 --- a/apps/documenteditor/main/resources/less/filemenu.less +++ b/apps/documenteditor/main/resources/less/filemenu.less @@ -194,8 +194,8 @@ hr { margin: 0; border-bottom: none; - border-color: @border-toolbar-ie; - border-color: @border-toolbar; + border-top: @scaled-one-px-value-ie solid @border-divider-ie; + border-top: @scaled-one-px-value solid @border-divider; } .thumb-list { diff --git a/apps/presentationeditor/main/resources/less/leftmenu.less b/apps/presentationeditor/main/resources/less/leftmenu.less index b083e4d0c..0a56783c7 100644 --- a/apps/presentationeditor/main/resources/less/leftmenu.less +++ b/apps/presentationeditor/main/resources/less/leftmenu.less @@ -196,7 +196,8 @@ h3 { margin: 0; font-size: 10pt; - color: #665; + color: @text-normal-ie; + color: @text-normal; font-weight: bold; padding: 0 0 10px 10px; white-space: nowrap; @@ -230,7 +231,8 @@ hr { margin: 0; border-bottom: none; - border-color: #e1e1e1; + border-top: @scaled-one-px-value-ie solid @border-divider-ie; + border-top: @scaled-one-px-value solid @border-divider; } .thumb-list { diff --git a/apps/spreadsheeteditor/main/resources/less/leftmenu.less b/apps/spreadsheeteditor/main/resources/less/leftmenu.less index 778e54c5d..04ba2926e 100644 --- a/apps/spreadsheeteditor/main/resources/less/leftmenu.less +++ b/apps/spreadsheeteditor/main/resources/less/leftmenu.less @@ -258,7 +258,8 @@ h3 { margin: 0; font-size: 10pt; - color: #665; + color: @text-normal-ie; + color: @text-normal; font-weight: bold; padding: 0 0 10px 10px; white-space: nowrap; @@ -291,7 +292,8 @@ hr { margin: 0; border-bottom: none; - border-color: #e1e1e1; + border-top: @scaled-one-px-value-ie solid @border-divider-ie; + border-top: @scaled-one-px-value solid @border-divider; } .thumb-list {