init
This commit is contained in:
13
public/tinymce/plugins/image/css/dialog-v4.css
Normal file
13
public/tinymce/plugins/image/css/dialog-v4.css
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Justboil.me - a TinyMCE image upload plugin
|
||||
* jbimages/css/dialog-v4.css
|
||||
*
|
||||
* Released under Creative Commons Attribution 3.0 Unported License
|
||||
*
|
||||
* License: http://creativecommons.org/licenses/by/3.0/
|
||||
* Plugin info: http://justboil.me/
|
||||
* Author: Viktor Kuzhelnyi
|
||||
*
|
||||
* Version: 2.3 released 23/06/2013
|
||||
*/
|
||||
|
126
public/tinymce/plugins/image/css/dialog.css
Normal file
126
public/tinymce/plugins/image/css/dialog.css
Normal file
@ -0,0 +1,126 @@
|
||||
/**
|
||||
* Justboil.me - a TinyMCE image upload plugin
|
||||
* jbimages/css/dialog.css
|
||||
*
|
||||
* Released under Creative Commons Attribution 3.0 Unported License
|
||||
*
|
||||
* License: http://creativecommons.org/licenses/by/3.0/
|
||||
* Plugin info: http://justboil.me/
|
||||
* Author: Viktor Kuzhelnyi
|
||||
*
|
||||
* Version: 2.3 released 23/06/2013
|
||||
*/
|
||||
|
||||
body {font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; text-align:center;}
|
||||
h2 {color:#666;}
|
||||
|
||||
.form-inline input {
|
||||
display: inline-block;
|
||||
*display: inline;
|
||||
margin-bottom: 0;
|
||||
vertical-align: middle;
|
||||
*zoom: 1;
|
||||
}
|
||||
.jbFileBox {border:0!important;}
|
||||
.jbFileBox {width:120px!important; }
|
||||
|
||||
#upload_target {border:0; margin:0; padding:0; width:0; height:0; display:none;}
|
||||
|
||||
.upload_infobar {display:none; font-size:12pt; background:#fff; padding:5px; margin-top:10px; border-radius:5px;}
|
||||
.upload_infobar img.spinner {margin-right:10px;}
|
||||
.upload_infobar a {color:#0000cc;}
|
||||
#upload_additional_info {font-size:10pt; padding-left:26px;}
|
||||
|
||||
#the_plugin_name {margin:25px 0 0 0;}
|
||||
#the_plugin_name, #the_plugin_name a {color:#777; font-size:9px;}
|
||||
#the_plugin_name a {text-decoration:none;}
|
||||
#the_plugin_name a:hover {color:#333;}
|
||||
|
||||
#close_link {margin-top:10px; display:none;} /* for opera */
|
||||
|
||||
/* this class makes the upload script output visible */
|
||||
.upload_target_visible {width:100%!important; height:200px!important; border:1px solid #000!important; display:block!important}
|
||||
|
||||
/* sweet upload button (from twitter bootstrap) */
|
||||
.btn {
|
||||
display: inline-block;
|
||||
*display: inline;
|
||||
padding: 4px 12px;
|
||||
margin-bottom: 0;
|
||||
*margin-left: .3em;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
color: #333333;
|
||||
text-align: center;
|
||||
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
|
||||
vertical-align: middle;
|
||||
cursor: pointer;
|
||||
background-color: #f5f5f5;
|
||||
*background-color: #e6e6e6;
|
||||
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
|
||||
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
|
||||
background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
|
||||
background-repeat: repeat-x;
|
||||
border: 1px solid #bbbbbb;
|
||||
*border: 0;
|
||||
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
|
||||
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
|
||||
border-bottom-color: #a2a2a2;
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe6e6e6', GradientType=0);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
|
||||
*zoom: 1;
|
||||
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
-moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.btn:hover,
|
||||
.btn:active,
|
||||
.btn.active,
|
||||
.btn.disabled,
|
||||
.btn[disabled] {
|
||||
color: #333333;
|
||||
background-color: #e6e6e6;
|
||||
*background-color: #d9d9d9;
|
||||
}
|
||||
|
||||
.btn:active,
|
||||
.btn.active {
|
||||
background-color: #cccccc \9;
|
||||
}
|
||||
|
||||
.btn:first-child {
|
||||
*margin-left: 0;
|
||||
}
|
||||
|
||||
.btn:hover {
|
||||
color: #333333;
|
||||
text-decoration: none;
|
||||
background-position: 0 -15px;
|
||||
-webkit-transition: background-position 0.1s linear;
|
||||
-moz-transition: background-position 0.1s linear;
|
||||
-o-transition: background-position 0.1s linear;
|
||||
transition: background-position 0.1s linear;
|
||||
}
|
||||
.btn:focus {
|
||||
outline: thin dotted #333;
|
||||
outline: 5px auto -webkit-focus-ring-color;
|
||||
outline-offset: -2px;
|
||||
}
|
||||
.btn.active,
|
||||
.btn:active {
|
||||
background-image: none;
|
||||
outline: 0;
|
||||
-webkit-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
-moz-box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
.btn {
|
||||
border-color: #c5c5c5;
|
||||
border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);
|
||||
}
|
125
public/tinymce/plugins/image/dialog.htm
Normal file
125
public/tinymce/plugins/image/dialog.htm
Normal file
@ -0,0 +1,125 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>上传图片</title>
|
||||
<link href="/css/bootstrap.css" rel="stylesheet" type="text/css">
|
||||
<link href="/css/plugin.css" rel="stylesheet" type="text/css">
|
||||
|
||||
<style>
|
||||
#upload_target {border:0; margin:0; padding:0; width:0; height:0; display:none;}
|
||||
.upload_infobar {display:none; font-size:12pt; background:#fff; margin-top:10px; border-radius:5px;}
|
||||
.upload_infobar img.spinner {margin-right:10px;}
|
||||
.upload_infobar a {color:#0000cc;}
|
||||
#upload_additional_info {font-size:10pt; padding-left:26px;}
|
||||
|
||||
#the_plugin_name {margin:15px 0 0 0;}
|
||||
#the_plugin_name, #the_plugin_name a {color:#777; font-size:9px;}
|
||||
#the_plugin_name a {text-decoration:none;}
|
||||
#the_plugin_name a:hover {color:#333;}
|
||||
|
||||
/* this class makes the upload script output visible */
|
||||
.upload_target_visible {width:100%!important; height:200px!important; border:1px solid #000!important; display:block!important}
|
||||
|
||||
/*-------------*/
|
||||
#dropbox{
|
||||
border-radius:3px;
|
||||
position: relative;
|
||||
min-height: 200px;
|
||||
overflow: hidden;
|
||||
padding-bottom: 40px;
|
||||
border: 1px solid #ccc;
|
||||
width: 100%;
|
||||
background-color:#eee;
|
||||
}
|
||||
#dropbox .message {
|
||||
font-size: 12px;
|
||||
text-align: center;
|
||||
padding-top: 80px;
|
||||
display: block;
|
||||
}
|
||||
#dropbox .message i {
|
||||
color:#ccc;
|
||||
font-size:10px;
|
||||
}
|
||||
#dropbox:before {
|
||||
border-radius:3px 3px 0 0;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<ul id="myTab" class="nav nav-tabs">
|
||||
<li class="active"><a href="#upload" data-toggle="tab">上传图片</a></li>
|
||||
<li class=""><a href="#url" data-toggle="tab">图片URL</a></li>
|
||||
</ul>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
|
||||
<div class="tab-pane active" id="upload" style="margin-top: 10px;">
|
||||
<!--ci/index.php/upload/english-->
|
||||
<form class="form-inline" id="upl" name="upl" action="/file/uploadImage" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="jbImagesDialog.inProgress();">
|
||||
|
||||
<div id="upload_in_progress" class="upload_infobar">
|
||||
<img src="img/spinner.gif" width="16" height="16" class="spinner">Upload in progress…
|
||||
<div id="upload_additional_info"></div>
|
||||
</div>
|
||||
|
||||
<div id="upload_infobar" class="alert alert-warning" style="display: none; margin-bottom: 10px;"></div>
|
||||
|
||||
<p id="upload_form_container">
|
||||
<input id="uploader" name="file" type="file" class="form-control" onChange="document.upl.submit(); jbImagesDialog.inProgress();">
|
||||
</p>
|
||||
</form>
|
||||
<iframe id="upload_target" name="upload_target" src="#"></iframe>
|
||||
|
||||
<div id="dropbox">
|
||||
<div class="message">
|
||||
或将图片拖到这里上传.
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane" id="url" style="margin-top: 10px;">
|
||||
<form class="form-inline" id="imageSrc2">
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th style="width: 50px"><label for="imageSrc">地址</label></th>
|
||||
<td><input type="url" id="imageSrc" name="src" class="form-control"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><label for="imageWidth">大小</label></th>
|
||||
<td>
|
||||
<input type="text" class="form-control" id="imageWidth" name="width" style="width: 100px; display: inline-block"/>
|
||||
X
|
||||
<input type="text" class="form-control" id="imageHeight" name="height" style="width: 100px; display: inline-block"/>
|
||||
<label>
|
||||
<input type="checkbox" checked="checked" id="autoScale"/>
|
||||
按比例缩放
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="bottomBtns">
|
||||
<div>
|
||||
<button class="btn btn-success" id="insertCodeBtn" onclick="insertImage();">确定</button>
|
||||
<button class="btn btn-default" id="closeBtn" onclick="closeWin()">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/js/jquery-1.9.0.min.js"></script>
|
||||
<script src="/js/bootstrap.js"></script>
|
||||
<script type="text/javascript" src="js/dialog.js"></script>
|
||||
<script type="text/javascript" src="js/jquery.filedrop.js"></script>
|
||||
<script type="text/javascript" src="js/drop.js"></script>
|
||||
</body>
|
||||
</html>
|
BIN
public/tinymce/plugins/image/img/jbimages-bw.gif
Normal file
BIN
public/tinymce/plugins/image/img/jbimages-bw.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 230 B |
BIN
public/tinymce/plugins/image/img/spinner.gif
Normal file
BIN
public/tinymce/plugins/image/img/spinner.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
250
public/tinymce/plugins/image/js/dialog.js
Normal file
250
public/tinymce/plugins/image/js/dialog.js
Normal file
@ -0,0 +1,250 @@
|
||||
/**
|
||||
* life
|
||||
*/
|
||||
|
||||
var tinymce = top.tinymce;
|
||||
var editor = tinymce.EditorManager.activeEditor;
|
||||
var dom = editor.dom;
|
||||
var imgElm = editor.selection.getNode();
|
||||
|
||||
var jbImagesDialog = {
|
||||
resized : false,
|
||||
iframeOpened : false,
|
||||
timeoutStore : false,
|
||||
|
||||
inProgress : function() {
|
||||
document.getElementById("upload_infobar").style.display = 'none';
|
||||
document.getElementById("upload_additional_info").innerHTML = '';
|
||||
document.getElementById("upload_form_container").style.display = 'none';
|
||||
document.getElementById("upload_in_progress").style.display = 'block';
|
||||
this.timeoutStore = window.setTimeout(function(){
|
||||
document.getElementById("upload_additional_info").innerHTML = 'This is taking longer than usual.' + '<br />' + 'An error may have occurred.' + '<br /><a href="#" onClick="jbImagesDialog.showIframe()">' + 'View script\'s output' + '</a>';
|
||||
// tinyMCEPopup.editor.windowManager.resizeBy(0, 30, tinyMCEPopup.id);
|
||||
}, 20000);
|
||||
},
|
||||
|
||||
showIframe : function() {
|
||||
if (this.iframeOpened == false)
|
||||
{
|
||||
document.getElementById("upload_target").className = 'upload_target_visible';
|
||||
// tinyMCEPopup.editor.windowManager.resizeBy(0, 190, tinyMCEPopup.id);
|
||||
this.iframeOpened = true;
|
||||
}
|
||||
},
|
||||
|
||||
uploadFinish : function(result) {
|
||||
if (result.resultCode == '0')
|
||||
{
|
||||
window.clearTimeout(this.timeoutStore);
|
||||
document.getElementById("upload_in_progress").style.display = 'none';
|
||||
document.getElementById("upload_infobar").style.display = 'block';
|
||||
$("#upload_infobar").html(result.result).show();
|
||||
document.getElementById("upload_form_container").style.display = 'block';
|
||||
|
||||
if (this.resized == false)
|
||||
{
|
||||
// tinyMCEPopup.editor.windowManager.resizeBy(0, 30, tinyMCEPopup.id);
|
||||
this.resized = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById("upload_in_progress").style.display = 'none';
|
||||
document.getElementById("upload_infobar").style.display = 'block';
|
||||
document.getElementById("upload_infobar").innerHTML = 'Upload Complete';
|
||||
|
||||
var w = this.getWin();
|
||||
tinymce = w.tinymce;
|
||||
|
||||
tinymce.EditorManager.activeEditor.insertContent('<img src="' + result.filename +'">');
|
||||
|
||||
this.close();
|
||||
|
||||
// 添加undo
|
||||
// var editor = tinymce.activeEditor;
|
||||
// editor.undoManager.transact(function() {
|
||||
// });
|
||||
}
|
||||
},
|
||||
|
||||
getWin : function() {
|
||||
return (!window.frameElement && window.dialogArguments) || opener || parent || top;
|
||||
},
|
||||
|
||||
close : function() {
|
||||
var t = this;
|
||||
|
||||
// To avoid domain relaxing issue in Opera
|
||||
function close() {
|
||||
tinymce.EditorManager.activeEditor.windowManager.close(window);
|
||||
tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup
|
||||
};
|
||||
|
||||
if (tinymce.isOpera)
|
||||
this.getWin().setTimeout(close, 0);
|
||||
else
|
||||
close();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//----------------------- url
|
||||
|
||||
$(function() {
|
||||
top.hiddenIframeBorder();
|
||||
|
||||
var oldWidth, oldHeihgt;
|
||||
// 是否选择的是image
|
||||
if(imgElm.nodeName == "IMG") {
|
||||
var $node = $(imgElm);
|
||||
$("#imageSrc").val($node.attr("src"));
|
||||
oldWidth = $node.width();
|
||||
oldHeight = $node.height();
|
||||
$("#imageWidth").val(oldWidth);
|
||||
$("#imageHeight").val(oldHeight);
|
||||
|
||||
$('#myTab a:last').tab('show');
|
||||
} else {
|
||||
imgElm = null;
|
||||
}
|
||||
|
||||
$("#imageSrc").blur(function(){
|
||||
getImageSize($(this).val(), function(ret) {
|
||||
if(ret.width) {
|
||||
oldWidth = ret.width;
|
||||
oldHeight = ret.Height;
|
||||
|
||||
$("#imageWidth").val(ret.width);
|
||||
$("#imageHeight").val(ret.height);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 按比例缩放
|
||||
function scale(isWidth) {
|
||||
var autoScale = $("#autoScale").is(":checked");
|
||||
var width = $("#imageWidth").val();
|
||||
var height = $("#imageHeight").val();
|
||||
|
||||
if(autoScale && oldWidth && oldHeight) {
|
||||
if(isWidth) {
|
||||
height = parseInt((width/oldWidth) * oldHeight);
|
||||
$("#imageHegiht").val(height);
|
||||
} else {
|
||||
width = parseInt((height/oldHeight) * oldWidth);
|
||||
$("#imageWidth").val(width);
|
||||
}
|
||||
}
|
||||
|
||||
oldWidth = width;
|
||||
oldHeight = height;
|
||||
}
|
||||
|
||||
$("#imageWidth").blur(function() {
|
||||
scale(true);
|
||||
});
|
||||
$("#imageHeight").blur(function() {
|
||||
scale(false);
|
||||
});
|
||||
});
|
||||
|
||||
//当url改变时, 得到图片的大小
|
||||
function getImageSize(url, callback) {
|
||||
var img = document.createElement('img');
|
||||
|
||||
function done(width, height) {
|
||||
img.parentNode.removeChild(img);
|
||||
callback({width: width, height: height});
|
||||
}
|
||||
|
||||
img.onload = function() {
|
||||
done(img.clientWidth, img.clientHeight);
|
||||
};
|
||||
|
||||
img.onerror = function() {
|
||||
done();
|
||||
};
|
||||
|
||||
img.src = url;
|
||||
|
||||
var style = img.style;
|
||||
style.visibility = 'hidden';
|
||||
style.position = 'fixed';
|
||||
style.bottom = style.left = 0;
|
||||
style.width = style.height = 'auto';
|
||||
|
||||
document.body.appendChild(img);
|
||||
}
|
||||
|
||||
function closeWin() {
|
||||
try {
|
||||
editor.windowManager.close();
|
||||
editor.windowManager.close();
|
||||
} catch(e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// 插入之
|
||||
var insertImage = function() {
|
||||
// 判断是否是第二个tab active
|
||||
if($("#myTab li:last").attr("class") != "active") {
|
||||
closeWin();
|
||||
return;
|
||||
}
|
||||
|
||||
// 加载图片并插入之
|
||||
function waitLoad(imgElm) {
|
||||
function selectImage() {
|
||||
imgElm.onload = imgElm.onerror = null;
|
||||
editor.selection.select(imgElm);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
|
||||
// 如果没有设置width, height, 就用图片本身的大小
|
||||
imgElm.onload = function() {
|
||||
if (!data.width && !data.height) {
|
||||
dom.setAttribs(imgElm, {
|
||||
width: imgElm.clientWidth,
|
||||
height: imgElm.clientHeight
|
||||
});
|
||||
}
|
||||
|
||||
selectImage();
|
||||
};
|
||||
|
||||
imgElm.onerror = selectImage;
|
||||
}
|
||||
|
||||
// 这是通过url插入图片
|
||||
// iframe里得到...
|
||||
var data = {width:null, height:null, src:null, style:null};
|
||||
data.width = $("#imageWidth").val();
|
||||
data.height = $("#imageHeight").val();
|
||||
data.src = $("#imageSrc").val();
|
||||
data.alt = "";
|
||||
|
||||
editor.undoManager.transact(function() {
|
||||
// 删除图片
|
||||
if (!data.src) {
|
||||
if (imgElm) {
|
||||
dom.remove(imgElm);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (!imgElm) {
|
||||
data.id = '__mcenew';
|
||||
editor.selection.setContent(dom.createHTML('img', data));
|
||||
imgElm = dom.get('__mcenew');
|
||||
dom.setAttrib(imgElm, 'id', null);
|
||||
} else {
|
||||
dom.setAttribs(imgElm, data);
|
||||
}
|
||||
|
||||
waitLoad(imgElm);
|
||||
});
|
||||
|
||||
closeWin();
|
||||
}
|
105
public/tinymce/plugins/image/js/drop.js
Normal file
105
public/tinymce/plugins/image/js/drop.js
Normal file
@ -0,0 +1,105 @@
|
||||
$(function() {
|
||||
var dropbox = $('#dropbox'),
|
||||
message = $('.message', dropbox);
|
||||
|
||||
dropbox.filedrop({
|
||||
// The name of the $_FILES entry:
|
||||
paramname: 'file',
|
||||
|
||||
maxfiles: 1,
|
||||
maxfilesize: 3,
|
||||
url: '/file/uploadImageJson',
|
||||
|
||||
uploadFinished: function(i, file, re) {
|
||||
jbImagesDialog.uploadFinish({
|
||||
filename: re.Id,
|
||||
result: re.Msg,
|
||||
resultCode: re.Code + ''
|
||||
});
|
||||
|
||||
$.data(file).addClass('done');
|
||||
},
|
||||
|
||||
error: function(err, file) {
|
||||
switch(err) {
|
||||
case 'BrowserNotSupported':
|
||||
showMessage('您的浏览器不支持拖拉上传文件, 请使用chrome或firefox浏览器');
|
||||
break;
|
||||
case 'TooManyFiles':
|
||||
alert('文件太多了');
|
||||
break;
|
||||
case 'FileTooLarge':
|
||||
alert(file.name+'文件太大, 最大支持3M图片');
|
||||
break;
|
||||
default:
|
||||
alert("出错了");
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
// Called before each upload is started
|
||||
beforeEach: function(file){
|
||||
if(!file.type.match(/^image\//)){
|
||||
alert('只能上传图片!');
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
uploadStarted:function(i, file, len){
|
||||
//createImage(file);
|
||||
},
|
||||
|
||||
progressUpdated: function(i, file, progress) {
|
||||
$('.progress-bar').css("width", progress + "%");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var template = '<div class="preview">'+
|
||||
'<span class="imageHolder">'+
|
||||
'<img />'+
|
||||
'<span class="uploaded"></span>'+
|
||||
'</span>'+
|
||||
'<div class="progressHolder">'+
|
||||
'<div class="progress"></div>'+
|
||||
'</div>'+
|
||||
'</div>';
|
||||
|
||||
|
||||
function createImage(file){
|
||||
|
||||
var preview = $(template),
|
||||
image = $('img', preview);
|
||||
|
||||
var reader = new FileReader();
|
||||
|
||||
image.width = 100;
|
||||
image.height = 100;
|
||||
|
||||
reader.onload = function(e){
|
||||
|
||||
// e.target.result holds the DataURL which
|
||||
// can be used as a source of the image:
|
||||
|
||||
image.attr('src',e.target.result);
|
||||
image.css("max-width", "200px")
|
||||
};
|
||||
|
||||
// Reading the file as a DataURL. When finished,
|
||||
// this will trigger the onload function above:
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
message.hide();
|
||||
preview.appendTo(dropbox);
|
||||
|
||||
// Associating a preview container
|
||||
// with the file, using jQuery's $.data():
|
||||
|
||||
$.data(file,preview);
|
||||
}
|
||||
|
||||
function showMessage(msg){
|
||||
message.html(msg);
|
||||
}
|
||||
|
||||
});
|
326
public/tinymce/plugins/image/js/jquery.filedrop.js
Normal file
326
public/tinymce/plugins/image/js/jquery.filedrop.js
Normal file
@ -0,0 +1,326 @@
|
||||
/*
|
||||
* Default text - jQuery plugin for html5 dragging files from desktop to browser
|
||||
*
|
||||
* Author: Weixi Yen
|
||||
*
|
||||
* Email: [Firstname][Lastname]@gmail.com
|
||||
*
|
||||
* Copyright (c) 2010 Resopollution
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Project home:
|
||||
* http://www.github.com/weixiyen/jquery-filedrop
|
||||
*
|
||||
* Version: 0.1.0
|
||||
*
|
||||
* Features:
|
||||
* Allows sending of extra parameters with file.
|
||||
* Works with Firefox 3.6+
|
||||
* Future-compliant with HTML5 spec (will work with Webkit browsers and IE9)
|
||||
* Usage:
|
||||
* See README at project homepage
|
||||
*
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
jQuery.event.props.push("dataTransfer");
|
||||
var opts = {},
|
||||
default_opts = {
|
||||
url: '',
|
||||
refresh: 1000,
|
||||
paramname: 'userfile',
|
||||
maxfiles: 25,
|
||||
maxfilesize: 1, // MBs
|
||||
data: {},
|
||||
drop: empty,
|
||||
dragEnter: empty,
|
||||
dragOver: empty,
|
||||
dragLeave: empty,
|
||||
docEnter: empty,
|
||||
docOver: empty,
|
||||
docLeave: empty,
|
||||
beforeEach: empty,
|
||||
afterAll: empty,
|
||||
rename: empty,
|
||||
error: function(err, file, i){alert(err);},
|
||||
uploadStarted: empty,
|
||||
uploadFinished: empty,
|
||||
progressUpdated: empty,
|
||||
speedUpdated: empty
|
||||
},
|
||||
errors = ["BrowserNotSupported", "TooManyFiles", "FileTooLarge"],
|
||||
doc_leave_timer,
|
||||
stop_loop = false,
|
||||
files_count = 0,
|
||||
files;
|
||||
|
||||
$.fn.filedrop = function(options) {
|
||||
opts = $.extend( {}, default_opts, options );
|
||||
|
||||
this.bind('drop', drop).bind('dragenter', dragEnter).bind('dragover', dragOver).bind('dragleave', dragLeave);
|
||||
$(document).bind('drop', docDrop).bind('dragenter', docEnter).bind('dragover', docOver).bind('dragleave', docLeave);
|
||||
};
|
||||
|
||||
function drop(e) {
|
||||
opts.drop(e);
|
||||
files = e.dataTransfer.files;
|
||||
if (files === null || files === undefined) {
|
||||
opts.error(errors[0]);
|
||||
return false;
|
||||
}
|
||||
|
||||
files_count = files.length;
|
||||
upload();
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function getBuilder(filename, filedata, boundary) {
|
||||
var dashdash = '--',
|
||||
crlf = '\r\n',
|
||||
builder = '';
|
||||
|
||||
$.each(opts.data, function(i, val) {
|
||||
if (typeof val === 'function') val = val();
|
||||
builder += dashdash;
|
||||
builder += boundary;
|
||||
builder += crlf;
|
||||
builder += 'Content-Disposition: form-data; name="'+i+'"';
|
||||
builder += crlf;
|
||||
builder += crlf;
|
||||
builder += val;
|
||||
builder += crlf;
|
||||
});
|
||||
|
||||
builder += dashdash;
|
||||
builder += boundary;
|
||||
builder += crlf;
|
||||
builder += 'Content-Disposition: form-data; name="'+opts.paramname+'"';
|
||||
// 当filename很中文,英文, 空格时有问题
|
||||
// 得到ext
|
||||
var pos = filename.lastIndexOf(".");
|
||||
var seconds = (new Date()).getTime();
|
||||
var filename2 = "leanote_" + seconds;
|
||||
if(pos != -1) {
|
||||
var ext = filename.substr(pos)
|
||||
filename2 += ext;
|
||||
}
|
||||
builder += '; filename="' + filename2 + '"';
|
||||
builder += crlf;
|
||||
|
||||
builder += 'Content-Type: application/octet-stream';
|
||||
builder += crlf;
|
||||
builder += crlf;
|
||||
|
||||
builder += filedata;
|
||||
builder += crlf;
|
||||
|
||||
builder += dashdash;
|
||||
builder += boundary;
|
||||
builder += dashdash;
|
||||
builder += crlf;
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
function progress(e) {
|
||||
if (e.lengthComputable) {
|
||||
var percentage = Math.round((e.loaded * 100) / e.total);
|
||||
if (this.currentProgress != percentage) {
|
||||
|
||||
this.currentProgress = percentage;
|
||||
opts.progressUpdated(this.index, this.file, this.currentProgress);
|
||||
|
||||
var elapsed = new Date().getTime();
|
||||
var diffTime = elapsed - this.currentStart;
|
||||
if (diffTime >= opts.refresh) {
|
||||
var diffData = e.loaded - this.startData;
|
||||
var speed = diffData / diffTime; // KB per second
|
||||
opts.speedUpdated(this.index, this.file, speed);
|
||||
this.startData = e.loaded;
|
||||
this.currentStart = elapsed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function upload() {
|
||||
stop_loop = false;
|
||||
if (!files) {
|
||||
opts.error(errors[0]);
|
||||
return false;
|
||||
}
|
||||
var filesDone = 0,
|
||||
filesRejected = 0;
|
||||
|
||||
if (files_count > opts.maxfiles) {
|
||||
opts.error(errors[1]);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var i=0; i<files_count; i++) {
|
||||
if (stop_loop) return false;
|
||||
try {
|
||||
if (beforeEach(files[i]) != false) {
|
||||
if (i === files_count) return;
|
||||
var reader = new FileReader(),
|
||||
max_file_size = 1048576 * opts.maxfilesize;
|
||||
|
||||
reader.index = i;
|
||||
if (files[i].size > max_file_size) {
|
||||
opts.error(errors[2], files[i], i);
|
||||
filesRejected++;
|
||||
continue;
|
||||
}
|
||||
|
||||
reader.onloadend = send;
|
||||
reader.readAsBinaryString(files[i]);
|
||||
} else {
|
||||
filesRejected++;
|
||||
}
|
||||
} catch(err) {
|
||||
opts.error(errors[0]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function send(e) {
|
||||
// Sometimes the index is not attached to the
|
||||
// event object. Find it by size. Hack for sure.
|
||||
if (e.target.index == undefined) {
|
||||
e.target.index = getIndexBySize(e.total);
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest(),
|
||||
upload = xhr.upload,
|
||||
file = files[e.target.index],
|
||||
index = e.target.index,
|
||||
start_time = new Date().getTime(),
|
||||
boundary = '------multipartformboundary' + (new Date).getTime(),
|
||||
builder;
|
||||
|
||||
|
||||
newName = rename(file.name);
|
||||
if (typeof newName === "string") {
|
||||
builder = getBuilder(newName, e.target.result, boundary);
|
||||
} else {
|
||||
builder = getBuilder(file.name, e.target.result, boundary);
|
||||
}
|
||||
|
||||
upload.index = index;
|
||||
upload.file = file;
|
||||
upload.downloadStartTime = start_time;
|
||||
upload.currentStart = start_time;
|
||||
upload.currentProgress = 0;
|
||||
upload.startData = 0;
|
||||
upload.addEventListener("progress", progress, false);
|
||||
|
||||
xhr.open("POST", opts.url, true);
|
||||
xhr.setRequestHeader('content-type', 'multipart/form-data; boundary='
|
||||
+ boundary);
|
||||
|
||||
xhr.sendAsBinary(builder);
|
||||
|
||||
opts.uploadStarted(index, file, files_count);
|
||||
|
||||
xhr.onload = function() {
|
||||
if (xhr.responseText) {
|
||||
var now = new Date().getTime(),
|
||||
timeDiff = now - start_time,
|
||||
result = opts.uploadFinished(index, file, jQuery.parseJSON(xhr.responseText), timeDiff);
|
||||
filesDone++;
|
||||
if (filesDone == files_count - filesRejected) {
|
||||
afterAll();
|
||||
}
|
||||
if (result === false) stop_loop = true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function getIndexBySize(size) {
|
||||
for (var i=0; i < files_count; i++) {
|
||||
if (files[i].size == size) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function rename(name) {
|
||||
return opts.rename(name);
|
||||
}
|
||||
|
||||
function beforeEach(file) {
|
||||
return opts.beforeEach(file);
|
||||
}
|
||||
|
||||
function afterAll() {
|
||||
return opts.afterAll();
|
||||
}
|
||||
|
||||
function dragEnter(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.dragEnter(e);
|
||||
}
|
||||
|
||||
function dragOver(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.docOver(e);
|
||||
opts.dragOver(e);
|
||||
}
|
||||
|
||||
function dragLeave(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
opts.dragLeave(e);
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function docDrop(e) {
|
||||
e.preventDefault();
|
||||
opts.docLeave(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
function docEnter(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.docEnter(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
function docOver(e) {
|
||||
clearTimeout(doc_leave_timer);
|
||||
e.preventDefault();
|
||||
opts.docOver(e);
|
||||
return false;
|
||||
}
|
||||
|
||||
function docLeave(e) {
|
||||
doc_leave_timer = setTimeout(function(){
|
||||
opts.docLeave(e);
|
||||
}, 200);
|
||||
}
|
||||
|
||||
function empty(){}
|
||||
|
||||
try {
|
||||
if (XMLHttpRequest.prototype.sendAsBinary) return;
|
||||
XMLHttpRequest.prototype.sendAsBinary = function(datastr) {
|
||||
function byteValue(x) {
|
||||
return x.charCodeAt(0) & 0xff;
|
||||
}
|
||||
var ords = Array.prototype.map.call(datastr, byteValue);
|
||||
var ui8a = new Uint8Array(ords);
|
||||
this.send(ui8a.buffer);
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
})(jQuery);
|
36
public/tinymce/plugins/image/plugin.js
Normal file
36
public/tinymce/plugins/image/plugin.js
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
// 与jbimages结合
|
||||
// 使用了jbimages/dialog-v4.htm
|
||||
// jbimages/js/dialog-v4.js
|
||||
tinymce.PluginManager.add('image', function(editor, url) {
|
||||
// 弹框
|
||||
function showDialog() {
|
||||
// 与jbimages结合
|
||||
// Simple default dialog
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert/edit image',
|
||||
file : url + '/dialog.htm',
|
||||
width : 550,
|
||||
height: 345
|
||||
});
|
||||
}
|
||||
|
||||
// 添加按钮
|
||||
editor.addButton('image', {
|
||||
icon: 'image',
|
||||
tooltip: 'Insert/edit image',
|
||||
onclick: showDialog,
|
||||
stateSelector: 'img:not([data-mce-object])'
|
||||
});
|
||||
});
|
1
public/tinymce/plugins/image/plugin.min.js
vendored
Normal file
1
public/tinymce/plugins/image/plugin.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
tinymce.PluginManager.add("image",function(i,t){function e(){win=i.windowManager.open({title:"Insert/edit image",file:t+"/dialog.htm",width:550,height:345})}i.addButton("image",{icon:"image",tooltip:"Insert/edit image",onclick:e,stateSelector:"img:not([data-mce-object])"})});
|
315
public/tinymce/plugins/image/plugin_ever.js
Normal file
315
public/tinymce/plugins/image/plugin_ever.js
Normal file
@ -0,0 +1,315 @@
|
||||
/**
|
||||
* plugin.js
|
||||
*
|
||||
* Copyright, Moxiecode Systems AB
|
||||
* Released under LGPL License.
|
||||
*
|
||||
* License: http://www.tinymce.com/license
|
||||
* Contributing: http://www.tinymce.com/contributing
|
||||
*/
|
||||
|
||||
/*global tinymce:true */
|
||||
|
||||
// 与jbimages结合
|
||||
// 使用了jbimages/dialog-v4.htm
|
||||
// jbimages/js/dialog-v4.js
|
||||
tinymce.PluginManager.add('image', function(editor, url) {
|
||||
function getImageSize(url, callback) {
|
||||
var img = document.createElement('img');
|
||||
|
||||
function done(width, height) {
|
||||
img.parentNode.removeChild(img);
|
||||
callback({width: width, height: height});
|
||||
}
|
||||
|
||||
img.onload = function() {
|
||||
done(img.clientWidth, img.clientHeight);
|
||||
};
|
||||
|
||||
img.onerror = function() {
|
||||
done();
|
||||
};
|
||||
|
||||
img.src = url;
|
||||
|
||||
var style = img.style;
|
||||
style.visibility = 'hidden';
|
||||
style.position = 'fixed';
|
||||
style.bottom = style.left = 0;
|
||||
style.width = style.height = 'auto';
|
||||
|
||||
document.body.appendChild(img);
|
||||
}
|
||||
|
||||
//??
|
||||
function createImageList(callback) {
|
||||
return function() {
|
||||
var imageList = editor.settings.image_list;
|
||||
|
||||
if (typeof(imageList) == "string") {
|
||||
tinymce.util.XHR.send({
|
||||
url: imageList,
|
||||
success: function(text) {
|
||||
callback(tinymce.util.JSON.parse(text));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
callback(imageList);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// 弹框
|
||||
function showDialog(imageList) {
|
||||
var win, data = {}, dom = editor.dom, imgElm = editor.selection.getNode();
|
||||
var width, height, imageListCtrl;
|
||||
|
||||
function buildImageList() {
|
||||
var imageListItems = [{text: 'None', value: ''}];
|
||||
|
||||
tinymce.each(imageList, function(image) {
|
||||
imageListItems.push({
|
||||
text: image.text || image.title,
|
||||
value: editor.convertURL(image.value || image.url, 'src'),
|
||||
menu: image.menu
|
||||
});
|
||||
});
|
||||
|
||||
return imageListItems;
|
||||
}
|
||||
|
||||
function recalcSize(e) {
|
||||
var widthCtrl, heightCtrl, newWidth, newHeight;
|
||||
|
||||
widthCtrl = win.find('#width')[0];
|
||||
heightCtrl = win.find('#height')[0];
|
||||
|
||||
newWidth = widthCtrl.value();
|
||||
newHeight = heightCtrl.value();
|
||||
|
||||
if (win.find('#constrain')[0].checked() && width && height && newWidth && newHeight) {
|
||||
if (e.control == widthCtrl) {
|
||||
newHeight = Math.round((newWidth / width) * newHeight);
|
||||
heightCtrl.value(newHeight);
|
||||
} else {
|
||||
newWidth = Math.round((newHeight / height) * newWidth);
|
||||
widthCtrl.value(newWidth);
|
||||
}
|
||||
}
|
||||
|
||||
width = newWidth;
|
||||
height = newHeight;
|
||||
}
|
||||
|
||||
function onSubmitForm() {
|
||||
function waitLoad(imgElm) {
|
||||
function selectImage() {
|
||||
imgElm.onload = imgElm.onerror = null;
|
||||
editor.selection.select(imgElm);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
|
||||
// 如果没有设置width, height, 就用图片本身的大小
|
||||
imgElm.onload = function() {
|
||||
if (!data.width && !data.height) {
|
||||
dom.setAttribs(imgElm, {
|
||||
width: imgElm.clientWidth,
|
||||
height: imgElm.clientHeight
|
||||
});
|
||||
}
|
||||
|
||||
selectImage();
|
||||
};
|
||||
|
||||
imgElm.onerror = selectImage;
|
||||
}
|
||||
|
||||
// 这是通过url插入图片
|
||||
// iframe里得到...
|
||||
var data = {};
|
||||
var ifr = $("iframe[src$='v4.htm']").contents().find("body");
|
||||
data.width = $(ifr).find("#imageWidth").val();
|
||||
data.height = $(ifr).find("#imageHeight").val();
|
||||
data.src = $(ifr).find("#imageSrc").val();
|
||||
data.alt = "";
|
||||
|
||||
if (data.width === '') {
|
||||
data.width = null;
|
||||
}
|
||||
|
||||
if (data.height === '') {
|
||||
data.height = null;
|
||||
}
|
||||
|
||||
if (data.style === '') {
|
||||
data.style = null;
|
||||
}
|
||||
|
||||
data = {
|
||||
src: data.src,
|
||||
alt: data.alt,
|
||||
width: data.width,
|
||||
height: data.height,
|
||||
style: data.style
|
||||
};
|
||||
|
||||
editor.undoManager.transact(function() {
|
||||
// 删除图片
|
||||
if (!data.src) {
|
||||
if (imgElm) {
|
||||
dom.remove(imgElm);
|
||||
editor.nodeChanged();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!imgElm) {
|
||||
data.id = '__mcenew';
|
||||
editor.selection.setContent(dom.createHTML('img', data));
|
||||
imgElm = dom.get('__mcenew');
|
||||
dom.setAttrib(imgElm, 'id', null);
|
||||
} else {
|
||||
dom.setAttribs(imgElm, data);
|
||||
}
|
||||
|
||||
waitLoad(imgElm);
|
||||
});
|
||||
|
||||
tinymce.EditorManager.activeEditor.windowManager.close(window);
|
||||
}
|
||||
|
||||
function removePixelSuffix(value) {
|
||||
if (value) {
|
||||
value = value.replace(/px$/, '');
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
// 当url改变时, 得到图片的大小
|
||||
function srcChange() {
|
||||
if (imageListCtrl) {
|
||||
imageListCtrl.value(editor.convertURL(this.value(), 'src'));
|
||||
}
|
||||
|
||||
getImageSize(this.value(), function(data) {
|
||||
if (data.width && data.height) {
|
||||
width = data.width;
|
||||
height = data.height;
|
||||
|
||||
win.find('#width').value(width);
|
||||
win.find('#height').value(height);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
width = dom.getAttrib(imgElm, 'width');
|
||||
height = dom.getAttrib(imgElm, 'height');
|
||||
|
||||
if (imgElm.nodeName == 'IMG' && !imgElm.getAttribute('data-mce-object')) {
|
||||
data = {
|
||||
src: dom.getAttrib(imgElm, 'src'),
|
||||
alt: dom.getAttrib(imgElm, 'alt'),
|
||||
width: width,
|
||||
height: height
|
||||
};
|
||||
} else {
|
||||
imgElm = null;
|
||||
}
|
||||
|
||||
if (imageList) {
|
||||
imageListCtrl = {
|
||||
type: 'listbox',
|
||||
label: 'Image list',
|
||||
values: buildImageList(),
|
||||
value: data.src && editor.convertURL(data.src, 'src'),
|
||||
onselect: function(e) {
|
||||
var altCtrl = win.find('#alt');
|
||||
|
||||
if (!altCtrl.value() || (e.lastControl && altCtrl.value() == e.lastControl.text())) {
|
||||
altCtrl.value(e.control.text());
|
||||
}
|
||||
|
||||
win.find('#src').value(e.control.value());
|
||||
},
|
||||
onPostRender: function() {
|
||||
imageListCtrl = this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// General settings shared between simple and advanced dialogs
|
||||
var generalFormItems = [
|
||||
{name: 'src', type: 'filepicker', filetype: 'image', label: 'Source', autofocus: true, onchange: srcChange},
|
||||
imageListCtrl,
|
||||
{name: 'alt', type: 'textbox', label: 'Image description'},
|
||||
{
|
||||
type: 'container',
|
||||
label: 'Dimensions',
|
||||
layout: 'flex',
|
||||
direction: 'row',
|
||||
align: 'center',
|
||||
spacing: 5,
|
||||
items: [
|
||||
{name: 'width', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
|
||||
{type: 'label', text: 'x'},
|
||||
{name: 'height', type: 'textbox', maxLength: 3, size: 3, onchange: recalcSize},
|
||||
{name: 'constrain', type: 'checkbox', checked: true, text: 'Constrain proportions'}
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
function updateStyle() {
|
||||
function addPixelSuffix(value) {
|
||||
if (value.length > 0 && /^[0-9]+$/.test(value)) {
|
||||
value += 'px';
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
var data = win.toJSON();
|
||||
var css = dom.parseStyle(data.style);
|
||||
|
||||
dom.setAttrib(imgElm, 'style', '');
|
||||
|
||||
delete css.margin;
|
||||
css['margin-top'] = css['margin-bottom'] = addPixelSuffix(data.vspace);
|
||||
css['margin-left'] = css['margin-right'] = addPixelSuffix(data.hspace);
|
||||
css['border-width'] = addPixelSuffix(data.border);
|
||||
|
||||
win.find('#style').value(dom.serializeStyle(dom.parseStyle(dom.serializeStyle(css))));
|
||||
}
|
||||
|
||||
// 与jbimages结合
|
||||
// Simple default dialog
|
||||
win = editor.windowManager.open({
|
||||
title: 'Insert/edit image',
|
||||
data: data,
|
||||
file : url + '/../jbimages/dialog-v4.htm',
|
||||
// body: generalFormItems,
|
||||
onSubmit: onSubmitForm,
|
||||
width : 550,
|
||||
height: 305,
|
||||
buttons: [{
|
||||
text: '确定',
|
||||
classes: 'widget btn primary first abs-layout-item',
|
||||
// disabled: false,
|
||||
onclick: onSubmitForm
|
||||
},
|
||||
{
|
||||
text: 'Close',
|
||||
onclick: 'close'
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
// 添加按钮
|
||||
editor.addButton('image', {
|
||||
icon: 'image',
|
||||
tooltip: 'Insert/edit image',
|
||||
onclick: createImageList(showDialog),
|
||||
stateSelector: 'img:not([data-mce-object])'
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user