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

成都大型网站建设网易企业邮箱和网易邮箱的区别

成都大型网站建设,网易企业邮箱和网易邮箱的区别,餐饮品牌设计公司哪家好,文明网站建设情况报告昨天同事那边有个需求#xff0c;就是要实现聊天功能#xff0c;需要用到一个富文本编辑器#xff0c;参考如下#xff1a; 上面的这个效果图是博客园的评论输入框 最终使用wangEditor编辑器实现的效果如下#xff1a; 只保留了个别的菜单#xff1a; 默认模式的wangE…昨天同事那边有个需求就是要实现聊天功能需要用到一个富文本编辑器参考如下 上面的这个效果图是博客园的评论输入框 最终使用wangEditor编辑器实现的效果如下 只保留了个别的菜单 默认模式的wangEditor编辑器如下 下面直接上代码 解决步骤1cdn引入 head头部标签引入css linkhrefhttps://unpkg.com/wangeditor/editorlatest/dist/css/style.cssrelstylesheet/script引入js script srchttps://unpkg.com/wangeditor/editorlatest/dist/index.js/script解决步骤2其余css配置 style#editor—wrapper {border: 1px solid #ccc;z-index: 100; /* 按需定义 */}#toolbar-container {border-bottom: 1px solid #ccc;}#editor-container {height: 500px;}/style解决步骤3html代码 div ideditor-content-textarea/divbutton idbtn-set-html设置html/buttondiv ideditor—wrapper stylewidth: 900pxdiv idtoolbar-container!-- 工具栏 --/divdiv ideditor-container!-- 编辑器 --/div/div解决步骤4script代码 scriptconst { createEditor, createToolbar } window.wangEditor;const editorConfig {placeholder: 请输入内容...,// maxLength:2000,//设置最大长度MENU_CONF: {},onChange(editor) {const html editor.getHtml();console.log(editor content, html);// 也可以同步到 textarea},};const editor createEditor({selector: #editor-container,html: pbr/p,config: editorConfig,mode: simple, // or simple});const toolbarConfig {excludeKeys: [blockquote,bgColor,// headerSelect,italic,group-more-style, // 排除菜单组写菜单组 key 的值即可bulletedList, //无序列表numberedList, //有序列表todo, //待办emotion, //表情insertTable, //表格codeBlock, //代码块group-video, //视频divider, //分割线fullScreen, //全屏// insertLink,//插入链接group-justify, //对齐方式group-indent, //缩进fontSize, //字体大小fontFamily, //字体lineHeight, //行高underline, //下划线color, //颜色undo, //撤销redo, //重做],};toolbarConfig.modalAppendToBody true;// 创建 toolbar 和 editor// 可监听 modalOrPanelShow 和 modalOrPanelHide 自定义事件来设置样式、蒙层editor.on(modalOrPanelShow, (modalOrPanel) {if (modalOrPanel.type ! modal) return;const { $elem } modalOrPanel; // modal element// 设置 modal 样式定位、z-index// 显示蒙层});editor.on(modalOrPanelHide, () {// 隐藏蒙层});const toolbar createToolbar({editor,selector: #toolbar-container,config: toolbarConfig,mode: default, // or simple});editorConfig.MENU_CONF[uploadImage] {server: /api/upload-image,fieldName: custom-field-name,// 继续写其他配置...customInsert(res, insertFn) {console.log(res);// JS 语法// res 即服务端的返回结果// 从 res 中找到 url alt href 然后插入图片// url: xxx, // 图片 src 必须// alt: yyy, // 图片描述文字非必须// href: zzz // 图片的链接非必须insertFn(url, alt, href);},//【注意】不需要修改的不用写wangEditor 会去 merge 当前其他配置}; });如果要实现回显则需要通过下面的代码 // textarea 初始化值const textarea document.getElementById(editor-content-textarea);textarea.value pwangEditor 只识别 editor.getHtml() 生成的 html 格式不可以随意自定义 html 代码html 格式太灵活了不会全部兼容/p\npwangEditor can only understand the HTML format from editor.getHtml() , but not all HTML formats./p\npbr/p;// Set HTMLdocument.getElementById(btn-set-html).addEventListener(click, () {if (editor.isDisabled()) editor.enable();if (!editor.isFocused()) editor.focus();editor.select([]);editor.deleteFragment();window.wangEditor.SlateTransforms.setNodes(editor,{ type: paragraph },{ mode: highest });editor.dangerouslyInsertHtml(textarea.value);完整代码如下 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlnshttp://www.w3.org/1999/xhtmlheadmeta http-equivcontent-type contenttext/html;charsetutf-8 /title富文本编辑器/titlelinkhrefhttps://unpkg.com/wangeditor/editorlatest/dist/css/style.cssrelstylesheet/style#editor—wrapper {border: 1px solid #ccc;z-index: 100; /* 按需定义 */}#toolbar-container {border-bottom: 1px solid #ccc;}#editor-container {height: 500px;}/style/headbodydiv ideditor-content-textarea/divbutton idbtn-set-html设置html/buttondiv ideditor—wrapper stylewidth: 900pxdiv idtoolbar-container!-- 工具栏 --/divdiv ideditor-container!-- 编辑器 --/div/divscript srchttps://unpkg.com/wangeditor/editorlatest/dist/index.js/scriptscriptconst { createEditor, createToolbar } window.wangEditor;const editorConfig {placeholder: 请输入内容...,// maxLength:2000,//设置最大长度MENU_CONF: {},onChange(editor) {const html editor.getHtml();console.log(editor content, html);// 也可以同步到 textarea},};const editor createEditor({selector: #editor-container,html: pbr/p,config: editorConfig,mode: simple, // or simple});const toolbarConfig {excludeKeys: [blockquote,bgColor,// headerSelect,italic,group-more-style, // 排除菜单组写菜单组 key 的值即可bulletedList, //无序列表numberedList, //有序列表todo, //待办emotion, //表情insertTable, //表格codeBlock, //代码块group-video, //视频divider, //分割线fullScreen, //全屏// insertLink,//插入链接group-justify, //对齐方式group-indent, //缩进fontSize, //字体大小fontFamily, //字体lineHeight, //行高underline, //下划线color, //颜色undo, //撤销redo, //重做],};toolbarConfig.modalAppendToBody true;// 创建 toolbar 和 editor// 可监听 modalOrPanelShow 和 modalOrPanelHide 自定义事件来设置样式、蒙层editor.on(modalOrPanelShow, (modalOrPanel) {if (modalOrPanel.type ! modal) return;const { $elem } modalOrPanel; // modal element// 设置 modal 样式定位、z-index// 显示蒙层});editor.on(modalOrPanelHide, () {// 隐藏蒙层});const toolbar createToolbar({editor,selector: #toolbar-container,config: toolbarConfig,mode: default, // or simple});editorConfig.MENU_CONF[uploadImage] {server: /api/upload-image,fieldName: custom-field-name,// 继续写其他配置...customInsert(res, insertFn) {console.log(res);// JS 语法// res 即服务端的返回结果// 从 res 中找到 url alt href 然后插入图片// url: xxx, // 图片 src 必须// alt: yyy, // 图片描述文字非必须// href: zzz // 图片的链接非必须insertFn(url, alt, href);},//【注意】不需要修改的不用写wangEditor 会去 merge 当前其他配置};// textarea 初始化值const textarea document.getElementById(editor-content-textarea);textarea.value pwangEditor 只识别 editor.getHtml() 生成的 html 格式不可以随意自定义 html 代码html 格式太灵活了不会全部兼容/p\npwangEditor can only understand the HTML format from editor.getHtml() , but not all HTML formats./p\npbr/p;// Set HTMLdocument.getElementById(btn-set-html).addEventListener(click, () {if (editor.isDisabled()) editor.enable();if (!editor.isFocused()) editor.focus();editor.select([]);editor.deleteFragment();window.wangEditor.SlateTransforms.setNodes(editor,{ type: paragraph },{ mode: highest });editor.dangerouslyInsertHtml(textarea.value);});/script/body /html
http://www.w-s-a.com/news/589787/

