From 6af6b9cd000ef490a7a89aa70d6dbc0f1126fe4f Mon Sep 17 00:00:00 2001 From: Frank Oosterhuis Date: Fri, 3 Jan 2020 14:07:24 +0100 Subject: [PATCH 1/7] [ZEPPELIN-4536] Select name in path --- .../src/components/note-create/visible.directive.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/zeppelin-web/src/components/note-create/visible.directive.js b/zeppelin-web/src/components/note-create/visible.directive.js index 7ba8db72f3d..0e88a080efa 100644 --- a/zeppelin-web/src/components/note-create/visible.directive.js +++ b/zeppelin-web/src/components/note-create/visible.directive.js @@ -36,7 +36,11 @@ function modalvisible() { }); element.on('shown.bs.modal', function(e) { if (scope.targetinput) { - angular.element(e.target).find('input#' + scope.targetinput).select(); + let input = angular.element(e.target).find('input#' + scope.targetinput); + let startSelect = input.value.lastIndexOf('/'); + let endSelect = input.value.length; + input.focus(); + input.setSelectionRange(startSelect, endSelect); } postVisibleMethod(); }); From 090f7a764e182c87c405e0da75f16b9bbf3ca803 Mon Sep 17 00:00:00 2001 From: Frank Oosterhuis Date: Mon, 6 Jan 2020 16:22:41 +0100 Subject: [PATCH 2/7] [ZEPPELIN-4536] Use HTMLInputElement --- .../src/components/note-create/visible.directive.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/zeppelin-web/src/components/note-create/visible.directive.js b/zeppelin-web/src/components/note-create/visible.directive.js index 0e88a080efa..d42b0040685 100644 --- a/zeppelin-web/src/components/note-create/visible.directive.js +++ b/zeppelin-web/src/components/note-create/visible.directive.js @@ -36,11 +36,9 @@ function modalvisible() { }); element.on('shown.bs.modal', function(e) { if (scope.targetinput) { - let input = angular.element(e.target).find('input#' + scope.targetinput); - let startSelect = input.value.lastIndexOf('/'); - let endSelect = input.value.length; + let input = angular.element(e.target).find('input#' + scope.targetinput)[0]; input.focus(); - input.setSelectionRange(startSelect, endSelect); + input.setSelectionRange(input.value.lastIndexOf('/'), input.value.length()); } postVisibleMethod(); }); From 436c199a9d373a776e20315c1650ad4909f4707a Mon Sep 17 00:00:00 2001 From: Frank Oosterhuis Date: Tue, 7 Jan 2020 09:53:58 +0100 Subject: [PATCH 3/7] [ZEPPELIN-4536] Im getting frustrated with angular --- .../src/components/note-create/visible.directive.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zeppelin-web/src/components/note-create/visible.directive.js b/zeppelin-web/src/components/note-create/visible.directive.js index d42b0040685..1594e9320d4 100644 --- a/zeppelin-web/src/components/note-create/visible.directive.js +++ b/zeppelin-web/src/components/note-create/visible.directive.js @@ -36,9 +36,9 @@ function modalvisible() { }); element.on('shown.bs.modal', function(e) { if (scope.targetinput) { - let input = angular.element(e.target).find('input#' + scope.targetinput)[0]; - input.focus(); - input.setSelectionRange(input.value.lastIndexOf('/'), input.value.length()); + let i = angular.element(document.getElementById('noteName')); + i.focus(); + i.setSelectionRange(i.val().lastIndexOf('/'), i.val().length()); } postVisibleMethod(); }); From 47292f085ea8ae84490c18f0723efdcf321d62d8 Mon Sep 17 00:00:00 2001 From: Frank Oosterhuis Date: Tue, 7 Jan 2020 11:53:48 +0100 Subject: [PATCH 4/7] [ZEPPELIN-4536] Calc start --- .../src/components/note-create/visible.directive.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zeppelin-web/src/components/note-create/visible.directive.js b/zeppelin-web/src/components/note-create/visible.directive.js index 1594e9320d4..368cda5abb7 100644 --- a/zeppelin-web/src/components/note-create/visible.directive.js +++ b/zeppelin-web/src/components/note-create/visible.directive.js @@ -36,9 +36,10 @@ function modalvisible() { }); element.on('shown.bs.modal', function(e) { if (scope.targetinput) { - let i = angular.element(document.getElementById('noteName')); - i.focus(); - i.setSelectionRange(i.val().lastIndexOf('/'), i.val().length()); + let i = angular.element(document.getElementById(scope.targetinput)); + let s = i.val().lastIndexOf('/') < 0 ? 1 : i.val().lastIndexOf('/') + 1; + i[0].focus(); + i[0].setSelectionRange(s, i.val().length); } postVisibleMethod(); }); From 091db5001a746485485505c68c97986306d10189 Mon Sep 17 00:00:00 2001 From: Frank Oosterhuis Date: Tue, 7 Jan 2020 11:54:59 +0100 Subject: [PATCH 5/7] [ZEPPELIN-4536] Simplify startpos --- zeppelin-web/src/components/note-create/visible.directive.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zeppelin-web/src/components/note-create/visible.directive.js b/zeppelin-web/src/components/note-create/visible.directive.js index 368cda5abb7..e8309f95ee1 100644 --- a/zeppelin-web/src/components/note-create/visible.directive.js +++ b/zeppelin-web/src/components/note-create/visible.directive.js @@ -37,9 +37,9 @@ function modalvisible() { element.on('shown.bs.modal', function(e) { if (scope.targetinput) { let i = angular.element(document.getElementById(scope.targetinput)); - let s = i.val().lastIndexOf('/') < 0 ? 1 : i.val().lastIndexOf('/') + 1; + let s = i.val().lastIndexOf('/'); i[0].focus(); - i[0].setSelectionRange(s, i.val().length); + i[0].setSelectionRange(s + 1, i.val().length); } postVisibleMethod(); }); From 049ea0fe2230c59e935606ca6a0d20ab9dc17e5c Mon Sep 17 00:00:00 2001 From: Frank Oosterhuis Date: Tue, 7 Jan 2020 13:33:05 +0100 Subject: [PATCH 6/7] [ZEPPELIN-4536] Removed variable. --- .../src/components/note-create/visible.directive.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/zeppelin-web/src/components/note-create/visible.directive.js b/zeppelin-web/src/components/note-create/visible.directive.js index e8309f95ee1..6345a1cf635 100644 --- a/zeppelin-web/src/components/note-create/visible.directive.js +++ b/zeppelin-web/src/components/note-create/visible.directive.js @@ -36,10 +36,9 @@ function modalvisible() { }); element.on('shown.bs.modal', function(e) { if (scope.targetinput) { - let i = angular.element(document.getElementById(scope.targetinput)); - let s = i.val().lastIndexOf('/'); - i[0].focus(); - i[0].setSelectionRange(s + 1, i.val().length); + let ele = angular.element(document.getElementById(scope.targetinput)); + ele[0].focus(); + ele[0].setSelectionRange(ele.val().lastIndexOf('/') + 1, ele.val().length); } postVisibleMethod(); }); From f905d49f24f5812d1b34906efe3e7585b951f3a6 Mon Sep 17 00:00:00 2001 From: Frank Oosterhuis Date: Tue, 7 Jan 2020 14:13:53 +0100 Subject: [PATCH 7/7] [ZEPPELIN-4536] Restore original selector --- zeppelin-web/src/components/note-create/visible.directive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zeppelin-web/src/components/note-create/visible.directive.js b/zeppelin-web/src/components/note-create/visible.directive.js index 6345a1cf635..2128f6ef6de 100644 --- a/zeppelin-web/src/components/note-create/visible.directive.js +++ b/zeppelin-web/src/components/note-create/visible.directive.js @@ -36,7 +36,7 @@ function modalvisible() { }); element.on('shown.bs.modal', function(e) { if (scope.targetinput) { - let ele = angular.element(document.getElementById(scope.targetinput)); + let ele = angular.element(e.target).find('input#' + scope.targetinput); ele[0].focus(); ele[0].setSelectionRange(ele.val().lastIndexOf('/') + 1, ele.val().length); }