当前位置: 首页 > wzjs >正文

公司网站建设需推广学校网站建设培训方案

公司网站建设需推广,学校网站建设培训方案,注册公司代理公司,网站建设技术员保密协议用户有自己的文章格式,要求复制或者粘贴进来的文章能够一键排版,不需要手动调试 这个需求的话咱们就需要自己去注册一个事件啦,这里我没有修改源码,而是在编辑器初始化之后给他注册了一个事件 我的工具列表变量 vue组件中data中…

用户有自己的文章格式,要求复制或者粘贴进来的文章能够一键排版,不需要手动调试

这个需求的话咱们就需要自己去注册一个事件啦,这里我没有修改源码,而是在编辑器初始化之后给他注册了一个事件

我的工具列表变量

vue组件中data中定义的变量
data(){return {aiList: [{name:'AIwrite',className:'edui-for-ai_writing',title:'一键排版',httpType:'AI_WRITING_ADDRESS'},// {name:'AIvoice',className:'edui-for-ai_voice',title:'AI语音',httpType:'AI_VOICE_ADDRESS'},// {name:'AIdraw',className:'edui-for-ai_AIdraw',title:'AI绘图',httpType:'AI_DRAWING_ADDRESS'},// {name:'AIvideo',className:'edui-for-AIvideo',title:'AI视频',httpType:'AI_VIDEO_ADDRESS'},// {name:'AIzhineng',className:'edui-for-AIzhineng',title:'AI智能',httpType:'AI_BRAINPOWER_ADDRESS'},// {name:'AIroom',className:'edui-for-AIroom',title:'AI实验室',httpType:'AI_LABORATORY_ADDRESS'},// {name:'AImore',className:'edui-for-AImore',title:'更多',httpType:'AI_MORE_ADDRESS'},]}
}

    registerUIYiJian(){  //当window对象已经挂在的ueditor的实例时调用此方法,在iframe.css中去调整自定义按钮的样式let _this = thiswindow.UE.registerUI( _this.aiList[0].name ,function(editor,uiName){var btn = new UE.ui.Button({name:'btn-dialog-' + uiName,className:_this.aiList[0].className,title:_this.aiList[0].title,onclick:function () {// AIwrite = window.open('https://www.baidu.com')_this.httpRequest(_this.aiList[0].httpType)}});return btn;},undefined);},

httpRequest中的逻辑主要是对稿件样式进行处理,添加自己的自定义类名之后,然后去iframe.css加上自己的样式即可

   // 一键排版功能oneClickLayout(){console.log(this.editor,'当前的编辑器内容')if(this.editor.body.childNodes.length > 0){// 说明当前文章有内容for (let i = 0; i < this.editor.body.childNodes.length; i++) {console.log(this.editor.body.childNodes[i],'当前的p标签有哪些元素')// 获取标签内容重新组装html结构填充到编辑器中this.editor.body.childNodes[i].classList.remove()this.editor.body.childNodes[i].removeAttribute('style')// 给最外层的标签加上我的目标样式this.editor.body.childNodes[i].classList.add('mystyle')this.clearCssStyle(this.editor.body.childNodes[i])}}  },// 递归去除所有标签的行内样式和类名clearCssStyle(node){if(node.childNodes.length == 0) return for (let i = 0; i < node.childNodes.length; i++) {if('classList' in node.childNodes[i]){node.childNodes[i].classList.remove()}if('style' in node.childNodes[i]){node.childNodes[i].removeAttribute('style')}}},

我移除了编辑器所有的类名和行内样式,增加了mystyle类名

一键排版就完成了 。

此外我还注册过其他功能,业务代码的话其实没啥好说的,主要是注册的方法的使用,比如之前还注册过一些ai的功能以及和135编辑器的一些交互

/** @description  : write something* @Author       : snoop-dog* @Date         : 2021-12-06 11:39:53* @LastEditors  : snoop-dog* @LastEditTime : 2021-12-06 14:15:39* @FilePath     : 135editor.js*/UE.registerUI('135editor',function(editor,uiName){// var dialog = new UE.ui.Dialog({//     iframeUrl: editor.options.UEDITOR_HOME_URL+'dialogs/135editor/135EditorDialogPage.html',//     cssRules:"width:"+ parseInt(document.body.clientWidth*0.9) +"px;height:"+(window.innerHeight -50)+"px;",//     editor:editor,//     name:uiName,//     title:"135缂栬緫鍣�"// });// dialog.fullscreen = false;// dialog.draggable = false;var editor135;function onContentFrom135(event) {if (typeof event.data !== 'string') {if(event.data.ready) {editor135.postMessage(editor.getContent(),'*');}return;};if(event.data.indexOf('<') !== 0) return;editor.setContent(event.data);editor.fireEvent("catchRemoteImage");window.removeEventListener('message', onContentFrom135);}var btn = new UE.ui.Button({name:'btn-dialog-' + uiName,className:'edui-for-135editor',title:'135编辑器',onclick:function () {// dialog.render();// dialog.open();// 鐢变簬鐧诲綍瀛樺湪璺ㄥ煙闂锛岃浣跨敤濡備笅鏂瑰紡璋冪敤135缂栬緫鍣�editor135 = window.open('https://www.135editor.com/simple_editor.html?callback=true&appkey=')window.removeEventListener('message', onContentFrom135);window.addEventListener('message', onContentFrom135, false);}});return btn;
},undefined);
// ai写作
var aiList = [{name:'AIwrite',className:'edui-for-ai_writing',title:'AI写作',httpType:'AI_WRITING_ADDRESS'},{name:'AIvoice',className:'edui-for-ai_voice',title:'AI语音',httpType:'AI_VOICE_ADDRESS'},{name:'AIdraw',className:'edui-for-ai_AIdraw',title:'AI绘图',httpType:'AI_DRAWING_ADDRESS'},{name:'AIvideo',className:'edui-for-AIvideo',title:'AI视频',httpType:'AI_VIDEO_ADDRESS'},{name:'AIzhineng',className:'edui-for-AIzhineng',title:'AI智能',httpType:'AI_BRAINPOWER_ADDRESS'},{name:'AIroom',className:'edui-for-AIroom',title:'AI实验室',httpType:'AI_LABORATORY_ADDRESS'},{name:'AImore',className:'edui-for-AImore',title:'更多',httpType:'AI_MORE_ADDRESS'},
]
for (let i = 0; i < aiList.length; i++) {UE.registerUI( aiList[i].name ,function(editor,uiName){var btn = new UE.ui.Button({name:'btn-dialog-' + uiName,className:aiList[i].className,title:aiList[i].title,onclick:function () {// AIwrite = window.open('https://www.baidu.com')httpRequest(aiList[i].httpType)}});return btn;},undefined);
}
// 原生js发送请求
function httpRequest(code){var currentUser = JSON.parse(localStorage.getItem("login_casData"))var url = window.location.origin +'/' +window.location.pathname.split('/')[1]+'/dyportalserver/ParameterController/getParameter'var formdata = new FormData()formdata.append('parameterCode',code)$.ajax({type: 'POST',url: url,data: formdata,contentType: false,processData: false,headers:{'tenantId': currentUser.tenantId,'token': currentUser.token,'userId': encodeURIComponent(currentUser.userId),'userName': encodeURIComponent(currentUser.userName),'X-Requested-With': 'XMLHttpRequest','newseditingsuite-header': true},success: function(data) {console.log(data,'当前接口是否成功')if(data.status){var targetUrl = data.data[0].parameterValue// 通知vue打开弹框,利用广播进行通信localStorage.setItem('openVueDialog',targetUrl)console.log('asdfasf',window.vm)const channel = new BroadcastChannel('updataCatalogTask') let obj = {url:targetUrl,}if(code === 'AI_WRITING_ADDRESS'){obj.type = true} else {obj.type = false}channel.postMessage(obj)} else {alert('当前参数未配置,请联系管理员配置!')}},error: function(jqXHR, textStatus, errorThrown) {alert('当前参数未配置,请联系管理员配置!')}});
} 


文章转载自:

http://7yJLdZJ5.Lbbgf.cn
http://T8QEoFwf.Lbbgf.cn
http://TpHUHog8.Lbbgf.cn
http://k9zbC8b2.Lbbgf.cn
http://waVghSho.Lbbgf.cn
http://CWc7b6oU.Lbbgf.cn
http://8NyLqeQS.Lbbgf.cn
http://urX2oCnz.Lbbgf.cn
http://iksiWshi.Lbbgf.cn
http://HbsCs0g6.Lbbgf.cn
http://PmLlBidC.Lbbgf.cn
http://2zKiV3nr.Lbbgf.cn
http://2HBVsgbj.Lbbgf.cn
http://HhwWxtCW.Lbbgf.cn
http://cmmZVfJW.Lbbgf.cn
http://XvQwF9VJ.Lbbgf.cn
http://6kacZ91l.Lbbgf.cn
http://1e2xz6Ld.Lbbgf.cn
http://jssaSKmX.Lbbgf.cn
http://TIXfTNC9.Lbbgf.cn
http://DxmZn45q.Lbbgf.cn
http://cnW9i11W.Lbbgf.cn
http://L6lNgkDY.Lbbgf.cn
http://eDdBxd3M.Lbbgf.cn
http://vI8l4Pl1.Lbbgf.cn
http://RJ15Mr6s.Lbbgf.cn
http://8aDL408O.Lbbgf.cn
http://N7nttv9E.Lbbgf.cn
http://cJ3x912a.Lbbgf.cn
http://aZD3fv3M.Lbbgf.cn
http://www.dtcms.com/wzjs/627618.html

相关文章:

  • 上海 响应式网站公司泊头市有做网站的吗
  • 电影采集网站流量免费企业邮箱号有哪些
  • 江西网站开发公司电话wordpress 做思维导图
  • 长春市规划建设局网站查询如何做能切换语言的网站
  • 济宁培训网站建设淘宝官网首页入口手机
  • 上海国际建设总承包公司网站中国站长网站
  • 怀宁做网站培训ui设计公司
  • 公司做网站需要哪些手续文本网站开发英文文献
  • 湿地公园网站开发招标网站收录差
  • 中山精品网站建设渠道做视频网站源码
  • 网站建设对用户影响百度官网网址
  • Wordpress djongo南宁外包seo服务
  • 网站建设与维护案例江苏省建设考试培训网站
  • 中山网站建设技术深圳电商网站设计公司
  • 绥化建设局网站360客户如何做网站推广
  • wordpress趣味插件seo服务器优化
  • 织梦网站后台打开空白WordPress农产品
  • 凡科网站建设怎么样wordpress doaction
  • 昆明智能网站推广价格wordpress 后门软件
  • 昆山市建设局招投标网站网页设计欣赏分析
  • 婺源做网站有吗产品推广目标
  • 开拓网站建设公司揭阳cms建站模板
  • 个人备案的网站 做企业站微信公众号api接口大全
  • 增城免费网站建设wordpress 缓存下不计数
  • 做灯饰的企业都会在哪些网站led外贸网站建设
  • 谷多网站做汽配外贸哪个网站
  • 关于设计图的网站网络推广策划方案怎么写
  • 网站开发组合seo怎么做优化计划
  • 网站有收录没排名嘉定区做网站
  • 一定得做网站认证昆山品牌设计公司