坑多的Ueditor富编辑器

第一步:修改serverUrl: window.BASEPATH + "notice/word"

第二部:添加依赖包

  1. <dependency>
  2. <groupId>org.apache.poi</groupId>
  3. <artifactId>poi</artifactId>
  4. <version>3.17</version>
  5. </dependency>
  6. <dependency>
  7. <groupId>org.apache.poi</groupId>
  8. <artifactId>poi-ooxml</artifactId>
  9. <version>3.13</version>
  10. </dependency>
  11. <dependency>
  12. <groupId>org.apache.poi</groupId>
  13. <artifactId>ooxml-schemas</artifactId>
  14. <version>1.1</version>
  15. </dependency>
  16. <dependency>
  17. <groupId>org.apache.poi</groupId>
  18. <artifactId>openxml4j</artifactId>
  19. <version>1.0-beta</version>
  20. </dependency>
  21. <dependency>
  22. <groupId>fr.opensagres.xdocreport</groupId>
  23. <artifactId>org.apache.poi.xwpf.converter.xhtml</artifactId>
  24. <version>1.0.6</version>
  25. </dependency>
  26. <dependency>
  27. <groupId>org.apache.poi</groupId>
  28. <artifactId>poi-scratchpad</artifactId>
  29. <version>3.13</version>
  30. </dependency>
  31. <dependency>
  32. <groupId>org.jsoup</groupId>
  33. <artifactId>jsoup</artifactId>
  34. <version>1.8.3</version>
  35. </dependency>
  36. <dependency>
  37. <groupId>net.sourceforge.cssparser</groupId>
  38. <artifactId>cssparser</artifactId>
  39. <version>0.9.25</version>
  40. </dependency>
  41. <dependency>
  42. <groupId>commons-fileupload</groupId>
  43. <artifactId>commons-fileupload</artifactId>
  44. <version>1.3.3</version>
  45. </dependency>
  46. <dependency>
  47. <groupId>org.json</groupId>
  48. <artifactId>json</artifactId>
  49. <version>20160810</version>
  50. </dependency>
  51. <!-- emf转png -->
  52. <dependency>
  53. <groupId>org.freehep</groupId>
  54. <artifactId>freehep-graphicsio</artifactId>
  55. <version>2.3</version>
  56. </dependency>
  57. <dependency>
  58. <groupId>org.freehep</groupId>
  59. <artifactId>freehep-graphicsio-emf</artifactId>
  60. <version>2.3</version>
  61. </dependency>
  62. <!-- wmf转svg -->
  63. <dependency>
  64. <groupId>net.arnx</groupId>
  65. <artifactId>wmf2svg</artifactId>
  66. <version>0.9.5</version>
  67. </dependency>
  68. <!-- svg转jpg --><!-- 缺少 batik-all-1.7.jar-->
  69. <dependency>
  70. <groupId>xml-apis</groupId>
  71. <artifactId>xml-apis-ext</artifactId>
  72. <version>1.3.04</version>
  73. </dependency>
  74. <dependency>
  75. <groupId>com.gitee.qdbp.thirdparty</groupId>
  76. <artifactId>ueditor</artifactId>
  77. <version>1.4.3.3</version>
  78. </dependency>

第三部:写controller

  1. @RequestMapping(value = "word")
  2. public void word(HttpServletRequest request,HttpServletResponse response) throws Exception{
  3. String rootPath = request.getSession()
  4. .getServletContext().getRealPath("/");
  5. boolean isMultipart = ServletFileUpload.isMultipartContent(request);
  6. FileItem fileItem = null;
  7. if (isMultipart) {
  8. DiskFileItemFactory factory = new DiskFileItemFactory(1024 * 1024 * 20, null);
  9. ServletFileUpload uploader = new ServletFileUpload(factory);
  10.  
  11. uploader.setHeaderEncoding("UTF-8");
  12. uploader.setSizeMax(1024 * 1024 * 20);
  13.  
  14. List<FileItem> fileItems = uploader.parseRequest(request);
  15. for (FileItem item : fileItems) {
  16. if (!item.isFormField()) {
  17. fileItem = item;
  18. }
  19. }
  20. }
  21. try {
  22. String exec = new ActionEnter(request, rootPath, fileItem).exec();
  23. PrintWriter writer = response.getWriter();
  24. writer.write(exec);
  25. writer.flush();
  26. writer.close();
  27. } catch (IOException e) {
  28. e.printStackTrace();
  29. }
  30. }
  1. <textarea id="container" name = "container" type="text/plain" style="width: 1200px;"></textarea>
  2.  
  3. <!-- 配置文件 -->
  4. <script type="text/javascript" src="js/ueditor/ueditor.config.js"></script>
  5. <!-- 编辑器源码文件 -->
  6. <script type="text/javascript" src="js/ueditor/ueditor.all.js"></script>
  7. <script type="text/javascript" src="js/ueditor/lang/zh-cn/zh-cn.js"></script>
  1. var ue = UE.getEditor('container',{
  2. toolbars: [
  3. ['undo', 'redo','importword','print','cleardoc']
  4. ],
  5. initialFrameWidth : 690,
  6. });
  7.  
  8. ue.ready(function() {
  9. ue.setHeight(300);
  10. ue.setContent('');
  11. })

