From 8fa074ef8da8b2b8c8333996a93e12d2cd6af25d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 30 Jul 2021 14:33:35 +0300 Subject: [PATCH] [DE] Fix Bug 51614 --- apps/common/embed/resources/less/common.less | 1 + apps/documenteditor/embed/index.html | 2 +- apps/documenteditor/embed/index.html.deploy | 2 +- apps/documenteditor/embed/index_loader.html | 2 +- .../embed/index_loader.html.deploy | 2 +- .../embed/js/ApplicationController.js | 60 ++++++++++++------- apps/documenteditor/embed/locale/en.json | 1 + apps/documenteditor/embed/locale/ru.json | 1 + 8 files changed, 46 insertions(+), 25 deletions(-) diff --git a/apps/common/embed/resources/less/common.less b/apps/common/embed/resources/less/common.less index 006c2f810..8d93e61af 100644 --- a/apps/common/embed/resources/less/common.less +++ b/apps/common/embed/resources/less/common.less @@ -687,6 +687,7 @@ font-weight: bold; font-size: 11px; box-shadow: 0 6px 12px rgba(0,0,0,0.175); + max-width: 350px; padding: 5px 12px; white-space: pre-wrap; diff --git a/apps/documenteditor/embed/index.html b/apps/documenteditor/embed/index.html index b3e6ef6fc..3fa779e70 100644 --- a/apps/documenteditor/embed/index.html +++ b/apps/documenteditor/embed/index.html @@ -221,7 +221,7 @@ - + diff --git a/apps/documenteditor/embed/index.html.deploy b/apps/documenteditor/embed/index.html.deploy index 6231036cf..aa9a9c4fe 100644 --- a/apps/documenteditor/embed/index.html.deploy +++ b/apps/documenteditor/embed/index.html.deploy @@ -213,7 +213,7 @@ - + diff --git a/apps/documenteditor/embed/index_loader.html b/apps/documenteditor/embed/index_loader.html index 0d25bab6b..af3c1d916 100644 --- a/apps/documenteditor/embed/index_loader.html +++ b/apps/documenteditor/embed/index_loader.html @@ -322,7 +322,7 @@ - + diff --git a/apps/documenteditor/embed/index_loader.html.deploy b/apps/documenteditor/embed/index_loader.html.deploy index ec68112af..c70bdcc1c 100644 --- a/apps/documenteditor/embed/index_loader.html.deploy +++ b/apps/documenteditor/embed/index_loader.html.deploy @@ -314,7 +314,7 @@ - + diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index 9e01296c5..544f672c6 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -44,7 +44,8 @@ DE.ApplicationController = new(function(){ appOptions = {}, btnSubmit, _submitFail, $submitedTooltip, $requiredTooltip, - $listControlMenu, listControlItems = [], listObj; + $listControlMenu, listControlItems = [], listObj, + bodyWidth = 0; var LoadingDocument = -256; @@ -84,6 +85,7 @@ DE.ApplicationController = new(function(){ } else { $('#toolbar').addClass('top'); $('#editor_sdk').addClass('top'); + ttOffset[1] = 40; } config.canBackToFolder = (config.canBackToFolder!==false) && config.customization && config.customization.goback && @@ -219,33 +221,47 @@ DE.ApplicationController = new(function(){ var $ttEl, $tooltip; function onDocMouseMove(data) { if (data) { - if (data.get_Type() == 1) { // hyperlink + var type = data.get_Type(); + if (type == Asc.c_oAscMouseMoveDataTypes.Hyperlink || type==Asc.c_oAscMouseMoveDataTypes.Form) { // hyperlink me.isHideBodyTip = false; + var str = (type == Asc.c_oAscMouseMoveDataTypes.Hyperlink) ? me.txtPressLink : data.get_FormHelpText(); + if (str.length>500) + str = str.substr(0, 500) + '...'; + str = common.utils.htmlEncode(str); + if ( !$ttEl ) { $ttEl = $('.hyperlink-tooltip'); $ttEl.tooltip({'container':'body', 'trigger':'manual'}); - $ttEl.on('shown.bs.tooltip', function(e) { - $tooltip = $ttEl.data('bs.tooltip').tip(); - - $tooltip.css({ - left: $ttEl.ttpos[0] + ttOffset[0], - top: $ttEl.ttpos[1] + ttOffset[1] - }); - - $tooltip.find('.tooltip-arrow').css({left: 10}); - }); } + $ttEl.ttpos = [data.get_X(), data.get_Y()]; + if ( !$tooltip) + $tooltip = $ttEl.data('bs.tooltip').tip(); - if ( !$tooltip ) { - $ttEl.ttpos = [data.get_X(), data.get_Y()]; - $ttEl.tooltip('show'); - } else { - $tooltip.css({ - left:data.get_X() + ttOffset[0], - top:data.get_Y() + ttOffset[1] - }); + if (!$tooltip.is(':visible')) { + var tip = $ttEl.data('bs.tooltip'); + tip.options.title = str; + tip.show([-1000, -1000]); + } else + $tooltip.find('.tooltip-inner')['text'](str); + + var ttHeight = $tooltip.height(), + ttWidth = $tooltip.width(); + !bodyWidth && (bodyWidth = $('body').width()); + + $ttEl.ttpos[1] -= (ttHeight - ttOffset[1] + 20); + if ($ttEl.ttpos[0] + ttWidth + 10 >bodyWidth) { + $ttEl.ttpos[0] = bodyWidth - ttWidth - 5; + if ($ttEl.ttpos[1] < 0) + $ttEl.ttpos[1] += ttHeight + ttOffset[1] + 20; + } else if ($ttEl.ttpos[1] < 0) { + $ttEl.ttpos[1] = 0; + $ttEl.ttpos[0] += 20; } + $tooltip.css({ + left: $ttEl.ttpos[0], + top: $ttEl.ttpos[1] + }); } } } @@ -807,6 +823,7 @@ DE.ApplicationController = new(function(){ function onDocumentResize() { api && api.Resize(); + bodyWidth = $('body').width(); } function createController(){ @@ -910,6 +927,7 @@ DE.ApplicationController = new(function(){ 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.", - txtEmpty: '(Empty)' + txtEmpty: '(Empty)', + txtPressLink: 'Press Ctrl and click link' } })(); \ No newline at end of file diff --git a/apps/documenteditor/embed/locale/en.json b/apps/documenteditor/embed/locale/en.json index 18212d966..2db8c2ef8 100644 --- a/apps/documenteditor/embed/locale/en.json +++ b/apps/documenteditor/embed/locale/en.json @@ -35,6 +35,7 @@ "DE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.", "DE.ApplicationController.waitText": "Please, wait...", "DE.ApplicationController.txtEmpty": "(Empty)", + "DE.ApplicationController.txtPressLink": "Press Ctrl and click link", "DE.ApplicationView.txtDownload": "Download", "DE.ApplicationView.txtDownloadDocx": "Download as docx", "DE.ApplicationView.txtDownloadPdf": "Download as pdf", diff --git a/apps/documenteditor/embed/locale/ru.json b/apps/documenteditor/embed/locale/ru.json index 29a785721..d596e3e18 100644 --- a/apps/documenteditor/embed/locale/ru.json +++ b/apps/documenteditor/embed/locale/ru.json @@ -33,6 +33,7 @@ "DE.ApplicationController.unknownErrorText": "Неизвестная ошибка.", "DE.ApplicationController.unsupportedBrowserErrorText": "Ваш браузер не поддерживается.", "DE.ApplicationController.waitText": "Пожалуйста, подождите...", + "DE.ApplicationController.txtPressLink": "Нажмите Ctrl и щелкните по ссылке", "DE.ApplicationView.txtDownload": "Скачать файл", "DE.ApplicationView.txtDownloadDocx": "Скачать как docx", "DE.ApplicationView.txtDownloadPdf": "Скачать как pdf",