imageBtn.directive.js 1.1 KB

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