Repository: incubator-zeppelin Updated Branches: refs/heads/master e3f57d1a6 -> 248a166f7
Switch ngDelete to ngEscape When IBM-compatible keyboards user presses `Delete` key, it updates title of notebook/paragraph instead of forward delete. This PR fix this bug by removing delete key event. Author: Mina Lee <[email protected]> Closes #149 from minahlee/switch_ngdelete_to_ng_escape and squashes the following commits: c34ee59 [Mina Lee] Switch ngDelete to ngEscape Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/248a166f Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/248a166f Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/248a166f Branch: refs/heads/master Commit: 248a166f75605c6439b79266d0a414d2f54d6955 Parents: e3f57d1 Author: Mina Lee <[email protected]> Authored: Fri Jul 10 14:36:50 2015 +0900 Committer: Mina Lee <[email protected]> Committed: Thu Jul 23 15:02:59 2015 +0900 ---------------------------------------------------------------------- zeppelin-web/src/app/notebook/notebook.html | 2 +- .../src/app/notebook/paragraph/paragraph.html | 2 +- .../components/ngdelete/ngdelete.directive.js | 28 -------------------- .../components/ngescape/ngescape.directive.js | 27 +++++++++++++++++++ zeppelin-web/src/index.html | 2 +- 5 files changed, 30 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/248a166f/zeppelin-web/src/app/notebook/notebook.html ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/notebook/notebook.html b/zeppelin-web/src/app/notebook/notebook.html index 3a3f751..4830a9d 100644 --- a/zeppelin-web/src/app/notebook/notebook.html +++ b/zeppelin-web/src/app/notebook/notebook.html @@ -16,7 +16,7 @@ limitations under the License. <div class="noteAction" ng-show="note.id && !paragraphUrl"> <h3 class="new_h3"> <input type="text" class="form-control2" placeholder="{{note.name || 'Note ' + note.id}}" style="width:200px;" - ng-show="showEditor" ng-model="note.name" ng-enter="sendNewName()" ng-delete="showEditor = false" autofocus/> + ng-show="showEditor" ng-model="note.name" ng-enter="sendNewName()" ng-escape="showEditor = false" autofocus/> <p class="form-control-static2" ng-click="showEditor = true" ng-show="!showEditor">{{note.name || 'Note ' + note.id}}</p> <span class="labelBtn btn-group"> <button type="button" http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/248a166f/zeppelin-web/src/app/notebook/paragraph/paragraph.html ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.html b/zeppelin-web/src/app/notebook/paragraph/paragraph.html index d11badf..dd5c325 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.html +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.html @@ -22,7 +22,7 @@ limitations under the License. placeholder="Edit title" ng-model="paragraph.title" ng-show="showTitleEditor" - ng-delete="showTitleEditor = false" + ng-escape="showTitleEditor = false" ng-enter="setTitle(); showTitleEditor = false"/> <div ng-click="showTitleEditor = !asIframe && !viewOnly" ng-show="!showTitleEditor" http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/248a166f/zeppelin-web/src/components/ngdelete/ngdelete.directive.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/ngdelete/ngdelete.directive.js b/zeppelin-web/src/components/ngdelete/ngdelete.directive.js deleted file mode 100644 index 1ddf1eb..0000000 --- a/zeppelin-web/src/components/ngdelete/ngdelete.directive.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -angular.module('zeppelinWebApp').directive('ngDelete', function() { - return function(scope, element, attrs) { - element.bind('keydown keyup', function(event) { - if (event.which === 27 || event.which === 46) { - scope.$apply(function() { - scope.$eval(attrs.ngEnter); - }); - event.preventDefault(); - } - }); - }; -}); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/248a166f/zeppelin-web/src/components/ngescape/ngescape.directive.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/components/ngescape/ngescape.directive.js b/zeppelin-web/src/components/ngescape/ngescape.directive.js new file mode 100644 index 0000000..415a04e --- /dev/null +++ b/zeppelin-web/src/components/ngescape/ngescape.directive.js @@ -0,0 +1,27 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +'use strict'; + +angular.module('zeppelinWebApp').directive('ngEscape', function() { + return function(scope, element, attrs) { + element.bind('keydown keyup', function(event) { + if (event.which === 27) { + scope.$apply(function() { + scope.$eval(attrs.ngEnter); + }); + event.preventDefault(); + } + }); + }; +}); http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/248a166f/zeppelin-web/src/index.html ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/index.html b/zeppelin-web/src/index.html index a647ae2..36aa933 100644 --- a/zeppelin-web/src/index.html +++ b/zeppelin-web/src/index.html @@ -112,7 +112,7 @@ limitations under the License. <script src="app/interpreter/interpreter.controller.js"></script> <script src="app/notebook/paragraph/paragraph.controller.js"></script> <script src="components/navbar/navbar.controller.js"></script> - <script src="components/ngdelete/ngdelete.directive.js"></script> + <script src="components/ngescape/ngescape.directive.js"></script> <script src="components/popover-html-unsafe/popover-html-unsafe.directive.js"></script> <script src="components/ngenter/ngenter.directive.js"></script> <script src="components/dropdowninput/dropdowninput.directive.js"></script>
