How to make layui support wangEditor editor: (Recommended: layui usage tutorial)
wangEditor.min.js module code
比如引用一个123.js "123.js" 基本配置编辑器模块代码如下 layui.config({ base: '../lib/wang/' //wangEditor.min.js目录,根据自己存放位置修改 // 比如我的位置:lib/wang/wangEditor.min.js }); layui.define(function(exports) { exports('wangeditor.min', function(){ demo:demo//这句没用,只是测试 }); }); //核心来了 layui.use(['layer', 'form','wangeditor.min'], function(){ var layer = layui.layer ,form = layui.form ,wang=layui.wangeditor('wang'); wang.create(); //创建编辑器 //一般在执行按钮操作时使用 var html = wang.$txt.html(); // 获取内容,更多方法,请wangEditor编辑器官网 console.log(html); //一般在执行按钮操作时使用 });
##
//富文本编辑器配置图片上传 wang.config.uploadImgUrl = '../page/upload/upload.aspx '//调用后台方法 wang.config.uploadImgFileName = 'file'// 可自己定义 wang.config.uploadHeaders = {'Accept' : 'text/x-json'}; //后台上传返回代码 //图片上传失败。Response.Write "error|返回的信息" 根据自己的程序相应输出 ------------成功返回------------- 直接输出图片路径地址:如 "/upload/xxxx.jpg" ------------成功返回------------- error|返回的信息The following is simple Introducing the content of the assignment editor, generally used for article editing edit page
<textarea class="layui-textarea layui-hide//隐藏显示" name="content" id="content">这里是数据库读取的文章内容</textarea> var editorhtml=$("#content").val() //获取 textarea的内容 wang.$txt.html(editorhtml);// 将内容添加到编辑器里Full code: https://pan.baidu.com/s/1-cXiYUIgqUfIpZBopEimWg
The above is the detailed content of How to make layui support wangEditor editor. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.