rightClick.js 621 B

123456789101112131415161718192021
  1. // TODO: This file was created by bulk-decaffeinate.
  2. // Fix any style issues and re-enable lint.
  3. /*
  4. * decaffeinate suggestions:
  5. * DS102: Remove unnecessary code created because of implicit returns
  6. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  7. */
  8. import App from '../base'
  9. export default App.directive('rightClick', function () {
  10. return {
  11. restrict: 'A',
  12. link(scope, element, attrs) {
  13. return element.bind('contextmenu', function (e) {
  14. e.preventDefault()
  15. e.stopPropagation()
  16. return scope.$eval(attrs.rightClick)
  17. })
  18. },
  19. }
  20. })