ueditor 編輯器,自定義圖片上傳
阿新 • • 發佈:2018-05-17
action () scree val ech idt tof height 使用
- <div>
- <h1>完整demo</h1>
- <form method="post" name="form">
- <div id="editor" name="content" style="width:800px;height:500px"></div>
- <div id="editor2" name="content" style="width:800px;height:500px"></div>
- </form>
- </div>
- <div><input type="button" value="提交" onclick="t()"></input></div>
- 三、創建ue對象實例
- <script type="text/javascript">
- //實例化編輯器
- //建議使用工廠方法getEditor創建和引用編輯器實例,如果在某個閉包下引用該編輯器,直接調用UE.getEditor(‘editor‘)就能拿到相關的實例
- var ue = UE.getEditor(‘editor‘,{
- toolbars: [
- [‘source‘,‘subscript‘,‘superscript‘, ‘undo‘, ‘redo‘, ‘bold‘, ‘snapscreen‘,‘preview‘, ‘simpleupload‘,‘insertimage‘, ‘emotion‘,
- ‘spechars‘, ‘drafts‘ , ‘time‘,‘date‘]
- ],
- autoHeightEnabled: true,
- autoFloatEnabled: true,
- imageActionName:‘testUpload‘//定義上傳的action名稱
- });
- UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl;
- UE.Editor.prototype.getActionUrl = function(action) {
- if (action == ‘testUpload‘) {//跳轉到後來的上傳action
- return ‘${pageContext.request.contextPath}/testEditor/testUpload.action‘;
- } else {
- return this._bkGetActionUrl.call(this, action);
- }
- }
- function t(){
- form.action="${pageContext.request.contextPath }/testEditor/testForm.action";
- form.submit();
- }
- </script>
ueditor 編輯器,自定義圖片上傳