* feat: snjs app groups * fix: update snjs version to point to wip commit * wip: account switcher * feat: rename lock manager to auto lock service * fix: more relevant sign out copy * chore(deps): update snjs * fix: use setTimeout instead of setImmediate * feat: make account switcher expiremental feature * chore(deps): upgrade snjs
18 lines
483 B
TypeScript
18 lines
483 B
TypeScript
/* @ngInject */
|
|
export function selectOnFocus($window: ng.IWindowService) {
|
|
return {
|
|
restrict: 'A',
|
|
link: function (scope: ng.IScope, element: JQLite) {
|
|
element.on('focus', () => {
|
|
if (!$window.getSelection()!.toString()) {
|
|
const input = element[0] as HTMLInputElement;
|
|
/** Allow text to populate */
|
|
setTimeout(() => {
|
|
input.setSelectionRange(0, input.value.length);
|
|
}, 0);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
}
|