Baidu editor UEditor changed to support physical path, Editor ueditor
I. Preface
I have been working for 2 years. There was no background development in just one year. Recently, I want to write a new project that uses the Rich Text Editor and select Baidu UEditor. It seems a little bad during use. Then, manually modify the source code. If the source code is not well written, please forgive me. This is only for beginners to learn. The technical content is not high. Please do not spray.
Ii. UEditor project structure
Iii. Transformation ideas
The uploaded image is processed through the backend. Here we find the controller. ashx file. After opening, we can see
Here, you can determine what to upload and load the configuration file (config. json ). Finally, the action. Process () method is called.
Here we find the key UploadHandler. Process () method for uploading.
Then, we found the code to convert the virtual path to the physical path.
Now we have a rough idea about the overall upload code operation.
4. Start Transformation
Start with config. json.
Add imageLocalPrefix to the configuration file and add the value
Find controller. ashx
Add this code to load the configuration file. Of course, you must add the LocalPrefix attribute to the UploadConfig object class.
Finally, the above path is changed.
Determine whether the physical path is used.
Now the transformation is complete. Our UEditor supports the upload of physical paths.