commandbutton.js 812 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * @fileOverview
  3. *
  4. * 生成绑定到某个命令的按钮
  5. *
  6. * @author: techird
  7. * @copyright: Baidu FEX, 2014
  8. */
  9. KityMinder.registerUI('widget/commandbutton', function(minder) {
  10. return {
  11. generate: function(command, onclick) {
  12. var $button = new FUI.Button({
  13. label: minder.getLang('ui.command.' + command) || minder.getLang('ui.' + command),
  14. text: minder.getLang('ui.command.' + command) || minder.getLang('ui.' + command),
  15. className: ['command-widget', 'command-button', command]
  16. });
  17. $button.bindExecution('click', onclick || function() {
  18. minder.execCommand(command);
  19. });
  20. $button.bindCommandState(minder, command);
  21. return $button;
  22. }
  23. };
  24. });