lineheight.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*******************************************************************************
  2. * KindEditor - WYSIWYG HTML Editor for Internet
  3. * Copyright (C) 2006-2011 kindsoft.net
  4. *
  5. * @author Roddy <luolonghao@gmail.com>
  6. * @site http://www.kindsoft.net/
  7. * @licence http://www.kindsoft.net/license.php
  8. *******************************************************************************/
  9. KindEditor.plugin('lineheight', function(K) {
  10. var self = this, name = 'lineheight', lang = self.lang(name + '.');
  11. self.clickToolbar(name, function() {
  12. var curVal = '', commonNode = self.cmd.commonNode({'*' : '.line-height'});
  13. if (commonNode) {
  14. curVal = commonNode.css('line-height');
  15. }
  16. var menu = self.createMenu({
  17. name : name,
  18. width : 150
  19. });
  20. K.each(lang.lineHeight, function(i, row) {
  21. K.each(row, function(key, val) {
  22. menu.addItem({
  23. title : val,
  24. checked : curVal === key,
  25. click : function() {
  26. self.cmd.toggle('<span style="line-height:' + key + ';"></span>', {
  27. span : '.line-height=' + key
  28. });
  29. self.updateState();
  30. self.addBookmark();
  31. self.hideMenu();
  32. }
  33. });
  34. });
  35. });
  36. });
  37. });