autotypesetpicker.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. ///import core
  2. ///import uicore
  3. (function() {
  4. var utils = baidu.editor.utils,
  5. UIBase = baidu.editor.ui.UIBase;
  6. var AutoTypeSetPicker = (baidu.editor.ui.AutoTypeSetPicker = function(
  7. options
  8. ) {
  9. this.initOptions(options);
  10. this.initAutoTypeSetPicker();
  11. });
  12. AutoTypeSetPicker.prototype = {
  13. initAutoTypeSetPicker: function() {
  14. this.initUIBase();
  15. },
  16. getHtmlTpl: function() {
  17. var me = this.editor,
  18. opt = me.options.autotypeset,
  19. lang = me.getLang("autoTypeSet");
  20. var textAlignInputName = "textAlignValue" + me.uid,
  21. imageBlockInputName = "imageBlockLineValue" + me.uid,
  22. symbolConverInputName = "symbolConverValue" + me.uid;
  23. return (
  24. '<div id="##" class="edui-autotypesetpicker %%">' +
  25. '<div class="edui-autotypesetpicker-body">' +
  26. "<table >" +
  27. '<tr><td nowrap><input type="checkbox" name="mergeEmptyline" ' +
  28. (opt["mergeEmptyline"] ? "checked" : "") +
  29. ">" +
  30. lang.mergeLine +
  31. '</td><td colspan="2"><input type="checkbox" name="removeEmptyline" ' +
  32. (opt["removeEmptyline"] ? "checked" : "") +
  33. ">" +
  34. lang.delLine +
  35. "</td></tr>" +
  36. '<tr><td nowrap><input type="checkbox" name="removeClass" ' +
  37. (opt["removeClass"] ? "checked" : "") +
  38. ">" +
  39. lang.removeFormat +
  40. '</td><td colspan="2"><input type="checkbox" name="indent" ' +
  41. (opt["indent"] ? "checked" : "") +
  42. ">" +
  43. lang.indent +
  44. "</td></tr>" +
  45. "<tr>" +
  46. '<td nowrap><input type="checkbox" name="textAlign" ' +
  47. (opt["textAlign"] ? "checked" : "") +
  48. ">" +
  49. lang.alignment +
  50. "</td>" +
  51. '<td colspan="2" id="' +
  52. textAlignInputName +
  53. '">' +
  54. '<input type="radio" name="' +
  55. textAlignInputName +
  56. '" value="left" ' +
  57. (opt["textAlign"] && opt["textAlign"] == "left" ? "checked" : "") +
  58. ">" +
  59. me.getLang("justifyleft") +
  60. '<input type="radio" name="' +
  61. textAlignInputName +
  62. '" value="center" ' +
  63. (opt["textAlign"] && opt["textAlign"] == "center" ? "checked" : "") +
  64. ">" +
  65. me.getLang("justifycenter") +
  66. '<input type="radio" name="' +
  67. textAlignInputName +
  68. '" value="right" ' +
  69. (opt["textAlign"] && opt["textAlign"] == "right" ? "checked" : "") +
  70. ">" +
  71. me.getLang("justifyright") +
  72. "</td>" +
  73. "</tr>" +
  74. "<tr>" +
  75. '<td nowrap><input type="checkbox" name="imageBlockLine" ' +
  76. (opt["imageBlockLine"] ? "checked" : "") +
  77. ">" +
  78. lang.imageFloat +
  79. "</td>" +
  80. '<td nowrap id="' +
  81. imageBlockInputName +
  82. '">' +
  83. '<input type="radio" name="' +
  84. imageBlockInputName +
  85. '" value="none" ' +
  86. (opt["imageBlockLine"] && opt["imageBlockLine"] == "none"
  87. ? "checked"
  88. : "") +
  89. ">" +
  90. me.getLang("default") +
  91. '<input type="radio" name="' +
  92. imageBlockInputName +
  93. '" value="left" ' +
  94. (opt["imageBlockLine"] && opt["imageBlockLine"] == "left"
  95. ? "checked"
  96. : "") +
  97. ">" +
  98. me.getLang("justifyleft") +
  99. '<input type="radio" name="' +
  100. imageBlockInputName +
  101. '" value="center" ' +
  102. (opt["imageBlockLine"] && opt["imageBlockLine"] == "center"
  103. ? "checked"
  104. : "") +
  105. ">" +
  106. me.getLang("justifycenter") +
  107. '<input type="radio" name="' +
  108. imageBlockInputName +
  109. '" value="right" ' +
  110. (opt["imageBlockLine"] && opt["imageBlockLine"] == "right"
  111. ? "checked"
  112. : "") +
  113. ">" +
  114. me.getLang("justifyright") +
  115. "</td>" +
  116. "</tr>" +
  117. '<tr><td nowrap><input type="checkbox" name="clearFontSize" ' +
  118. (opt["clearFontSize"] ? "checked" : "") +
  119. ">" +
  120. lang.removeFontsize +
  121. '</td><td colspan="2"><input type="checkbox" name="clearFontFamily" ' +
  122. (opt["clearFontFamily"] ? "checked" : "") +
  123. ">" +
  124. lang.removeFontFamily +
  125. "</td></tr>" +
  126. '<tr><td nowrap colspan="3"><input type="checkbox" name="removeEmptyNode" ' +
  127. (opt["removeEmptyNode"] ? "checked" : "") +
  128. ">" +
  129. lang.removeHtml +
  130. "</td></tr>" +
  131. '<tr><td nowrap colspan="3"><input type="checkbox" name="pasteFilter" ' +
  132. (opt["pasteFilter"] ? "checked" : "") +
  133. ">" +
  134. lang.pasteFilter +
  135. "</td></tr>" +
  136. "<tr>" +
  137. '<td nowrap><input type="checkbox" name="symbolConver" ' +
  138. (opt["bdc2sb"] || opt["tobdc"] ? "checked" : "") +
  139. ">" +
  140. lang.symbol +
  141. "</td>" +
  142. '<td id="' +
  143. symbolConverInputName +
  144. '">' +
  145. '<input type="radio" name="bdc" value="bdc2sb" ' +
  146. (opt["bdc2sb"] ? "checked" : "") +
  147. ">" +
  148. lang.bdc2sb +
  149. '<input type="radio" name="bdc" value="tobdc" ' +
  150. (opt["tobdc"] ? "checked" : "") +
  151. ">" +
  152. lang.tobdc +
  153. "" +
  154. "</td>" +
  155. '<td nowrap align="right"><button >' +
  156. lang.run +
  157. "</button></td>" +
  158. "</tr>" +
  159. "</table>" +
  160. "</div>" +
  161. "</div>"
  162. );
  163. },
  164. _UIBase_render: UIBase.prototype.render
  165. };
  166. utils.inherits(AutoTypeSetPicker, UIBase);
  167. })();