/*!
* xhEditor - WYSIWYG XHTML Editor
* @requires jQuery v1.4.4
*
* @author Yanis.Wang<yanis.wang@gmail.com>
* @site http://xheditor.com/
* @licence LGPL(http://xheditor.com/license/lgpl.txt)
*
* @Version: 1.1.10 (build 110904)
*/
(function ($, undefined) {
if (window.xheditor) return false; //防止JS重复加载
var agent = navigator.userAgent.toLowerCase();
var bMobile = agent.indexOf('mobile') > -1, browser = $.browser, browerVer = parseFloat(browser.version), isIE = browser.msie, isMozilla = browser.mozilla, isSafari = browser.safari, isOpera = browser.opera;
$.fn.xheditor = function (options) {
if (bMobile) return false; //手机浏览器不初始化编辑器
var arrSuccess = [];
this.each(function () {
if (!$.nodeName(this, 'TEXTAREA')) return;
if (options === false)//卸载
{
if (this.xheditor) {
this.xheditor.remove();
this.xheditor = null;
}
}
else//初始化
{
if (!this.xheditor) {
var tOptions = /({.*})/.exec($(this).attr('class'));
if (tOptions) {
try { tOptions = eval('(' + tOptions[1] + ')'); } catch (ex) { };
options = $.extend({}, tOptions, options);
}
var editor = new xheditor(this, options);
if (editor.init()) {
this.xheditor = editor;
arrSuccess.push(editor);
}
else editor = null;
}
else arrSuccess.push(this.xheditor);
}
});
if (arrSuccess.length === 0) arrSuccess = false;
if (arrSuccess.length === 1) arrSuccess = arrSuccess[0];
return arrSuccess;
}
var xCount = 0, bShowPanel = false, bClickCancel = true, bShowModal = false, bCheckEscInit = false;
var _jPanel, _jShadow, _jCntLine, _jPanelButton;
var jModal, jModalShadow, layerShadow, jOverlay, jHideSelect, onModalRemove;
var editorRoot;
$('script[src*=xheditor]').each(function () {
var s = this.src;
if (s.match(/xheditor[^\/]*\.js/i)) { editorRoot = s.replace(/[\?#].*$/, '').replace(/(^|[\/\\])[^\/]*$/, '$1'); return false; }
});
//ie6 缓存背景图片
if (isIE) {
try { document.execCommand('BackgroundImageCache', false, true); }
catch (e) { }
}
var specialKeys = { 27: 'esc', 9: 'tab', 32: 'space', 13: 'enter', 8: 'backspace', 145: 'scroll',
20: 'capslock', 144: 'numlock', 19: 'pause', 45: 'insert', 36: 'home', 46: 'del',
35: 'end', 33: 'pageup', 34: 'pagedown', 37: 'left', 38: 'up', 39: 'right', 40: 'down',
112: 'f1', 113: 'f2', 114: 'f3', 115: 'f4', 116: 'f5', 117: 'f6', 118: 'f7', 119: 'f8', 120: 'f9', 121: 'f10', 122: 'f11', 123: 'f12'
};
var itemColors = ['#FFFFFF', '#CCCCCC', '#C0C0C0', '#999999', '#666666', '#333333', '#000000', '#FFCCCC', '#FF6666', '#FF0000', '#CC0000', '#990000', '#660000', '#330000', '#FFCC99', '#FF9966', '#FF9900', '#FF6600', '#CC6600', '#993300', '#663300', '#FFFF99', '#FFFF66', '#FFCC66', '#FFCC33', '#CC9933', '#996633', '#663333', '#FFFFCC', '#FFFF33', '#FFFF00', '#FFCC00', '#999900', '#666600', '#333300', '#99FF99', '#66FF99', '#33FF33', '#33CC00', '#009900', '#006600', '#003300', '#99FFFF', '#33FFFF', '#66CCCC', '#00CCCC', '#339999', '#336666', '#003333', '#CCFFFF', '#66FFFF', '#33CCFF', '#3366FF', '#3333FF', '#000099', '#000066', '#CCCCFF', '#9999FF', '#6666CC', '#6633FF', '#6600CC', '#333399', '#330099', '#FFCCFF', '#FF99FF', '#CC66CC', '#CC33CC', '#993399', '#663366', '#330033'];
var arrBlocktag = [{ n: 'p', t: '普通段落' }, { n: 'h1', t: '标题1' }, { n: 'h2', t: '标题2' }, { n: 'h3', t: '标题3' }, { n: 'h4', t: '标题4' }, { n: 'h5', t: '标题5' }, { n: 'h6', t: '标题6' }, { n: 'pre', t: '已编排格式' }, { n: 'address', t: '地址'}];
var arrFontname = [{ n: '宋体', c: 'SimSun' }, { n: '仿宋体', c: 'FangSong_GB2312' }, { n: '黑体', c: 'SimHei' }, { n: '楷体', c: 'KaiTi_GB2312' }, { n: '微软雅黑', c: 'Microsoft YaHei' }, { n: 'Arial' }, { n: 'Arial Black' }, { n: 'Comic Sans MS' }, { n: 'Courier New' }, { n: 'System' }, { n: 'Times New Roman' }, { n: 'Tahoma' }, { n: 'Verdana'}];
var arrFontsize = [{ n: 'x-small', s: '10px', t: '极小' }, { n: 'small', s: '13px', t: '特小' }, { n: 'medium', s: '16px', t: '小' }, { n: 'large', s: '18px', t: '中' }, { n: 'x-large', s: '24px', t: '大' }, { n: 'xx-large', s: '32px', t: '特大' }, { n: '-webkit-xxx-large', s: '48px', t: '极大'}];
var menuAlign = [{ s: '左对齐', v: 'justifyleft' }, { s: '居中', v: 'justifycenter' }, { s: '右对齐', v: 'justifyright' }, { s: '两端对齐', v: 'justifyfull'}], menuList = [{ s: '数字列表', v: 'insertOrderedList' }, { s: '符号列表', v: 'insertUnorderedList'}];
var htmlPastetext = '<div><label for="xhePastetextValue">使用键盘快捷键(Ctrl+V)把内容粘贴到方框里,按 确定</label></div><div><textarea id="xhePastetextValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlLink = '<div><label for="xheLinkUrl">链接地址: </label><input type="text" id="xheLinkUrl" value="http://" class="xheText" /></div><div><label for="xheLinkTarget">打开方式: </label><select id="xheLinkTarget"><option selected="selected" value="">默认</option><option value="_blank">新窗口</option><option value="_self">当前窗口</option><option value="_parent">父窗口</option></select></div><div style="display:none"><label for="xheLinkText">链接文字: </label><input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlAnchor = '<div><label for="xheAnchorName">锚点名称: </label><input type="text" id="xheAnchorName" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlImg = '<div><label for="xheImgUrl">图片文件: </label><input type="text" id="xheImgUrl" value="http://" class="xheText" /></div><div><div><label for="xheImgAlt">替换文本: </label><input type="text" id="xheImgAlt" /></div><div><label for="xheImgAlign">对齐方式: </label><select id="xheImgAlign"><option selected="selected" value="">默认</option><option value="left">左对齐</option><option value="right">右对齐</option><option value="top">顶端</option><option value="middle">居中</option><option value="baseline">基线</option><option value="bottom">底边</option></select></div><div><label for="xheImgWidth">宽 度: </label><input type="text" id="xheImgWidth" style="width:40px;" /> <label for="xheImgHeight">高 度: </label><input type="text" id="xheImgHeight" style="width:40px;" /></div><div><label for="xheImgBorder">边框大小: </label><input type="text" id="xheImgBorder" style="width:40px;" /></div><div><label for="xheImgHspace">水平间距: </label><input type="text" id="xheImgHspace" style="width:40px;" /> <label for="xheImgVspace">垂直间距: </label><input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlFlash = '<div><label for="xheFlashUrl">动画文件: </label><input type="text" id="xheFlashUrl" value="http://" class="xheText" /></div><div><label for="xheFlashWidth">宽 度: </label><input type="text" id="xheFlashWidth" style="width:40px;" value="480" /> <label for="xheFlashHeight">高 度: </label><input type="text" id="xheFlashHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
var htmlMedia = '<div><label for="xheMediaUrl">媒体文件: </label><input type="text" id="xheMediaUrl" val
xheditor修改版 解决上传宽高为aoto的bug
4星 · 超过85%的资源 需积分: 9 93 浏览量
2011-11-09
17:15:47
上传
评论
收藏 28KB RAR 举报
afu45
- 粉丝: 38
- 资源: 32
最新资源
- 软件工程项目验收系列文档.doc
- content_1713513663833.xmind
- 数据流图(Data Flow Diagram,简称DFD).md
- 基于Mybatis-Plus的Maven代码生成插件设计源码
- 67e1bc92-b0ee-45c1-b46f-9d519bbd6925.ofd
- npcsvpwm.v
- Java项目:基于Springboot+vue实现的校园志愿者管理系统(源码+数据库+环境配置和运行指导视频+系统讲解视频)
- 驱动开发,驱动加载工具,支持安装、启动、停止、卸载、关闭功能
- UTS 32146 Data Visualisation and Visual Analytics A1
- 西门子1200PLC 六部十层电梯程序案例,WINCC RT Advanced界面,博图
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