vendor/assets/ckeditor/ckeditor/plugins/codemirror/js/addon/edit/matchbrackets.js in rich-1.4.5 vs vendor/assets/ckeditor/ckeditor/plugins/codemirror/js/addon/edit/matchbrackets.js in rich-1.4.6

- old
+ new

@@ -1,4 +1,4 @@ -(function(){function k(b){function e(a,c,d){if(a.text){var g=i?0:a.text.length-1,f=i?a.text.length:-1;for(null!=d&&(g=d+h);g!=f;g+=h)if(d=a.text.charAt(g),l.test(d)&&b.getTokenAt({line:c,ch:g+1}).type==k){var e=n[d];if(">"==e.charAt(1)==i)o.push(d);else{if(o.pop()!=e.charAt(0))return{pos:g,match:!1};if(!o.length)return{pos:g,match:!0}}}}}var a=b.getCursor(),f=b.getLineHandle(a.line),d=a.ch-1,c=0<=d&&n[f.text.charAt(d)]||n[f.text.charAt(++d)];if(!c)return null;for(var i=">"==c.charAt(1),h=i?1:-1,k= -b.getTokenAt({line:a.line,ch:d+1}).type,o=[f.text.charAt(d)],l=/[(){}[\]]/,c=a.line,j,m=i?Math.min(c+100,b.lineCount()):Math.max(-1,c-100);c!=m&&!(j=c==a.line?e(f,c,d):e(b.getLineHandle(c),c));c+=h);return{from:{line:a.line,ch:d},to:j&&{line:c,ch:j.pos},match:j&&j.match}}function l(b,e){var a=k(b);if(a){var f=a.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",d=b.markText(a.from,{line:a.from.line,ch:a.from.ch+1},{className:f}),c=a.to&&b.markText(a.to,{line:a.to.line,ch:a.to.ch+1}, -{className:f}),a=function(){b.operation(function(){d.clear();c&&c.clear()})};if(e)setTimeout(a,800);else return a}}function m(b){b.operation(function(){h&&(h(),h=null);b.somethingSelected()||(h=l(b,!1))})}var n={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},h=null;CodeMirror.defineOption("matchBrackets",!1,function(b,e){if(e)b.on("cursorActivity",m);else b.off("cursorActivity",m)});CodeMirror.defineExtension("matchBrackets",function(){l(this,!0)});CodeMirror.defineExtension("findMatchingBracket", -function(){return k(this)})})(); +(function(){function l(b){function e(a,c,d){if(a.text){var g=j?0:a.text.length-1,f=j?a.text.length:-1;for(null!=d&&(g=d+h);g!=f;g+=h)if(d=a.text.charAt(g),m.test(d)&&b.getTokenAt(i(c,g+1)).type==l){var e=o[d];if(">"==e.charAt(1)==j)p.push(d);else{if(p.pop()!=e.charAt(0))return{pos:g,match:!1};if(!p.length)return{pos:g,match:!0}}}}}var a=b.getCursor(),f=b.getLineHandle(a.line),d=a.ch-1,c=0<=d&&o[f.text.charAt(d)]||o[f.text.charAt(++d)];if(!c)return null;for(var j=">"==c.charAt(1),h=j?1:-1,l=b.getTokenAt(i(a.line, +d+1)).type,p=[f.text.charAt(d)],m=/[(){}[\]]/,c=a.line,k,n=j?Math.min(c+100,b.lineCount()):Math.max(-1,c-100);c!=n&&!(k=c==a.line?e(f,c,d):e(b.getLineHandle(c),c));c+=h);return{from:i(a.line,d),to:k&&i(c,k.pos),match:k&&k.match}}function m(b,e){var a=l(b);if(a&&!(b.getLine(a.from.line).length>n||a.to&&b.getLine(a.to.line).length>n)){var f=a.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",d=b.markText(a.from,i(a.from.line,a.from.ch+1),{className:f}),c=a.to&&b.markText(a.to,i(a.to.line, +a.to.ch+1),{className:f});r&&b.state.focused&&b.display.input.focus();a=function(){b.operation(function(){d.clear();c&&c.clear()})};if(e)setTimeout(a,800);else return a}}function q(b){b.operation(function(){h&&(h(),h=null);b.somethingSelected()||(h=m(b,!1))})}var r=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||8>document.documentMode),i=CodeMirror.Pos,n=1E3,o={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},h=null;CodeMirror.defineOption("matchBrackets",!1,function(b,e){if(e)b.on("cursorActivity", +q);else b.off("cursorActivity",q)});CodeMirror.defineExtension("matchBrackets",function(){m(this,!0)});CodeMirror.defineExtension("findMatchingBracket",function(){return l(this)})})(); \ No newline at end of file