修复文本框链接问题
This commit is contained in:
@@ -1,80 +1,82 @@
|
|||||||
(function () {
|
(function () {
|
||||||
/* eslint-disable */
|
var parent = window.parent;
|
||||||
if (window.frameElement.id) {
|
//dialog对象
|
||||||
let parent = window.parent,
|
dialog = parent.$EDITORUI[window.frameElement.id.replace( /_iframe$/, '' )];
|
||||||
|
//当前打开dialog的编辑器实例
|
||||||
|
editor = dialog.editor;
|
||||||
|
|
||||||
dialog = parent.$EDITORUI[window.frameElement.id.replace(/_iframe$/, '')],
|
UE = parent.UE;
|
||||||
|
|
||||||
editor = dialog.editor,
|
domUtils = UE.dom.domUtils;
|
||||||
|
|
||||||
UE = parent.UE,
|
utils = UE.utils;
|
||||||
|
|
||||||
domUtils = UE.dom.domUtils,
|
browser = UE.browser;
|
||||||
|
|
||||||
utils = UE.utils,
|
ajax = UE.ajax;
|
||||||
|
|
||||||
browser = UE.browser,
|
$G = function ( id ) {
|
||||||
/* eslint-disable */
|
return document.getElementById( id )
|
||||||
ajax = UE.ajax,
|
};
|
||||||
|
//focus元素
|
||||||
|
$focus = function ( node ) {
|
||||||
|
setTimeout( function () {
|
||||||
|
if ( browser.ie ) {
|
||||||
|
var r = node.createTextRange();
|
||||||
|
r.collapse( false );
|
||||||
|
r.select();
|
||||||
|
} else {
|
||||||
|
node.focus()
|
||||||
|
}
|
||||||
|
}, 0 )
|
||||||
|
};
|
||||||
|
window.nowEditor = {editor: editor, dialog: dialog};
|
||||||
|
utils.loadFile(document,{
|
||||||
|
href:editor.options.themePath + editor.options.theme + "/dialogbase.css?cache="+Math.random(),
|
||||||
|
tag:"link",
|
||||||
|
type:"text/css",
|
||||||
|
rel:"stylesheet"
|
||||||
|
});
|
||||||
|
lang = editor.getLang(dialog.className.split( "-" )[2]);
|
||||||
|
if(lang){
|
||||||
|
domUtils.on(window,'load',function () {
|
||||||
|
|
||||||
$G = function (id) {
|
var langImgPath = editor.options.langPath + editor.options.lang + "/images/";
|
||||||
return document.getElementById(id)
|
//针对静态资源
|
||||||
},
|
for ( var i in lang["static"] ) {
|
||||||
$focus = function (node) {
|
var dom = $G( i );
|
||||||
setTimeout(function () {
|
if(!dom) continue;
|
||||||
if (browser.ie) {
|
var tagName = dom.tagName,
|
||||||
var r = node.createTextRange();
|
content = lang["static"][i];
|
||||||
r.collapse(false);
|
if(content.src){
|
||||||
r.select();
|
//clone
|
||||||
} else {
|
content = utils.extend({},content,false);
|
||||||
node.focus()
|
content.src = langImgPath + content.src;
|
||||||
}
|
|
||||||
}, 0)
|
|
||||||
};
|
|
||||||
window.nowEditor = {editor: editor, dialog: dialog};
|
|
||||||
utils.loadFile(document, {
|
|
||||||
href: editor.options.themePath + editor.options.theme + '/dialogbase.css?cache=' + Math.random(),
|
|
||||||
tag: 'link',
|
|
||||||
type: 'text/css',
|
|
||||||
rel: 'stylesheet'
|
|
||||||
});
|
|
||||||
var lang = editor.getLang(dialog.className.split('-')[2]);
|
|
||||||
if (lang) {
|
|
||||||
domUtils.on(window, 'load', function () {
|
|
||||||
var langImgPath = editor.options.langPath + editor.options.lang + '/images/';
|
|
||||||
// 针对静态资源
|
|
||||||
for (var i in lang['static']) {
|
|
||||||
var dom = $G(i);
|
|
||||||
if (!dom) continue;
|
|
||||||
let tagName = dom.tagName,
|
|
||||||
content = lang['static'][i];
|
|
||||||
if (content.src) {
|
|
||||||
// clone
|
|
||||||
content = utils.extend({}, content, false);
|
|
||||||
content.src = langImgPath + content.src;
|
|
||||||
}
|
|
||||||
if (content.style) {
|
|
||||||
content = utils.extend({}, content, false);
|
|
||||||
content.style = content.style.replace(/url\s*\(/g, 'url(' + langImgPath)
|
|
||||||
}
|
|
||||||
switch (tagName.toLowerCase()) {
|
|
||||||
case 'var':
|
|
||||||
dom.parentNode.replaceChild(document.createTextNode(content), dom);
|
|
||||||
break;
|
|
||||||
case 'select':
|
|
||||||
var ops = dom.options;
|
|
||||||
for (var j = 0, oj; oj = ops[j];) {
|
|
||||||
oj.innerHTML = content.options[j++];
|
|
||||||
}
|
|
||||||
for (var p in content) {
|
|
||||||
p != 'options' && dom.setAttribute(p, content[p]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
domUtils.setAttributes(dom, content);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
if(content.style){
|
||||||
}
|
content = utils.extend({},content,false);
|
||||||
|
content.style = content.style.replace(/url\s*\(/g,"url(" + langImgPath)
|
||||||
|
}
|
||||||
|
switch ( tagName.toLowerCase() ) {
|
||||||
|
case "var":
|
||||||
|
dom.parentNode.replaceChild( document.createTextNode( content ), dom );
|
||||||
|
break;
|
||||||
|
case "select":
|
||||||
|
var ops = dom.options;
|
||||||
|
for ( var j = 0, oj; oj = ops[j]; ) {
|
||||||
|
oj.innerHTML = content.options[j++];
|
||||||
|
}
|
||||||
|
for ( var p in content ) {
|
||||||
|
p != "options" && dom.setAttribute( p, content[p] );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
domUtils.setAttributes( dom, content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|||||||
@@ -256,7 +256,7 @@ var scrawl = function (options) {
|
|||||||
|
|
||||||
if (img) {
|
if (img) {
|
||||||
if (!scaleCon) {
|
if (!scaleCon) {
|
||||||
picBoard.style.cssText = "position:relative;z-index:1;"+picBoard.style.cssText;
|
picBoard.style.cssText = "position:relative;z-index:999;"+picBoard.style.cssText;
|
||||||
img.style.cssText = "position: absolute;top:" + (canvas.height - img.height) / 2 + "px;left:" + (canvas.width - img.width) / 2 + "px;";
|
img.style.cssText = "position: absolute;top:" + (canvas.height - img.height) / 2 + "px;left:" + (canvas.width - img.width) / 2 + "px;";
|
||||||
var scale = new ScaleBoy();
|
var scale = new ScaleBoy();
|
||||||
picBoard.appendChild(scale.init());
|
picBoard.appendChild(scale.init());
|
||||||
@@ -268,7 +268,7 @@ var scrawl = function (options) {
|
|||||||
picBoard.style.zIndex = "";
|
picBoard.style.zIndex = "";
|
||||||
} else {
|
} else {
|
||||||
scaleCon.style.visibility = "visible";
|
scaleCon.style.visibility = "visible";
|
||||||
picBoard.style.cssText += "position:relative;z-index:1";
|
picBoard.style.cssText += "position:relative;z-index:999";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
+556
-627
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,372 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by JetBrains PhpStorm.
|
||||||
|
* User: taoqili
|
||||||
|
* Date: 12-7-18
|
||||||
|
* Time: 上午11: 32
|
||||||
|
* UEditor编辑器通用上传类
|
||||||
|
*/
|
||||||
|
class Uploader
|
||||||
|
{
|
||||||
|
private $fileField; //文件域名
|
||||||
|
private $file; //文件上传对象
|
||||||
|
private $base64; //文件上传对象
|
||||||
|
private $config; //配置信息
|
||||||
|
private $oriName; //原始文件名
|
||||||
|
private $fileName; //新文件名
|
||||||
|
private $fullName; //完整文件名,即从当前配置目录开始的URL
|
||||||
|
private $filePath; //完整文件名,即从当前配置目录开始的URL
|
||||||
|
private $fileSize; //文件大小
|
||||||
|
private $fileType; //文件类型
|
||||||
|
private $stateInfo; //上传状态信息,
|
||||||
|
private $stateMap = array( //上传状态映射表,国际化用户需考虑此处数据的国际化
|
||||||
|
"SUCCESS", //上传成功标记,在UEditor中内不可改变,否则flash判断会出错
|
||||||
|
"文件大小超出 upload_max_filesize 限制",
|
||||||
|
"文件大小超出 MAX_FILE_SIZE 限制",
|
||||||
|
"文件未被完整上传",
|
||||||
|
"没有文件被上传",
|
||||||
|
"上传文件为空",
|
||||||
|
"ERROR_TMP_FILE" => "临时文件错误",
|
||||||
|
"ERROR_TMP_FILE_NOT_FOUND" => "找不到临时文件",
|
||||||
|
"ERROR_SIZE_EXCEED" => "文件大小超出网站限制",
|
||||||
|
"ERROR_TYPE_NOT_ALLOWED" => "文件类型不允许",
|
||||||
|
"ERROR_CREATE_DIR" => "目录创建失败",
|
||||||
|
"ERROR_DIR_NOT_WRITEABLE" => "目录没有写权限",
|
||||||
|
"ERROR_FILE_MOVE" => "文件保存时出错",
|
||||||
|
"ERROR_FILE_NOT_FOUND" => "找不到上传文件",
|
||||||
|
"ERROR_WRITE_CONTENT" => "写入文件内容错误",
|
||||||
|
"ERROR_UNKNOWN" => "未知错误",
|
||||||
|
"ERROR_DEAD_LINK" => "链接不可用",
|
||||||
|
"ERROR_HTTP_LINK" => "链接不是http链接",
|
||||||
|
"ERROR_HTTP_CONTENTTYPE" => "链接contentType不正确",
|
||||||
|
"INVALID_URL" => "非法 URL",
|
||||||
|
"INVALID_IP" => "非法 IP"
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造函数
|
||||||
|
* @param string $fileField 表单名称
|
||||||
|
* @param array $config 配置项
|
||||||
|
* @param bool $base64 是否解析base64编码,可省略。若开启,则$fileField代表的是base64编码的字符串表单名
|
||||||
|
*/
|
||||||
|
public function __construct($fileField, $config, $type = "upload")
|
||||||
|
{
|
||||||
|
$this->fileField = $fileField;
|
||||||
|
$this->config = $config;
|
||||||
|
$this->type = $type;
|
||||||
|
if ($type == "remote") {
|
||||||
|
$this->saveRemote();
|
||||||
|
} else if($type == "base64") {
|
||||||
|
$this->upBase64();
|
||||||
|
} else {
|
||||||
|
$this->upFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->stateMap['ERROR_TYPE_NOT_ALLOWED'] = iconv('unicode', 'utf-8', $this->stateMap['ERROR_TYPE_NOT_ALLOWED']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传文件的主处理方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
private function upFile()
|
||||||
|
{
|
||||||
|
$file = $this->file = $_FILES[$this->fileField];
|
||||||
|
if (!$file) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_FILE_NOT_FOUND");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($this->file['error']) {
|
||||||
|
$this->stateInfo = $this->getStateInfo($file['error']);
|
||||||
|
return;
|
||||||
|
} else if (!file_exists($file['tmp_name'])) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_TMP_FILE_NOT_FOUND");
|
||||||
|
return;
|
||||||
|
} else if (!is_uploaded_file($file['tmp_name'])) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_TMPFILE");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->oriName = $file['name'];
|
||||||
|
$this->fileSize = $file['size'];
|
||||||
|
$this->fileType = $this->getFileExt();
|
||||||
|
$this->fullName = $this->getFullName();
|
||||||
|
$this->filePath = $this->getFilePath();
|
||||||
|
$this->fileName = $this->getFileName();
|
||||||
|
$dirname = dirname($this->filePath);
|
||||||
|
|
||||||
|
//检查文件大小是否超出限制
|
||||||
|
if (!$this->checkSize()) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_SIZE_EXCEED");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//检查是否不允许的文件格式
|
||||||
|
if (!$this->checkType()) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_TYPE_NOT_ALLOWED");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//创建目录失败
|
||||||
|
if (!file_exists($dirname) && !mkdir($dirname, 0777, true)) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_CREATE_DIR");
|
||||||
|
return;
|
||||||
|
} else if (!is_writeable($dirname)) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_DIR_NOT_WRITEABLE");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//移动文件
|
||||||
|
if (!(move_uploaded_file($file["tmp_name"], $this->filePath) && file_exists($this->filePath))) { //移动失败
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_FILE_MOVE");
|
||||||
|
} else { //移动成功
|
||||||
|
$this->stateInfo = $this->stateMap[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理base64编码的图片上传
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
private function upBase64()
|
||||||
|
{
|
||||||
|
$base64Data = $_POST[$this->fileField];
|
||||||
|
$img = base64_decode($base64Data);
|
||||||
|
|
||||||
|
$this->oriName = $this->config['oriName'];
|
||||||
|
$this->fileSize = strlen($img);
|
||||||
|
$this->fileType = $this->getFileExt();
|
||||||
|
$this->fullName = $this->getFullName();
|
||||||
|
$this->filePath = $this->getFilePath();
|
||||||
|
$this->fileName = $this->getFileName();
|
||||||
|
$dirname = dirname($this->filePath);
|
||||||
|
|
||||||
|
//检查文件大小是否超出限制
|
||||||
|
if (!$this->checkSize()) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_SIZE_EXCEED");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//创建目录失败
|
||||||
|
if (!file_exists($dirname) && !mkdir($dirname, 0777, true)) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_CREATE_DIR");
|
||||||
|
return;
|
||||||
|
} else if (!is_writeable($dirname)) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_DIR_NOT_WRITEABLE");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//移动文件
|
||||||
|
if (!(file_put_contents($this->filePath, $img) && file_exists($this->filePath))) { //移动失败
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_WRITE_CONTENT");
|
||||||
|
} else { //移动成功
|
||||||
|
$this->stateInfo = $this->stateMap[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉取远程图片
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
private function saveRemote()
|
||||||
|
{
|
||||||
|
$imgUrl = htmlspecialchars($this->fileField);
|
||||||
|
$imgUrl = str_replace("&", "&", $imgUrl);
|
||||||
|
|
||||||
|
//http开头验证
|
||||||
|
if (strpos($imgUrl, "http") !== 0) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_HTTP_LINK");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
preg_match('/(^https*:\/\/[^:\/]+)/', $imgUrl, $matches);
|
||||||
|
$host_with_protocol = count($matches) > 1 ? $matches[1] : '';
|
||||||
|
|
||||||
|
// 判断是否是合法 url
|
||||||
|
if (!filter_var($host_with_protocol, FILTER_VALIDATE_URL)) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("INVALID_URL");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
preg_match('/^https*:\/\/(.+)/', $host_with_protocol, $matches);
|
||||||
|
$host_without_protocol = count($matches) > 1 ? $matches[1] : '';
|
||||||
|
|
||||||
|
// 此时提取出来的可能是 ip 也有可能是域名,先获取 ip
|
||||||
|
$ip = gethostbyname($host_without_protocol);
|
||||||
|
// 判断是否是私有 ip
|
||||||
|
if(!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("INVALID_IP");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取请求头并检测死链
|
||||||
|
$heads = get_headers($imgUrl, 1);
|
||||||
|
if (!(stristr($heads[0], "200") && stristr($heads[0], "OK"))) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_DEAD_LINK");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//格式验证(扩展名验证和Content-Type验证)
|
||||||
|
$fileType = strtolower(strrchr($imgUrl, '.'));
|
||||||
|
if (!in_array($fileType, $this->config['allowFiles']) || !isset($heads['Content-Type']) || !stristr($heads['Content-Type'], "image")) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_HTTP_CONTENTTYPE");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//打开输出缓冲区并获取远程图片
|
||||||
|
ob_start();
|
||||||
|
$context = stream_context_create(
|
||||||
|
array('http' => array(
|
||||||
|
'follow_location' => false // don't follow redirects
|
||||||
|
))
|
||||||
|
);
|
||||||
|
readfile($imgUrl, false, $context);
|
||||||
|
$img = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
preg_match("/[\/]([^\/]*)[\.]?[^\.\/]*$/", $imgUrl, $m);
|
||||||
|
|
||||||
|
$this->oriName = $m ? $m[1]:"";
|
||||||
|
$this->fileSize = strlen($img);
|
||||||
|
$this->fileType = $this->getFileExt();
|
||||||
|
$this->fullName = $this->getFullName();
|
||||||
|
$this->filePath = $this->getFilePath();
|
||||||
|
$this->fileName = $this->getFileName();
|
||||||
|
$dirname = dirname($this->filePath);
|
||||||
|
|
||||||
|
//检查文件大小是否超出限制
|
||||||
|
if (!$this->checkSize()) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_SIZE_EXCEED");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//创建目录失败
|
||||||
|
if (!file_exists($dirname) && !mkdir($dirname, 0777, true)) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_CREATE_DIR");
|
||||||
|
return;
|
||||||
|
} else if (!is_writeable($dirname)) {
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_DIR_NOT_WRITEABLE");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//移动文件
|
||||||
|
if (!(file_put_contents($this->filePath, $img) && file_exists($this->filePath))) { //移动失败
|
||||||
|
$this->stateInfo = $this->getStateInfo("ERROR_WRITE_CONTENT");
|
||||||
|
} else { //移动成功
|
||||||
|
$this->stateInfo = $this->stateMap[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传错误检查
|
||||||
|
* @param $errCode
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getStateInfo($errCode)
|
||||||
|
{
|
||||||
|
return !$this->stateMap[$errCode] ? $this->stateMap["ERROR_UNKNOWN"] : $this->stateMap[$errCode];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件扩展名
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getFileExt()
|
||||||
|
{
|
||||||
|
return strtolower(strrchr($this->oriName, '.'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重命名文件
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getFullName()
|
||||||
|
{
|
||||||
|
//替换日期事件
|
||||||
|
$t = time();
|
||||||
|
$d = explode('-', date("Y-y-m-d-H-i-s"));
|
||||||
|
$format = $this->config["pathFormat"];
|
||||||
|
$format = str_replace("{yyyy}", $d[0], $format);
|
||||||
|
$format = str_replace("{yy}", $d[1], $format);
|
||||||
|
$format = str_replace("{mm}", $d[2], $format);
|
||||||
|
$format = str_replace("{dd}", $d[3], $format);
|
||||||
|
$format = str_replace("{hh}", $d[4], $format);
|
||||||
|
$format = str_replace("{ii}", $d[5], $format);
|
||||||
|
$format = str_replace("{ss}", $d[6], $format);
|
||||||
|
$format = str_replace("{time}", $t, $format);
|
||||||
|
|
||||||
|
//过滤文件名的非法自负,并替换文件名
|
||||||
|
$oriName = substr($this->oriName, 0, strrpos($this->oriName, '.'));
|
||||||
|
$oriName = preg_replace("/[\|\?\"\<\>\/\*\\\\]+/", '', $oriName);
|
||||||
|
$format = str_replace("{filename}", $oriName, $format);
|
||||||
|
|
||||||
|
//替换随机字符串
|
||||||
|
$randNum = rand(1, 10000000000) . rand(1, 10000000000);
|
||||||
|
if (preg_match("/\{rand\:([\d]*)\}/i", $format, $matches)) {
|
||||||
|
$format = preg_replace("/\{rand\:[\d]*\}/i", substr($randNum, 0, $matches[1]), $format);
|
||||||
|
}
|
||||||
|
|
||||||
|
$ext = $this->getFileExt();
|
||||||
|
return $format . $ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件名
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getFileName () {
|
||||||
|
return substr($this->filePath, strrpos($this->filePath, '/') + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件完整路径
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getFilePath()
|
||||||
|
{
|
||||||
|
$fullname = $this->fullName;
|
||||||
|
$rootPath = $_SERVER['DOCUMENT_ROOT'];
|
||||||
|
|
||||||
|
if (substr($fullname, 0, 1) != '/') {
|
||||||
|
$fullname = '/' . $fullname;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rootPath . $fullname;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件类型检测
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function checkType()
|
||||||
|
{
|
||||||
|
return in_array($this->getFileExt(), $this->config["allowFiles"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件大小检测
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
private function checkSize()
|
||||||
|
{
|
||||||
|
return $this->fileSize <= ($this->config["maxSize"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前上传成功文件的各项信息
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getFileInfo()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
"state" => $this->stateInfo,
|
||||||
|
"url" => $this->fullName,
|
||||||
|
"title" => $this->fileName,
|
||||||
|
"original" => $this->oriName,
|
||||||
|
"type" => $this->fileType,
|
||||||
|
"size" => $this->fileSize
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* 抓取远程图片
|
||||||
|
* User: Jinqn
|
||||||
|
* Date: 14-04-14
|
||||||
|
* Time: 下午19:18
|
||||||
|
*/
|
||||||
|
set_time_limit(0);
|
||||||
|
include("Uploader.class.php");
|
||||||
|
|
||||||
|
/* 上传配置 */
|
||||||
|
$config = array(
|
||||||
|
"pathFormat" => $CONFIG['catcherPathFormat'],
|
||||||
|
"maxSize" => $CONFIG['catcherMaxSize'],
|
||||||
|
"allowFiles" => $CONFIG['catcherAllowFiles'],
|
||||||
|
"oriName" => "remote.png"
|
||||||
|
);
|
||||||
|
$fieldName = $CONFIG['catcherFieldName'];
|
||||||
|
|
||||||
|
/* 抓取远程图片 */
|
||||||
|
$list = array();
|
||||||
|
if (isset($_POST[$fieldName])) {
|
||||||
|
$source = $_POST[$fieldName];
|
||||||
|
} else {
|
||||||
|
$source = $_GET[$fieldName];
|
||||||
|
}
|
||||||
|
foreach ($source as $imgUrl) {
|
||||||
|
$item = new Uploader($imgUrl, $config, "remote");
|
||||||
|
$info = $item->getFileInfo();
|
||||||
|
array_push($list, array(
|
||||||
|
"state" => $info["state"],
|
||||||
|
"url" => $info["url"],
|
||||||
|
"size" => $info["size"],
|
||||||
|
"title" => htmlspecialchars($info["title"]),
|
||||||
|
"original" => htmlspecialchars($info["original"]),
|
||||||
|
"source" => htmlspecialchars($imgUrl)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 返回抓取数据 */
|
||||||
|
return json_encode(array(
|
||||||
|
'state'=> count($list) ? 'SUCCESS':'ERROR',
|
||||||
|
'list'=> $list
|
||||||
|
));
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* 获取已上传的文件列表
|
||||||
|
* User: Jinqn
|
||||||
|
* Date: 14-04-09
|
||||||
|
* Time: 上午10:17
|
||||||
|
*/
|
||||||
|
include "Uploader.class.php";
|
||||||
|
|
||||||
|
/* 判断类型 */
|
||||||
|
switch ($_GET['action']) {
|
||||||
|
/* 列出文件 */
|
||||||
|
case 'listfile':
|
||||||
|
$allowFiles = $CONFIG['fileManagerAllowFiles'];
|
||||||
|
$listSize = $CONFIG['fileManagerListSize'];
|
||||||
|
$path = $CONFIG['fileManagerListPath'];
|
||||||
|
break;
|
||||||
|
/* 列出图片 */
|
||||||
|
case 'listimage':
|
||||||
|
default:
|
||||||
|
$allowFiles = $CONFIG['imageManagerAllowFiles'];
|
||||||
|
$listSize = $CONFIG['imageManagerListSize'];
|
||||||
|
$path = $CONFIG['imageManagerListPath'];
|
||||||
|
}
|
||||||
|
$allowFiles = substr(str_replace(".", "|", join("", $allowFiles)), 1);
|
||||||
|
|
||||||
|
/* 获取参数 */
|
||||||
|
$size = isset($_GET['size']) ? htmlspecialchars($_GET['size']) : $listSize;
|
||||||
|
$start = isset($_GET['start']) ? htmlspecialchars($_GET['start']) : 0;
|
||||||
|
$end = $start + $size;
|
||||||
|
|
||||||
|
/* 获取文件列表 */
|
||||||
|
$path = $_SERVER['DOCUMENT_ROOT'] . (substr($path, 0, 1) == "/" ? "":"/") . $path;
|
||||||
|
$files = getfiles($path, $allowFiles);
|
||||||
|
if (!count($files)) {
|
||||||
|
return json_encode(array(
|
||||||
|
"state" => "no match file",
|
||||||
|
"list" => array(),
|
||||||
|
"start" => $start,
|
||||||
|
"total" => count($files)
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 获取指定范围的列表 */
|
||||||
|
$len = count($files);
|
||||||
|
for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--){
|
||||||
|
$list[] = $files[$i];
|
||||||
|
}
|
||||||
|
//倒序
|
||||||
|
//for ($i = $end, $list = array(); $i < $len && $i < $end; $i++){
|
||||||
|
// $list[] = $files[$i];
|
||||||
|
//}
|
||||||
|
|
||||||
|
/* 返回数据 */
|
||||||
|
$result = json_encode(array(
|
||||||
|
"state" => "SUCCESS",
|
||||||
|
"list" => $list,
|
||||||
|
"start" => $start,
|
||||||
|
"total" => count($files)
|
||||||
|
));
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 遍历获取目录下的指定类型的文件
|
||||||
|
* @param $path
|
||||||
|
* @param array $files
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function getfiles($path, $allowFiles, &$files = array())
|
||||||
|
{
|
||||||
|
if (!is_dir($path)) return null;
|
||||||
|
if(substr($path, strlen($path) - 1) != '/') $path .= '/';
|
||||||
|
$handle = opendir($path);
|
||||||
|
while (false !== ($file = readdir($handle))) {
|
||||||
|
if ($file != '.' && $file != '..') {
|
||||||
|
$path2 = $path . $file;
|
||||||
|
if (is_dir($path2)) {
|
||||||
|
getfiles($path2, $allowFiles, $files);
|
||||||
|
} else {
|
||||||
|
if (preg_match("/\.(".$allowFiles.")$/i", $file)) {
|
||||||
|
$files[] = array(
|
||||||
|
'url'=> substr($path2, strlen($_SERVER['DOCUMENT_ROOT'])),
|
||||||
|
'mtime'=> filemtime($path2)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $files;
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* 上传附件和上传视频
|
||||||
|
* User: Jinqn
|
||||||
|
* Date: 14-04-09
|
||||||
|
* Time: 上午10:17
|
||||||
|
*/
|
||||||
|
include "Uploader.class.php";
|
||||||
|
|
||||||
|
/* 上传配置 */
|
||||||
|
$base64 = "upload";
|
||||||
|
switch (htmlspecialchars($_GET['action'])) {
|
||||||
|
case 'uploadimage':
|
||||||
|
$config = array(
|
||||||
|
"pathFormat" => $CONFIG['imagePathFormat'],
|
||||||
|
"maxSize" => $CONFIG['imageMaxSize'],
|
||||||
|
"allowFiles" => $CONFIG['imageAllowFiles']
|
||||||
|
);
|
||||||
|
$fieldName = $CONFIG['imageFieldName'];
|
||||||
|
break;
|
||||||
|
case 'uploadscrawl':
|
||||||
|
$config = array(
|
||||||
|
"pathFormat" => $CONFIG['scrawlPathFormat'],
|
||||||
|
"maxSize" => $CONFIG['scrawlMaxSize'],
|
||||||
|
"allowFiles" => $CONFIG['scrawlAllowFiles'],
|
||||||
|
"oriName" => "scrawl.png"
|
||||||
|
);
|
||||||
|
$fieldName = $CONFIG['scrawlFieldName'];
|
||||||
|
$base64 = "base64";
|
||||||
|
break;
|
||||||
|
case 'uploadvideo':
|
||||||
|
$config = array(
|
||||||
|
"pathFormat" => $CONFIG['videoPathFormat'],
|
||||||
|
"maxSize" => $CONFIG['videoMaxSize'],
|
||||||
|
"allowFiles" => $CONFIG['videoAllowFiles']
|
||||||
|
);
|
||||||
|
$fieldName = $CONFIG['videoFieldName'];
|
||||||
|
break;
|
||||||
|
case 'uploadfile':
|
||||||
|
default:
|
||||||
|
$config = array(
|
||||||
|
"pathFormat" => $CONFIG['filePathFormat'],
|
||||||
|
"maxSize" => $CONFIG['fileMaxSize'],
|
||||||
|
"allowFiles" => $CONFIG['fileAllowFiles']
|
||||||
|
);
|
||||||
|
$fieldName = $CONFIG['fileFieldName'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 生成上传实例对象并完成上传 */
|
||||||
|
$up = new Uploader($fieldName, $config, $base64);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到上传文件所对应的各个参数,数组结构
|
||||||
|
* array(
|
||||||
|
* "state" => "", //上传状态,上传成功时必须返回"SUCCESS"
|
||||||
|
* "url" => "", //返回的地址
|
||||||
|
* "title" => "", //新文件名
|
||||||
|
* "original" => "", //原始文件名
|
||||||
|
* "type" => "" //文件类型
|
||||||
|
* "size" => "", //文件大小
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* 返回数据 */
|
||||||
|
return json_encode($up->getFileInfo());
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/* 前后端通信相关的配置,注释只允许使用多行方式 */
|
||||||
|
{
|
||||||
|
/* 上传图片配置项 */
|
||||||
|
"imageActionName": "uploadimage", /* 执行上传图片的action名称 */
|
||||||
|
"imageFieldName": "upfile", /* 提交的图片表单名称 */
|
||||||
|
"imageMaxSize": 2048000, /* 上传大小限制,单位B */
|
||||||
|
"imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 上传图片格式显示 */
|
||||||
|
"imageCompressEnable": true, /* 是否压缩图片,默认是true */
|
||||||
|
"imageCompressBorder": 1600, /* 图片压缩最长边限制 */
|
||||||
|
"imageInsertAlign": "none", /* 插入的图片浮动方式 */
|
||||||
|
"imageUrlPrefix": "", /* 图片访问路径前缀 */
|
||||||
|
"imagePathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||||
|
/* {filename} 会替换成原文件名,配置这项需要注意中文乱码问题 */
|
||||||
|
/* {rand:6} 会替换成随机数,后面的数字是随机数的位数 */
|
||||||
|
/* {time} 会替换成时间戳 */
|
||||||
|
/* {yyyy} 会替换成四位年份 */
|
||||||
|
/* {yy} 会替换成两位年份 */
|
||||||
|
/* {mm} 会替换成两位月份 */
|
||||||
|
/* {dd} 会替换成两位日期 */
|
||||||
|
/* {hh} 会替换成两位小时 */
|
||||||
|
/* {ii} 会替换成两位分钟 */
|
||||||
|
/* {ss} 会替换成两位秒 */
|
||||||
|
/* 非法字符 \ : * ? " < > | */
|
||||||
|
/* 具请体看线上文档: fex.baidu.com/ueditor/#use-format_upload_filename */
|
||||||
|
|
||||||
|
/* 涂鸦图片上传配置项 */
|
||||||
|
"scrawlActionName": "uploadscrawl", /* 执行上传涂鸦的action名称 */
|
||||||
|
"scrawlFieldName": "upfile", /* 提交的图片表单名称 */
|
||||||
|
"scrawlPathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||||
|
"scrawlMaxSize": 2048000, /* 上传大小限制,单位B */
|
||||||
|
"scrawlUrlPrefix": "", /* 图片访问路径前缀 */
|
||||||
|
"scrawlInsertAlign": "none",
|
||||||
|
|
||||||
|
/* 截图工具上传 */
|
||||||
|
"snapscreenActionName": "uploadimage", /* 执行上传截图的action名称 */
|
||||||
|
"snapscreenPathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||||
|
"snapscreenUrlPrefix": "", /* 图片访问路径前缀 */
|
||||||
|
"snapscreenInsertAlign": "none", /* 插入的图片浮动方式 */
|
||||||
|
|
||||||
|
/* 抓取远程图片配置 */
|
||||||
|
"catcherLocalDomain": ["127.0.0.1", "localhost", "img.baidu.com"],
|
||||||
|
"catcherActionName": "catchimage", /* 执行抓取远程图片的action名称 */
|
||||||
|
"catcherFieldName": "source", /* 提交的图片列表表单名称 */
|
||||||
|
"catcherPathFormat": "/ueditor/php/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||||
|
"catcherUrlPrefix": "", /* 图片访问路径前缀 */
|
||||||
|
"catcherMaxSize": 2048000, /* 上传大小限制,单位B */
|
||||||
|
"catcherAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 抓取图片格式显示 */
|
||||||
|
|
||||||
|
/* 上传视频配置 */
|
||||||
|
"videoActionName": "uploadvideo", /* 执行上传视频的action名称 */
|
||||||
|
"videoFieldName": "upfile", /* 提交的视频表单名称 */
|
||||||
|
"videoPathFormat": "/ueditor/php/upload/video/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||||
|
"videoUrlPrefix": "", /* 视频访问路径前缀 */
|
||||||
|
"videoMaxSize": 102400000, /* 上传大小限制,单位B,默认100MB */
|
||||||
|
"videoAllowFiles": [
|
||||||
|
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
|
||||||
|
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid"], /* 上传视频格式显示 */
|
||||||
|
|
||||||
|
/* 上传文件配置 */
|
||||||
|
"fileActionName": "uploadfile", /* controller里,执行上传视频的action名称 */
|
||||||
|
"fileFieldName": "upfile", /* 提交的文件表单名称 */
|
||||||
|
"filePathFormat": "/ueditor/php/upload/file/{yyyy}{mm}{dd}/{time}{rand:6}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||||
|
"fileUrlPrefix": "", /* 文件访问路径前缀 */
|
||||||
|
"fileMaxSize": 51200000, /* 上传大小限制,单位B,默认50MB */
|
||||||
|
"fileAllowFiles": [
|
||||||
|
".png", ".jpg", ".jpeg", ".gif", ".bmp",
|
||||||
|
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
|
||||||
|
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
|
||||||
|
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
|
||||||
|
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
|
||||||
|
], /* 上传文件格式显示 */
|
||||||
|
|
||||||
|
/* 列出指定目录下的图片 */
|
||||||
|
"imageManagerActionName": "listimage", /* 执行图片管理的action名称 */
|
||||||
|
"imageManagerListPath": "/ueditor/php/upload/image/", /* 指定要列出图片的目录 */
|
||||||
|
"imageManagerListSize": 20, /* 每次列出文件数量 */
|
||||||
|
"imageManagerUrlPrefix": "", /* 图片访问路径前缀 */
|
||||||
|
"imageManagerInsertAlign": "none", /* 插入的图片浮动方式 */
|
||||||
|
"imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 列出的文件类型 */
|
||||||
|
|
||||||
|
/* 列出指定目录下的文件 */
|
||||||
|
"fileManagerActionName": "listfile", /* 执行文件管理的action名称 */
|
||||||
|
"fileManagerListPath": "/ueditor/php/upload/file/", /* 指定要列出文件的目录 */
|
||||||
|
"fileManagerUrlPrefix": "", /* 文件访问路径前缀 */
|
||||||
|
"fileManagerListSize": 20, /* 每次列出文件数量 */
|
||||||
|
"fileManagerAllowFiles": [
|
||||||
|
".png", ".jpg", ".jpeg", ".gif", ".bmp",
|
||||||
|
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
|
||||||
|
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
|
||||||
|
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
|
||||||
|
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
|
||||||
|
] /* 列出的文件类型 */
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
//header('Access-Control-Allow-Origin: http://www.baidu.com'); //设置http://www.baidu.com允许跨域访问
|
||||||
|
//header('Access-Control-Allow-Headers: X-Requested-With,X_Requested_With'); //设置允许的跨域header
|
||||||
|
date_default_timezone_set("Asia/chongqing");
|
||||||
|
error_reporting(E_ERROR);
|
||||||
|
header("Content-Type: text/html; charset=utf-8");
|
||||||
|
|
||||||
|
$CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents("config.json")), true);
|
||||||
|
$action = $_GET['action'];
|
||||||
|
|
||||||
|
switch ($action) {
|
||||||
|
case 'config':
|
||||||
|
$result = json_encode($CONFIG);
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* 上传图片 */
|
||||||
|
case 'uploadimage':
|
||||||
|
/* 上传涂鸦 */
|
||||||
|
case 'uploadscrawl':
|
||||||
|
/* 上传视频 */
|
||||||
|
case 'uploadvideo':
|
||||||
|
/* 上传文件 */
|
||||||
|
case 'uploadfile':
|
||||||
|
$result = include("action_upload.php");
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* 列出图片 */
|
||||||
|
case 'listimage':
|
||||||
|
$result = include("action_list.php");
|
||||||
|
break;
|
||||||
|
/* 列出文件 */
|
||||||
|
case 'listfile':
|
||||||
|
$result = include("action_list.php");
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* 抓取远程文件 */
|
||||||
|
case 'catchimage':
|
||||||
|
$result = include("action_crawler.php");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
$result = json_encode(array(
|
||||||
|
'state'=> '请求地址出错'
|
||||||
|
));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 输出结果 */
|
||||||
|
if (isset($_GET["callback"])) {
|
||||||
|
if (preg_match("/^[\w_]+$/", $_GET["callback"])) {
|
||||||
|
echo htmlspecialchars($_GET["callback"]) . '(' . $result . ')';
|
||||||
|
} else {
|
||||||
|
echo json_encode(array(
|
||||||
|
'state'=> 'callback参数不合法'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo $result;
|
||||||
|
}
|
||||||
@@ -133,7 +133,6 @@ div.edui-box {
|
|||||||
}
|
}
|
||||||
/*UI工具栏、编辑区域、底部*/
|
/*UI工具栏、编辑区域、底部*/
|
||||||
.edui-default .edui-editor {
|
.edui-default .edui-editor {
|
||||||
z-index: 1 !important;
|
|
||||||
border: 1px solid #d4d4d4;
|
border: 1px solid #d4d4d4;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+292
-268
@@ -2,7 +2,7 @@
|
|||||||
* ueditor完整配置项
|
* ueditor完整配置项
|
||||||
* 可以在这里配置整个编辑器的特性
|
* 可以在这里配置整个编辑器的特性
|
||||||
*/
|
*/
|
||||||
/** ************************提示********************************
|
/**************************提示********************************
|
||||||
* 所有被注释的配置项均为UEditor默认值。
|
* 所有被注释的配置项均为UEditor默认值。
|
||||||
* 修改默认配置请首先确保已经完全明确该参数的真实用途。
|
* 修改默认配置请首先确保已经完全明确该参数的真实用途。
|
||||||
* 主要有两种修改方案,一种是取消此处注释,然后修改成对应参数;另一种是在实例化编辑器时传入对应参数。
|
* 主要有两种修改方案,一种是取消此处注释,然后修改成对应参数;另一种是在实例化编辑器时传入对应参数。
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
**************************提示********************************/
|
**************************提示********************************/
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑器资源文件根路径。它所表示的含义是:以编辑器实例化页面为当前路径,指向编辑器资源文件(即dialog等文件夹)的路径。
|
* 编辑器资源文件根路径。它所表示的含义是:以编辑器实例化页面为当前路径,指向编辑器资源文件(即dialog等文件夹)的路径。
|
||||||
* 鉴于很多同学在使用编辑器的时候出现的种种路径问题,此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置。
|
* 鉴于很多同学在使用编辑器的时候出现的种种路径问题,此处强烈建议大家使用"相对于网站根目录的相对路径"进行配置。
|
||||||
@@ -25,89 +26,94 @@
|
|||||||
*/
|
*/
|
||||||
window.UEDITOR_CONFIG = {
|
window.UEDITOR_CONFIG = {
|
||||||
|
|
||||||
// 为编辑器实例添加一个路径,这个不能被注释
|
//为编辑器实例添加一个路径,这个不能被注释
|
||||||
UEDITOR_HOME_URL: URL,
|
UEDITOR_HOME_URL: URL
|
||||||
|
|
||||||
// 服务器统一请求接口路径
|
// 服务器统一请求接口路径
|
||||||
serverUrl: URL + 'php/controller.php',
|
, serverUrl: URL + "php/controller.php"
|
||||||
|
|
||||||
// 工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义
|
//工具栏上的所有的功能按钮和下拉框,可以在new编辑器的实例时选择自己需要的重新定义
|
||||||
toolbars: [[
|
, toolbars: [[
|
||||||
'source', '|', 'undo', 'redo', '|',
|
'fullscreen', 'source', '|', 'undo', 'redo', '|',
|
||||||
'bold', 'italic', 'underline', 'strikethrough', '|', 'superscript', 'subscript', '|', 'forecolor', 'backcolor', '|',
|
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
|
||||||
'removeformat', '|', 'insertorderedlist', 'insertunorderedlist', '|', 'selectall', 'cleardoc', 'paragraph', '|',
|
'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
|
||||||
'fontfamily', 'fontsize', '|', 'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
|
'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
|
||||||
'link', 'unlink', '|', 'emotion', '|',
|
'directionalityltr', 'directionalityrtl', 'indent', '|',
|
||||||
'|', 'horizontal', 'print', 'preview', 'fullscreen', 'drafts', 'formula'
|
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
|
||||||
]],
|
'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
|
||||||
// 当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准
|
'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe', 'insertcode', 'webapp', 'pagebreak', 'template', 'background', '|',
|
||||||
//, labelMap:{
|
'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
|
||||||
|
'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
|
||||||
|
'print', 'preview', 'searchreplace', 'drafts', 'help'
|
||||||
|
]]
|
||||||
|
//当鼠标放在工具栏上时显示的tooltip提示,留空支持自动多语言配置,否则以配置值为准
|
||||||
|
//,labelMap:{
|
||||||
// 'anchor':'', 'undo':''
|
// 'anchor':'', 'undo':''
|
||||||
// }
|
//}
|
||||||
|
|
||||||
// 语言配置项,默认是zh-cn。有需要的话也可以使用如下这样的方式来自动多语言切换,当然,前提条件是lang文件夹下存在对应的语言文件:
|
//语言配置项,默认是zh-cn。有需要的话也可以使用如下这样的方式来自动多语言切换,当然,前提条件是lang文件夹下存在对应的语言文件:
|
||||||
// lang值也可以通过自动获取 (navigator.language||navigator.browserLanguage ||navigator.userLanguage).toLowerCase()
|
//lang值也可以通过自动获取 (navigator.language||navigator.browserLanguage ||navigator.userLanguage).toLowerCase()
|
||||||
//, lang:"zh-cn"
|
//,lang:"zh-cn"
|
||||||
//, langPath:URL +"lang/"
|
//,langPath:URL +"lang/"
|
||||||
|
|
||||||
// 主题配置项,默认是default。有需要的话也可以使用如下这样的方式来自动多主题切换,当然,前提条件是themes文件夹下存在对应的主题文件:
|
//主题配置项,默认是default。有需要的话也可以使用如下这样的方式来自动多主题切换,当然,前提条件是themes文件夹下存在对应的主题文件:
|
||||||
// 现有如下皮肤:default
|
//现有如下皮肤:default
|
||||||
//, theme:'default'
|
//,theme:'default'
|
||||||
//, themePath:URL +"themes/"
|
//,themePath:URL +"themes/"
|
||||||
|
|
||||||
//, zIndex : 900 //编辑器层级的基数,默认是900
|
//,zIndex : 900 //编辑器层级的基数,默认是900
|
||||||
|
|
||||||
// 针对getAllHtml方法,会在对应的head标签中增加该编码设置。
|
//针对getAllHtml方法,会在对应的head标签中增加该编码设置。
|
||||||
//, charset:"utf-8"
|
//,charset:"utf-8"
|
||||||
|
|
||||||
// 若实例化编辑器的页面手动修改的domain,此处需要设置为true
|
//若实例化编辑器的页面手动修改的domain,此处需要设置为true
|
||||||
//, customDomain:false
|
//,customDomain:false
|
||||||
|
|
||||||
// 常用配置项目
|
//常用配置项目
|
||||||
//, isShow : true //默认显示编辑器
|
//,isShow : true //默认显示编辑器
|
||||||
|
|
||||||
//, textarea:'editorValue' // 提交表单时,服务器获取编辑器提交内容的所用的参数,多实例时可以给容器name属性,会将name给定的值最为每个实例的键值,不用每次实例化的时候都设置这个值
|
//,textarea:'editorValue' // 提交表单时,服务器获取编辑器提交内容的所用的参数,多实例时可以给容器name属性,会将name给定的值最为每个实例的键值,不用每次实例化的时候都设置这个值
|
||||||
|
|
||||||
//, initialContent:'欢迎使用ueditor!' //初始化编辑器的内容,也可以通过textarea/script给值,看官网例子
|
//,initialContent:'欢迎使用ueditor!' //初始化编辑器的内容,也可以通过textarea/script给值,看官网例子
|
||||||
|
|
||||||
//, autoClearinitialContent:true //是否自动清除编辑器初始内容,注意:如果focus属性设置为true,这个也为真,那么编辑器一上来就会触发导致初始化的内容看不到了
|
//,autoClearinitialContent:true //是否自动清除编辑器初始内容,注意:如果focus属性设置为true,这个也为真,那么编辑器一上来就会触发导致初始化的内容看不到了
|
||||||
|
|
||||||
//, focus:false //初始化时,是否让编辑器获得焦点true或false
|
//,focus:false //初始化时,是否让编辑器获得焦点true或false
|
||||||
|
|
||||||
// 如果自定义,最好给p标签如下的行高,要不输入中文时,会有跳动感
|
//如果自定义,最好给p标签如下的行高,要不输入中文时,会有跳动感
|
||||||
//, initialStyle:'p{line-height:1em}'//编辑器层级的基数,可以用来改变字体等
|
//,initialStyle:'p{line-height:1em}'//编辑器层级的基数,可以用来改变字体等
|
||||||
|
|
||||||
//, iframeCssUrl: URL + '/themes/iframe.css' //给编辑区域的iframe引入一个css文件
|
//,iframeCssUrl: URL + '/themes/iframe.css' //给编辑区域的iframe引入一个css文件
|
||||||
|
|
||||||
// indentValue
|
//indentValue
|
||||||
// 首行缩进距离,默认是2em
|
//首行缩进距离,默认是2em
|
||||||
//, indentValue:'2em'
|
//,indentValue:'2em'
|
||||||
|
|
||||||
//, initialFrameWidth:1000 //初始化编辑器宽度,默认1000
|
//,initialFrameWidth:1000 //初始化编辑器宽度,默认1000
|
||||||
//, initialFrameHeight:320 //初始化编辑器高度,默认320
|
//,initialFrameHeight:320 //初始化编辑器高度,默认320
|
||||||
|
|
||||||
//, readonly : false //编辑器初始化结束后,编辑区域是否是只读的,默认是false
|
//,readonly : false //编辑器初始化结束后,编辑区域是否是只读的,默认是false
|
||||||
|
|
||||||
//, autoClearEmptyNode : true //getContent时,是否删除空的inlineElement节点(包括嵌套的情况)
|
//,autoClearEmptyNode : true //getContent时,是否删除空的inlineElement节点(包括嵌套的情况)
|
||||||
|
|
||||||
// 启用自动保存
|
//启用自动保存
|
||||||
//, enableAutoSave: true
|
//,enableAutoSave: true
|
||||||
// 自动保存间隔时间, 单位ms
|
//自动保存间隔时间, 单位ms
|
||||||
//, saveInterval: 500
|
//,saveInterval: 500
|
||||||
|
|
||||||
//, fullscreen : false //是否开启初始化时即全屏,默认关闭
|
//,fullscreen : false //是否开启初始化时即全屏,默认关闭
|
||||||
|
|
||||||
//, imagePopup:true //图片操作的浮层开关,默认打开
|
//,imagePopup:true //图片操作的浮层开关,默认打开
|
||||||
|
|
||||||
//, autoSyncData:true //自动同步编辑器要提交的数据
|
//,autoSyncData:true //自动同步编辑器要提交的数据
|
||||||
//, emotionLocalization:false //是否开启表情本地化,默认关闭。若要开启请确保emotion文件夹下包含官网提供的images表情文件夹
|
//,emotionLocalization:false //是否开启表情本地化,默认关闭。若要开启请确保emotion文件夹下包含官网提供的images表情文件夹
|
||||||
|
|
||||||
// 粘贴只保留标签,去除标签所有属性
|
//粘贴只保留标签,去除标签所有属性
|
||||||
//, retainOnlyLabelPasted: false
|
//,retainOnlyLabelPasted: false
|
||||||
|
|
||||||
//, pasteplain:false //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
|
//,pasteplain:false //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
|
||||||
// 纯文本粘贴模式下的过滤规则
|
//纯文本粘贴模式下的过滤规则
|
||||||
// 'filterTxtRules' : function(){
|
//'filterTxtRules' : function(){
|
||||||
// function transP(node){
|
// function transP(node){
|
||||||
// node.tagName = 'p';
|
// node.tagName = 'p';
|
||||||
// node.setStyle();
|
// node.setStyle();
|
||||||
@@ -132,13 +138,13 @@
|
|||||||
// node.parentNode.removeChild(node,node.innerText())
|
// node.parentNode.removeChild(node,node.innerText())
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// }()
|
//}()
|
||||||
|
|
||||||
//, allHtmlEnabled:false //提交到后台的数据是否包含整个html字符串
|
//,allHtmlEnabled:false //提交到后台的数据是否包含整个html字符串
|
||||||
|
|
||||||
// insertorderedlist
|
//insertorderedlist
|
||||||
// 有序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
|
//有序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
|
||||||
//, 'insertorderedlist':{
|
//,'insertorderedlist':{
|
||||||
// //自定的样式
|
// //自定的样式
|
||||||
// 'num':'1,2,3...',
|
// 'num':'1,2,3...',
|
||||||
// 'num1':'1),2),3)...',
|
// 'num1':'1),2),3)...',
|
||||||
@@ -152,26 +158,26 @@
|
|||||||
// 'lower-roman' : '' , //'i,ii,iii...'
|
// 'lower-roman' : '' , //'i,ii,iii...'
|
||||||
// 'upper-alpha' : '' , lang //'A,B,C'
|
// 'upper-alpha' : '' , lang //'A,B,C'
|
||||||
// 'upper-roman' : '' //'I,II,III...'
|
// 'upper-roman' : '' //'I,II,III...'
|
||||||
// }
|
//}
|
||||||
|
|
||||||
// insertunorderedlist
|
//insertunorderedlist
|
||||||
// 无序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
|
//无序列表的下拉配置,值留空时支持多语言自动识别,若配置值,则以此值为准
|
||||||
//, insertunorderedlist : { //自定的样式
|
//,insertunorderedlist : { //自定的样式
|
||||||
// 'dash' :'— 破折号', //-破折号
|
// 'dash' :'— 破折号', //-破折号
|
||||||
// 'dot':' 。 小圆圈', //系统自带
|
// 'dot':' 。 小圆圈', //系统自带
|
||||||
// 'circle' : '', // '○ 小圆圈'
|
// 'circle' : '', // '○ 小圆圈'
|
||||||
// 'disc' : '', // '● 小圆点'
|
// 'disc' : '', // '● 小圆点'
|
||||||
// 'square' : '' //'■ 小方块'
|
// 'square' : '' //'■ 小方块'
|
||||||
// }
|
//}
|
||||||
//, listDefaultPaddingLeft : '30'//默认的左边缩进的基数倍
|
//,listDefaultPaddingLeft : '30'//默认的左边缩进的基数倍
|
||||||
//, listiconpath : 'http://bs.baidu.com/listicon/'//自定义标号的路径
|
//,listiconpath : 'http://bs.baidu.com/listicon/'//自定义标号的路径
|
||||||
//, maxListLevel : 3 //限制可以tab的级数, 设置-1为不限制
|
//,maxListLevel : 3 //限制可以tab的级数, 设置-1为不限制
|
||||||
|
|
||||||
//, autoTransWordToList:false //禁止word中粘贴进来的列表自动变成列表标签
|
//,autoTransWordToList:false //禁止word中粘贴进来的列表自动变成列表标签
|
||||||
|
|
||||||
// fontfamily
|
//fontfamily
|
||||||
// 字体设置 label留空支持多语言自动切换,若配置,则以配置值为准
|
//字体设置 label留空支持多语言自动切换,若配置,则以配置值为准
|
||||||
//, 'fontfamily':[
|
//,'fontfamily':[
|
||||||
// { label:'',name:'songti',val:'宋体,SimSun'},
|
// { label:'',name:'songti',val:'宋体,SimSun'},
|
||||||
// { label:'',name:'kaiti',val:'楷体,楷体_GB2312, SimKai'},
|
// { label:'',name:'kaiti',val:'楷体,楷体_GB2312, SimKai'},
|
||||||
// { label:'',name:'yahei',val:'微软雅黑,Microsoft YaHei'},
|
// { label:'',name:'yahei',val:'微软雅黑,Microsoft YaHei'},
|
||||||
@@ -183,48 +189,48 @@
|
|||||||
// { label:'',name:'comicSansMs',val:'comic sans ms'},
|
// { label:'',name:'comicSansMs',val:'comic sans ms'},
|
||||||
// { label:'',name:'impact',val:'impact,chicago'},
|
// { label:'',name:'impact',val:'impact,chicago'},
|
||||||
// { label:'',name:'timesNewRoman',val:'times new roman'}
|
// { label:'',name:'timesNewRoman',val:'times new roman'}
|
||||||
// ]
|
//]
|
||||||
|
|
||||||
// fontsize
|
//fontsize
|
||||||
// 字号
|
//字号
|
||||||
//, 'fontsize':[10, 11, 12, 14, 16, 18, 20, 24, 36]
|
//,'fontsize':[10, 11, 12, 14, 16, 18, 20, 24, 36]
|
||||||
|
|
||||||
// paragraph
|
//paragraph
|
||||||
// 段落格式 值留空时支持多语言自动识别,若配置,则以配置值为准
|
//段落格式 值留空时支持多语言自动识别,若配置,则以配置值为准
|
||||||
//, 'paragraph':{'p':'', 'h1':'', 'h2':'', 'h3':'', 'h4':'', 'h5':'', 'h6':''}
|
//,'paragraph':{'p':'', 'h1':'', 'h2':'', 'h3':'', 'h4':'', 'h5':'', 'h6':''}
|
||||||
|
|
||||||
// rowspacingtop
|
//rowspacingtop
|
||||||
// 段间距 值和显示的名字相同
|
//段间距 值和显示的名字相同
|
||||||
//, 'rowspacingtop':['5', '10', '15', '20', '25']
|
//,'rowspacingtop':['5', '10', '15', '20', '25']
|
||||||
|
|
||||||
// rowspacingBottom
|
//rowspacingBottom
|
||||||
// 段间距 值和显示的名字相同
|
//段间距 值和显示的名字相同
|
||||||
//, 'rowspacingbottom':['5', '10', '15', '20', '25']
|
//,'rowspacingbottom':['5', '10', '15', '20', '25']
|
||||||
|
|
||||||
// lineheight
|
//lineheight
|
||||||
// 行内间距 值和显示的名字相同
|
//行内间距 值和显示的名字相同
|
||||||
//, 'lineheight':['1', '1.5','1.75','2', '3', '4', '5']
|
//,'lineheight':['1', '1.5','1.75','2', '3', '4', '5']
|
||||||
|
|
||||||
// customstyle
|
//customstyle
|
||||||
// 自定义样式,不支持国际化,此处配置值即可最后显示值
|
//自定义样式,不支持国际化,此处配置值即可最后显示值
|
||||||
// block的元素是依据设置段落的逻辑设置的,inline的元素依据BIU的逻辑设置
|
//block的元素是依据设置段落的逻辑设置的,inline的元素依据BIU的逻辑设置
|
||||||
// 尽量使用一些常用的标签
|
//尽量使用一些常用的标签
|
||||||
// 参数说明
|
//参数说明
|
||||||
// tag 使用的标签名字
|
//tag 使用的标签名字
|
||||||
// label 显示的名字也是用来标识不同类型的标识符,注意这个值每个要不同,
|
//label 显示的名字也是用来标识不同类型的标识符,注意这个值每个要不同,
|
||||||
// style 添加的样式
|
//style 添加的样式
|
||||||
// 每一个对象就是一个自定义的样式
|
//每一个对象就是一个自定义的样式
|
||||||
//, 'customstyle':[
|
//,'customstyle':[
|
||||||
// {tag:'h1', name:'tc', label:'', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:center;margin:0 0 20px 0;'},
|
// {tag:'h1', name:'tc', label:'', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;text-align:center;margin:0 0 20px 0;'},
|
||||||
// {tag:'h1', name:'tl',label:'', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;margin:0 0 10px 0;'},
|
// {tag:'h1', name:'tl',label:'', style:'border-bottom:#ccc 2px solid;padding:0 4px 0 0;margin:0 0 10px 0;'},
|
||||||
// {tag:'span',name:'im', label:'', style:'font-style:italic;font-weight:bold'},
|
// {tag:'span',name:'im', label:'', style:'font-style:italic;font-weight:bold'},
|
||||||
// {tag:'span',name:'hi', label:'', style:'font-style:italic;font-weight:bold;color:rgb(51, 153, 204)'}
|
// {tag:'span',name:'hi', label:'', style:'font-style:italic;font-weight:bold;color:rgb(51, 153, 204)'}
|
||||||
// ]
|
//]
|
||||||
|
|
||||||
// 打开右键菜单功能
|
//打开右键菜单功能
|
||||||
//, enableContextMenu: true
|
//,enableContextMenu: true
|
||||||
// 右键菜单的内容,可以参考plugins/contextmenu.js里边的默认菜单的例子,label留空支持国际化,否则以此配置为准
|
//右键菜单的内容,可以参考plugins/contextmenu.js里边的默认菜单的例子,label留空支持国际化,否则以此配置为准
|
||||||
//, contextMenu:[
|
//,contextMenu:[
|
||||||
// {
|
// {
|
||||||
// label:'', //显示的名称
|
// label:'', //显示的名称
|
||||||
// cmdName:'selectall',//执行的command命令,当点击这个右键菜单时
|
// cmdName:'selectall',//执行的command命令,当点击这个右键菜单时
|
||||||
@@ -234,69 +240,69 @@
|
|||||||
// //this.ui._dialogs['inserttableDialog'].open();
|
// //this.ui._dialogs['inserttableDialog'].open();
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
// ]
|
//]
|
||||||
|
|
||||||
// 快捷菜单
|
//快捷菜单
|
||||||
//, shortcutMenu:["fontfamily", "fontsize", "bold", "italic", "underline", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist"]
|
//,shortcutMenu:["fontfamily", "fontsize", "bold", "italic", "underline", "forecolor", "backcolor", "insertorderedlist", "insertunorderedlist"]
|
||||||
|
|
||||||
// elementPathEnabled
|
//elementPathEnabled
|
||||||
// 是否启用元素路径,默认是显示
|
//是否启用元素路径,默认是显示
|
||||||
//, elementPathEnabled : true
|
//,elementPathEnabled : true
|
||||||
|
|
||||||
// wordCount
|
//wordCount
|
||||||
//, wordCount:true //是否开启字数统计
|
//,wordCount:true //是否开启字数统计
|
||||||
//, maximumWords:10000 //允许的最大字符数
|
//,maximumWords:10000 //允许的最大字符数
|
||||||
// 字数统计提示,{#count}代表当前字数,{#leave}代表还可以输入多少字符数,留空支持多语言自动切换,否则按此配置显示
|
//字数统计提示,{#count}代表当前字数,{#leave}代表还可以输入多少字符数,留空支持多语言自动切换,否则按此配置显示
|
||||||
//, wordCountMsg:'' //当前已输入 {#count} 个字符,您还可以输入{#leave} 个字符
|
//,wordCountMsg:'' //当前已输入 {#count} 个字符,您还可以输入{#leave} 个字符
|
||||||
// 超出字数限制提示 留空支持多语言自动切换,否则按此配置显示
|
//超出字数限制提示 留空支持多语言自动切换,否则按此配置显示
|
||||||
//, wordOverFlowMsg:'' //<span style="color:red;">你输入的字符个数已经超出最大允许值,服务器可能会拒绝保存!</span>
|
//,wordOverFlowMsg:'' //<span style="color:red;">你输入的字符个数已经超出最大允许值,服务器可能会拒绝保存!</span>
|
||||||
|
|
||||||
// tab
|
//tab
|
||||||
// 点击tab键时移动的距离,tabSize倍数,tabNode什么字符做为单位
|
//点击tab键时移动的距离,tabSize倍数,tabNode什么字符做为单位
|
||||||
//, tabSize:4
|
//,tabSize:4
|
||||||
//, tabNode:' '
|
//,tabNode:' '
|
||||||
|
|
||||||
// removeFormat
|
//removeFormat
|
||||||
// 清除格式时可以删除的标签和属性
|
//清除格式时可以删除的标签和属性
|
||||||
// removeForamtTags标签
|
//removeForamtTags标签
|
||||||
//, removeFormatTags:'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var'
|
//,removeFormatTags:'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var'
|
||||||
// removeFormatAttributes属性
|
//removeFormatAttributes属性
|
||||||
//, removeFormatAttributes:'class,style,lang,width,height,align,hspace,valign'
|
//,removeFormatAttributes:'class,style,lang,width,height,align,hspace,valign'
|
||||||
|
|
||||||
// undo
|
//undo
|
||||||
// 可以最多回退的次数,默认20
|
//可以最多回退的次数,默认20
|
||||||
//, maxUndoCount:20
|
//,maxUndoCount:20
|
||||||
// 当输入的字符数超过该值时,保存一次现场
|
//当输入的字符数超过该值时,保存一次现场
|
||||||
//, maxInputCount:1
|
//,maxInputCount:1
|
||||||
|
|
||||||
// autoHeightEnabled
|
//autoHeightEnabled
|
||||||
// 是否自动长高,默认true
|
// 是否自动长高,默认true
|
||||||
//, autoHeightEnabled:true
|
//,autoHeightEnabled:true
|
||||||
|
|
||||||
// scaleEnabled
|
//scaleEnabled
|
||||||
// 是否可以拉伸长高,默认true(当开启时,自动长高失效)
|
//是否可以拉伸长高,默认true(当开启时,自动长高失效)
|
||||||
//, scaleEnabled:false
|
//,scaleEnabled:false
|
||||||
//, minFrameWidth:800 //编辑器拖动时最小宽度,默认800
|
//,minFrameWidth:800 //编辑器拖动时最小宽度,默认800
|
||||||
//, minFrameHeight:220 //编辑器拖动时最小高度,默认220
|
//,minFrameHeight:220 //编辑器拖动时最小高度,默认220
|
||||||
|
|
||||||
// autoFloatEnabled
|
//autoFloatEnabled
|
||||||
// 是否保持toolbar的位置不动,默认true
|
//是否保持toolbar的位置不动,默认true
|
||||||
//, autoFloatEnabled:true
|
//,autoFloatEnabled:true
|
||||||
// 浮动时工具栏距离浏览器顶部的高度,用于某些具有固定头部的页面
|
//浮动时工具栏距离浏览器顶部的高度,用于某些具有固定头部的页面
|
||||||
//, topOffset:30
|
//,topOffset:30
|
||||||
// 编辑器底部距离工具栏高度(如果参数大于等于编辑器高度,则设置无效)
|
//编辑器底部距离工具栏高度(如果参数大于等于编辑器高度,则设置无效)
|
||||||
//, toolbarTopOffset:400
|
//,toolbarTopOffset:400
|
||||||
|
|
||||||
// 设置远程图片是否抓取到本地保存
|
//设置远程图片是否抓取到本地保存
|
||||||
//, catchRemoteImageEnable: true //设置是否抓取远程图片
|
//,catchRemoteImageEnable: true //设置是否抓取远程图片
|
||||||
|
|
||||||
// pageBreakTag
|
//pageBreakTag
|
||||||
// 分页标识符,默认是_ueditor_page_break_tag_
|
//分页标识符,默认是_ueditor_page_break_tag_
|
||||||
//, pageBreakTag:'_ueditor_page_break_tag_'
|
//,pageBreakTag:'_ueditor_page_break_tag_'
|
||||||
|
|
||||||
// autotypeset
|
//autotypeset
|
||||||
// 自动排版参数
|
//自动排版参数
|
||||||
//, autotypeset: {
|
//,autotypeset: {
|
||||||
// mergeEmptyline: true, //合并空行
|
// mergeEmptyline: true, //合并空行
|
||||||
// removeClass: true, //去掉冗余的class
|
// removeClass: true, //去掉冗余的class
|
||||||
// removeEmptyline: false, //去掉空行
|
// removeEmptyline: false, //去掉空行
|
||||||
@@ -312,162 +318,180 @@
|
|||||||
// indentValue : '2em', //行首缩进的大小
|
// indentValue : '2em', //行首缩进的大小
|
||||||
// bdc2sb: false,
|
// bdc2sb: false,
|
||||||
// tobdc: false
|
// tobdc: false
|
||||||
// }
|
//}
|
||||||
|
|
||||||
// tableDragable
|
//tableDragable
|
||||||
// 表格是否可以拖拽
|
//表格是否可以拖拽
|
||||||
//, tableDragable: true
|
//,tableDragable: true
|
||||||
|
|
||||||
// sourceEditor
|
|
||||||
// 源码的查看方式,codemirror 是代码高亮,textarea是文本框,默认是codemirror
|
|
||||||
// 注意默认codemirror只能在ie8+和非ie中使用
|
|
||||||
//, sourceEditor:"codemirror"
|
|
||||||
// 如果sourceEditor是codemirror,还用配置一下两个参数
|
|
||||||
// codeMirrorJsUrl js加载的路径,默认是 URL + "third-party/codemirror/codemirror.js"
|
|
||||||
//, codeMirrorJsUrl:URL + "third-party/codemirror/codemirror.js"
|
|
||||||
// codeMirrorCssUrl css加载的路径,默认是 URL + "third-party/codemirror/codemirror.css"
|
|
||||||
//, codeMirrorCssUrl:URL + "third-party/codemirror/codemirror.css"
|
|
||||||
// 编辑器初始化完成后是否进入源码模式,默认为否。
|
|
||||||
//, sourceEditorFirst:false
|
|
||||||
|
|
||||||
// iframeUrlMap
|
|
||||||
// dialog内容的路径 ~会被替换成URL,垓属性一旦打开,将覆盖所有的dialog的默认路径
|
//sourceEditor
|
||||||
//, iframeUrlMap:{
|
//源码的查看方式,codemirror 是代码高亮,textarea是文本框,默认是codemirror
|
||||||
|
//注意默认codemirror只能在ie8+和非ie中使用
|
||||||
|
//,sourceEditor:"codemirror"
|
||||||
|
//如果sourceEditor是codemirror,还用配置一下两个参数
|
||||||
|
//codeMirrorJsUrl js加载的路径,默认是 URL + "third-party/codemirror/codemirror.js"
|
||||||
|
//,codeMirrorJsUrl:URL + "third-party/codemirror/codemirror.js"
|
||||||
|
//codeMirrorCssUrl css加载的路径,默认是 URL + "third-party/codemirror/codemirror.css"
|
||||||
|
//,codeMirrorCssUrl:URL + "third-party/codemirror/codemirror.css"
|
||||||
|
//编辑器初始化完成后是否进入源码模式,默认为否。
|
||||||
|
//,sourceEditorFirst:false
|
||||||
|
|
||||||
|
//iframeUrlMap
|
||||||
|
//dialog内容的路径 ~会被替换成URL,垓属性一旦打开,将覆盖所有的dialog的默认路径
|
||||||
|
//,iframeUrlMap:{
|
||||||
// 'anchor':'~/dialogs/anchor/anchor.html',
|
// 'anchor':'~/dialogs/anchor/anchor.html',
|
||||||
// }
|
//}
|
||||||
|
|
||||||
// allowLinkProtocol 允许的链接地址,有这些前缀的链接地址不会自动添加http
|
//allowLinkProtocol 允许的链接地址,有这些前缀的链接地址不会自动添加http
|
||||||
//, allowLinkProtocols: ['http:', 'https:', '#', '/', 'ftp:', 'mailto:', 'tel:', 'git:', 'svn:']
|
//, allowLinkProtocols: ['http:', 'https:', '#', '/', 'ftp:', 'mailto:', 'tel:', 'git:', 'svn:']
|
||||||
|
|
||||||
// webAppKey 百度应用的APIkey,每个站长必须首先去百度官网注册一个key后方能正常使用app功能,注册介绍,http://app.baidu.com/static/cms/getapikey.html
|
//webAppKey 百度应用的APIkey,每个站长必须首先去百度官网注册一个key后方能正常使用app功能,注册介绍,http://app.baidu.com/static/cms/getapikey.html
|
||||||
//, webAppKey: ""
|
//, webAppKey: ""
|
||||||
|
|
||||||
// 默认过滤规则相关配置项目
|
//默认过滤规则相关配置项目
|
||||||
//, disabledTableInTable:true //禁止表格嵌套
|
//,disabledTableInTable:true //禁止表格嵌套
|
||||||
//, allowDivTransToP:true //允许进入编辑器的div标签自动变成p标签
|
//,allowDivTransToP:true //允许进入编辑器的div标签自动变成p标签
|
||||||
//, rgb2Hex:true //默认产出的数据中的color自动从rgb格式变成16进制格式
|
//,rgb2Hex:true //默认产出的数据中的color自动从rgb格式变成16进制格式
|
||||||
|
|
||||||
// xss 过滤是否开启,inserthtml等操作
|
// xss 过滤是否开启,inserthtml等操作
|
||||||
xssFilterRules: true,
|
,xssFilterRules: true
|
||||||
// input xss过滤
|
//input xss过滤
|
||||||
inputXssFilter: true,
|
,inputXssFilter: true
|
||||||
// output xss过滤
|
//output xss过滤
|
||||||
outputXssFilter: true,
|
,outputXssFilter: true
|
||||||
// xss过滤白名单 名单来源: https://raw.githubusercontent.com/leizongmin/js-xss/master/lib/default.js
|
// xss过滤白名单 名单来源: https://raw.githubusercontent.com/leizongmin/js-xss/master/lib/default.js
|
||||||
whiteList: {
|
,whiteList: {
|
||||||
a: ['target', 'href', 'title', 'class', 'style'],
|
a: ['target', 'href', 'title', 'class', 'style'],
|
||||||
abbr: ['title', 'class', 'style'],
|
abbr: ['title', 'class', 'style'],
|
||||||
address: ['class', 'style'],
|
address: ['class', 'style'],
|
||||||
area: ['shape', 'coords', 'href', 'alt'],
|
area: ['shape', 'coords', 'href', 'alt'],
|
||||||
article: [],
|
article: [],
|
||||||
aside: [],
|
aside: [],
|
||||||
audio: ['autoplay', 'controls', 'loop', 'preload', 'src', 'class', 'style'],
|
audio: ['autoplay', 'controls', 'loop', 'preload', 'src', 'class', 'style'],
|
||||||
b: ['class', 'style'],
|
b: ['class', 'style'],
|
||||||
bdi: ['dir'],
|
bdi: ['dir'],
|
||||||
bdo: ['dir'],
|
bdo: ['dir'],
|
||||||
big: [],
|
big: [],
|
||||||
blockquote: ['cite', 'class', 'style'],
|
blockquote: ['cite', 'class', 'style'],
|
||||||
br: [],
|
br: [],
|
||||||
caption: ['class', 'style'],
|
caption: ['class', 'style'],
|
||||||
center: [],
|
center: [],
|
||||||
cite: [],
|
cite: [],
|
||||||
code: ['class', 'style'],
|
code: ['class', 'style'],
|
||||||
col: ['align', 'valign', 'span', 'width', 'class', 'style'],
|
col: ['align', 'valign', 'span', 'width', 'class', 'style'],
|
||||||
colgroup: ['align', 'valign', 'span', 'width', 'class', 'style'],
|
colgroup: ['align', 'valign', 'span', 'width', 'class', 'style'],
|
||||||
dd: ['class', 'style'],
|
dd: ['class', 'style'],
|
||||||
del: ['datetime'],
|
del: ['datetime'],
|
||||||
details: ['open'],
|
details: ['open'],
|
||||||
div: ['class', 'style'],
|
div: ['class', 'style'],
|
||||||
dl: ['class', 'style'],
|
dl: ['class', 'style'],
|
||||||
dt: ['class', 'style'],
|
dt: ['class', 'style'],
|
||||||
em: ['class', 'style'],
|
em: ['class', 'style'],
|
||||||
font: ['color', 'size', 'face'],
|
font: ['color', 'size', 'face'],
|
||||||
footer: [],
|
footer: [],
|
||||||
h1: ['class', 'style'],
|
h1: ['class', 'style'],
|
||||||
h2: ['class', 'style'],
|
h2: ['class', 'style'],
|
||||||
h3: ['class', 'style'],
|
h3: ['class', 'style'],
|
||||||
h4: ['class', 'style'],
|
h4: ['class', 'style'],
|
||||||
h5: ['class', 'style'],
|
h5: ['class', 'style'],
|
||||||
h6: ['class', 'style'],
|
h6: ['class', 'style'],
|
||||||
header: [],
|
header: [],
|
||||||
hr: [],
|
hr: [],
|
||||||
i: ['class', 'style'],
|
i: ['class', 'style'],
|
||||||
img: ['src', 'alt', 'title', 'width', 'height', 'id', '_src', 'loadingclass', 'class', 'data-latex'],
|
img: ['src', 'alt', 'title', 'width', 'height', 'id', '_src', 'loadingclass', 'class', 'data-latex'],
|
||||||
ins: ['datetime'],
|
ins: ['datetime'],
|
||||||
li: ['class', 'style'],
|
li: ['class', 'style'],
|
||||||
mark: [],
|
mark: [],
|
||||||
nav: [],
|
nav: [],
|
||||||
ol: ['class', 'style'],
|
ol: ['class', 'style'],
|
||||||
p: ['class', 'style'],
|
p: ['class', 'style'],
|
||||||
pre: ['class', 'style'],
|
pre: ['class', 'style'],
|
||||||
s: [],
|
s: [],
|
||||||
section: [],
|
section:[],
|
||||||
small: [],
|
small: [],
|
||||||
span: ['class', 'style'],
|
span: ['class', 'style'],
|
||||||
sub: ['class', 'style'],
|
sub: ['class', 'style'],
|
||||||
sup: ['class', 'style'],
|
sup: ['class', 'style'],
|
||||||
strong: ['class', 'style'],
|
strong: ['class', 'style'],
|
||||||
table: ['width', 'border', 'align', 'valign', 'class', 'style'],
|
table: ['width', 'border', 'align', 'valign', 'class', 'style'],
|
||||||
tbody: ['align', 'valign', 'class', 'style'],
|
tbody: ['align', 'valign', 'class', 'style'],
|
||||||
td: ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
|
td: ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
|
||||||
tfoot: ['align', 'valign', 'class', 'style'],
|
tfoot: ['align', 'valign', 'class', 'style'],
|
||||||
th: ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
|
th: ['width', 'rowspan', 'colspan', 'align', 'valign', 'class', 'style'],
|
||||||
thead: ['align', 'valign', 'class', 'style'],
|
thead: ['align', 'valign', 'class', 'style'],
|
||||||
tr: ['rowspan', 'align', 'valign', 'class', 'style'],
|
tr: ['rowspan', 'align', 'valign', 'class', 'style'],
|
||||||
tt: [],
|
tt: [],
|
||||||
u: [],
|
u: [],
|
||||||
ul: ['class', 'style'],
|
ul: ['class', 'style'],
|
||||||
video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width', 'class', 'style']
|
video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width', 'class', 'style']
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function getUEBasePath (docUrl, confUrl) {
|
function getUEBasePath(docUrl, confUrl) {
|
||||||
|
|
||||||
return getBasePath(docUrl || self.document.URL || self.location.href, confUrl || getConfigFilePath());
|
return getBasePath(docUrl || self.document.URL || self.location.href, confUrl || getConfigFilePath());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getConfigFilePath () {
|
function getConfigFilePath() {
|
||||||
|
|
||||||
var configPath = document.getElementsByTagName('script');
|
var configPath = document.getElementsByTagName('script');
|
||||||
|
|
||||||
return configPath[ configPath.length - 1 ].src;
|
return configPath[ configPath.length - 1 ].src;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBasePath (docUrl, confUrl) {
|
function getBasePath(docUrl, confUrl) {
|
||||||
|
|
||||||
var basePath = confUrl;
|
var basePath = confUrl;
|
||||||
|
|
||||||
if (/^(\/|\\\\)/.test(confUrl)) {
|
|
||||||
basePath = /^.+?\w(\/|\\\\)/.exec(docUrl)[0] + confUrl.replace(/^(\/|\\\\)/, '');
|
|
||||||
} else if (!/^[a-z]+:/i.test(confUrl)) {
|
|
||||||
docUrl = docUrl.split('#')[0].split('?')[0].replace(/[^\\\/]+$/, '');
|
|
||||||
|
|
||||||
basePath = docUrl + '' + confUrl;
|
if (/^(\/|\\\\)/.test(confUrl)) {
|
||||||
|
|
||||||
|
basePath = /^.+?\w(\/|\\\\)/.exec(docUrl)[0] + confUrl.replace(/^(\/|\\\\)/, '');
|
||||||
|
|
||||||
|
} else if (!/^[a-z]+:/i.test(confUrl)) {
|
||||||
|
|
||||||
|
docUrl = docUrl.split("#")[0].split("?")[0].replace(/[^\\\/]+$/, '');
|
||||||
|
|
||||||
|
basePath = docUrl + "" + confUrl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return optimizationPath(basePath);
|
return optimizationPath(basePath);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function optimizationPath (path) {
|
function optimizationPath(path) {
|
||||||
let protocol = /^[a-z]+:\/\//.exec(path)[ 0 ],
|
|
||||||
|
var protocol = /^[a-z]+:\/\//.exec(path)[ 0 ],
|
||||||
tmp = null,
|
tmp = null,
|
||||||
res = [];
|
res = [];
|
||||||
|
|
||||||
path = path.replace(protocol, '').split('?')[0].split('#')[0];
|
path = path.replace(protocol, "").split("?")[0].split("#")[0];
|
||||||
|
|
||||||
path = path.replace(/\\/g, '/').split(/\//);
|
path = path.replace(/\\/g, '/').split(/\//);
|
||||||
|
|
||||||
path[ path.length - 1 ] = '';
|
path[ path.length - 1 ] = "";
|
||||||
|
|
||||||
while (path.length) {
|
while (path.length) {
|
||||||
if ((tmp = path.shift()) === '..') {
|
|
||||||
|
if (( tmp = path.shift() ) === "..") {
|
||||||
res.pop();
|
res.pop();
|
||||||
} else if (tmp !== '.') {
|
} else if (tmp !== ".") {
|
||||||
res.push(tmp);
|
res.push(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return protocol + res.join('/');
|
return protocol + res.join("/");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.UE = {
|
window.UE = {
|
||||||
getUEBasePath: getUEBasePath
|
getUEBasePath: getUEBasePath
|
||||||
};
|
};
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -708,7 +708,7 @@ export default {
|
|||||||
addCustomDialog() {
|
addCustomDialog() {
|
||||||
window.UE.registerUI('yshop', function (editor, uiName) {
|
window.UE.registerUI('yshop', function (editor, uiName) {
|
||||||
let dialog = new window.UE.ui.Dialog({
|
let dialog = new window.UE.ui.Dialog({
|
||||||
iframeUrl: '/yshop/materia/index',
|
iframeUrl: '#/yshop/materia/index',
|
||||||
editor: editor,
|
editor: editor,
|
||||||
name: uiName,
|
name: uiName,
|
||||||
title: '上传图片',
|
title: '上传图片',
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export default {
|
|||||||
addCustomDialog () {
|
addCustomDialog () {
|
||||||
window.UE.registerUI('yshop', function (editor, uiName) {
|
window.UE.registerUI('yshop', function (editor, uiName) {
|
||||||
let dialog = new window.UE.ui.Dialog({
|
let dialog = new window.UE.ui.Dialog({
|
||||||
iframeUrl: '/yshop/materia/index',
|
iframeUrl: '#/yshop/materia/index',
|
||||||
editor: editor,
|
editor: editor,
|
||||||
name: uiName,
|
name: uiName,
|
||||||
title: '上传图片',
|
title: '上传图片',
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ export default {
|
|||||||
addCustomDialog () {
|
addCustomDialog () {
|
||||||
window.UE.registerUI('yshop', function (editor, uiName) {
|
window.UE.registerUI('yshop', function (editor, uiName) {
|
||||||
let dialog = new window.UE.ui.Dialog({
|
let dialog = new window.UE.ui.Dialog({
|
||||||
iframeUrl: '/yshop/materia/index',
|
iframeUrl: '#/yshop/materia/index',
|
||||||
editor: editor,
|
editor: editor,
|
||||||
name: uiName,
|
name: uiName,
|
||||||
title: '上传图片',
|
title: '上传图片',
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export default {
|
|||||||
addCustomDialog () {
|
addCustomDialog () {
|
||||||
window.UE.registerUI('yshop', function (editor, uiName) {
|
window.UE.registerUI('yshop', function (editor, uiName) {
|
||||||
let dialog = new window.UE.ui.Dialog({
|
let dialog = new window.UE.ui.Dialog({
|
||||||
iframeUrl: '/yshop/materia/index',
|
iframeUrl: '#yshop/materia/index',
|
||||||
editor: editor,
|
editor: editor,
|
||||||
name: uiName,
|
name: uiName,
|
||||||
title: '上传图片',
|
title: '上传图片',
|
||||||
|
|||||||
Reference in New Issue
Block a user