cellalignpicker.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ///import core
  2. ///import uicore
  3. (function () {
  4. var utils = baidu.editor.utils,
  5. Popup = baidu.editor.ui.Popup,
  6. Stateful = baidu.editor.ui.Stateful,
  7. UIBase = baidu.editor.ui.UIBase;
  8. var CellAlignPicker = baidu.editor.ui.CellAlignPicker = function (options) {
  9. this.initOptions(options);
  10. this.initCellAlignPicker();
  11. };
  12. CellAlignPicker.prototype = {
  13. initCellAlignPicker:function () {
  14. this.initUIBase();
  15. this.Stateful_init();
  16. },
  17. getHtmlTpl:function () {
  18. return '<div id="##" class="edui-cellalignpicker %%">' +
  19. '<div class="edui-cellalignpicker-body">' +
  20. '<table onclick="$$._onClick(event);">' +
  21. '<tr><td index="0" stateful><div class="edui-icon edui-left"></div></td>' +
  22. '<td index="1" stateful><div class="edui-icon edui-center"></div></td>' +
  23. '<td index="2" stateful><div class="edui-icon edui-right"></div></td>' +
  24. '</tr>' +
  25. '<tr><td index="3" stateful><div class="edui-icon edui-left"></div></td>' +
  26. '<td index="4" stateful><div class="edui-icon edui-center"></div></td>' +
  27. '<td index="5" stateful><div class="edui-icon edui-right"></div></td>' +
  28. '</tr>' +
  29. '<tr><td index="6" stateful><div class="edui-icon edui-left"></div></td>' +
  30. '<td index="7" stateful><div class="edui-icon edui-center"></div></td>' +
  31. '<td index="8" stateful><div class="edui-icon edui-right"></div></td>' +
  32. '</tr>' +
  33. '</table>' +
  34. '</div>' +
  35. '</div>';
  36. },
  37. getStateDom: function (){
  38. return this.target;
  39. },
  40. _onClick: function (evt){
  41. var target= evt.target || evt.srcElement;
  42. if(/icon/.test(target.className)){
  43. this.items[target.parentNode.getAttribute("index")].onclick();
  44. Popup.postHide(evt);
  45. }
  46. },
  47. _UIBase_render:UIBase.prototype.render
  48. };
  49. utils.inherits(CellAlignPicker, UIBase);
  50. utils.extend(CellAlignPicker.prototype, Stateful,true);
  51. })();