二次加载ueditor

  1. UE.delEditor('container');
  2. var ue = UE.getEditor('container',{
  3. toolbars: [
  4. ['undo', 'redo','importword','print','cleardoc']
  5. ],
  6. initialFrameWidth : 690,
  7. });
  8. ue.ready(function() {
  9. ue.setHeight(300);
  10. ue.setContent('');
  11. ue.setContent(dgmcfjData);
  12. })
  13. //ueditor.all.js
  14. UE.plugin.register('importword', function (){
  15. domUtils.on(input, 'change', function(){
  16. me.execCommand('cleardoc');//清空内容
  17. //var message = document.getElementById('edui1_message_holder');
  18. //替换为
  19. var message = document.getElementById(me.ui.id + '_message_holder');
  20. })
  21. })

Ueditor富编辑器的更多相关文章

  1. MVC 使用 Ueditor富文本编辑器

    一.Ueditor 1.下载Ueditor富文本编辑器 官方下载地址: http://ueditor.baidu.com/website/download.html 建议下载开发版,此处我下载的是 . ...

  2. Thinkphp下嵌套UEditor富文本WEB编辑器

    UEditor是由百度web前端研发部开发所见即所得富文本web编辑器,具有轻量,可定制,注重用户体验等特点,开源基于MIT协议,允许自由使用和修改代码... 本文实际操作于ThinkPHP框架下,现 ...

  3. 百度ueditor富文本编辑器的使用

    百度ueditor富文本编辑器的使用 //以下为我在官网下载的ueditor v1.3.5 php版的大楷配置步骤第一步: //配置文件的引入应该比功能文件先引入,最后设置语言类型.即:editor. ...

  4. 前后端分离ueditor富文本编辑器的使用-Java版本

    最近在写一个自己的后台管理系统(主要是写着玩的,用来熟悉后端java的知识,目前只是会简单的写点接口),想在项目中编写一个发布新闻文章的功能,想到了使用百度的ueditor富文本编辑器,网上找了很多j ...

  5. ASP.NET MVC5 中百度ueditor富文本编辑器的使用

    随着网站信息发布内容越来越多,越来越重视美观,富文本编辑就是不可缺少的了,众多编辑器比较后我选了百度的ueditor富文本编辑器. 百度ueditor富文本编辑器分为两种一种是完全版的ueditor, ...

  6. PHP如何搭建百度Ueditor富文本编辑器

    本文为大家分享了PHP搭建百度Ueditor富文本编辑器的方法,供大家参考,具体内容如下 下载UEditor 官网:下载地址 将下载好的文件解压到thinkphp项目中,本文是解压到PUBLIC目录下 ...

  7. ueditor富文本编辑器使用百度地图自定义动态地图组件及兼容https及http协议

    ueditor富文本编辑器默认支持百度地图组件,但是如果导入动态地图后会加很多默认的地图组件在上面.如果需要自定义动态地图的组件则需要修改ueditor特定的html. ueditor百度地图组件所在 ...

  8. WEB项目中使用UEditor(富文本编辑器)

    Ueditor富文本编辑器是在很多项目里经常用到的框架,是百度开发团队开发的一款很好用的富文本编辑器 下面就是我在一个系统里用到的,有了富文本编辑器,管理员使用起来不是很方便? 所以本博客介绍这个富文 ...

  9. UEditor富文本编辑器简单使用

    UEditor富文本编辑器简单使用 一.下载地址:https://ueditor.baidu.com/website/ 官网中并没有 python 版本的 UEditor 富文本编辑器,本文简单介绍 ...

随机推荐

  1. 使用JS&jQuery改善用户体验

    第一章  JavaScript基本语法 一.运算符 运算符就是完成操作的一系列符号,它有七类: 赋值运算符(=,+=,-=,*=,/=,%=,<<=,>>=,|=,&= ...

  2. ajax的post提交方式和传统的post提交方式哪个更快?

    如果同时用ajax和post提交先执行哪个呢?是ajax返回后再执行post呢还是同时执行? ajax的post提交方式和传统的post提交方式哪个更快? >> php这个答案描述的挺清楚 ...

  3. CREATE TABLE 语句后的 ON [PRIMARY] 起什么作用

    CREATE   TABLE   [dbo].[table1]   ( [gh]   [char]   (10)   COLLATE   Chinese_PRC_CI_AS   NOT   NULL ...

  4. 如何使用阿里云的yum源

    这里需要有网.因为我们需要下载会用到wget [root@localhost ~]# iptables -F[root@localhost ~]# systemctl stop firewalld[r ...

  5. SVG矢量动画

    一.概述 相较于png.jpg等位图通过存储像素点来记录图像,svg (Scalable Vector Graphics)拥有一套自己的语法,通过描述的形式来记录图形.Android并不直接使用原始的 ...

  6. Airtest ——poco

    1.  Pymysql(No module named ‘cryptography’) pip install cryptography pip install paramiko 把 cryptogr ...

  7. 安装laravel项目出错

    我的本地是7.0.1,而下载下来的原来是运行在7.0.8版本的,于是执行:composer install 时,报了一堆错.解决办法:删掉composer.lock,重新composer instal ...

  8. HDU 1042 N!( 高精度乘法水 )

    链接:传送门 思路:高精度乘法板子题,高精度耗时又耗空间...... /**************************************************************** ...

  9. CF343E Pumping Stations(最小割树)

    没学过最小割树的出门左转. 我们已经知道了两点的最小割就是最小割树上,对应两点之间路径的权值的最小值. 找到最小割树中权值的最小的边. 那么一定是先选完一侧的点在选完另一侧的点. 因为当前边最小,那么 ...

  10. C文件I/O超详细教程

    本文主要参考了C Primer Plus (5th & 6th Edition) 您可以选择本文的部分内容来读,有些内容对于不熟悉MS-DOS的读者可能过于晦涩难懂. C语言文件基本知识 文件 ...