fill.js 1.3 KB

1234567891011121314151617181920212223242526272829
  1. UE.registerUI('fillBlank', function(editor, uiname){
  2. var iconUrl = editor.options.UEDITOR_HOME_URL + 'plugin/fillBlank.png';
  3. /* editor.ready(function(){
  4. UE.utils.cssRule('fillBlank', 'img.fillBlank{vertical-align: middle;}', editor.document);
  5. });*/
  6. /*editor.ready(function(){
  7. UE.utils.cssRule('fillBlank', 'img.kfformula{vertical-align: middle;}', editor.document);
  8. });*/
  9. // let iconUrl = "./fillBlank.png"
  10. var kfBtn = new UE.ui.Button({
  11. name:'插入填空' + uiname,
  12. title:'插入填空',
  13. //需要添加的额外样式,指定icon图标
  14. cssRules :'margin-top: 2px; background: url("' + iconUrl + '") no-repeat !important',
  15. onclick: function () {
  16. editor.execCommand('insertHtml', '<span style="display: inline-block;' +
  17. ' font-weight: bold; margin: 5px; color: red">__________</span>');
  18. // editor.execCommand('insertHtml', '<span style="display: inline-block; text-align: center; width: 90px; border-bottom: 2px solid red; font-weight: bold; margin: 5px; color: red">1</span>');// insertNode('<span style="display: inline-block; color: red">________</span>')
  19. // let content = editor.getContent() + '<span style="display: inline-block; color: red">________</span>'
  20. // editor.setContent(content)
  21. }
  22. });
  23. return kfBtn;
  24. });