From 00b075ad9cd4444cc2bab1dd21bb32e98ef0d8db Mon Sep 17 00:00:00 2001
From: Catouse
Date: Fri, 28 Dec 2018 20:35:21 +0800
Subject: [PATCH] * finish task #5175 and fix bug #2304.
---
www/js/kindeditor/kindeditor.js | 38 +++++++++++++++--------------
www/js/kindeditor/kindeditor.min.js | 12 ++++-----
2 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/www/js/kindeditor/kindeditor.js b/www/js/kindeditor/kindeditor.js
index c738d2ccd0..77e6782433 100644
--- a/www/js/kindeditor/kindeditor.js
+++ b/www/js/kindeditor/kindeditor.js
@@ -20,6 +20,7 @@
var _VERSION = '4.1.9 (2013-10-08)',
_ua = navigator.userAgent.toLowerCase(),
_IE = _ua.indexOf('msie') > -1 && _ua.indexOf('opera') == -1,
+ _NEWIE = _ua.indexOf('msie') == -1 && _ua.indexOf('trident') > -1,
_GECKO = _ua.indexOf('gecko') > -1 && _ua.indexOf('khtml') == -1,
_WEBKIT = _ua.indexOf('applewebkit') > -1,
_OPERA = _ua.indexOf('opera') > -1,
@@ -259,7 +260,7 @@
langType: 'zh_CN',
urlType: '',
newlineTag: 'p',
- resizeType: 2,
+ resizeType: 1,
syncType: 'form',
pasteType: 2,
dialogAlignType: 'page',
@@ -1368,17 +1369,14 @@
function _getScrollPos(doc) {
doc = doc || document;
var x, y;
- if(_IE || _OPERA) {
+ if (_IE || _NEWIE || _OPERA) {
x = _docElement(doc).scrollLeft;
y = _docElement(doc).scrollTop;
} else {
x = _getWin(doc).scrollX;
y = _getWin(doc).scrollY;
}
- return {
- x: x,
- y: y
- };
+ return {x : x, y : y};
}
function KNode(node) {
@@ -3602,6 +3600,7 @@
height = moveEl.height(),
pageX = e.pageX,
pageY = e.pageY;
+ K(self).addClass('ke-dragging');
if(beforeDrag) {
beforeDrag();
}
@@ -3626,6 +3625,7 @@
if(self.releaseCapture) {
self.releaseCapture();
}
+ K(self).removeClass('ke-dragging');
}
K(docs).mousemove(moveListener)
.mouseup(upListener)
@@ -3722,10 +3722,10 @@
},
autoPos: function(width, height) {
var self = this,
- w = _removeUnit(width) || 0,
- h = _removeUnit(height) || 0,
- scrollPos = _getScrollPos();
- if(self._alignEl) {
+ w = _removeUnit(width) || 0,
+ h = _removeUnit(height) || 0,
+ scrollPos = _getScrollPos();
+ if (self._alignEl) {
var knode = K(self._alignEl),
pos = knode.pos(),
diffX = _round(knode[0].clientWidth / 2 - w / 2),
@@ -3737,7 +3737,7 @@
x = _round(scrollPos.x + (docEl.clientWidth - w) / 2);
y = _round(scrollPos.y + (docEl.clientHeight - h) / 2);
}
- if(!(_IE && _V < 7 || _QUIRKS)) {
+ if (!(_IE && _V < 7 || _QUIRKS)) {
x -= scrollPos.x;
y -= scrollPos.y;
}
@@ -5383,9 +5383,11 @@
}
}
});
+ // statusbar.removeClass('statusbar').addClass('ke-statusbar')
+ // .append('')
+ // .append('');
statusbar.removeClass('statusbar').addClass('ke-statusbar')
- .append('')
- .append('');
+ .append('');
if(self._fullscreenResizeHandler) {
K(window).unbind('resize', self._fullscreenResizeHandler);
self._fullscreenResizeHandler = null;
@@ -5407,8 +5409,8 @@
};
K(window).bind('resize', self._fullscreenResizeHandler);
toolbar.select('fullscreen');
- statusbar.first().css('visibility', 'hidden');
- statusbar.last().css('visibility', 'hidden');
+ // statusbar.first().css('visibility', 'hidden');
+ // statusbar.last().css('visibility', 'hidden');
} else {
if(_GECKO) {
K(window).bind('scroll', function(e) {
@@ -5425,7 +5427,7 @@
}
});
} else {
- statusbar.first().css('visibility', 'hidden');
+ // statusbar.first().css('visibility', 'hidden');
}
if(self.resizeType === 2) {
_drag({
@@ -5438,7 +5440,7 @@
}
});
} else {
- statusbar.last().css('visibility', 'hidden');
+ // statusbar.last().css('visibility', 'hidden');
}
}
return self;
@@ -9968,7 +9970,7 @@ KindEditor.plugin('table', function (K) {
colsCount += cellSpan ? parseInt(cellSpan) : 1;
});
for(var i = 0; i < colsCount; ++i) {
- theadHtml.push('' + (K.IE ? ' ' : ' ') + ' | ');
+ theadHtml.push('' + (K.IE ? ' ' : ' ') + ' | ');
}
theadHtml.push('');
$thead = $(theadHtml.join(''));
diff --git a/www/js/kindeditor/kindeditor.min.js b/www/js/kindeditor/kindeditor.min.js
index 37ad659afd..c2f1a239cd 100644
--- a/www/js/kindeditor/kindeditor.min.js
+++ b/www/js/kindeditor/kindeditor.min.js
@@ -1,6 +1,6 @@
-!function(window,undefined){function _isArray(e){return!!e&&"[object Array]"===Object.prototype.toString.call(e)}function _isFunction(e){return!!e&&"[object Function]"===Object.prototype.toString.call(e)}function _inArray(e,t){for(var n=0,i=t.length;n=0}function _addUnit(e,t){return t=t||"px",e&&/^\d+$/.test(e)?e+t:e}function _removeUnit(e){var t;return e&&(t=/(\d+)/.exec(e))?parseInt(t[1],10):0}function _escape(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function _unescape(e){return e.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function _toCamel(e){var t=e.split("-");return e="",_each(t,function(t,n){e+=t>0?n.charAt(0).toUpperCase()+n.substr(1):n}),e}function _toHex(e){function t(e){var t=parseInt(e,10).toString(16).toUpperCase();return t.length>1?t:"0"+t}return e.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/gi,function(e,n,i,a){return"#"+t(n)+t(i)+t(a)})}function _toMap(e,t){t=t===undefined?",":t;var n,i={},a=_isArray(e)?e:e.split(t);return _each(a,function(e,t){if(n=/^(\d+)\.\.(\d+)$/.exec(t))for(var a=parseInt(n[1],10);a<=parseInt(n[2],10);a++)i[a.toString()]=!0;else i[t]=!0}),i}function _toArray(e,t){return Array.prototype.slice.call(e,t||0)}function _undef(e,t){return e===undefined?t:e}function _invalidUrl(e){return!e||/[<>"]/.test(e)}function _addParam(e,t){return e.indexOf("?")>=0?e+"&"+t:e+"?"+t}function _extend(e,t,n){n||(n=t,t=null);var i;if(t){var a=function(){};a.prototype=t.prototype,i=new a,_each(n,function(e,t){i[e]=t})}else i=n;i.constructor=e,e.prototype=i,e.parent=t?t.prototype:null}function _json(text){var match;(match=/\{[\s\S]*\}|\[[\s\S]*\]/.exec(text))&&(text=match[0]);var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return eval("("+text+")");throw"JSON parse error"}function _getBasePath(){for(var e,t=document.getElementsByTagName("script"),n=0,i=t.length;n=0)return void _each(t.split(","),function(){_bind(e,this,n)});var i=_getId(e);i||(i=_setId(e)),_eventData[i]===undefined&&(_eventData[i]={});var a=_eventData[i][t];a&&a.length>0?_unbindEvent(e,t,a[0]):(_eventData[i][t]=[],_eventData[i].el=e),a=_eventData[i][t],0===a.length&&(a[0]=function(t){var n=t?new KEvent(e,t):undefined;_each(a,function(t,i){t>0&&i&&i.call(e,n)})}),_inArray(n,a)<0&&a.push(n),_bindEvent(e,t,a[0])}function _unbind(e,t,n){if(t&&t.indexOf(",")>=0)return void _each(t.split(","),function(){_unbind(e,this,n)});var i=_getId(e);if(i){if(t===undefined)return void(i in _eventData&&(_each(_eventData[i],function(t,n){"el"!=t&&n.length>0&&_unbindEvent(e,t,n[0])}),delete _eventData[i],_removeId(e)));if(_eventData[i]){var a=_eventData[i][t];if(a&&a.length>0){n===undefined?(_unbindEvent(e,t,a[0]),delete _eventData[i][t]):(_each(a,function(e,t){e>0&&t===n&&a.splice(e,1)}),1==a.length&&(_unbindEvent(e,t,a[0]),delete _eventData[i][t]));var o=0;_each(_eventData[i],function(){o++}),o<2&&(delete _eventData[i],_removeId(e))}}}}function _fire(e,t){if(t.indexOf(",")>=0)return void _each(t.split(","),function(){_fire(e,this)});var n=_getId(e);if(n){var i=_eventData[n][t];_eventData[n]&&i&&i.length>0&&i[0]()}}function _ctrl(e,t,n){t=/^\d{2,}$/.test(t)?t:t.toUpperCase().charCodeAt(0),_bind(e,"keydown",function(i){!i.ctrlKey||i.which!=t||i.shiftKey||i.altKey||(n.call(e),i.stop())})}function _ready(e){function t(){a||(a=!0,e(KindEditor),_readyFinished=!0)}function n(){if(!a){try{document.documentElement.doScroll("left")}catch(e){return void setTimeout(n,100)}t()}}function i(){"complete"===document.readyState&&t()}if(_readyFinished)return void e(KindEditor);var a=!1;if(document.addEventListener)_bind(document,"DOMContentLoaded",t);else if(document.attachEvent){_bind(document,"readystatechange",i);var o=!1;try{o=null==window.frameElement}catch(r){}document.documentElement.doScroll&&o&&n()}_bind(window,"load",t)}function _getCssList(e){for(var t,n={},i=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g;t=i.exec(e);){var a=_trim(t[1].toLowerCase()),o=_trim(_toHex(t[2]));n[a]=o}return n}function _getAttrList(e){for(var t,n={},i=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g;t=i.exec(e);){var a=(t[1]||t[2]||t[4]||t[6]).toLowerCase(),o=(t[2]?t[3]:t[4]?t[5]:t[7])||"";n[a]=o}return n}function _addClassToTag(e,t){return e=/\s+class\s*=/.test(e)?e.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(e,n,i,a){return(" "+i+" ").indexOf(" "+t+" ")<0?""===i?n+t+a:n+i+" "+t+a:e}):e.substr(0,e.length-1)+' class="'+t+'">'}function _formatCss(e){var t="";return _each(_getCssList(e),function(e,n){t+=e+":"+n+";"}),t}function _formatUrl(e,t,n,i){function a(e){for(var t=e.split("/"),n=[],i=0,a=t.length;i0&&n.pop():""!==o&&"."!=o&&n.push(o)}return"/"+n.join("/")}function o(t,n){if(e.substr(0,t.length)===t){for(var a=[],r=0;r0&&(s+="/"+a.join("/")),"/"==i&&(s+="/"),s+e.substr(t.length)}if(l=/^(.*)\//.exec(t))return o(l[1],++n)}if(t=_undef(t,"").toLowerCase(),"data:"!=e.substr(0,5)&&(e=e.replace(/([^:])\/\//g,"$1/")),_inArray(t,["absolute","relative","domain"])<0)return e;if(n=n||location.protocol+"//"+location.host,i===undefined){var r=location.pathname.match(/^(\/.*)\//);i=r?r[1]:""}var l;if(l=/^(\w+:\/\/[^\/]*)/.exec(e)){if(l[1]!==n)return e}else if(/^\w+:/.test(e))return e;return/^\//.test(e)?e=n+a(e.substr(1)):/^\w+:\/\//.test(e)||(e=n+a(i+"/"+e)),"relative"===t?e=o(n+i,0).substr(2):"absolute"===t&&e.substr(0,n.length)===n&&(e=e.substr(n.length)),e}function _formatHtml(e,t,n,i,a){null==e&&(e=""),n=n||"",i=_undef(i,!1),a=_undef(a,"\t");var o="xx-small,x-small,small,medium,large,x-large,xx-large".split(",");e=e.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/gi,function(e,t,n,i){return t+n.replace(/<(?:br|br\s[^>]*)>/gi,"\n")+i}),e=e.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/gi,"
"),e=e.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/gi,"$1
$2"),e=e.replace(/\u200B/g,""),e=e.replace(/\u00A9/g,"©"),e=e.replace(/<[^>]+>/g,function(e){return e.replace(/\s+/g," ")});var r={};t&&(_each(t,function(e,t){for(var n=e.split(","),i=0,a=n.length;i]*)>)([\s\S]*?)(<\/script>)/gi,"")),r.style||(e=e.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/gi,"")));var l=/(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g,s=[];return e=e.replace(l,function(e,l,d,c,u,p,h){var f=e,m=l||"",g=d||"",v=c.toLowerCase(),_=u||"",b=p?" "+p:"",y=h||"";if(t&&!r[v])return"";if(""===b&&_SINGLE_TAG_MAP[v]&&(b=" /"),_INLINE_TAG_MAP[v]&&(m&&(m=" "),y&&(y=" ")),_PRE_TAG_MAP[v]&&(g?y="\n":m="\n"),i&&"br"==v&&(y="\n"),_BLOCK_TAG_MAP[v]&&!_PRE_TAG_MAP[v])if(i){g&&s.length>0&&s[s.length-1]===v?s.pop():s.push(v),m="\n",y="\n";for(var k=0,w=g?s.length:s.length-1;k=0&&(S[e]=_formatUrl(i,n)),(t&&"style"!==e&&!r[v]["*"]&&!r[v][e]||"body"===v&&"contenteditable"===e||/^kindeditor_\d+$/.test(e))&&delete S[e],"style"===e&&""!==i){var a=_getCssList(i);_each(a,function(e,n){!t||r[v].style||r[v]["."+e]||delete a[e]});var o="";_each(a,function(e,t){o+=e+":"+t+";"}),S.style=o}}),_="",_each(S,function(e,t){"style"===e&&""===t||(t=t.replace(/"/g,"""),_+=" "+e+'="'+t+'"')})}return"font"===v&&(v="span"),m+"<"+g+v+_+b+">"+y}),e=e.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/gi,function(e,t,n,i){return t+n.replace(/\n/g,'\n')+i}),e=e.replace(/\n\s*\n/g,"\n"),e=e.replace(/\n/g,"\n"),_trim(e)}function _clearMsWord(e,t){return e=e.replace(//gi,"").replace(//gi,"").replace(/"];return _isArray(n)||(n=[n]),_each(n,function(e,t){t&&a.push('')}),i&&a.push(""),a.push("