diff --git a/app/js/directives.js b/app/js/directives.js index 62fcfa20..662cd089 100755 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -264,7 +264,7 @@ angular.module('myApp.directives', ['myApp.filters']) updateMessageText($scope, element, message); unlink(); } - }) + }); } $scope.$on('message_edit', function (e, data) { @@ -272,7 +272,10 @@ angular.module('myApp.directives', ['myApp.filters']) return; } console.log('after edit', message); + updateMessageText($scope, element, message); + updateMessageMedia($scope, element, message); updateMessageKeyboard($scope, element, message); + $scope.$emit('ui_height'); }); } }) diff --git a/app/js/lib/ng_utils.js b/app/js/lib/ng_utils.js index a31fbcad..60e15277 100644 --- a/app/js/lib/ng_utils.js +++ b/app/js/lib/ng_utils.js @@ -1217,6 +1217,7 @@ angular.module('izhukov.utils', []) return { wrapRichText: wrapRichText, wrapPlainText: wrapPlainText, + wrapUrl: wrapUrl, parseEntities: parseEntities, parseMarkdown: parseMarkdown, parseEmojis: parseEmojis, @@ -1584,32 +1585,7 @@ angular.module('izhukov.utils', []) break; } var url = entity.url || entityText; - if (!url.match(/^https?:\/\//i)) { - url = 'http://' + url; - } - var tgMeMatch; - if (entity._ == 'messageEntityTextUrl') { - url = 'tg://unsafe_url?url=' + encodeURIComponent(url); - } - else if ((tgMeMatch = url.match(/^https?:\/\/telegram\.me\/(.+)/))) { - var path = tgMeMatch[1].split('/'); - switch (path[0]) { - case 'joinchat': - url = 'tg://join?invite=' + path[1]; - break; - case 'addstickers': - url = 'tg://addstickers?set=' + path[1]; - break; - default: - if (path[1] && path[1].match(/^\d+$/)) { - url = 'tg://resolve?domain=' + path[0] + '&post=' + path[1]; - } - else if (!path[1]) { - var domainQuery = path[0].split('?'); - url = 'tg://resolve?domain=' + domainQuery[0] + (domainQuery[1] ? '&' + domainQuery[1] : ''); - } - } - } + url = wrapUrl(url, entity._ == 'messageEntityTextUrl'); html.push( '
-