From 12c7519260f0bc84e1ff2968f3585ca7372fca23 Mon Sep 17 00:00:00 2001
From: Catouse
Date: Fri, 22 Jan 2021 10:26:02 +0800
Subject: [PATCH] * fix anchor name missing after toggle fullscreen.
see https://github.com/kindsoft/kindeditor/issues/218
---
www/js/kindeditor/kindeditor.js | 3 +++
www/js/kindeditor/kindeditor.min.js | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/www/js/kindeditor/kindeditor.js b/www/js/kindeditor/kindeditor.js
index 97fa9158d3..42bb6a3ea2 100644
--- a/www/js/kindeditor/kindeditor.js
+++ b/www/js/kindeditor/kindeditor.js
@@ -919,6 +919,9 @@
attrMap.style = fontStyle;
}
_each(attrMap, function(key, val) {
+ if (key.indexOf('data-ke-') === 0) {
+ return;
+ }
if(val === true) val = '';
if(_FILL_ATTR_MAP[key]) {
attrMap[key] = key;
diff --git a/www/js/kindeditor/kindeditor.min.js b/www/js/kindeditor/kindeditor.min.js
index 8e5bcf05b4..acef57d178 100644
--- a/www/js/kindeditor/kindeditor.min.js
+++ b/www/js/kindeditor/kindeditor.min.js
@@ -1,5 +1,5 @@
/*! KindEditor Copyright (C) kindsoft.net, Licence: http://kindeditor.net/license.php */
-if(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,t){var n,i={},a=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g;for(t===undefined&&(t="");n=a.exec(e);){var o=(n[1]||n[2]||n[4]||n[6]).toLowerCase(),r=(n[2]?n[3]:n[4]?n[5]:n[7])||t;i[o]=r}return i}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("#"===e[0])return e;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,o){null==e&&(e=""),n=n||"",i=_undef(i,!1),a=_undef(a,"\t");var r="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 l={};t&&(_each(t,function(e,t){for(var n=e.split(","),i=0,a=n.length;i]*)>)([\s\S]*?)(<\/script>)/gi,"")),l.style||(e=e.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/gi,"")));var s=/(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g,d=[],c=null;return e=e.replace(s,function(e,s,u,p,h,f,m){var g=e,v=s||"",_=u||"",b=p.toLowerCase(),y=h||"",k=f?" "+f:"",w=m||"";if(t&&!l[b])return"";if(""===k&&_SINGLE_TAG_MAP[b]&&(k=" /"),_INLINE_TAG_MAP[b]&&(v&&(v=" "),w&&(w=" ")),_PRE_TAG_MAP[b]&&(_?w="\n":v="\n"),!i||"br"!=b&&"hr"!==b||o&&c!==!0||(w="\n"),_BLOCK_TAG_MAP[b]&&!_PRE_TAG_MAP[b])if(i){var C=!!(_&&d.length>0&&d[d.length-1]===b);if(C?(d.pop(),o&&(v="",w="\n")):(d.push(b),o&&(v="\n",w="")),o||(v="\n",w="\n"),!o||c===!1&&!C||c===!0)for(var S=0,x=_?d.length:d.length-1;S=0&&(E[e]=_formatUrl(i,n)),(t&&"style"!==e&&!l[b]["*"]&&!l[b][e]||"body"===b&&"contenteditable"===e||/^kindeditor_\d+$/.test(e))&&delete E[e],"style"===e&&""!==i){var a=_getCssList(i);_each(a,function(e,n){!t||l[b].style||l[b]["."+e]||delete a[e]});var o="";_each(a,function(e,t){o+=e+":"+t+";"}),E.style=o}}),y="",_each(E,function(e,t){if(t!==!1&&("style"!==e||""!==t)){if(t===!0)return void(y+=" "+e);t=t.replace(/"/g,"""),y+=" "+e+'="'+t+'"'}})}return"font"===b&&(b="span"),v+"<"+_+b+y+k+">"+w}),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("