/*
 * 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';

/**
 * @ngdoc directive
 * @name zeppelinWebApp.directive:delete
 * @description
 * # ngDelete
 */
angular.module('zeppelinWebApp').directive('ngDelete', function() {
  return function(scope, element, attrs) {
    element.bind('keydown keypress', function(event) {
      if (event.which === 27 || event.which === 46) {
        scope.$apply(function() {
          scope.$eval(attrs.ngEnter);
        });
        event.preventDefault();
      }
    });
  };
});

/*
 * 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';

/**
 * @ngdoc directive
 * @name zeppelinWebApp.directive:delete
 * @description
 * # ngDelete
 */
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();
      }
    });
  };
});

Enable to type dot(.) in title
Enable to type dot(.) in title

Changed 'keypress' event to 'keyup' event since keypress event is for printable characters.

Author: Mina Lee <minalee@nflabs.com>

Closes #95 from minahlee/fix/enable_dot_in_title and squashes the following commits:

9100fa6 [Mina Lee] Enable to type dot(.) in title
