From b03ea1f1b01bbf123542a9ec80ee66f47d8811bd Mon Sep 17 00:00:00 2001 From: Igor Zhukov Date: Mon, 13 Jul 2015 19:55:12 +0300 Subject: [PATCH] Fixed double-click selection Also show ticks up to 900px w --- app/js/controllers.js | 7 +------ app/js/directives.js | 2 +- app/js/lib/utils.js | 10 ++++++++++ app/less/desktop.less | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/js/controllers.js b/app/js/controllers.js index d6c4c4be..e3851555 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -1402,12 +1402,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) } if (!$scope.historyState.selectActions) { - var sel = ( - window.getSelection && window.getSelection() || - document.getSelection && document.getSelection() || - document.selection && document.selection.createRange().text || '' - ).toString().replace(/^\s+|\s+$/g, ''); - if (sel) { + if (getSelectedText()) { return false; } diff --git a/app/js/directives.js b/app/js/directives.js index 8d2cf1ae..7cd32640 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -1217,7 +1217,7 @@ angular.module('myApp.directives', ['myApp.filters']) updateSizes(); if (data && data.blur) { $scope.$broadcast('ui_message_blur'); - } else { + } else if (!getSelectedText()) { $scope.$broadcast('ui_message_send'); } diff --git a/app/js/lib/utils.js b/app/js/lib/utils.js index 5ebaab22..2d469381 100644 --- a/app/js/lib/utils.js +++ b/app/js/lib/utils.js @@ -237,6 +237,16 @@ function setRichFocus(field, selectNode) { } } +function getSelectedText () { + var sel = ( + window.getSelection && window.getSelection() || + document.getSelection && document.getSelection() || + document.selection && document.selection.createRange().text || '' + ).toString().replace(/^\s+|\s+$/g, ''); + + return sel; +} + function scrollToNode (scrollable, node, scroller) { var elTop = node.offsetTop - 15, elHeight = node.offsetHeight + 30, diff --git a/app/less/desktop.less b/app/less/desktop.less index 77dd0e78..b276490e 100644 --- a/app/less/desktop.less +++ b/app/less/desktop.less @@ -903,7 +903,7 @@ a.footer_link.active:active { display: none; } -@media (min-width: 1024px) { +@media (min-width: 900px) { .im_message_wrap { position: relative; }