Skip to content

Commit

Permalink
ver 1.2.2 (2015-4-26)
Browse files Browse the repository at this point in the history
-----------------------

添加:

1. 添加:添加对jquery 1系列所有版本的兼容,内置$.browser,对以下3个版本进行了测试:1.8.0, 1.9.0, 1.11.2

修正:

1. 修正:修复不兼容IE11的问题
  • Loading branch information
yaniswang committed Apr 26, 2015
1 parent 2289369 commit 7c3cb81
Show file tree
Hide file tree
Showing 8 changed files with 85 additions and 21 deletions.
11 changes: 11 additions & 0 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
xhEditor 变更日志
=======================

ver 1.2.2 (2015-4-26)
-----------------------

添加:

1. 添加:添加对jquery 1系列所有版本的兼容,内置$.browser,对以下3个版本进行了测试:1.8.0, 1.9.0, 1.11.2

修正:

1. 修正:修复不兼容IE11的问题

ver 1.2.1 (2013-2-24)
-----------------------

Expand Down
17 changes: 8 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,21 @@ module.exports = function(grunt) {
content = content.replace(/@BUILDDATE/g,grunt.template.today("yymmdd"));
}
else if(/\.html$/i.test(filename)){

content = content.replace(/xheditor\.js"/g, pkg.name + '-' + pkg.version + '.min.js"');
}
return content;
}
},
files: [
{src: ['dist/<%= pkg.name %>-<%= pkg.version %>.min.js'], dest: 'temp/xheditor-<%= pkg.version %>/<%= pkg.name %>-<%= pkg.version %>.min.js'},
{src:['xheditor_lang/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{src:['xheditor_skin/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{src:['xheditor_emot/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{src:['xheditor_plugins/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{src:['demos/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{src:['jquery/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{src:['serverscript/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{src:['CHANGE.md', 'LGPL-LICENSE.txt', 'README.md', 'THANKS.md', 'TODO.md', 'wizard.html'], dest: 'temp/xheditor-<%= pkg.version %>/'}
{expand: true, src:['xheditor_lang/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{expand: true, src:['xheditor_skin/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{expand: true, src:['xheditor_emot/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{expand: true, src:['xheditor_plugins/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{expand: true, src:['demos/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{expand: true, src:['jquery/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{expand: true, src:['serverscript/**'], dest: 'temp/xheditor-<%= pkg.version %>/'},
{expand: true, src:['CHANGE.md', 'LGPL-LICENSE.txt', 'README.md', 'THANKS.md', 'TODO.md', 'wizard.html'], dest: 'temp/xheditor-<%= pkg.version %>/'}
]
}
},
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,17 @@ xhEditor默认基于[LGPL开源许可协议](http://xheditor.com/license/lgpl.tx

npm install grunt-cli -g
cd xhEditor && npm install
grunt -version

开发调试
---------------

确认grunt并构建:
open wizard.html
edit src/**

构建并打包zip:
-----------------

grunt -version
grunt


Expand Down
4 changes: 4 additions & 0 deletions jquery/jquery-1.11.2.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions jquery/jquery-1.8.3.min.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions jquery/jquery-1.9.1.min.js

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "xheditor",
"title": "xhEditor",
"description": "xhEditor是一个基于jQuery开发的简单迷你并且高效的在线可视化HTML编辑器,基于网络访问并且兼容IE 6.0+,Firefox 3.0+,Opera 9.6+,Chrome 1.0+,Safari 3.22+。",
"version": "1.2.1",
"version": "1.2.2",
"author": "yanis.wang@gmail.com",
"homepage": "http://xheditor.com/",
"repository": {
Expand All @@ -20,12 +20,12 @@
],
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.0rc7",
"grunt-contrib-clean": "~0.4.0rc6",
"grunt-contrib-concat": "~0.1.2rc6",
"grunt-contrib-uglify": "~0.1.1rc6",
"grunt-contrib-copy": "~0.4.0rc7",
"grunt-contrib-compress": "~0.4.0rc7"
"grunt": "0.4.5",
"grunt-contrib-clean": "0.6.0",
"grunt-contrib-concat": "0.5.1",
"grunt-contrib-uglify": "0.9.1",
"grunt-contrib-copy": "0.8.0",
"grunt-contrib-compress": "0.13.0"
},
"keywords": [
"javascript",
Expand Down
43 changes: 40 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,49 @@
* @license Copyright (c) 2009-2013, xhEditor.com. All rights reserved.
* For licensing, see LGPL-LICENSE.txt or http://xheditor.com/license/lgpl.txt
*/
(function($, undefined){
if(!$.browser){
function uaMatch( ua ) {
ua = ua.toLowerCase();

var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
/(msie) ([\w.]+)/.exec( ua ) ||
ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
[];

return {
browser: match[ 1 ] || "",
version: match[ 2 ] || "0"
};
};
var matched = uaMatch( navigator.userAgent );
var browser = {};

if ( matched.browser ) {
browser[ matched.browser ] = true;
browser.version = matched.version;
}

// Chrome is Webkit, but Webkit is also Safari.
if ( browser.chrome ) {
browser.webkit = true;
} else if ( browser.webkit ) {
browser.safari = true;
}

$.browser = browser;
}
})(jQuery);

(function(XHEDITOR, $, undefined){

var agent=navigator.userAgent.toLowerCase();
var bMobile=/mobile/i.test(agent),
browser=$.browser,browerVer=parseFloat(browser.version),
isIE=browser.msie,
isIE11 = /trident\//i.test(agent) && (/rv:/i.test(agent) || /Netscape/i.test(agent.appName)),
isMozilla=browser.mozilla,
isWebkit=browser.webkit,
isOpera=browser.opera,
Expand Down Expand Up @@ -419,14 +456,14 @@
this.setTextCursor=function(bLast)
{
var rng=_this.getRng(true),cursorNode=_doc.body;
if(isIE)rng.moveToElementText(cursorNode);
if(isIE || isIE11)rng.moveToElementText(cursorNode);
else{
var chileName=bLast?'lastChild':'firstChild';
while(cursorNode.nodeType!=3&&cursorNode[chileName]){cursorNode=cursorNode[chileName];}
rng.selectNode(cursorNode);
}
rng.collapse(bLast?false:true);
if(isIE)rng.select();
if(isIE || isIE11)rng.select();
else{var sel=_this.getSel();sel.removeAllRanges();sel.addRange(rng);}
}
this.getSel=function()
Expand Down Expand Up @@ -2065,7 +2102,7 @@
_this.saveBookmark();
var tag=isIE?'pre':'div',jDiv=$('<'+tag+' class="xhe-paste">\uFEFF\uFEFF</'+tag+'>',_doc).appendTo(_doc.body),div=jDiv[0],sel=_this.getSel(),rng=_this.getRng(true);
jDiv.css('top',_jWin.scrollTop());
if(isIE){
if(isIE || isIE11){
rng.moveToElementText(div);
rng.select();
//注:调用execommand:paste,会导致IE8,IE9目标路径无法转为绝对路径
Expand Down

0 comments on commit 7c3cb81

Please sign in to comment.