相关文章:

  • 用dw怎么做网站留言板百度举报网站
  • 成都微网站设计企业为什么要做网络营销推广
  • 双桥区网站制作企业网站一般内容包括哪些
  • 莆田外贸专业建站做app 需要先做网站吗
  • 网站怎么用北京口碑最好的装修公司
  • 潮州网站建设深圳微信分销网站设计
  • asp.net网站开发实例教程pdf泉州seo网站关键词优推广
  • 怎样建立一个企业网站dede 网站名称
  • 做网上竞彩网站合法吗免费网站建设品牌
  • 网站开发所需要的的环境客户关系管理的内涵
  • 优质做网站公司做软件的人叫什么
  • 徐州市徐州市城乡建设局网站首页网站建设刂金手指下拉十五
  • 建设游戏网站目的及其定位市场营销策略概念
  • 小学电教检查网站建设资料wordpress谷歌字体
  • 南通做网站的公司有哪些中国建筑论坛网
  • 技术支持 佛山网站建设wordpress不用ftp
  • 广州定制app开发wordpress配置搜索引擎优化
  • 兰州网站建设论坛四川建设网官网登录
  • 在线作图免费网站湖南批量出品机
  • 深圳做网站公司有哪些地方妇联加强网站平台建设
  • vps建设网站别人访问不了网页链接生成器
  • 网站建设一般要多少钱电商平台取名字大全
  • 怎么做网站封面上的图网站开发语言 微信接口
  • 免费观看网站建设优化安徽
  • 上海电商网站开发公司做婚恋网站的翻译好吗
  • 以网站建设为开题报告大数据技术就业前景
  • dw做网站字体 别人电脑显示青岛活动策划公司
  • 网站成立时间查询墨猴seo排名公司
  • 技术支持 随州网站建设苏州企业网站建设定制
  • 美食网站开发目的与意义网站开发环境选择