Merge branch 'master' into layer-53
This commit is contained in:
commit
6b67d66fee
@ -3217,17 +3217,16 @@ angular.module('myApp.directives', ['myApp.filters'])
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
.directive('myCopyElement', function (toaster, _) {
|
.directive('myCopyField', function (toaster, _) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
scope: {
|
scope: {
|
||||||
selectEvent: '=myCopyElement'
|
selectEvent: '=myCopyField'
|
||||||
},
|
},
|
||||||
link: link
|
link: link
|
||||||
};
|
};
|
||||||
|
|
||||||
function link($scope, element, attrs) {
|
function link($scope, element, attrs) {
|
||||||
if (element[0].tagName == 'INPUT') {
|
|
||||||
element.attr('readonly', 'true');
|
element.attr('readonly', 'true');
|
||||||
element[0].readonly = true;
|
element[0].readonly = true;
|
||||||
element.on('click', function () {
|
element.on('click', function () {
|
||||||
@ -3242,36 +3241,61 @@ angular.module('myApp.directives', ['myApp.filters'])
|
|||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
};
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
.directive('myCopyLink', function ($compile, $timeout, _) {
|
||||||
|
|
||||||
|
return {
|
||||||
|
restrict: 'A',
|
||||||
|
replace: false,
|
||||||
|
terminal: true,
|
||||||
|
priority: 1000,
|
||||||
|
link: link
|
||||||
|
};
|
||||||
|
|
||||||
|
function link ($scope, element, attrs) {
|
||||||
|
element.attr('tooltip', '{{ttLabel}}');
|
||||||
|
element.removeAttr('my-copy-link');
|
||||||
|
element.removeAttr('data-my-copy-link');
|
||||||
|
|
||||||
|
var resetPromise = false;
|
||||||
|
var resetTooltip = function () {
|
||||||
|
$timeout.cancel(resetPromise);
|
||||||
|
resetPromise = false;
|
||||||
|
$scope.ttLabel = _('conversations_modal_share_url_copy_raw');
|
||||||
|
};
|
||||||
|
|
||||||
|
resetTooltip();
|
||||||
|
|
||||||
|
$compile(element)($scope);
|
||||||
|
|
||||||
var clipboard = new Clipboard(element[0]);
|
var clipboard = new Clipboard(element[0]);
|
||||||
|
|
||||||
clipboard.on('success', function(e) {
|
clipboard.on('success', function(e) {
|
||||||
toaster.pop({
|
$timeout.cancel(resetPromise);
|
||||||
type: 'info',
|
$scope.$apply(function () {
|
||||||
timeout: 2000,
|
$scope.ttLabel = _('clipboard_copied_raw');
|
||||||
body: _('clipboard_copied'),
|
|
||||||
bodyOutputType: 'trustedHtml',
|
|
||||||
showCloseButton: false
|
|
||||||
});
|
});
|
||||||
e.clearSelection();
|
resetPromise = $timeout(resetTooltip, 2000);
|
||||||
});
|
});
|
||||||
|
|
||||||
clipboard.on('error', function(e) {
|
clipboard.on('error', function(e) {
|
||||||
var langKey = Config.Navigator.osX ? 'clipboard_press_cmd_c' : 'clipboard_press_ctrl_c';
|
$timeout.cancel(resetPromise);
|
||||||
toaster.pop({
|
var langKey = Config.Navigator.osX
|
||||||
type: 'info',
|
? 'clipboard_press_cmd_c'
|
||||||
timeout: 4000,
|
: 'clipboard_press_ctrl_c';
|
||||||
body: _(langKey),
|
$scope.$apply(function () {
|
||||||
bodyOutputType: 'trustedHtml',
|
$scope.ttLabel = _(langKey + '_raw');
|
||||||
showCloseButton: false
|
|
||||||
});
|
});
|
||||||
|
resetPromise = $timeout(resetTooltip, 5000);
|
||||||
});
|
});
|
||||||
|
|
||||||
$scope.$on('$destroy', function () {
|
$scope.$on('$destroy', function () {
|
||||||
clipboard.destroy();
|
clipboard.destroy();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@
|
|||||||
|
|
||||||
"clipboard_copied": "Copied!",
|
"clipboard_copied": "Copied!",
|
||||||
"clipboard_press_ctrl_c": "Press Ctrl+C to copy",
|
"clipboard_press_ctrl_c": "Press Ctrl+C to copy",
|
||||||
"clipboard_press_cmd_c": "Press ⌘ + C to copy",
|
"clipboard_press_cmd_c": "Press ⌘+C to copy",
|
||||||
|
|
||||||
"confirm_modal_logout": "Are you sure you want to log out?",
|
"confirm_modal_logout": "Are you sure you want to log out?",
|
||||||
"confirm_modal_update_reload": "A new version of Telegram Web has been downloaded. Launch it?",
|
"confirm_modal_update_reload": "A new version of Telegram Web has been downloaded. Launch it?",
|
||||||
@ -275,6 +275,7 @@
|
|||||||
"conversations_modal_select_recipients": "Select recipients",
|
"conversations_modal_select_recipients": "Select recipients",
|
||||||
"conversations_modal_recipients": "Recipients:",
|
"conversations_modal_recipients": "Recipients:",
|
||||||
"conversations_modal_share_url_loading": "Loading{dots}",
|
"conversations_modal_share_url_loading": "Loading{dots}",
|
||||||
|
"conversations_modal_share_url_copy": "Click to copy share link",
|
||||||
|
|
||||||
"contact_edit_modal_first_name": "First name",
|
"contact_edit_modal_first_name": "First name",
|
||||||
"contact_edit_modal_last_name": "Last name",
|
"contact_edit_modal_last_name": "Last name",
|
||||||
|
@ -4449,3 +4449,54 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils'])
|
|||||||
shareUrl: shareUrl
|
shareUrl: shareUrl
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
.service('DraftsManager', function (qSync, Storage) {
|
||||||
|
|
||||||
|
var localDrafts = {};
|
||||||
|
|
||||||
|
return {
|
||||||
|
getDraft: getDraft,
|
||||||
|
saveDraft: saveDraft,
|
||||||
|
changeDraft: changeDraft,
|
||||||
|
syncDraft: syncDraft
|
||||||
|
};
|
||||||
|
|
||||||
|
function getDraft (peerID, options) {
|
||||||
|
return Storage.get('draft' + peerID).then(function (draft) {
|
||||||
|
if (typeof draft === 'string' && draft.length > 0) {
|
||||||
|
draft = {
|
||||||
|
text: draft
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (draft === false || draft == null) {
|
||||||
|
draft = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveDraft(peerID, draftData) {
|
||||||
|
localDrafts[peerID] = draftData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeDraft(peerID, message, options) {
|
||||||
|
options = options || {};
|
||||||
|
if (typeof message === 'string' || options.replyToMsgID) {
|
||||||
|
var localDraft = {
|
||||||
|
text: message,
|
||||||
|
replyToMsgID: replyToMsgID
|
||||||
|
};
|
||||||
|
var backupDraftObj = {};
|
||||||
|
backupDraftObj['draft' + peerID] = localDraft;
|
||||||
|
Storage.set(backupDraftObj);
|
||||||
|
} else {
|
||||||
|
Storage.remove('draft' + peerID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function syncDraft(peerID) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
@ -10,14 +10,14 @@
|
|||||||
<div ng-switch-when="true">
|
<div ng-switch-when="true">
|
||||||
<div class="md-input-group md-textarea-group" my-labeled-input>
|
<div class="md-input-group md-textarea-group" my-labeled-input>
|
||||||
<label class="md-input-label" my-i18n="group_invite_link_link_label"></label>
|
<label class="md-input-label" my-i18n="group_invite_link_link_label"></label>
|
||||||
<textarea class="md-input" ng-model="exportedInvite.link" rows="2" my-copy-element="'ui_invite_select'"></textarea>
|
<textarea class="md-input" ng-model="exportedInvite.link" rows="2" my-copy-field="'ui_invite_select'"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-switch-default>
|
<div ng-switch-default>
|
||||||
<div class="md-input-group" my-labeled-input>
|
<div class="md-input-group" my-labeled-input>
|
||||||
<label class="md-input-label" my-i18n="group_invite_link_link_label"></label>
|
<label class="md-input-label" my-i18n="group_invite_link_link_label"></label>
|
||||||
<input class="md-input" type="text" ng-model="exportedInvite.link" my-copy-element="'ui_invite_select'" />
|
<input class="md-input" type="text" ng-model="exportedInvite.link" my-copy-field="'ui_invite_select'" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -78,7 +78,9 @@
|
|||||||
<span ng-switch-when="url_loading" class="peer_select_modal_recipients_empty" my-i18n="conversations_modal_share_url_loading">
|
<span ng-switch-when="url_loading" class="peer_select_modal_recipients_empty" my-i18n="conversations_modal_share_url_loading">
|
||||||
<my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
|
<my-i18n-param name="dots"><span my-loading-dots></span></my-i18n-param>
|
||||||
</span>
|
</span>
|
||||||
<a ng-switch-when="url" class="peer_select_modal_share_link" my-copy-element ng-bind="shareLink.url | shortUrl" data-clipboard-text="{{shareLink.url}}"></a>
|
<span ng-switch-when="url">
|
||||||
|
<a class="peer_select_modal_share_link" my-copy-link ng-bind="shareLink.url | shortUrl" data-clipboard-text="{{shareLink.url}}"></a>
|
||||||
|
</span>
|
||||||
<span ng-switch-default class="peer_select_modal_recipients_empty" my-i18n="conversations_modal_select_recipients"></span>
|
<span ng-switch-default class="peer_select_modal_recipients_empty" my-i18n="conversations_modal_select_recipients"></span>
|
||||||
</span>
|
</span>
|
||||||
<span ng-switch-default>
|
<span ng-switch-default>
|
||||||
|
Loading…
Reference in New Issue
Block a user