How to make layui support wangEditor Editor
This article mainly introduces how to make layui support wangEditor editor, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
The way to get layui to support the wangEditor editor:
WangEditor.min.js module code
For example, refer to a 123.js "123.js" basic configuration editor module code as follows: layui.config ({base:'.. / lib/wang/' / / wangEditor.min.js directory, modify / / such as my location: lib/wang/wangEditor.min.js}) according to your storage location. Layui.define (function (exports) {exports ('wangeditor.min', function () {demo:demo// is useless, just testing});}); / / layui.use ([' layer', 'form','wangeditor.min'], function () {var layer = layui.layer, form = layui.form, wang=layui.wangeditor (' wang'); wang.create () / / create an editor / / generally use var html = wang.$txt.html () when performing button operations; / / get content, more methods, please wangEditor editor website console.log (html); / / generally use} when performing button operations)
This is the editor.
/ / Rich text editor configures picture upload wang.config.uploadImgUrl ='.. / page/upload/upload.aspx'/ calls the background method wang.config.uploadImgFileName = 'file'//, but you can define wang.config.uploadHeaders = {' Accept': 'text/x-json'}; / / the backend upload return code / / image upload failed. Response.Write "error | returned information" output according to its own program-successful return-direct output image path address: such as "/ upload/xxxx.jpg"-successfully returned-error | returned information
The following is a brief introduction to the content of the assignment editor, which is generally used for article editing
Edit page
Here is the article content var editorhtml=$ ("# content") read by the database. Val () / / get the content of textarea wang.$txt.html (editorhtml) / / add the content to the editor. Thank you for reading this article carefully. I hope the article "how to make layui support wangEditor Editor" shared by the editor will be helpful to everyone. At the same time, I hope you will support it and follow the industry information channel. More related knowledge is waiting for you to learn!