From df70e7e9be4afa6c0c7259c1f8b6fe2fa67b98cf Mon Sep 17 00:00:00 2001
From: Peter Dave Hello
Date: Tue, 11 Nov 2014 09:57:58 +0800
Subject: [PATCH] add textAngular v1.3.0-pre13
---
.../dist/textAngular-sanitize.min.js | 6 +
.../1.3.0-pre13/dist/textAngular.min.js | 18 +
.../1.3.0-pre13/src/textAngular-sanitize.js | 728 +++++
.../1.3.0-pre13/src/textAngular.js | 2389 +++++++++++++++++
.../1.3.0-pre13/src/textAngularSetup.js | 683 +++++
5 files changed, 3824 insertions(+)
create mode 100644 ajax/libs/textAngular/1.3.0-pre13/dist/textAngular-sanitize.min.js
create mode 100644 ajax/libs/textAngular/1.3.0-pre13/dist/textAngular.min.js
create mode 100644 ajax/libs/textAngular/1.3.0-pre13/src/textAngular-sanitize.js
create mode 100644 ajax/libs/textAngular/1.3.0-pre13/src/textAngular.js
create mode 100644 ajax/libs/textAngular/1.3.0-pre13/src/textAngularSetup.js
diff --git a/ajax/libs/textAngular/1.3.0-pre13/dist/textAngular-sanitize.min.js b/ajax/libs/textAngular/1.3.0-pre13/dist/textAngular-sanitize.min.js
new file mode 100644
index 000000000..96fcacd3c
--- /dev/null
+++ b/ajax/libs/textAngular/1.3.0-pre13/dist/textAngular-sanitize.min.js
@@ -0,0 +1,6 @@
+!function(a,b){b["true"]=a,/**
+ * @license AngularJS v1.2.26
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+function(a,b){"use strict";function c(){this.$get=["$$sanitizeUri",function(a){return function(b){var c=[];return f(b,k(c,function(b,c){return!/^unsafe/.test(a(b,c))})),c.join("")}}]}function d(a){var c=[],d=k(c,b.noop);return d.chars(a),c.join("")}function e(a){var b,c={},d=a.split(",");for(b=0;b=0&&k[f]!=d;f--);if(f>=0){for(e=k.length-1;e>=f;e--)c.end&&c.end(k[e]);k.length=f}}"string"!=typeof a&&(a=null===a||"undefined"==typeof a?"":""+a);var f,h,i,j,k=[],u=a;for(k.last=function(){return k[k.length-1]};a;){if(j="",h=!0,k.last()&&C[k.last()]?(a=a.replace(new RegExp("(.*)<\\s*\\/\\s*"+k.last()+"[^>]*>","i"),function(a,b){return b=b.replace(r,"$1").replace(t,"$1"),c.chars&&c.chars(g(b)),""}),e("",k.last())):(0===a.indexOf("",f)===f&&(c.comment&&c.comment(a.substring(4,f)),a=a.substring(f+3),h=!1)):s.test(a)?(i=a.match(s),i&&(a=a.replace(i[0],""),h=!1)):q.test(a)?(i=a.match(n),i&&(a=a.substring(i[0].length),i[0].replace(n,e),h=!1)):p.test(a)&&(i=a.match(m),i?(i[4]&&(a=a.substring(i[0].length),i[0].replace(m,d)),h=!1):(j+="<",a=a.substring(1))),h&&(f=a.indexOf("<"),j+=0>f?a:a.substring(0,f),a=0>f?"":a.substring(f),c.chars&&c.chars(g(j)))),a==u)throw l("badparse","The sanitizer was unable to parse the following block of html: {0}",a);u=a}e()}function g(a){if(!a)return"";var b=H.exec(a),c=b[1],d=b[3],e=b[2];return e&&(G.innerHTML=e.replace(/=b||173==b||b>=1536&&1540>=b||1807==b||6068==b||6069==b||b>=8204&&8207>=b||b>=8232&&8239>=b||b>=8288&&8303>=b||65279==b||b>=65520&&65535>=b?""+b+";":a}).replace(//g,">")}function i(a){var c="",d=a.split(";");return b.forEach(d,function(a){var d=a.split(":");if(2==d.length){var e=I(b.lowercase(d[0])),a=I(b.lowercase(d[1]));(("color"===e||"background-color"===e)&&(a.match(/^rgb\([0-9%,\. ]*\)$/i)||a.match(/^rgba\([0-9%,\. ]*\)$/i)||a.match(/^hsl\([0-9%,\. ]*\)$/i)||a.match(/^hsla\([0-9%,\. ]*\)$/i)||a.match(/^#[0-9a-f]{3,6}$/i)||a.match(/^[a-z]*$/i))||"text-align"===e&&("left"===a||"right"===a||"center"===a||"justify"===a)||"float"===e&&("left"===a||"right"===a||"none"===a)||("width"===e||"height"===e)&&a.match(/[0-9\.]*(px|em|rem|%)/))&&(c+=e+": "+a+";")}}),c}function j(a,b,c,d){return"img"===a&&b["ta-insert-video"]&&("ta-insert-video"===c||"allowfullscreen"===c||"frameborder"===c||"contenteditble"===c&&"false"===d)?!0:!1}function k(a,c){var d=!1,e=b.bind(a,a.push);return{start:function(a,f,g){a=b.lowercase(a),!d&&C[a]&&(d=a),d||D[a]!==!0||(e("<"),e(a),b.forEach(f,function(d,g){var k=b.lowercase(g),l="img"===a&&"src"===k||"background"===k;("style"===k&&""!==(d=i(d))||j(a,f,k,d)||F[k]===!0&&(E[k]!==!0||c(d,l)))&&(e(" "),e(g),e('="'),e(h(d)),e('"'))}),e(g?"/>":">"))},end:function(a){a=b.lowercase(a),d||D[a]!==!0||(e(""),e(a),e(">")),a==d&&(d=!1)},chars:function(a){d||e(h(a))}}}var l=b.$$minErr("$sanitize"),m=/^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,n=/^<\/\s*([\w:-]+)[^>]*>/,o=/([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,p=/^,q=/^<\//,r=//g,s=/]*?)>/i,t=//g,u=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,v=/([^\#-~| |!])/g,w=e("area,br,col,hr,img,wbr"),x=e("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),y=e("rp,rt"),z=b.extend({},y,x),A=b.extend({},x,e("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")),B=b.extend({},y,e("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")),C=e("script,style"),D=b.extend({},w,A,B,z),E=e("background,cite,href,longdesc,src,usemap"),F=b.extend({},E,e("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,id,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,target,title,type,valign,value,vspace,width")),G=document.createElement("pre"),H=/^(\s*)([\s\S]*?)(\s*)$/,I=function(){return String.prototype.trim?function(a){return b.isString(a)?a.trim():a}:function(a){return b.isString(a)?a.replace(/^\s\s*/,"").replace(/\s\s*$/,""):a}}();b.module("ngSanitize",[]).provider("$sanitize",c),b.module("ngSanitize").filter("linky",["$sanitize",function(a){var c=/((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"]/,e=/^mailto:/;return function(f,g){function h(a){a&&n.push(d(a))}function i(a,c){n.push("'),h(c),n.push(" ")}if(!f)return f;for(var j,k,l,m=f,n=[];j=m.match(c);)k=j[0],j[2]==j[3]&&(k="mailto:"+k),l=j.index,h(m.substr(0,l)),i(k,j[0].replace(e,"")),m=m.substring(l+j[0].length);return h(m),a(n.join(""))}}])}(window,window.angular)}({},function(){return this}());
\ No newline at end of file
diff --git a/ajax/libs/textAngular/1.3.0-pre13/dist/textAngular.min.js b/ajax/libs/textAngular/1.3.0-pre13/dist/textAngular.min.js
new file mode 100644
index 000000000..812c01f99
--- /dev/null
+++ b/ajax/libs/textAngular/1.3.0-pre13/dist/textAngular.min.js
@@ -0,0 +1,18 @@
+!function(a,b){b["true"]=a,/*
+@license textAngular
+Author : Austin Anderson
+License : 2013 MIT
+Version 1.3.0-pre12
+
+See README.md or https://github.com/fraywing/textAngular/wiki for requirements and use.
+*/
+angular.module("textAngularSetup",[]).value("taOptions",{toolbar:[["h1","h2","h3","h4","h5","h6","p","pre","quote"],["bold","italics","underline","strikeThrough","ul","ol","redo","undo","clear"],["justifyLeft","justifyCenter","justifyRight","indent","outdent"],["html","insertImage","insertLink","insertVideo","wordcount","charcount"]],classes:{focussed:"focussed",toolbar:"btn-toolbar",toolbarGroup:"btn-group",toolbarButton:"btn btn-default",toolbarButtonActive:"active",disabled:"disabled",textEditor:"form-control",htmlEditor:"form-control"},setup:{textEditorSetup:function(){},htmlEditorSetup:function(){}},defaultFileDropHandler:function(a,b){var c=new FileReader;return"image"===a.type.substring(0,5)?(c.onload=function(){""!==c.result&&b("insertImage",c.result,!0)},c.readAsDataURL(a),!0):!1}}).value("taSelectableElements",["a","img"]).value("taCustomRenderers",[{selector:"img",customAttribute:"ta-insert-video",renderLogic:function(a){var b=angular.element(""),c=a.prop("attributes");angular.forEach(c,function(a){b.attr(a.name,a.value)}),b.attr("src",b.attr("ta-insert-video")),a.replaceWith(b)}}]).value("taTranslations",{html:{buttontext:"Toggle HTML",tooltip:"Toggle html / Rich Text"},heading:{tooltip:"Heading "},p:{tooltip:"Paragraph"},pre:{tooltip:"Preformatted text"},ul:{tooltip:"Unordered List"},ol:{tooltip:"Ordered List"},quote:{tooltip:"Quote/unqoute selection or paragraph"},undo:{tooltip:"Undo"},redo:{tooltip:"Redo"},bold:{tooltip:"Bold"},italic:{tooltip:"Italic"},underline:{tooltip:"Underline"},strikeThrough:{tooltip:"Strikethrough"},justifyLeft:{tooltip:"Align text left"},justifyRight:{tooltip:"Align text right"},justifyCenter:{tooltip:"Center"},indent:{tooltip:"Increase indent"},outdent:{tooltip:"Decrease indent"},clear:{tooltip:"Clear formatting"},insertImage:{dialogPrompt:"Please enter an image URL to insert",tooltip:"Insert image",hotkey:"the - possibly language dependent hotkey ... for some future implementation"},insertVideo:{tooltip:"Insert video",dialogPrompt:"Please enter a youtube URL to embed"},insertLink:{tooltip:"Insert / edit link",dialogPrompt:"Please enter a URL to insert"},wordcount:{tooltip:"Display words Count"},charcount:{tooltip:"Display characters Count"}}).run(["taRegisterTool","$window","taTranslations","taSelection",function(a,b,c,d){a("html",{buttontext:c.html.buttontext,tooltiptext:c.html.tooltip,action:function(){this.$editor().switchView()},activeState:function(){return this.$editor().showHtml}});var e=function(a){return function(){return this.$editor().queryFormatBlockState(a)}},f=function(){return this.$editor().wrapSelection("formatBlock","<"+this.name.toUpperCase()+">")};angular.forEach(["h1","h2","h3","h4","h5","h6"],function(b){a(b.toLowerCase(),{buttontext:b.toUpperCase(),tooltiptext:c.heading.tooltip+b.charAt(1),action:f,activeState:e(b.toLowerCase())})}),a("p",{buttontext:"P",tooltiptext:c.p.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","")},activeState:function(){return this.$editor().queryFormatBlockState("p")}}),a("pre",{buttontext:"pre",tooltiptext:c.pre.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","
")},activeState:function(){return this.$editor().queryFormatBlockState("pre")}}),a("ul",{iconclass:"fa fa-list-ul",tooltiptext:c.ul.tooltip,action:function(){return this.$editor().wrapSelection("insertUnorderedList",null)},activeState:function(){return this.$editor().queryCommandState("insertUnorderedList")}}),a("ol",{iconclass:"fa fa-list-ol",tooltiptext:c.ol.tooltip,action:function(){return this.$editor().wrapSelection("insertOrderedList",null)},activeState:function(){return this.$editor().queryCommandState("insertOrderedList")}}),a("quote",{iconclass:"fa fa-quote-right",tooltiptext:c.quote.tooltip,action:function(){return this.$editor().wrapSelection("formatBlock","")},activeState:function(){return this.$editor().queryFormatBlockState("blockquote")}}),a("undo",{iconclass:"fa fa-undo",tooltiptext:c.undo.tooltip,action:function(){return this.$editor().wrapSelection("undo",null)}}),a("redo",{iconclass:"fa fa-repeat",tooltiptext:c.redo.tooltip,action:function(){return this.$editor().wrapSelection("redo",null)}}),a("bold",{iconclass:"fa fa-bold",tooltiptext:c.bold.tooltip,action:function(){return this.$editor().wrapSelection("bold",null)},activeState:function(){return this.$editor().queryCommandState("bold")},commandKeyCode:98}),a("justifyLeft",{iconclass:"fa fa-align-left",tooltiptext:c.justifyLeft.tooltip,action:function(){return this.$editor().wrapSelection("justifyLeft",null)},activeState:function(a){var b=!1;return a&&(b="left"===a.css("text-align")||"left"===a.attr("align")||"right"!==a.css("text-align")&&"center"!==a.css("text-align")&&"justify"!==a.css("text-align")&&!this.$editor().queryCommandState("justifyRight")&&!this.$editor().queryCommandState("justifyCenter")&&!this.$editor().queryCommandState("justifyFull")),b=b||this.$editor().queryCommandState("justifyLeft")}}),a("justifyRight",{iconclass:"fa fa-align-right",tooltiptext:c.justifyRight.tooltip,action:function(){return this.$editor().wrapSelection("justifyRight",null)},activeState:function(a){var b=!1;return a&&(b="right"===a.css("text-align")),b=b||this.$editor().queryCommandState("justifyRight")}}),a("justifyCenter",{iconclass:"fa fa-align-center",tooltiptext:c.justifyCenter.tooltip,action:function(){return this.$editor().wrapSelection("justifyCenter",null)},activeState:function(a){var b=!1;return a&&(b="center"===a.css("text-align")),b=b||this.$editor().queryCommandState("justifyCenter")}}),a("indent",{iconclass:"fa fa-indent",tooltiptext:c.indent.tooltip,action:function(){return this.$editor().wrapSelection("indent",null)},activeState:function(){return this.$editor().queryFormatBlockState("blockquote")}}),a("outdent",{iconclass:"fa fa-outdent",tooltiptext:c.outdent.tooltip,action:function(){return this.$editor().wrapSelection("outdent",null)},activeState:function(){return!1}}),a("italics",{iconclass:"fa fa-italic",tooltiptext:c.italic.tooltip,action:function(){return this.$editor().wrapSelection("italic",null)},activeState:function(){return this.$editor().queryCommandState("italic")},commandKeyCode:105}),a("underline",{iconclass:"fa fa-underline",tooltiptext:c.underline.tooltip,action:function(){return this.$editor().wrapSelection("underline",null)},activeState:function(){return this.$editor().queryCommandState("underline")},commandKeyCode:117}),a("strikeThrough",{iconclass:"fa fa-strikethrough",action:function(){return this.$editor().wrapSelection("strikeThrough",null)},activeState:function(){return document.queryCommandState("strikeThrough")}}),a("clear",{iconclass:"fa fa-ban",tooltiptext:c.clear.tooltip,action:function(a,b){var c;this.$editor().wrapSelection("removeFormat",null);var e=angular.element(d.getSelectionElement()),f=function(a){a=angular.element(a);var b=a;angular.forEach(a.children(),function(a){var c=angular.element("
");c.html(angular.element(a).html()),b.after(c),b=c}),a.remove()};if(angular.forEach(e.find("ul"),f),angular.forEach(e.find("ol"),f),"li"===e[0].tagName.toLowerCase()){var g=e[0].parentNode.childNodes,h=[],i=[],j=!1;for(c=0;c
");if(l.html(angular.element(e[0]).html()),0===h.length||0===i.length)0===i.length?k.after(l):k[0].parentNode.insertBefore(l[0],k[0]),0===h.length&&0===i.length?k.remove():angular.element(e[0]).remove();else{var m=angular.element("<"+k[0].tagName+">"+k[0].tagName+">"),n=angular.element("<"+k[0].tagName+">"+k[0].tagName+">");for(c=0;c'),g=angular.element('100% ');g.on("click",function(a){a.preventDefault(),b.css({width:"100%",height:""}),d()});var h=angular.element('50% ');h.on("click",function(a){a.preventDefault(),b.css({width:"50%",height:""}),d()});var i=angular.element('25% ');i.on("click",function(a){a.preventDefault(),b.css({width:"25%",height:""}),d()});var j=angular.element('Reset ');j.on("click",function(a){a.preventDefault(),b.css({width:"",height:""}),d()}),f.append(g),f.append(h),f.append(i),f.append(j),e.append(f),f=angular.element('');var k=angular.element('
');k.on("click",function(a){a.preventDefault(),b.css("float","left"),b.css("cssFloat","left"),b.css("styleFloat","left"),d()});var l=angular.element('
');l.on("click",function(a){a.preventDefault(),b.css("float","right"),b.css("cssFloat","right"),b.css("styleFloat","right"),d()});var m=angular.element('
');m.on("click",function(a){a.preventDefault(),b.css("float",""),b.css("cssFloat",""),b.css("styleFloat",""),d()}),f.append(k),f.append(m),f.append(l),e.append(f),f=angular.element('
');var n=angular.element('
');n.on("click",function(a){a.preventDefault(),b.remove(),d()}),f.append(n),e.append(f),c.showPopover(b),c.showResizeOverlay(b)};a("insertImage",{iconclass:"fa fa-picture-o",tooltiptext:c.insertImage.tooltip,action:function(){var a;return a=b.prompt(c.insertImage.dialogPrompt,"http://"),a&&""!==a&&"http://"!==a?this.$editor().wrapSelection("insertImage",a,!0):void 0},onElementSelect:{element:"img",action:g}}),a("insertVideo",{iconclass:"fa fa-youtube-play",tooltiptext:c.insertVideo.tooltip,action:function(){var a;if(a=b.prompt(c.insertVideo.dialogPrompt,"https://"),a&&""!==a&&"https://"!==a){var d=a.match(/(\?|&)v=[^&]*/);if(d.length>0){var e="https://www.youtube.com/embed/"+d[0].substring(3),f='
';return this.$editor().wrapSelection("insertHTML",f,!0)}}},onElementSelect:{element:"img",onlyWithAttrs:["ta-insert-video"],action:g}}),a("insertLink",{tooltiptext:c.insertLink.tooltip,iconclass:"fa fa-link",action:function(){var a;return a=b.prompt(c.insertLink.dialogPrompt,"http://"),a&&""!==a&&"http://"!==a?this.$editor().wrapSelection("createLink",a,!0):void 0},activeState:function(a){return a?"A"===a[0].tagName:!1},onElementSelect:{element:"a",action:function(a,d,e){a.preventDefault(),e.displayElements.popover.css("width","435px");var f=e.displayElements.popoverContainer;f.empty(),f.css("line-height","28px");var g=angular.element('
'+d.attr("href")+" ");g.css({display:"inline-block","max-width":"200px",overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","vertical-align":"middle"}),f.append(g);var h=angular.element('
'),i=angular.element('
');i.on("click",function(a){a.preventDefault();var f=b.prompt(c.insertLink.dialogPrompt,d.attr("href"));f&&""!==f&&"http://"!==f&&(d.attr("href",f),e.updateTaBindtaTextElement()),e.hidePopover()}),h.append(i);var j=angular.element('
');j.on("click",function(a){a.preventDefault(),d.replaceWith(d.contents()),e.updateTaBindtaTextElement(),e.hidePopover()}),h.append(j);var k=angular.element('
Open in New Window ');"_blank"===d.attr("target")&&k.addClass("active"),k.on("click",function(a){a.preventDefault(),d.attr("target","_blank"===d.attr("target")?"":"_blank"),k.toggleClass("active"),e.updateTaBindtaTextElement()}),h.append(k),f.append(h),e.showPopover(d)}}}),a("wordcount",{display:'
Words:{{wordcount}}
',disabled:!0,wordcount:0,activeState:function(){var a=this.$editor().displayElements.text,b=a[0].innerHTML,c=b.replace(/(<[^>]*?>)/gi," "),d=c.match(/\S+/g),e=d&&d.length||0;return this.wordcount=e,this.$editor().wordcount=e,!1}}),a("charcount",{display:'
Characters:{{charcount}}
',disabled:!0,charcount:0,activeState:function(){var a=this.$editor().displayElements.text,b=a[0].innerText||a[0].textContent,c=b.replace(/(\r\n|\n|\r)/gm,"").replace(/^\s+/g," ").replace(/\s+$/g," ").length;return this.charcount=c,this.$editor().charcount=c,!1}})}]),/*
+@license textAngular
+Author : Austin Anderson
+License : 2013 MIT
+Version 1.3.0-pre12
+
+See README.md or https://github.com/fraywing/textAngular/wiki for requirements and use.
+*/
+function(){"Use Strict";function a(a){try{return 0!==angular.element(a).length}catch(b){return!1}}function b(a,c){var d=[],e=a.children();return e.length&&angular.forEach(e,function(a){d=d.concat(b(angular.element(a),c))}),void 0!==a.attr(c)&&d.push(a),d}function c(b,c){if(!b||""===b||s.hasOwnProperty(b))throw"textAngular Error: A unique name is required for a Tool Definition";if(c.display&&(""===c.display||!a(c.display))||!c.display&&!c.buttontext&&!c.iconclass)throw'textAngular Error: Tool Definition for "'+b+'" does not have a valid display/iconclass/buttontext value';s[b]=c}var d={ie:function(){for(var a,b=3,c=document.createElement("div"),d=c.getElementsByTagName("i");c.innerHTML="",d[0];);return b>4?b:a}(),webkit:/AppleWebKit\/([\d.]+)/i.test(navigator.userAgent)},e=!1;d.webkit&&(document.addEventListener("mousedown",function(a){var b=a||window.event,c=b.target;if(e&&null!==c){for(var d=!1,f=c;null!==f&&"html"!==f.tagName.toLowerCase()&&!d;)d="true"===f.contentEditable,f=f.parentNode;d||(document.getElementById("textAngular-editableFix-010203040506070809").setSelectionRange(0,0),c.focus(),c.select&&c.select())}e=!1},!1),angular.element(document).ready(function(){angular.element(document.body).append(angular.element('
'))}));var f=/^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/gi,g=/^(ul|li|ol)$/gi,h=/^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/gi;String.prototype.trim||(String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")});var i,j,k,l,m;if(d.ie>8||void 0===d.ie){for(var n,o=document.styleSheets,p=0;p
"),html:angular.element(""),text:angular.element("
"),scrollWindow:angular.element("
"),popover:angular.element('
'),popoverArrow:angular.element('
'),popoverContainer:angular.element('
'),resize:{overlay:angular.element('
'),background:angular.element('
'),anchors:[angular.element('
'),angular.element('
'),angular.element('
'),angular.element('
')],info:angular.element('
')}},l.displayElements.popover.append(l.displayElements.popoverArrow),l.displayElements.popover.append(l.displayElements.popoverContainer),l.displayElements.scrollWindow.append(l.displayElements.popover),l.displayElements.popover.on("mousedown",function(a,b){return b&&angular.extend(a,b),a.preventDefault(),!1}),l.showPopover=function(a){l.displayElements.popover.css("display","block"),l.reflowPopover(a),i.addClass(l.displayElements.popover,"in"),A(m,"click keyup",function(){l.hidePopover()})},l.reflowPopover=function(a){l.displayElements.text[0].offsetHeight-51>a[0].offsetTop?(l.displayElements.popover.css("top",a[0].offsetTop+a[0].offsetHeight+"px"),l.displayElements.popover.removeClass("top").addClass("bottom")):(l.displayElements.popover.css("top",a[0].offsetTop-54+"px"),l.displayElements.popover.removeClass("bottom").addClass("top"));var b=l.displayElements.text[0].offsetWidth-l.displayElements.popover[0].offsetWidth,c=a[0].offsetLeft+a[0].offsetWidth/2-l.displayElements.popover[0].offsetWidth/2;l.displayElements.popover.css("left",Math.max(0,Math.min(b,c))+"px"),l.displayElements.popoverArrow.css("margin-left",Math.min(c,Math.max(0,c-b))-11+"px")},l.hidePopover=function(){var a=function(){l.displayElements.popover.css("display",""),l.displayElements.popoverContainer.attr("style",""),l.displayElements.popoverContainer.attr("class","popover-content")};k.when(i.removeClass(l.displayElements.popover,"in",a)).then(a)},l.displayElements.resize.overlay.append(l.displayElements.resize.background),angular.forEach(l.displayElements.resize.anchors,function(a){l.displayElements.resize.overlay.append(a)}),l.displayElements.resize.overlay.append(l.displayElements.resize.info),l.displayElements.scrollWindow.append(l.displayElements.resize.overlay),l.reflowResizeOverlay=function(a){a=angular.element(a)[0],l.displayElements.resize.overlay.css({display:"block",left:a.offsetLeft-5+"px",top:a.offsetTop-5+"px",width:a.offsetWidth+10+"px",height:a.offsetHeight+10+"px"}),l.displayElements.resize.info.text(a.offsetWidth+" x "+a.offsetHeight)},l.showResizeOverlay=function(a){var b=function(b){var c={width:parseInt(a.attr("width")),height:parseInt(a.attr("height")),x:b.clientX,y:b.clientY};void 0===c.width&&(c.width=a[0].offsetWidth),void 0===c.height&&(c.height=a[0].offsetHeight),l.hidePopover();var d=c.height/c.width,e=function(b){var e={x:Math.max(0,c.width+(b.clientX-c.x)),y:Math.max(0,c.height+(b.clientY-c.y))},f=function(a,b){a=angular.element(a),"img"===a[0].tagName.toLowerCase()&&(b.height&&(a.attr("height",b.height),delete b.height),b.width&&(a.attr("width",b.width),delete b.width)),a.css(b)};if(b.shiftKey){var g=e.y/e.x;f(a,{width:d>g?e.x:e.y/d,height:d>g?e.x*d:e.y})}else f(a,{width:e.x,height:e.y});l.reflowResizeOverlay(a)};h.find("body").on("mousemove",e),A(l.displayElements.resize.overlay,"mouseup",function(){h.find("body").off("mousemove",e),l.showPopover(a)}),b.stopPropagation(),b.preventDefault()};l.displayElements.resize.anchors[3].on("mousedown",b),l.reflowResizeOverlay(a),A(m,"click",function(){l.hideResizeOverlay()})},l.hideResizeOverlay=function(){l.displayElements.resize.overlay.css("display","")},l.setup.htmlEditorSetup(l.displayElements.html),l.setup.textEditorSetup(l.displayElements.text),l.displayElements.html.attr({id:"taHtmlElement"+y,"ng-show":"showHtml","ta-bind":"ta-bind","ng-model":"html"}),l.displayElements.text.attr({id:"taTextElement"+y,contentEditable:"true","ta-bind":"ta-bind","ng-model":"html"}),l.displayElements.scrollWindow.attr({"ng-hide":"showHtml"}),n.taDefaultWrap&&l.displayElements.text.attr("ta-default-wrap",n.taDefaultWrap),n.taUnsafeSanitizer&&(l.displayElements.text.attr("ta-unsafe-sanitizer",n.taUnsafeSanitizer),l.displayElements.html.attr("ta-unsafe-sanitizer",n.taUnsafeSanitizer)),l.displayElements.scrollWindow.append(l.displayElements.text),m.append(l.displayElements.scrollWindow),m.append(l.displayElements.html),l.displayElements.forminput.attr("name",z),m.append(l.displayElements.forminput),n.tabindex&&(m.removeAttr("tabindex"),l.displayElements.text.attr("tabindex",n.tabindex),l.displayElements.html.attr("tabindex",n.tabindex)),n.placeholder&&(l.displayElements.text.attr("placeholder",n.placeholder),l.displayElements.html.attr("placeholder",n.placeholder)),n.taDisabled&&(l.displayElements.text.attr("ta-readonly","disabled"),l.displayElements.html.attr("ta-readonly","disabled"),l.disabled=l.$parent.$eval(n.taDisabled),l.$parent.$watch(n.taDisabled,function(a){l.disabled=a,l.disabled?m.addClass(l.classes.disabled):m.removeClass(l.classes.disabled)})),a(l.displayElements.scrollWindow)(l),a(l.displayElements.html)(l),l.updateTaBindtaTextElement=l["updateTaBindtaTextElement"+y],l.updateTaBindtaHtmlElement=l["updateTaBindtaHtmlElement"+y],m.addClass("ta-root"),l.displayElements.scrollWindow.addClass("ta-text ta-editor "+l.classes.textEditor),l.displayElements.html.addClass("ta-html ta-editor "+l.classes.htmlEditor),l._actionRunning=!1;var B=!1;if(l.startAction=function(){return l._actionRunning=!0,B=g.rangy.saveSelection(),function(){B&&g.rangy.restoreSelection(B)}},l.endAction=function(){l._actionRunning=!1,B&&g.rangy.removeMarkers(B),B=!1,l.updateSelectedStyles(),l.showHtml||l["updateTaBindtaTextElement"+y]()},t=function(){m.addClass(l.classes.focussed),w.focus()},l.displayElements.html.on("focus",t),l.displayElements.text.on("focus",t),u=function(a){return l._actionRunning||h[0].activeElement===l.displayElements.html[0]||h[0].activeElement===l.displayElements.text[0]||(m.removeClass(l.classes.focussed),w.unfocus(),b(function(){m.triggerHandler("blur")},0)),a.preventDefault(),!1},l.displayElements.html.on("blur",u),l.displayElements.text.on("blur",u),l.queryFormatBlockState=function(a){return!l.showHtml&&a.toLowerCase()===h[0].queryCommandValue("formatBlock").toLowerCase()},l.queryCommandState=function(a){return l.showHtml?"":h[0].queryCommandState(a)},l.switchView=function(){l.showHtml=!l.showHtml,i.enabled(!1,l.displayElements.html),i.enabled(!1,l.displayElements.text),l.showHtml?b(function(){return i.enabled(!0,l.displayElements.html),i.enabled(!0,l.displayElements.text),l.displayElements.html[0].focus()},100):b(function(){return i.enabled(!0,l.displayElements.html),i.enabled(!0,l.displayElements.text),l.displayElements.text[0].focus()},100)},n.ngModel){var C=!0;o.$render=function(){if(C){C=!1;var a=l.$parent.$eval(n.ngModel);void 0!==a&&null!==a||!v||""===v||o.$setViewValue(v)}l.displayElements.forminput.val(o.$viewValue),l._elementSelectTriggered||h[0].activeElement===l.displayElements.html[0]||h[0].activeElement===l.displayElements.text[0]||(l.html=o.$viewValue||"")};var D=function(a){return n.required&&o.$setValidity("required",!(!a||""===a.trim())),a};o.$parsers.push(D),o.$formatters.push(D)}else l.displayElements.forminput.val(v),l.html=v;if(l.$watch("html",function(a,b){a!==b&&(n.ngModel&&o.$viewValue!==a&&o.$setViewValue(a),l.displayElements.forminput.val(a))}),n.taTargetToolbars)w=f.registerEditor(z,l,n.taTargetToolbars.split(","));else{var E=angular.element('');n.taToolbar&&E.attr("ta-toolbar",n.taToolbar),n.taToolbarClass&&E.attr("ta-toolbar-class",n.taToolbarClass),n.taToolbarGroupClass&&E.attr("ta-toolbar-group-class",n.taToolbarGroupClass),n.taToolbarButtonClass&&E.attr("ta-toolbar-button-class",n.taToolbarButtonClass),n.taToolbarActiveButtonClass&&E.attr("ta-toolbar-active-button-class",n.taToolbarActiveButtonClass),n.taFocussedClass&&E.attr("ta-focussed-class",n.taFocussedClass),m.prepend(E),a(E)(l.$parent),w=f.registerEditor(z,l,["textAngularToolbar"+y])}l.$on("$destroy",function(){f.unregisterEditor(z)}),l.$on("ta-element-select",function(a,b){w.triggerElementSelect(a,b)&&l["reApplyOnSelectorHandlerstaTextElement"+y]()}),l.$on("ta-drop-event",function(a,c,d,e){l.displayElements.text[0].focus(),e&&e.files&&e.files.length>0?(angular.forEach(e.files,function(a){try{k.when(l.fileDropHandler(a,l.wrapSelection)||l.fileDropHandler!==l.defaultFileDropHandler&&k.when(l.defaultFileDropHandler(a,l.wrapSelection))).then(function(){l["updateTaBindtaTextElement"+y]()})}catch(b){j.error(b)}}),d.preventDefault(),d.stopPropagation()):b(function(){l["updateTaBindtaTextElement"+y]()},0)}),l._bUpdateSelectedStyles=!1,l.updateSelectedStyles=function(){var a;void 0!==(a=d.getSelectionElement())&&a.parentNode!==l.displayElements.text[0]?w.updateSelectedStyles(angular.element(a)):w.updateSelectedStyles(),l._bUpdateSelectedStyles&&b(l.updateSelectedStyles,200)},p=function(){l._bUpdateSelectedStyles||(l._bUpdateSelectedStyles=!0,l.$apply(function(){l.updateSelectedStyles()}))},l.displayElements.html.on("keydown",p),l.displayElements.text.on("keydown",p),q=function(){l._bUpdateSelectedStyles=!1},l.displayElements.html.on("keyup",q),l.displayElements.text.on("keyup",q),r=function(a,b){b&&angular.extend(a,b),l.$apply(function(){return w.sendKeyCommand(a)?(l._bUpdateSelectedStyles||l.updateSelectedStyles(),a.preventDefault(),!1):void 0})},l.displayElements.html.on("keypress",r),l.displayElements.text.on("keypress",r),s=function(){l._bUpdateSelectedStyles=!1,l.$apply(function(){l.updateSelectedStyles()})},l.displayElements.html.on("mouseup",s),l.displayElements.text.on("mouseup",s)}}}]).factory("taBrowserTag",[function(){return function(a){return a?""===a?void 0===d.ie?"div":d.ie<=8?"P":"p":d.ie<=8?a.toUpperCase():a:d.ie<=8?"P":"p"}}]).factory("taExecCommand",["taSelection","taBrowserTag","$document",function(a,b,c){var d=function(b,c){var d,e,f=b.find("li");for(e=f.length-1;e>=0;e--)d=angular.element("<"+c+">"+f[e].innerHTML+""+c+">"),b.after(d);b.remove(),a.setSelectionToElementEnd(d[0])},e=function(b){/(
)$/i.test(b.innerHTML.trim())?a.setSelectionBeforeElement(angular.element(b).find("br")[0]):a.setSelectionToElementEnd(b)},h=function(a,b){var c=angular.element("<"+b+">"+a[0].innerHTML+""+b+">");a.after(c),a.remove(),e(c.find("li")[0])},i=function(a,c,d){for(var f="",g=0;g
"+a[g].innerHTML+""+b("li")+">";var h=angular.element("<"+d+">"+f+""+d+">");c.after(h),c.remove(),e(h.find("li")[0])};return function(e,j){return e=b(e),function(k,l,m){var n,o,p,q,r,s,t,u=angular.element("<"+e+">");try{t=a.getSelectionElement()}catch(v){}var w=angular.element(t);if(void 0!==t){var x=t.tagName.toLowerCase();if("insertorderedlist"===k.toLowerCase()||"insertunorderedlist"===k.toLowerCase()){var y=b("insertorderedlist"===k.toLowerCase()?"ol":"ul");if(x===y)return d(w,e);if("li"===x&&w.parent()[0].tagName.toLowerCase()===y&&1===w.parent().children().length)return d(w.parent(),e);if("li"===x&&w.parent()[0].tagName.toLowerCase()!==y&&1===w.parent().children().length)return h(w.parent(),y);if(x.match(f)&&!w.hasClass("ta-bind")){if("ol"===x||"ul"===x)return h(w,y);var z=!1;return angular.forEach(w.children(),function(a){a.tagName.match(f)&&(z=!0)}),z?i(w.children(),w,y):i([angular.element(""+t.innerHTML+"
")[0]],w,y)}if(x.match(f)){if(q=a.getOnlySelectedElements(),0===q.length)o=angular.element("<"+y+">"+t.innerHTML+" "+y+">"),w.html(""),w.append(o);else{if(1===q.length&&("ol"===q[0].tagName.toLowerCase()||"ul"===q[0].tagName.toLowerCase()))return q[0].tagName.toLowerCase()===y?d(angular.element(q[0]),e):h(angular.element(q[0]),y);p="";var A=[];for(n=0;n"+B[0].innerHTML+""+b("li")+">",A.unshift(B)}o=angular.element("<"+y+">"+p+""+y+">"),A.pop().replaceWith(o),angular.forEach(A,function(a){a.remove()})}return void a.setSelectionToElementEnd(o[0])}}else{if("formatblock"===k.toLowerCase()){for(s=m.toLowerCase().replace(/[<>]/gi,""),"default"===s.trim()&&(s=e,m="<"+e+">"),o="li"===x?w.parent():w;!o[0].tagName||!o[0].tagName.match(f)&&!o.parent().attr("contenteditable");)o=o.parent(),x=(o[0].tagName||"").toLowerCase();if(x===s){q=o.children();var C=!1;for(n=0;n=0;n--)q[n].parentNode&&q[n].parentNode.removeChild(q[n])}else for(n=0;n"),u[0].innerHTML=E[n].outerHTML,E[n]=u[0]),D.parent()[0].insertBefore(E[n],D[0]);D.remove()}return void a.setSelectionToElementEnd(o[0])}if("createlink"===k.toLowerCase()){var F=a.getSelection();if(F.collapsed)return void a.insertHtml(''+m+" ",j)}else if("inserthtml"===k.toLowerCase())return void a.insertHtml(m,j)}}try{c[0].execCommand(k,l,m)}catch(v){}}}}]).directive("taBind",["taSanitize","$timeout","$window","$document","taFixChrome","taBrowserTag","taSelection","taSelectableElements","taApplyCustomRenderers","taOptions",function(a,b,c,f,g,i,l,m,n,o){return{require:"ngModel",link:function(i,p,r,s){var t,u,v,w=void 0!==p.attr("contenteditable")&&p.attr("contenteditable"),x=w||"textarea"===p[0].tagName.toLowerCase()||"input"===p[0].tagName.toLowerCase(),y=!1,z=!1,A=r.taUnsafeSanitizer||o.disableSanitizer,B=/^(9|19|20|27|33|34|35|36|37|38|39|40|45|112|113|114|115|116|117|118|119|120|121|122|123|144|145)$/i,C=/^(8|13|32|46|59|61|107|109|186|187|188|189|190|191|192|219|220|221|222)$/i,D=/<(a|abbr|acronym|bdi|bdo|big|cite|code|del|dfn|img|ins|kbd|label|map|mark|q|ruby|rp|rt|s|samp|time|tt|var)[^>]*>/i,E=/^<[^>]+>(\s| )*<\/[^>]+>$/gi;void 0===r.taDefaultWrap&&(r.taDefaultWrap="p"),""===r.taDefaultWrap?(u="",v=void 0===d.ie?"
":d.ie>=11?"
":d.ie<=8?"
":"
"):(u=void 0===d.ie||d.ie>=11?"<"+r.taDefaultWrap+"> "+r.taDefaultWrap+">":d.ie<=8?"<"+r.taDefaultWrap.toUpperCase()+">"+r.taDefaultWrap.toUpperCase()+">":"<"+r.taDefaultWrap+">"+r.taDefaultWrap+">",v=void 0===d.ie||d.ie>=11?"<"+r.taDefaultWrap+"> "+r.taDefaultWrap+">":d.ie<=8?"<"+r.taDefaultWrap.toUpperCase()+"> "+r.taDefaultWrap.toUpperCase()+">":"<"+r.taDefaultWrap+"> "+r.taDefaultWrap+">");var F=function(a){return a=a.trim(),0===a.length||a===v||E.test(a)||!(/>\s*(([^\s<]+)\s*)+]+\s*)+$/i.test(a)||D.test(a))};p.addClass("ta-bind");var G;i["$undoManager"+(r.id||"")]=s.$undoManager={_stack:[],_index:0,_max:1e3,push:function(a){return"undefined"==typeof a||null===a||"undefined"!=typeof this.current()&&null!==this.current()&&a===this.current()?a:(this._indexthis._max&&this._stack.shift(),this._index=this._stack.length-1,a)},undo:function(){return this.setToIndex(this._index-1)},redo:function(){return this.setToIndex(this._index+1)},setToIndex:function(a){return 0>a||a>this._stack.length-1?void 0:(this._index=a,this.current())},current:function(){return this._stack[this._index]}};var H=i["$undoTaBind"+(r.id||"")]=function(){if(!y&&w){var a=s.$undoManager.undo();"undefined"!=typeof a&&null!==a&&(p[0].innerHTML=a,K(a,!1),l.setSelectionToElementEnd(p[0].childNodes.length?p[0].childNodes[p[0].childNodes.length-1]:p[0]))}},I=i["$redoTaBind"+(r.id||"")]=function(){if(!y&&w){var a=s.$undoManager.redo();"undefined"!=typeof a&&null!==a&&(p[0].innerHTML=a,K(a,!1),l.setSelectionToElementEnd(p[0].childNodes.length?p[0].childNodes[p[0].childNodes.length-1]:p[0]))}},J=function(){if(w)return p[0].innerHTML;if(x)return p.val();throw"textAngular Error: attempting to update non-editable taBind"},K=function(a,b){("undefined"==typeof b||null===b)&&(b=!0&&w),("undefined"==typeof a||null===a)&&(a=J()),F(a)?(""!==s.$viewValue&&s.$setViewValue(""),b&&""!==s.$undoManager.current()&&s.$undoManager.push("")):s.$viewValue!==a&&(s.$setViewValue(a),b&&s.$undoManager.push(a))};if(i["updateTaBind"+(r.id||"")]=function(){y||K()},x)if(w){var L=function(a,b,c){p[0].childNodes&&p[0].childNodes.length>0?c(a,b):(that={s:a,_:b,cb:c},that.callself=function(){L(that.s,that._,that.cb)},setTimeout(that.callself,20))},M=function(d,e){if(text=p[0].innerHTML,p[0].innerHTML=d,c.rangy.restoreSelection(e),text.trim().length){if(text.match(/class=["']*Mso(Normal|List)/i)){var f=text.match(/([\s\S]*?)/i);f=f?f[1]:text,f=f.replace(/[\s\S]*?<\/o:p>/gi,"").replace(/class=(["']|)MsoNormal(["']|)/gi,"");var g=angular.element(""+f+"
"),h=angular.element("
"),i={element:null,lastIndent:[],lastLi:null,isUl:!1};i.lastIndent.peek=function(){var a=this.length;return a>0?this[a-1]:void 0};for(var j=function(a){i.isUl=a,i.element=angular.element(a?"":""),i.lastIndent=[],i.lastIndent.peek=function(){var a=this.length;return a>0?this[a-1]:void 0},i.lastLevelMatch=null},k=0;k<=g[0].childNodes.length;k++)if(g[0].childNodes[k]&&"#text"!==g[0].childNodes[k].nodeName&&"p"===g[0].childNodes[k].tagName.toLowerCase()){var m=angular.element(g[0].childNodes[k]),n=(m.attr("class")||"").match(/MsoList(Bullet|Number|Paragraph)(CxSp(First|Middle|Last)|)/i);if(n){if(m[0].childNodes.length<2||m[0].childNodes[1].childNodes.length<1)continue;var o="bullet"===n[1].toLowerCase()||"number"!==n[1].toLowerCase()&&!(/^[^0-9a-z<]*[0-9a-z]+[^0-9a-z<>]]":""),i.lastLi.append(i.element);else if(null!=i.lastIndent.peek()&&i.lastIndent.peek()>r){for(;null!=i.lastIndent.peek()&&i.lastIndent.peek()>r;)if("li"!==i.element.parent()[0].tagName.toLowerCase()){if(!/[uo]l/i.test(i.element.parent()[0].tagName.toLowerCase()))break;i.element=i.element.parent(),i.lastIndent.pop()}else i.element=i.element.parent();i.isUl="ul"===i.element[0].tagName.toLowerCase(),o!==i.isUl&&(j(o),h.append(i.element))}i.lastLevelMatch=t,r!==i.lastIndent.peek()&&i.lastIndent.push(r),i.lastLi=angular.element(""),i.element.append(i.lastLi),i.lastLi.html(m.html().replace(/[\s\S]*?/gi,"")),m.remove()}else j(!1),h.append(m)}var u=function(a){a=angular.element(a);for(var b=a[0].childNodes.length-1;b>=0;b--)a.after(a[0].childNodes[b]);a.remove()};angular.forEach(h.find("span"),function(a){a.removeAttribute("lang"),a.attributes.length<=0&&u(a)}),angular.forEach(h.find("font"),u),text=h.html()}text=a(text,"",A),l.insertHtml(text,p[0]),b(function(){s.$setViewValue(J())},0)}};if(p.on("paste",function(a,b){b&&angular.extend(a,b);var d=c.rangy.saveSelection();if(y)return a.stopPropagation(),a.preventDefault(),!1;var e=p[0].innerHTML,f=(a.originalEvent||a).clipboardData;if(f&&f.getData){for(var g="",h=0;h$/i.test(c.innerHTML.trim())&&"blockquote"===c.parentNode.tagName.toLowerCase()&&!c.nextSibling){$selection=angular.element(c);var e=$selection.parent();e.after(d),$selection.remove(),0===e.children().length&&e.remove(),l.setSelectionToElementStart(d[0]),a.preventDefault()}else/^<[^>]+> <\/[^>]+>$/i.test(c.innerHTML.trim())&&"blockquote"===c.tagName.toLowerCase()&&($selection=angular.element(c),$selection.after(d),$selection.remove(),l.setSelectionToElementStart(d[0]),a.preventDefault())}}),p.on("keyup",function(a,c){if(c&&angular.extend(a,c),G&&b.cancel(G),!y&&!B.test(a.keyCode)){if(""!==u&&13===a.keyCode&&!a.shiftKey){for(var d=l.getSelectionElement();!d.tagName.match(h)&&d!==p[0];)d=d.parentNode;if(d.tagName.toLowerCase()!==r.taDefaultWrap&&"li"!==d.tagName.toLowerCase()&&(""===d.innerHTML.trim()||" "===d.innerHTML.trim())){var e=angular.element(u);angular.element(d).replaceWith(e),l.setSelectionToElementStart(e[0])}}var f=J();""!==u&&""===f.trim()&&(p[0].innerHTML=u,l.setSelectionToElementStart(p.children()[0]));var g=t!==a.keyCode&&C.test(a.keyCode);K(f,g),g||(G=b(function(){s.$undoManager.push(f)},250)),t=a.keyCode}}),p.on("blur",function(){z=!1,y||K(),s.$render()}),r.placeholder&&(d.ie>8||void 0===d.ie)){var N;if(!r.id)throw"textAngular Error: An unique ID is required for placeholders to work";N=j("#"+r.id+".placeholder-text:before",'content: "'+r.placeholder+'"'),i.$on("$destroy",function(){k(N)})}p.on("focus",function(){z=!0,s.$render()}),p.on("mousedown",function(a,b){b&&angular.extend(a,b),a.stopPropagation()})}else p.on("change blur",function(){y||s.$setViewValue(J())});var O=function(b){return s.$oldViewValue=a(g(b),s.$oldViewValue,A)},P=function(a){return r.required&&s.$setValidity("required",!F(a)),a};s.$parsers.push(O),s.$parsers.push(P),s.$formatters.push(O),s.$formatters.push(function(a){if(F(a))return a;var b=angular.element(""+a+"
");return 0===b.children().length&&(a="<"+r.taDefaultWrap+">"+a+""+r.taDefaultWrap+">"),a}),s.$formatters.push(P),s.$formatters.push(function(a){return s.$undoManager.push(a||"")});var Q=function(a){return i.$emit("ta-element-select",this),a.preventDefault(),!1},R=function(a,c){if(c&&angular.extend(a,c),!q&&!y){q=!0;var d;d=a.originalEvent?a.originalEvent.dataTransfer:a.dataTransfer,i.$emit("ta-drop-event",this,a,d),b(function(){q=!1,K(),S()},100)}},S=i["reApplyOnSelectorHandlers"+(r.id||"")]=function(){y||angular.forEach(m,function(a){p.find(a).off("click",Q).on("click",Q)})},T=function(a){p[0].innerHTML=a};s.$render=function(){var a=s.$viewValue||"";f[0].activeElement!==p[0]?w?(r.placeholder?""===a?(z?p.removeClass("placeholder-text"):p.addClass("placeholder-text"),T(u)):(p.removeClass("placeholder-text"),T(a)):T(""===a?u:a),y?p.off("drop",R):(S(),p.on("drop",R))):"textarea"!==p[0].tagName.toLowerCase()&&"input"!==p[0].tagName.toLowerCase()?T(n(a)):p.val(a):w&&p.removeClass("placeholder-text")},r.taReadonly&&(y=i.$eval(r.taReadonly),y?(p.addClass("ta-readonly"),("textarea"===p[0].tagName.toLowerCase()||"input"===p[0].tagName.toLowerCase())&&p.attr("disabled","disabled"),void 0!==p.attr("contenteditable")&&p.attr("contenteditable")&&p.removeAttr("contenteditable")):(p.removeClass("ta-readonly"),"textarea"===p[0].tagName.toLowerCase()||"input"===p[0].tagName.toLowerCase()?p.removeAttr("disabled"):w&&p.attr("contenteditable","true")),i.$watch(r.taReadonly,function(a,b){b!==a&&(a?(p.addClass("ta-readonly"),("textarea"===p[0].tagName.toLowerCase()||"input"===p[0].tagName.toLowerCase())&&p.attr("disabled","disabled"),void 0!==p.attr("contenteditable")&&p.attr("contenteditable")&&p.removeAttr("contenteditable"),angular.forEach(m,function(a){p.find(a).on("click",Q)}),p.off("drop",R)):(p.removeClass("ta-readonly"),"textarea"===p[0].tagName.toLowerCase()||"input"===p[0].tagName.toLowerCase()?p.removeAttr("disabled"):w&&p.attr("contenteditable","true"),angular.forEach(m,function(a){p.find(a).off("click",Q)}),p.on("drop",R)),y=a)})),w&&!y&&(angular.forEach(m,function(a){p.find(a).on("click",Q)}),p.on("drop",R),p.on("blur",function(){d.webkit&&(e=!0)}))}}}]).factory("taApplyCustomRenderers",["taCustomRenderers",function(a){return function(c){var d=angular.element("
");return d[0].innerHTML=c,angular.forEach(a,function(a){var c=[];a.selector&&""!==a.selector?c=d.find(a.selector):a.customAttribute&&""!==a.customAttribute&&(c=b(d,a.customAttribute)),angular.forEach(c,function(b){b=angular.element(b),a.selector&&""!==a.selector&&a.customAttribute&&""!==a.customAttribute?void 0!==b.attr(a.customAttribute)&&a.renderLogic(b):a.renderLogic(b)})}),d[0].innerHTML}}]).directive("taMaxText",function(){return{restrict:"A",require:"ngModel",link:function(a,b,c,d){function e(a){var b=angular.element("
");b.html(a);var c=b.text().length;return f>=c?(d.$setValidity("taMaxText",!0),a):void d.$setValidity("taMaxText",!1)}var f=parseInt(a.$eval(c.taMaxText));if(isNaN(f))throw"Max text must be an integer";c.$observe("taMaxText",function(a){if(f=parseInt(a),isNaN(f))throw"Max text must be an integer";d.$dirty&&d.$setViewValue(d.$viewValue)}),d.$parsers.unshift(e)}}}).directive("taMinText",function(){return{restrict:"A",require:"ngModel",link:function(a,b,c,d){function e(a){var b=angular.element("
");b.html(a);var c=b.text().length;return!c||c>=f?(d.$setValidity("taMinText",!0),a):void d.$setValidity("taMinText",!1)}var f=parseInt(a.$eval(c.taMinText));if(isNaN(f))throw"Min text must be an integer";c.$observe("taMinText",function(a){if(f=parseInt(a),isNaN(f))throw"Min text must be an integer";d.$dirty&&d.$setViewValue(d.$viewValue)}),d.$parsers.unshift(e)}}}).factory("taFixChrome",function(){var a=function(a){for(var b=angular.element(""+a+"
"),c=angular.element(b).find("span"),d=0;d0&&"BR"===e.next()[0].tagName&&e.next().remove(),e.replaceWith(e[0].innerHTML)))
+}var f=b[0].innerHTML.replace(/style="[^"]*?(line-height: 1.428571429;|color: inherit; line-height: 1.1;)[^"]*"/gi,"");return f!==b[0].innerHTML&&(b[0].innerHTML=f),b[0].innerHTML};return a}).factory("taSanitize",["$sanitize",function(a){return function(c,d,e){var f=angular.element(""+c+"
");angular.forEach(b(f,"align"),function(a){a.css("text-align",a.attr("align")),a.removeAttr("align")});var g;c=f[0].innerHTML;try{g=a(c),e&&(g=c)}catch(h){g=d||""}return g}}]).directive("textAngularToolbar",["$compile","textAngularManager","taOptions","taTools","taToolExecuteAction","$window",function(a,b,c,d,e,f){return{scope:{name:"@"},restrict:"EA",link:function(g,h,i){if(!g.name||""===g.name)throw"textAngular Error: A toolbar requires a name";angular.extend(g,angular.copy(c)),i.taToolbar&&(g.toolbar=g.$parent.$eval(i.taToolbar)),i.taToolbarClass&&(g.classes.toolbar=i.taToolbarClass),i.taToolbarGroupClass&&(g.classes.toolbarGroup=i.taToolbarGroupClass),i.taToolbarButtonClass&&(g.classes.toolbarButton=i.taToolbarButtonClass),i.taToolbarActiveButtonClass&&(g.classes.toolbarButtonActive=i.taToolbarActiveButtonClass),i.taFocussedClass&&(g.classes.focussed=i.taFocussedClass),g.disabled=!0,g.focussed=!1,g._$element=h,h[0].innerHTML="",h.addClass("ta-toolbar "+g.classes.toolbar),g.$watch("focussed",function(){g.focussed?h.addClass(g.classes.focussed):h.removeClass(g.classes.focussed)});var j=function(b,c){var d;if(d=angular.element(b&&b.display?b.display:""),d.addClass(b&&b["class"]?b["class"]:g.classes.toolbarButton),d.attr("name",c.name),d.attr("unselectable","on"),d.attr("ng-disabled","isDisabled()"),d.attr("tabindex","-1"),d.attr("ng-click","executeAction()"),d.attr("ng-class","displayActiveToolClass(active)"),b&&b.tooltiptext&&d.attr("title",b.tooltiptext),d.on("mousedown",function(a,b){return b&&angular.extend(a,b),a.preventDefault(),!1}),b&&!b.display&&!c._display&&(d[0].innerHTML="",b.buttontext&&(d[0].innerHTML=b.buttontext),b.iconclass)){var e=angular.element(""),f=d[0].innerHTML;e.addClass(b.iconclass),d[0].innerHTML="",d.append(e),f&&""!==f&&d.append(" "+f)}return c._lastToolDefinition=angular.copy(b),a(d)(c)};g.tools={},g._parent={disabled:!0,showHtml:!1,queryFormatBlockState:function(){return!1},queryCommandState:function(){return!1}};var k={$window:f,$editor:function(){return g._parent},isDisabled:function(){return"function"!=typeof this.$eval("disabled")&&this.$eval("disabled")||this.$eval("disabled()")||"html"!==this.name&&this.$editor().showHtml||this.$parent.disabled||this.$editor().disabled},displayActiveToolClass:function(a){return a?g.classes.toolbarButtonActive:""},executeAction:e};angular.forEach(g.toolbar,function(a){var b=angular.element(" ");b.addClass(g.classes.toolbarGroup),angular.forEach(a,function(a){g.tools[a]=angular.extend(g.$new(!0),d[a],k,{name:a}),g.tools[a].$element=j(d[a],g.tools[a]),b.append(g.tools[a].$element)}),h.append(b)}),g.updateToolDisplay=function(a,b,c){var d=g.tools[a];if(d){if(d._lastToolDefinition&&!c&&(b=angular.extend({},d._lastToolDefinition,b)),null===b.buttontext&&null===b.iconclass&&null===b.display)throw'textAngular Error: Tool Definition for updating "'+a+'" does not have a valid display/iconclass/buttontext value';null===b.buttontext&&delete b.buttontext,null===b.iconclass&&delete b.iconclass,null===b.display&&delete b.display;var e=j(b,d);d.$element.replaceWith(e),d.$element=e}},g.addTool=function(a,b,c,e){g.tools[a]=angular.extend(g.$new(!0),d[a],k,{name:a}),g.tools[a].$element=j(d[a],g.tools[a]);var f;void 0===c&&(c=g.toolbar.length-1),f=angular.element(h.children()[c]),void 0===e?(f.append(g.tools[a].$element),g.toolbar[c][g.toolbar[c].length-1]=a):(f.children().eq(e).after(g.tools[a].$element),g.toolbar[c][e]=a)},b.registerToolbar(g),g.$on("$destroy",function(){b.unregisterToolbar(g.name)})}}}]).service("taToolExecuteAction",["$q","$log",function(a,b){return function(c){void 0!==c&&(this.$editor=function(){return c});var d=a.defer(),e=d.promise,f=this.$editor();e["finally"](function(){f.endAction.call(f)});var g;try{g=this.action(d,f.startAction())}catch(h){b.error(h)}(g||void 0===g)&&d.resolve()}}]).service("textAngularManager",["taToolExecuteAction","taTools","taRegisterTool",function(a,b,c){var d={},e={};return{registerEditor:function(c,f,g){if(!c||""===c)throw"textAngular Error: An editor requires a name";if(!f)throw"textAngular Error: An editor requires a scope";if(e[c])throw'textAngular Error: An Editor with name "'+c+'" already exists';var h=[];return angular.forEach(g,function(a){d[a]&&h.push(d[a])}),e[c]={scope:f,toolbars:g,_registerToolbar:function(a){this.toolbars.indexOf(a.name)>=0&&h.push(a)},editorFunctions:{disable:function(){angular.forEach(h,function(a){a.disabled=!0})},enable:function(){angular.forEach(h,function(a){a.disabled=!1})},focus:function(){angular.forEach(h,function(a){a._parent=f,a.disabled=!1,a.focussed=!0})},unfocus:function(){angular.forEach(h,function(a){a.disabled=!0,a.focussed=!1})},updateSelectedStyles:function(a){angular.forEach(h,function(b){angular.forEach(b.tools,function(c){c.activeState&&(b._parent=f,c.active=c.activeState(a))})})},sendKeyCommand:function(c){var d=!1;return(c.ctrlKey||c.metaKey)&&angular.forEach(b,function(b,e){if(b.commandKeyCode&&b.commandKeyCode===c.which)for(var g=0;g0)for(var k=0;k"+a+"
"),q=d.getSelection().getRangeAt(0),r=c.createDocumentFragment(),s=p[0].childNodes,t=!0;if(s.length>0){for(j=[],i=0;i)$/i.test(g.innerHTML.trim())&&(q.setStartBefore(g),q.setEndBefore(g),angular.element(g).remove()),/^(| )$/i.test(h.innerHTML.trim())&&angular.element(h).remove()}else q.deleteContents();q.insertNode(r),o&&e.setSelectionToElementEnd(o)}};return e}])}()}({},function(){return this}());
\ No newline at end of file
diff --git a/ajax/libs/textAngular/1.3.0-pre13/src/textAngular-sanitize.js b/ajax/libs/textAngular/1.3.0-pre13/src/textAngular-sanitize.js
new file mode 100644
index 000000000..cbb0b3452
--- /dev/null
+++ b/ajax/libs/textAngular/1.3.0-pre13/src/textAngular-sanitize.js
@@ -0,0 +1,728 @@
+/**
+ * @license AngularJS v1.2.26
+ * (c) 2010-2014 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular, undefined) {'use strict';
+
+var $sanitizeMinErr = angular.$$minErr('$sanitize');
+
+/**
+ * @ngdoc module
+ * @name ngSanitize
+ * @description
+ *
+ * # ngSanitize
+ *
+ * The `ngSanitize` module provides functionality to sanitize HTML.
+ *
+ *
+ *
+ *
+ * See {@link ngSanitize.$sanitize `$sanitize`} for usage.
+ */
+
+/*
+ * HTML Parser By Misko Hevery (misko@hevery.com)
+ * based on: HTML Parser By John Resig (ejohn.org)
+ * Original code by Erik Arvidsson, Mozilla Public License
+ * http://erik.eae.net/simplehtmlparser/simplehtmlparser.js
+ *
+ * // Use like so:
+ * htmlParser(htmlString, {
+ * start: function(tag, attrs, unary) {},
+ * end: function(tag) {},
+ * chars: function(text) {},
+ * comment: function(text) {}
+ * });
+ *
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $sanitize
+ * @kind function
+ *
+ * @description
+ * The input is sanitized by parsing the html into tokens. All safe tokens (from a whitelist) are
+ * then serialized back to properly escaped html string. This means that no unsafe input can make
+ * it into the returned string, however, since our parser is more strict than a typical browser
+ * parser, it's possible that some obscure input, which would be recognized as valid HTML by a
+ * browser, won't make it through the sanitizer.
+ * The whitelist is configured using the functions `aHrefSanitizationWhitelist` and
+ * `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider `$compileProvider`}.
+ *
+ * @param {string} html Html input.
+ * @returns {string} Sanitized html.
+ *
+ * @example
+
+
+
+
+ Snippet:
+
+
+ Directive
+ How
+ Source
+ Rendered
+
+
+ ng-bind-html
+ Automatically uses $sanitize
+ <div ng-bind-html="snippet"> </div>
+
+
+
+ ng-bind-html
+ Bypass $sanitize by explicitly trusting the dangerous value
+
+ <div ng-bind-html="deliberatelyTrustDangerousSnippet()">
+</div>
+
+
+
+
+ ng-bind
+ Automatically escapes
+ <div ng-bind="snippet"> </div>
+
+
+
+
+
+
+ it('should sanitize the html snippet by default', function() {
+ expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
+ toBe('an html\nclick here \nsnippet
');
+ });
+
+ it('should inline raw snippet if bound to a trusted value', function() {
+ expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
+ toBe("an html\n" +
+ "click here \n" +
+ "snippet
");
+ });
+
+ it('should escape snippet without any filter', function() {
+ expect(element(by.css('#bind-default div')).getInnerHtml()).
+ toBe("<p style=\"color:blue\">an html\n" +
+ "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
+ "snippet</p>");
+ });
+
+ it('should update', function() {
+ element(by.model('snippet')).clear();
+ element(by.model('snippet')).sendKeys('new text ');
+ expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
+ toBe('new text ');
+ expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
+ 'new text ');
+ expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
+ "new <b onclick=\"alert(1)\">text</b>");
+ });
+
+
+ */
+function $SanitizeProvider() {
+ this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
+ return function(html) {
+ var buf = [];
+ htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
+ return !/^unsafe/.test($$sanitizeUri(uri, isImage));
+ }));
+ return buf.join('');
+ };
+ }];
+}
+
+function sanitizeText(chars) {
+ var buf = [];
+ var writer = htmlSanitizeWriter(buf, angular.noop);
+ writer.chars(chars);
+ return buf.join('');
+}
+
+
+// Regular Expressions for parsing tags and attributes
+var START_TAG_REGEXP =
+ /^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/,
+ END_TAG_REGEXP = /^<\/\s*([\w:-]+)[^>]*>/,
+ ATTR_REGEXP = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g,
+ BEGIN_TAG_REGEXP = /^,
+ BEGING_END_TAGE_REGEXP = /^<\//,
+ COMMENT_REGEXP = //g,
+ DOCTYPE_REGEXP = /]*?)>/i,
+ CDATA_REGEXP = //g,
+ SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
+ // Match everything outside of normal chars and " (quote character)
+ NON_ALPHANUMERIC_REGEXP = /([^\#-~| |!])/g;
+
+
+// Good source of info about elements and attributes
+// http://dev.w3.org/html5/spec/Overview.html#semantics
+// http://simon.html5.org/html-elements
+
+// Safe Void Elements - HTML5
+// http://dev.w3.org/html5/spec/Overview.html#void-elements
+var voidElements = makeMap("area,br,col,hr,img,wbr");
+
+// Elements that you can, intentionally, leave open (and which close themselves)
+// http://dev.w3.org/html5/spec/Overview.html#optional-tags
+var optionalEndTagBlockElements = makeMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),
+ optionalEndTagInlineElements = makeMap("rp,rt"),
+ optionalEndTagElements = angular.extend({},
+ optionalEndTagInlineElements,
+ optionalEndTagBlockElements);
+
+// Safe Block Elements - HTML5
+var blockElements = angular.extend({}, optionalEndTagBlockElements, makeMap("address,article," +
+ "aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," +
+ "h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul"));
+
+// Inline Elements - HTML5
+var inlineElements = angular.extend({}, optionalEndTagInlineElements, makeMap("a,abbr,acronym,b," +
+ "bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," +
+ "samp,small,span,strike,strong,sub,sup,time,tt,u,var"));
+
+
+// Special Elements (can contain anything)
+var specialElements = makeMap("script,style");
+
+var validElements = angular.extend({},
+ voidElements,
+ blockElements,
+ inlineElements,
+ optionalEndTagElements);
+
+//Attributes that have href and hence need to be sanitized
+var uriAttrs = makeMap("background,cite,href,longdesc,src,usemap");
+var validAttrs = angular.extend({}, uriAttrs, makeMap(
+ 'abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,'+
+ 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,'+
+ 'id,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,'+
+ 'scope,scrolling,shape,size,span,start,summary,target,title,type,'+
+ 'valign,value,vspace,width'));
+
+function makeMap(str) {
+ var obj = {}, items = str.split(','), i;
+ for (i = 0; i < items.length; i++) obj[items[i]] = true;
+ return obj;
+}
+
+
+/**
+ * @example
+ * htmlParser(htmlString, {
+ * start: function(tag, attrs, unary) {},
+ * end: function(tag) {},
+ * chars: function(text) {},
+ * comment: function(text) {}
+ * });
+ *
+ * @param {string} html string
+ * @param {object} handler
+ */
+function htmlParser( html, handler ) {
+ if (typeof html !== 'string') {
+ if (html === null || typeof html === 'undefined') {
+ html = '';
+ } else {
+ html = '' + html;
+ }
+ }
+ var index, chars, match, stack = [], last = html, text;
+ stack.last = function() { return stack[ stack.length - 1 ]; };
+
+ while ( html ) {
+ text = '';
+ chars = true;
+
+ // Make sure we're not in a script or style element
+ if ( !stack.last() || !specialElements[ stack.last() ] ) {
+
+ // Comment
+ if ( html.indexOf("", index) === index) {
+ if (handler.comment) handler.comment( html.substring( 4, index ) );
+ html = html.substring( index + 3 );
+ chars = false;
+ }
+ // DOCTYPE
+ } else if ( DOCTYPE_REGEXP.test(html) ) {
+ match = html.match( DOCTYPE_REGEXP );
+
+ if ( match ) {
+ html = html.replace( match[0], '');
+ chars = false;
+ }
+ // end tag
+ } else if ( BEGING_END_TAGE_REGEXP.test(html) ) {
+ match = html.match( END_TAG_REGEXP );
+
+ if ( match ) {
+ html = html.substring( match[0].length );
+ match[0].replace( END_TAG_REGEXP, parseEndTag );
+ chars = false;
+ }
+
+ // start tag
+ } else if ( BEGIN_TAG_REGEXP.test(html) ) {
+ match = html.match( START_TAG_REGEXP );
+
+ if ( match ) {
+ // We only have a valid start-tag if there is a '>'.
+ if ( match[4] ) {
+ html = html.substring( match[0].length );
+ match[0].replace( START_TAG_REGEXP, parseStartTag );
+ }
+ chars = false;
+ } else {
+ // no ending tag found --- this piece should be encoded as an entity.
+ text += '<';
+ html = html.substring(1);
+ }
+ }
+
+ if ( chars ) {
+ index = html.indexOf("<");
+
+ text += index < 0 ? html : html.substring( 0, index );
+ html = index < 0 ? "" : html.substring( index );
+
+ if (handler.chars) handler.chars( decodeEntities(text) );
+ }
+
+ } else {
+ html = html.replace(new RegExp("(.*)<\\s*\\/\\s*" + stack.last() + "[^>]*>", 'i'),
+ function(all, text){
+ text = text.replace(COMMENT_REGEXP, "$1").replace(CDATA_REGEXP, "$1");
+
+ if (handler.chars) handler.chars( decodeEntities(text) );
+
+ return "";
+ });
+
+ parseEndTag( "", stack.last() );
+ }
+
+ if ( html == last ) {
+ throw $sanitizeMinErr('badparse', "The sanitizer was unable to parse the following block " +
+ "of html: {0}", html);
+ }
+ last = html;
+ }
+
+ // Clean up any remaining tags
+ parseEndTag();
+
+ function parseStartTag( tag, tagName, rest, unary ) {
+ tagName = angular.lowercase(tagName);
+ if ( blockElements[ tagName ] ) {
+ while ( stack.last() && inlineElements[ stack.last() ] ) {
+ parseEndTag( "", stack.last() );
+ }
+ }
+
+ if ( optionalEndTagElements[ tagName ] && stack.last() == tagName ) {
+ parseEndTag( "", tagName );
+ }
+
+ unary = voidElements[ tagName ] || !!unary;
+
+ if ( !unary )
+ stack.push( tagName );
+
+ var attrs = {};
+
+ rest.replace(ATTR_REGEXP,
+ function(match, name, doubleQuotedValue, singleQuotedValue, unquotedValue) {
+ var value = doubleQuotedValue
+ || singleQuotedValue
+ || unquotedValue
+ || '';
+
+ attrs[name] = decodeEntities(value);
+ });
+ if (handler.start) handler.start( tagName, attrs, unary );
+ }
+
+ function parseEndTag( tag, tagName ) {
+ var pos = 0, i;
+ tagName = angular.lowercase(tagName);
+ if ( tagName )
+ // Find the closest opened tag of the same type
+ for ( pos = stack.length - 1; pos >= 0; pos-- )
+ if ( stack[ pos ] == tagName )
+ break;
+
+ if ( pos >= 0 ) {
+ // Close all the open elements, up the stack
+ for ( i = stack.length - 1; i >= pos; i-- )
+ if (handler.end) handler.end( stack[ i ] );
+
+ // Remove the open elements from the stack
+ stack.length = pos;
+ }
+ }
+}
+
+var hiddenPre=document.createElement("pre");
+var spaceRe = /^(\s*)([\s\S]*?)(\s*)$/;
+/**
+ * decodes all entities into regular string
+ * @param value
+ * @returns {string} A string with decoded entities.
+ */
+function decodeEntities(value) {
+ if (!value) { return ''; }
+
+ // Note: IE8 does not preserve spaces at the start/end of innerHTML
+ // so we must capture them and reattach them afterward
+ var parts = spaceRe.exec(value);
+ var spaceBefore = parts[1];
+ var spaceAfter = parts[3];
+ var content = parts[2];
+ if (content) {
+ hiddenPre.innerHTML=content.replace(/= 1536 && c <= 1540) ||
+ c == 1807 ||
+ c == 6068 ||
+ c == 6069 ||
+ (c >= 8204 && c <= 8207) ||
+ (c >= 8232 && c <= 8239) ||
+ (c >= 8288 && c <= 8303) ||
+ c == 65279 ||
+ (c >= 65520 && c <= 65535)) return '' + c + ';';
+ return value; // avoids multilingual issues
+ }).
+ replace(//g, '>');
+}
+
+var trim = (function() {
+ // native trim is way faster: http://jsperf.com/angular-trim-test
+ // but IE doesn't have it... :-(
+ // TODO: we should move this into IE/ES5 polyfill
+ if (!String.prototype.trim) {
+ return function(value) {
+ return angular.isString(value) ? value.replace(/^\s\s*/, '').replace(/\s\s*$/, '') : value;
+ };
+ }
+ return function(value) {
+ return angular.isString(value) ? value.trim() : value;
+ };
+})();
+
+// Custom logic for accepting certain style options only - textAngular
+// Currently allows only the color, background-color, text-align, float, width and height attributes
+// all other attributes should be easily done through classes.
+function validStyles(styleAttr){
+ var result = '';
+ var styleArray = styleAttr.split(';');
+ angular.forEach(styleArray, function(value){
+ var v = value.split(':');
+ if(v.length == 2){
+ var key = trim(angular.lowercase(v[0]));
+ var value = trim(angular.lowercase(v[1]));
+ if(
+ (key === 'color' || key === 'background-color') && (
+ value.match(/^rgb\([0-9%,\. ]*\)$/i)
+ || value.match(/^rgba\([0-9%,\. ]*\)$/i)
+ || value.match(/^hsl\([0-9%,\. ]*\)$/i)
+ || value.match(/^hsla\([0-9%,\. ]*\)$/i)
+ || value.match(/^#[0-9a-f]{3,6}$/i)
+ || value.match(/^[a-z]*$/i)
+ )
+ ||
+ key === 'text-align' && (
+ value === 'left'
+ || value === 'right'
+ || value === 'center'
+ || value === 'justify'
+ )
+ ||
+ key === 'float' && (
+ value === 'left'
+ || value === 'right'
+ || value === 'none'
+ )
+ ||
+ (key === 'width' || key === 'height') && (
+ value.match(/[0-9\.]*(px|em|rem|%)/)
+ )
+ ) result += key + ': ' + value + ';';
+ }
+ });
+ return result;
+}
+
+// this function is used to manually allow specific attributes on specific tags with certain prerequisites
+function validCustomTag(tag, attrs, lkey, value){
+ // catch the div placeholder for the iframe replacement
+ if (tag === 'img' && attrs['ta-insert-video']){
+ if(lkey === 'ta-insert-video' || lkey === 'allowfullscreen' || lkey === 'frameborder' || (lkey === 'contenteditble' && value === 'false')) return true;
+ }
+ return false;
+}
+
+/**
+ * create an HTML/XML writer which writes to buffer
+ * @param {Array} buf use buf.jain('') to get out sanitized html string
+ * @returns {object} in the form of {
+ * start: function(tag, attrs, unary) {},
+ * end: function(tag) {},
+ * chars: function(text) {},
+ * comment: function(text) {}
+ * }
+ */
+function htmlSanitizeWriter(buf, uriValidator){
+ var ignore = false;
+ var out = angular.bind(buf, buf.push);
+ return {
+ start: function(tag, attrs, unary){
+ tag = angular.lowercase(tag);
+ if (!ignore && specialElements[tag]) {
+ ignore = tag;
+ }
+ if (!ignore && validElements[tag] === true) {
+ out('<');
+ out(tag);
+ angular.forEach(attrs, function(value, key){
+ var lkey=angular.lowercase(key);
+ var isImage=(tag === 'img' && lkey === 'src') || (lkey === 'background');
+ if ((lkey === 'style' && (value = validStyles(value)) !== '') || validCustomTag(tag, attrs, lkey, value) || validAttrs[lkey] === true &&
+ (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
+ out(' ');
+ out(key);
+ out('="');
+ out(encodeEntities(value));
+ out('"');
+ }
+ });
+ out(unary ? '/>' : '>');
+ }
+ },
+ end: function(tag){
+ tag = angular.lowercase(tag);
+ if (!ignore && validElements[tag] === true) {
+ out('');
+ out(tag);
+ out('>');
+ }
+ if (tag == ignore) {
+ ignore = false;
+ }
+ },
+ chars: function(chars){
+ if (!ignore) {
+ out(encodeEntities(chars));
+ }
+ }
+ };
+}
+
+
+// define ngSanitize module and register $sanitize service
+angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
+
+/* global sanitizeText: false */
+
+/**
+ * @ngdoc filter
+ * @name linky
+ * @kind function
+ *
+ * @description
+ * Finds links in text input and turns them into html links. Supports http/https/ftp/mailto and
+ * plain email address links.
+ *
+ * Requires the {@link ngSanitize `ngSanitize`} module to be installed.
+ *
+ * @param {string} text Input text.
+ * @param {string} target Window (_blank|_self|_parent|_top) or named frame to open links in.
+ * @returns {string} Html-linkified text.
+ *
+ * @usage
+
+ *
+ * @example
+
+
+
+
+ Snippet:
+
+
+ Filter
+ Source
+ Rendered
+
+
+ linky filter
+
+ <div ng-bind-html="snippet | linky"> </div>
+
+
+
+
+
+
+ linky target
+
+ <div ng-bind-html="snippetWithTarget | linky:'_blank'"> </div>
+
+
+
+
+
+
+ no filter
+ <div ng-bind="snippet"> </div>
+
+
+
+
+
+ it('should linkify the snippet with urls', function() {
+ expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
+ toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
+ 'another@somewhere.org, and one more: ftp://127.0.0.1/.');
+ expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
+ });
+
+ it('should not linkify snippet without the linky filter', function() {
+ expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
+ toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
+ 'another@somewhere.org, and one more: ftp://127.0.0.1/.');
+ expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
+ });
+
+ it('should update', function() {
+ element(by.model('snippet')).clear();
+ element(by.model('snippet')).sendKeys('new http://link.');
+ expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
+ toBe('new http://link.');
+ expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
+ expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
+ .toBe('new http://link.');
+ });
+
+ it('should work with the target property', function() {
+ expect(element(by.id('linky-target')).
+ element(by.binding("snippetWithTarget | linky:'_blank'")).getText()).
+ toBe('http://angularjs.org/');
+ expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
+ });
+
+
+ */
+angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
+ var LINKY_URL_REGEXP =
+ /((ftp|https?):\/\/|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"]/,
+ MAILTO_REGEXP = /^mailto:/;
+
+ return function(text, target) {
+ if (!text) return text;
+ var match;
+ var raw = text;
+ var html = [];
+ var url;
+ var i;
+ while ((match = raw.match(LINKY_URL_REGEXP))) {
+ // We can not end in these as they are sometimes found at the end of the sentence
+ url = match[0];
+ // if we did not match ftp/http/mailto then assume mailto
+ if (match[2] == match[3]) url = 'mailto:' + url;
+ i = match.index;
+ addText(raw.substr(0, i));
+ addLink(url, match[0].replace(MAILTO_REGEXP, ''));
+ raw = raw.substring(i + match[0].length);
+ }
+ addText(raw);
+ return $sanitize(html.join(''));
+
+ function addText(text) {
+ if (!text) {
+ return;
+ }
+ html.push(sanitizeText(text));
+ }
+
+ function addLink(url, text) {
+ html.push('
');
+ addText(text);
+ html.push(' ');
+ }
+ };
+}]);
+
+
+})(window, window.angular);
diff --git a/ajax/libs/textAngular/1.3.0-pre13/src/textAngular.js b/ajax/libs/textAngular/1.3.0-pre13/src/textAngular.js
new file mode 100644
index 000000000..1a573f57a
--- /dev/null
+++ b/ajax/libs/textAngular/1.3.0-pre13/src/textAngular.js
@@ -0,0 +1,2389 @@
+/*
+@license textAngular
+Author : Austin Anderson
+License : 2013 MIT
+Version 1.3.0-pre13
+
+See README.md or https://github.com/fraywing/textAngular/wiki for requirements and use.
+*/
+
+(function(){ // encapsulate all variables so they don't become global vars
+ "Use Strict";
+
+ // IE version detection - http://stackoverflow.com/questions/4169160/javascript-ie-detection-why-not-use-simple-conditional-comments
+ // We need this as IE sometimes plays funny tricks with the contenteditable.
+ // ----------------------------------------------------------
+ // If you're not in IE (or IE version is less than 5) then:
+ // ie === undefined
+ // If you're in IE (>=5) then you can determine which version:
+ // ie === 7; // IE7
+ // Thus, to detect IE:
+ // if (ie) {}
+ // And to detect the version:
+ // ie === 6 // IE6
+ // ie > 7 // IE8, IE9, IE10 ...
+ // ie < 9 // Anything less than IE9
+ // ----------------------------------------------------------
+ /* istanbul ignore next: untestable browser check */
+ var _browserDetect = {
+ ie: (function(){
+ var undef,
+ v = 3,
+ div = document.createElement('div'),
+ all = div.getElementsByTagName('i');
+
+ while (
+ div.innerHTML = '',
+ all[0]
+ );
+
+ return v > 4 ? v : undef;
+ }()),
+ webkit: /AppleWebKit\/([\d.]+)/i.test(navigator.userAgent)
+ };
+
+ // fix a webkit bug, see: https://gist.github.com/shimondoodkin/1081133
+ // this is set true when a blur occurs as the blur of the ta-bind triggers before the click
+ var globalContentEditableBlur = false;
+ /* istanbul ignore next: Browser Un-Focus fix for webkit */
+ if(_browserDetect.webkit) {
+ document.addEventListener("mousedown", function(_event){
+ var e = _event || window.event;
+ var curelement = e.target;
+ if(globalContentEditableBlur && curelement !== null){
+ var isEditable = false;
+ var tempEl = curelement;
+ while(tempEl !== null && tempEl.tagName.toLowerCase() !== 'html' && !isEditable){
+ isEditable = tempEl.contentEditable === 'true';
+ tempEl = tempEl.parentNode;
+ }
+ if(!isEditable){
+ document.getElementById('textAngular-editableFix-010203040506070809').setSelectionRange(0, 0); // set caret focus to an element that handles caret focus correctly.
+ curelement.focus(); // focus the wanted element.
+ if (curelement.select) {
+ curelement.select(); // use select to place cursor for input elements.
+ }
+ }
+ }
+ globalContentEditableBlur = false;
+ }, false); // add global click handler
+ angular.element(document).ready(function () {
+ angular.element(document.body).append(angular.element('
'));
+ });
+ }
+
+ // Gloabl to textAngular REGEXP vars for block and list elements.
+
+ var BLOCKELEMENTS = /^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/ig;
+ var LISTELEMENTS = /^(ul|li|ol)$/ig;
+ var VALIDELEMENTS = /^(address|article|aside|audio|blockquote|canvas|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/ig;
+
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Compatibility
+ /* istanbul ignore next: trim shim for older browsers */
+ if (!String.prototype.trim) {
+ String.prototype.trim = function () {
+ return this.replace(/^\s+|\s+$/g, '');
+ };
+ }
+
+ // tests against the current jqLite/jquery implementation if this can be an element
+ function validElementString(string){
+ try{
+ return angular.element(string).length !== 0;
+ }catch(any){
+ return false;
+ }
+ }
+
+ /*
+ Custom stylesheet for the placeholders rules.
+ Credit to: http://davidwalsh.name/add-rules-stylesheets
+ */
+ var sheet, addCSSRule, removeCSSRule, _addCSSRule, _removeCSSRule;
+ /* istanbul ignore else: IE <8 test*/
+ if(_browserDetect.ie > 8 || _browserDetect.ie === undefined){
+ var _sheets = document.styleSheets, _lastValidSheet;
+ /* istanbul ignore next: preference for stylesheet loaded externally */
+ for(var i = 0; i < _sheets.length; i++){
+ if(_sheets[i].media.length === 0 || _sheets[i].media.mediaText.match(/(all|screen)/ig)){
+ if(_sheets[i].href){
+ if(_sheets[i].href.match(/textangular\.(min\.|)css/ig)){
+ sheet = _sheets[i];
+ break;
+ } else _lastValidSheet = _sheets[i];
+ }
+ }
+ }
+ /* istanbul ignore next: preference for stylesheet loaded externally */
+ if(!sheet && _lastValidSheet){
+ sheet = _lastValidSheet;
+ }else if(!sheet){
+ // this sheet is used for the placeholders later on.
+ sheet = (function() {
+ // Create the