主题: 上传图片成功后,怎么回显在编辑器里? |
作者: 我是菜鸟, 发布日期: 2014-07-19 15:22:25, 浏览数: 2943 |
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/taglibs.jsp"%> <!doctype html> <html> <head> <meta charset="utf-8" /> <title>讲义管理</title> <style> form { margin: 0; } textarea { display: block; } </style> <link href="${baseUrlStatic}/css/common/bootstrap.css" rel="stylesheet"> <link href="${baseUrlStatic}/css/common/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen"> </head> <body> <form id="handoutHtml" action="/system/classRoom/saveHandout" method="post" target="hidden_frame"> <input type="hidden" id="roomId" name="roomId" value="${roomId}"/> <textarea id="content" name="content" style="width:400px;height:400px;visibility:hidden;"></textarea> <textarea id="htmlContent" name="handout" style="display:none"></textarea> </br> <p> <input id="saveHandout" type="button" name="getHtml" class="btn btn-primary" value="保存讲义的HTML" /> </p> <div id="createDangerAlert" class="alert alert-danger pull-left" style="display: none;"> <strong>对不起!新增失败... </strong><span id="errorMsg"></span> </div> </form> <iframe name='hidden_frame' id="hidden_frame" style='display:none'> </iframe> <script type="text/javascript" src="${baseUrlStatic}/js/common/jquery-1.11.1.min.js"></script> <script type="text/javascript" src="${baseUrlStatic}/kindeditor-4.1.7/kindeditor.js?ver=${version}"></script> <script type="text/javascript" src="${baseUrlStatic}/kindeditor-4.1.7/lang/zh_CN.js?ver=${version}"></script> <script type="text/javascript" src="${baseUrlStatic}/js/system/handout.js?ver=${version}"></script> <script> var editor; KindEditor.ready(function(K) { editor = K.create('textarea[name="content"]', { uploadJson : '/system/classRoom/uploadJson', fileManagerJson : '/system/classRoom/fileManagerJson', allowFileManager : true, width : '450px', minWidth : '300px', shadowMode : true, formatUploadUrl : false, //false时不会自动格式化上传后的URL。 afterUpload : function(url) { // alert("保存图片的路径:" + url); }, resizeType : 1, allowPreviewEmoticons : false, allowImageUpload : true, items : [ 'formatblock','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', '|', 'emoticons', 'image', 'link'] }); // JSP // editor = K.create('textarea[name="content"]', { // allowFileManager : true // }); K("#saveHandout").click(function(e) { // alert(editor.html()); $("#htmlContent").val(editor.html()); // alert($("#htmlContent").val()); // $("handoutHtml").action=path; $("#handoutHtml").submit(); }); }); </script> </body> </html> |