135editor.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. UE.registerUI('135editor',function(editor,uiName){
  2. // var dialog = new UE.ui.Dialog({
  3. // iframeUrl: editor.options.UEDITOR_HOME_URL+'dialogs/135editor/135EditorDialogPage.html',
  4. // cssRules:"width:"+ parseInt(document.body.clientWidth*0.9) +"px;height:"+(window.innerHeight -50)+"px;",
  5. // editor:editor,
  6. // name:uiName,
  7. // title:"135编辑器"
  8. // });
  9. // dialog.fullscreen = false;
  10. // dialog.draggable = false;
  11. var btn = new UE.ui.Button({
  12. name:'btn-dialog-' + uiName,
  13. className:'edui-for-135editor',
  14. title:'135编辑器',
  15. onclick:function () {
  16. // dialog.render();
  17. // dialog.open();
  18. // 由于登录存在跨域问题,请使用如下方式调用135编辑器
  19. var editor135 = window.open('https://www.135editor.com/simple_editor.html?callback=true&appkey=')
  20. // setTimeout(function(){
  21. // editor135.postMessage(editor.getContent(),'*');
  22. // },3000);
  23. window.addEventListener('message', function (event) {
  24. if (typeof event.data !== 'string') {
  25. if(event.data.ready) {
  26. editor135.postMessage(editor.getContent(),'*');
  27. }
  28. return;
  29. };
  30. editor.setContent(event.data);
  31. editor.fireEvent("catchRemoteImage");
  32. }, false);
  33. }
  34. });
  35. return btn;
  36. },undefined);
  37. // 修改最后的undefined参数为数字序号,比如5,可调整135编辑器按钮的顺序。默认出现在最后面