appendNode.directive.js 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. angular.module('kityminderEditor')
  2. .directive('appendNode', ['commandBinder', function(commandBinder) {
  3. return {
  4. restrict: 'E',
  5. templateUrl: 'ui/directive/appendNode/appendNode.html',
  6. scope: {
  7. minder: '='
  8. },
  9. replace: true,
  10. link: function($scope) {
  11. var minder = $scope.minder;
  12. commandBinder.bind(minder, 'appendchildnode', $scope)
  13. $scope.execCommand = function(command) {
  14. minder.execCommand(command, '分支主题');
  15. editText();
  16. };
  17. function editText() {
  18. var receiverElement = editor.receiver.element;
  19. var fsm = editor.fsm;
  20. var receiver = editor.receiver;
  21. receiverElement.innerText = minder.queryCommandValue('text');
  22. fsm.jump('input', 'input-request');
  23. receiver.selectAll();
  24. }
  25. }
  26. }
  27. }]);