Customizable web Rich Text Editor with source code download and jquery source code download Based on jquery
Today, we will introduce you to UMeditor, a great WEB online Rich Text Editor. It is a mini edition editor developed by Baidu web Front-end R & D department and developed by what you see as what you see is the rich text web Editor UEditor, it is lightweight, customizable, and user experience-oriented. It allows you to use and modify code freely. It is applicable to the front-end quick reply box or background Content Editor.
Download Online Preview source code
How to use it?
To create a demo.html file, first Add the following code to the editor. You can use the style to set the width and height of the editor.
<Script type = "text/plain" id = "myEditor" style = "width: 98%; height: 240px;"> <p> content area </p> </script>
Then, load the js and css files related to UMeditor. You can download related files from this site or directly download the latest version from the UMeditor website.
<script src="http://libs.useso.com/js/jquery/2.1.0/jquery.min.js"></script> <script type="text/javascript" charset="utf-8" src="umeditor.config.js"></script> <script type="text/javascript" charset="utf-8" src="umeditor.min.js"></script> <link href="themes/default/css/umeditor.min.css" type="text/css" rel="stylesheet">
Next, let's call the Editor:
<script type="text/javascript"> var um = UM.getEditor('myEditor'); </script>
Now we can open the browser to preview the editor effect.
Custom options
UMeditor provides a wide range of options for you to customize based on your project needs.
You can use the following code to obtain the content in the editor. You can also obtain plain text content.
Copy codeThe Code is as follows:
UM. getEditor ('myeditor'). getContent ();
You can use the following code to determine whether the editor has content:
Var cont = UM. getEditor ('myeditor'). hasContents (); if (cont = true) {alert ('has content. ');} Else {alert (' no content. ');}
If you put the editor into the form and set the action path, you can submit the content in the form transfer editor. For example:
<Form action = "server. php "method =" post "> <script id =" container "name =" content "type =" text/plain "style =" width: 98%; height: 240px; "> write your initialization content here </script> <button type =" submit "class =" btn "> submit </button> </form>
You can set the tool icons that can be used in the toolbar, such as the following:
var editor = UM.getEditor('container',{ toolbar: ['bold italic underline fullscreen', 'link unlink','| justifyleft justifycenter justifyright justifyjustify |', 'emotion image video | map'] });
UMeditor provides many tools that can be customized as needed, such as table editing, list layout, multimedia insertion, image uploading, and map calling. UMeditor provides several language versions for the server, mainly used for processing uploaded images. You can set the upload path, upload file type, size, and so on. You only need to set it to apply it.