hyperLink.directive.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. angular.module('kityminderEditor')
  2. .directive('hyperLink', ['$modal', function($modal) {
  3. return {
  4. restrict: 'E',
  5. templateUrl: 'ui/directive/hyperLink/hyperLink.html',
  6. scope: {
  7. minder: '='
  8. },
  9. replace: true,
  10. link: function($scope) {
  11. var minder = $scope.minder;
  12. $scope.addHyperlink = function() {
  13. var link = minder.queryCommandValue('HyperLink');
  14. var hyperlinkModal = $modal.open({
  15. animation: true,
  16. templateUrl: 'ui/dialog/hyperlink/hyperlink.tpl.html',
  17. controller: 'hyperlink.ctrl',
  18. size: 'md',
  19. resolve: {
  20. link: function() {
  21. return link;
  22. }
  23. }
  24. });
  25. hyperlinkModal.result.then(function(result) {
  26. minder.execCommand('HyperLink', result.url, result.title || '');
  27. });
  28. }
  29. }
  30. }
  31. }]);