diff --git a/dist/wysihtml5-0.4.0pre.js b/dist/wysihtml5-0.4.0pre.js index 66da87ab..f43d719e 100644 --- a/dist/wysihtml5-0.4.0pre.js +++ b/dist/wysihtml5-0.4.0pre.js @@ -3485,7 +3485,7 @@ wysihtml5.browser = (function() { * Firefox on OSX navigates through history when hitting CMD + Arrow right/left */ hasHistoryIssue: function() { - return isGecko; + return isGecko && navigator.platform.substr(0, 3) === "Mac"; }, /** @@ -3725,6 +3725,18 @@ wysihtml5.browser = (function() { */ hasIframeFocusIssue: function() { return isIE; + }, + + /** + * Chrome + Safari create invalid nested markup after paste + * + *

+ * foo + *

bar

+ *

+ */ + createsNestedInvalidMarkupAfterPaste: function() { + return isWebKit; } }; })();wysihtml5.lang.array = function(arr) { @@ -3876,7 +3888,14 @@ wysihtml5.browser = (function() { }; };(function() { var WHITE_SPACE_START = /^\s+/, - WHITE_SPACE_END = /\s+$/; + WHITE_SPACE_END = /\s+$/, + ENTITY_REG_EXP = /[&<>"]/g, + ENTITY_MAP = { + '&': '&', + '<': '<', + '>': '>', + '"': """ + }; wysihtml5.lang.string = function(str) { str = String(str); return { @@ -3912,6 +3931,15 @@ wysihtml5.browser = (function() { return str.split(search).join(replace); } }; + }, + + /** + * @example + * wysihtml5.lang.string("hello
").escapeHTML(); + * // => "hello<br>" + */ + escapeHTML: function() { + return str.replace(ENTITY_REG_EXP, function(c) { return ENTITY_MAP[c]; }); } }; }; @@ -4002,11 +4030,12 @@ wysihtml5.browser = (function() { */ function _wrapMatchesInNode(textNode) { var parentNode = textNode.parentNode, + nodeValue = wysihtml5.lang.string(textNode.data).escapeHTML(), tempElement = _getTempElement(parentNode.ownerDocument); // We need to insert an empty/temporary to fix IE quirks // Elsewise IE would strip white space in the beginning - tempElement.innerHTML = "" + _convertUrlsToLinks(textNode.data); + tempElement.innerHTML = "" + _convertUrlsToLinks(nodeValue); tempElement.removeChild(tempElement.firstChild); while (tempElement.firstChild) { @@ -4792,9 +4821,9 @@ wysihtml5.dom.parse = (function() { } while (element.firstChild) { - firstChild = element.firstChild; - element.removeChild(firstChild); + firstChild = element.firstChild; newNode = _convert(firstChild, cleanUp); + element.removeChild(firstChild); if (newNode) { fragment.appendChild(newNode); } @@ -4815,6 +4844,7 @@ wysihtml5.dom.parse = (function() { oldChildsLength = oldChilds.length, method = NODE_TYPE_MAPPING[oldNodeType], i = 0, + fragment, newNode, newChild; @@ -4833,10 +4863,13 @@ wysihtml5.dom.parse = (function() { // Cleanup senseless elements if (cleanUp && - newNode.childNodes.length <= 1 && newNode.nodeName.toLowerCase() === DEFAULT_NODE_NAME && - !newNode.attributes.length) { - return newNode.firstChild; + (!newNode.childNodes.length || !newNode.attributes.length)) { + fragment = newNode.ownerDocument.createDocumentFragment(); + while (newNode.firstChild) { + fragment.appendChild(newNode.firstChild); + } + return fragment; } return newNode; @@ -5054,8 +5087,17 @@ wysihtml5.dom.parse = (function() { } } + var INVISIBLE_SPACE_REG_EXP = /\uFEFF/g; function _handleText(oldNode) { - return oldNode.ownerDocument.createTextNode(oldNode.data); + var nextSibling = oldNode.nextSibling; + if (nextSibling && nextSibling.nodeType === wysihtml5.TEXT_NODE) { + // Concatenate text nodes + nextSibling.data = oldNode.data + nextSibling.data; + } else { + // \uFEFF = wysihtml5.INVISIBLE_SPACE (used as a hack in certain rich text editing situations) + var data = oldNode.data.replace(INVISIBLE_SPACE_REG_EXP, ""); + return oldNode.ownerDocument.createTextNode(data); + } } @@ -6896,8 +6938,7 @@ wysihtml5.commands.bold = { * Instead we set a css class */ (function(wysihtml5) { - var undef, - REG_EXP = /wysiwyg-font-size-[0-9a-z\-]+/g; + var REG_EXP = /wysiwyg-font-size-[0-9a-z\-]+/g; wysihtml5.commands.fontSize = { exec: function(composer, command, size) { @@ -6906,10 +6947,6 @@ wysihtml5.commands.bold = { state: function(composer, command, size) { return wysihtml5.commands.formatInline.state(composer, command, "span", "wysiwyg-font-size-" + size, REG_EXP); - }, - - value: function() { - return undef; } }; })(wysihtml5); @@ -7274,7 +7311,6 @@ wysihtml5.commands.bold = { var doc = composer.doc, image = this.state(composer), textNode, - i, parent; if (image) { @@ -7297,11 +7333,8 @@ wysihtml5.commands.bold = { image = doc.createElement(NODE_NAME); - for (i in value) { - if (i === "className") { - i = "class"; - } - image.setAttribute(i, value[i]); + for (var i in value) { + image.setAttribute(i === "className" ? "class" : i, value[i]); } composer.selection.insertNode(image); @@ -7896,11 +7929,6 @@ wysihtml5.views.View = Base.extend( value = this.parent.parse(value); } - // Replace all "zero width no breaking space" chars - // which are used as hacks to enable some functionalities - // Also remove all CARET hacks that somehow got left - value = wysihtml5.lang.string(value).replace(wysihtml5.INVISIBLE_SPACE).by(""); - return value; }, @@ -8229,6 +8257,16 @@ wysihtml5.views.View = Base.extend( }); } + // Under certain circumstances Chrome + Safari create nested

or tags after paste + // Inserting an invisible white space in front of it fixes the issue + if (browser.createsNestedInvalidMarkupAfterPaste()) { + dom.observe(this.element, "paste", function(event) { + var invisibleSpace = that.doc.createTextNode(wysihtml5.INVISIBLE_SPACE); + that.selection.insertNode(invisibleSpace); + }); + } + + dom.observe(this.doc, "keydown", function(event) { var keyCode = event.keyCode; @@ -8896,6 +8934,7 @@ wysihtml5.views.Textarea = wysihtml5.views.View.extend( callbackWrapper(event); } if (keyCode === wysihtml5.ESCAPE_KEY) { + that.fire("cancel"); that.hide(); } }); @@ -9143,6 +9182,20 @@ wysihtml5.views.Textarea = wysihtml5.views.View.extend( this._observe(); this.show(); + + if (editor.config.classNameCommandDisabled != null) { + CLASS_NAME_COMMAND_DISABLED = editor.config.classNameCommandDisabled; + } + if (editor.config.classNameCommandsDisabled != null) { + CLASS_NAME_COMMANDS_DISABLED = editor.config.classNameCommandsDisabled; + } + if (editor.config.classNameCommandActive != null) { + CLASS_NAME_COMMAND_ACTIVE = editor.config.classNameCommandActive; + } + if (editor.config.classNameActionActive != null) { + CLASS_NAME_ACTION_ACTIVE = editor.config.classNameActionActive; + } + var speechInputLinks = this.container.querySelectorAll("[data-wysihtml5-command=insertSpeech]"), length = speechInputLinks.length, @@ -9263,10 +9316,14 @@ wysihtml5.views.Textarea = wysihtml5.views.View.extend( for (; i= 0.3.0 comes with basic support for iOS 5) - supportTouchDevices: true + supportTouchDevices: true, + // Whether senseless elements (empty or without attributes) should be removed/replaced with their content + cleanUp: true }; wysihtml5.Editor = wysihtml5.lang.Dispatcher.extend( @@ -9554,7 +9613,7 @@ wysihtml5.views.Textarea = wysihtml5.views.View.extend( }, parse: function(htmlOrElement) { - var returnValue = this.config.parser(htmlOrElement, this.config.parserRules, this.composer.sandbox.getDocument(), true); + var returnValue = this.config.parser(htmlOrElement, this.config.parserRules, this.composer.sandbox.getDocument(), this.config.cleanUp); if (typeof(htmlOrElement) === "object") { wysihtml5.quirks.redraw(htmlOrElement); } diff --git a/dist/wysihtml5-0.4.0pre.min.js b/dist/wysihtml5-0.4.0pre.min.js index 04215ffe..318f3728 100644 --- a/dist/wysihtml5-0.4.0pre.min.js +++ b/dist/wysihtml5-0.4.0pre.min.js @@ -16,251 +16,253 @@ Build date: 13 November 2011 */ var wysihtml5={version:"0.4.0pre",commands:{},dom:{},quirks:{},toolbar:{},lang:{},selection:{},views:{},INVISIBLE_SPACE:"\ufeff",EMPTY_FUNCTION:function(){},ELEMENT_NODE:1,TEXT_NODE:3,BACKSPACE_KEY:8,ENTER_KEY:13,ESCAPE_KEY:27,SPACE_KEY:32,DELETE_KEY:46}; -window.rangy=function(){function b(a,b){var c=typeof a[b];return c==j||!!(c==g&&a[b])||"unknown"==c}function c(a,b){return!!(typeof a[b]==g&&a[b])}function a(a,b){return typeof a[b]!=k}function d(a){return function(b,c){for(var d=c.length;d--;)if(!a(b,c[d]))return!1;return!0}}function e(a){return a&&p(a,u)&&t(a,v)}function f(a){window.alert("Rangy not supported in your browser. Reason: "+a);q.initialized=!0;q.supported=!1}function h(){if(!q.initialized){var a,d=!1,g=!1;b(document,"createRange")&& -(a=document.createRange(),p(a,n)&&t(a,m)&&(d=!0),a.detach());if((a=c(document,"body")?document.body:document.getElementsByTagName("body")[0])&&b(a,"createTextRange"))a=a.createTextRange(),e(a)&&(g=!0);!d&&!g&&f("Neither Range nor TextRange are implemented");q.initialized=!0;q.features={implementsDomRange:d,implementsTextRange:g};d=A.concat(y);g=0;for(a=d.length;g["+a.childNodes.length+"]":a.nodeName}function j(a){this._next=this.root=a}function k(a,b){this.node=a;this.offset=b}function m(a){this.code=this[a];this.codeName=a;this.message="DOMException: "+this.codeName} -var n="undefined",v=b.util;v.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||c.fail("document missing a Node creation method");v.isHostMethod(document,"getElementsByTagName")||c.fail("document missing getElementsByTagName method");var u=document.createElement("div");v.areHostMethods(u,["insertBefore","appendChild","cloneNode"])||c.fail("Incomplete Element implementation");v.isHostProperty(u,"innerHTML")||c.fail("Element is missing innerHTML property");u=document.createTextNode("test"); -v.areHostMethods(u,["splitText","deleteData","insertData","appendData","cloneNode"])||c.fail("Incomplete Text Node implementation");var p=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1};j.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next,b;if(this._current){b=a.firstChild;if(!b)for(b=null;a!==this.root&&!(b=a.nextSibling);)a=a.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root= -null}};k.prototype={equals:function(a){return this.node===a.node&this.offset==a.offset},inspect:function(){return"[DomPosition("+g(this.node)+":"+this.offset+")]"}};m.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11};m.prototype.toString=function(){return this.message};b.dom={arrayContains:p,isHtmlNamespace:function(a){var b;return typeof a.namespaceURI==n||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"== -b},parentElement:function(a){a=a.parentNode;return 1==a.nodeType?a:null},getNodeIndex:a,getNodeLength:function(a){var b;return f(a)?a.length:(b=a.childNodes)?b.length:0},getCommonAncestor:d,isAncestorOf:function(a,b,c){for(b=c?b:b.parentNode;b;){if(b===a)return!0;b=b.parentNode}return!1},getClosestAncestorIn:e,isCharacterDataNode:f,insertAfter:h,splitDataNode:function(a,b){var c=a.cloneNode(!1);c.deleteData(0,b);a.deleteData(b,a.length-b);h(c,a);return c},getDocument:i,getWindow:function(a){a=i(a); -if(typeof a.defaultView!=n)return a.defaultView;if(typeof a.parentWindow!=n)return a.parentWindow;throw Error("Cannot get a window object for node");},getIframeWindow:function(a){if(typeof a.contentWindow!=n)return a.contentWindow;if(typeof a.contentDocument!=n)return a.contentDocument.defaultView;throw Error("getIframeWindow: No Window object found for iframe element");},getIframeDocument:function(a){if(typeof a.contentDocument!=n)return a.contentDocument;if(typeof a.contentWindow!=n)return a.contentWindow.document; -throw Error("getIframeWindow: No Document object found for iframe element");},getBody:function(a){return v.isHostObject(a,"body")?a.body:a.getElementsByTagName("body")[0]},getRootContainer:function(a){for(var b;b=a.parentNode;)a=b;return a},comparePoints:function(b,c,g,j){var f;if(b==g)return c===j?0:c=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]);return d}function i(b){for(var c,d,e=a(b.range).createDocumentFragment();d=b.next();){c=b.isPartiallySelectedSubtree();d=d.cloneNode(!c);c&&(c=b.getSubtreeIterator(),d.appendChild(i(c)),c.detach(!0));if(10==d.nodeType)throw new C("HIERARCHY_REQUEST_ERR");e.appendChild(d)}return e}function g(a,b,c){for(var d,e,c=c||{stop:!1};d=a.next();)if(a.isPartiallySelectedSubtree())if(!1=== -b(d)){c.stop=!0;break}else{if(d=a.getSubtreeIterator(),g(d,b,c),d.detach(!0),c.stop)break}else for(d=l.createIterator(d);e=d.next();)if(!1===b(e)){c.stop=!0;return}}function j(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),j(b),b.detach(!0)):a.remove()}function k(b){for(var c,d=a(b.range).createDocumentFragment(),e;c=b.next();){b.isPartiallySelectedSubtree()?(c=c.cloneNode(!1),e=b.getSubtreeIterator(),c.appendChild(k(e)),e.detach(!0)):b.remove();if(10==c.nodeType)throw new C("HIERARCHY_REQUEST_ERR"); -d.appendChild(c)}return d}function m(a,b,c){var d=!(!b||!b.length),e,j=!!c;d&&(e=RegExp("^("+b.join("|")+")$"));var f=[];g(new v(a,!1),function(a){(!d||e.test(a.nodeType))&&(!j||c(a))&&f.push(a)});return f}function n(a){return"["+("undefined"==typeof a.getName?"Range":a.getName())+"("+l.inspectNode(a.startContainer)+":"+a.startOffset+", "+l.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function v(a,b){this.range=a;this.clonePartiallySelectedTextNodes=b;if(!a.collapsed){this.sc=a.startContainer; -this.so=a.startOffset;this.ec=a.endContainer;this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&l.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc===c&&!l.isCharacterDataNode(this.sc)?this.sc.childNodes[this.so]:l.getClosestAncestorIn(this.sc,c,!0),this._last=this.ec===c&&!l.isCharacterDataNode(this.ec)?this.ec.childNodes[this.eo-1]:l.getClosestAncestorIn(this.ec,c,!0))}}function u(a){this.code= -this[a];this.codeName=a;this.message="RangeException: "+this.codeName}function p(a,b,c){this.nodes=m(a,b,c);this._next=this.nodes[0];this._position=0}function r(a){return function(b,c){for(var d,e=c?b:b.parentNode;e;){d=e.nodeType;if(l.arrayContains(a,d))return e;e=e.parentNode}return null}}function t(a,b){if(L(a,b))throw new u("INVALID_NODE_TYPE_ERR");}function q(a){if(!a.startContainer)throw new C("INVALID_STATE_ERR");}function y(a,b){if(!l.arrayContains(b,a.nodeType))throw new u("INVALID_NODE_TYPE_ERR"); -}function A(a,b){if(0>b||b>(l.isCharacterDataNode(a)?a.length:a.childNodes.length))throw new C("INDEX_SIZE_ERR");}function B(a,b){if(I(a,!0)!==I(b,!0))throw new C("WRONG_DOCUMENT_ERR");}function D(a){if(T(a,!0))throw new C("NO_MODIFICATION_ALLOWED_ERR");}function z(a,b){if(!a)throw new C(b);}function x(a){q(a);if(!l.arrayContains(M,a.startContainer.nodeType)&&!I(a.startContainer,!0)||!l.arrayContains(M,a.endContainer.nodeType)&&!I(a.endContainer,!0)||!(a.startOffset<=(l.isCharacterDataNode(a.startContainer)? -a.startContainer.length:a.startContainer.childNodes.length))||!(a.endOffset<=(l.isCharacterDataNode(a.endContainer)?a.endContainer.length:a.endContainer.childNodes.length)))throw Error("Range error: Range is no longer valid after DOM mutation ("+a.inspect()+")");}function G(){}function Q(a){a.START_TO_START=U;a.START_TO_END=Y;a.END_TO_END=ca;a.END_TO_START=Z;a.NODE_BEFORE=$;a.NODE_AFTER=aa;a.NODE_BEFORE_AND_AFTER=ba;a.NODE_INSIDE=V}function s(a){Q(a);Q(a.prototype)}function J(a,b){return function(){x(this); -var c=this.startContainer,d=this.startOffset,e=this.commonAncestorContainer,j=new v(this,!0);c!==e&&(c=l.getClosestAncestorIn(c,e,!0),d=f(c),c=d.node,d=d.offset);g(j,D);j.reset();e=a(j);j.detach();b(this,c,d,c,d);return e}}function N(a,d,g){function h(a,b){return function(c){q(this);y(c,E);y(K(c),M);c=(a?e:f)(c);(b?S:i)(this,c.node,c.offset)}}function S(a,b,c){var e=a.endContainer,g=a.endOffset;if(b!==a.startContainer||c!==a.startOffset){if(K(b)!=K(e)||1==l.comparePoints(b,c,e,g))e=b,g=c;d(a,b,c, -e,g)}}function i(a,b,c){var e=a.startContainer,g=a.startOffset;if(b!==a.endContainer||c!==a.endOffset){if(K(b)!=K(e)||-1==l.comparePoints(b,c,e,g))e=b,g=c;d(a,e,g,b,c)}}a.prototype=new G;b.util.extend(a.prototype,{setStart:function(a,b){q(this);t(a,!0);A(a,b);S(this,a,b)},setEnd:function(a,b){q(this);t(a,!0);A(a,b);i(this,a,b)},setStartBefore:h(!0,!0),setStartAfter:h(!1,!0),setEndBefore:h(!0,!1),setEndAfter:h(!1,!1),collapse:function(a){x(this);a?d(this,this.startContainer,this.startOffset,this.startContainer, -this.startOffset):d(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){q(this);t(a,!0);d(this,a,0,a,l.getNodeLength(a))},selectNode:function(a){q(this);t(a,!1);y(a,E);var b=e(a),a=f(a);d(this,b.node,b.offset,a.node,a.offset)},extractContents:J(k,d),deleteContents:J(j,d),canSurroundContents:function(){x(this);D(this.startContainer);D(this.endContainer);var a=new v(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);a.detach();return!b}, -detach:function(){g(this)},splitBoundaries:function(){x(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,e=this.endOffset,g=a===c;l.isCharacterDataNode(c)&&(0=l.getNodeIndex(a)&&e++,b=0);d(this,a,b,c,e)},normalizeBoundaries:function(){x(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,e=this.endOffset,g=function(a){var b= -a.nextSibling;b&&b.nodeType==a.nodeType&&(c=a,e=a.length,a.appendData(b.data),b.parentNode.removeChild(b))},j=function(d){var g=d.previousSibling;if(g&&g.nodeType==d.nodeType){a=d;var j=d.length;b=g.length;d.insertData(0,g.data);g.parentNode.removeChild(g);a==c?(e+=b,c=a):c==d.parentNode&&(g=l.getNodeIndex(d),e==g?(c=d,e=j):e>g&&e--)}},f=!0;l.isCharacterDataNode(c)?c.length==e&&g(c):(0x",W=3==S.firstChild.nodeType}catch(da){}b.features.htmlParsingConforms=W;var X="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer".split(" "),U=0,Y=1,ca=2,Z=3,$=0,aa=1,ba=2,V=3;G.prototype={attachListener:function(a,b){this._listeners[a].push(b)},compareBoundaryPoints:function(a,b){x(this); -B(this.startContainer,b.startContainer);var c=a==Z||a==U?"start":"end",d=a==Y||a==U?"start":"end";return l.comparePoints(this[c+"Container"],this[c+"Offset"],b[d+"Container"],b[d+"Offset"])},insertNode:function(a){x(this);y(a,F);D(this.startContainer);if(l.isAncestorOf(a,this.startContainer,!0))throw new C("HIERARCHY_REQUEST_ERR");a=h(a,this.startContainer,this.startOffset);this.setStartBefore(a)},cloneContents:function(){x(this);var b,c;if(this.collapsed)return a(this).createDocumentFragment();if(this.startContainer=== -this.endContainer&&l.isCharacterDataNode(this.startContainer))return b=this.startContainer.cloneNode(!0),b.data=b.data.slice(this.startOffset,this.endOffset),c=a(this).createDocumentFragment(),c.appendChild(b),c;c=new v(this,!0);b=i(c);c.detach();return b},canSurroundContents:function(){x(this);D(this.startContainer);D(this.endContainer);var a=new v(this,!0),b=a._first&&c(a._first,this)||a._last&&c(a._last,this);a.detach();return!b},surroundContents:function(a){y(a,P);if(!this.canSurroundContents())throw new u("BAD_BOUNDARYPOINTS_ERR"); -var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);h(a,this.startContainer,this.startOffset);a.appendChild(b);this.selectNode(a)},cloneRange:function(){x(this);for(var b=new w(a(this)),c=X.length,d;c--;)d=X[c],b[d]=this[d];return b},toString:function(){x(this);var a=this.startContainer;if(a===this.endContainer&&l.isCharacterDataNode(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],a=new v(this,!0);g(a,function(a){(3== -a.nodeType||4==a.nodeType)&&b.push(a.data)});a.detach();return b.join("")},compareNode:function(a){x(this);var b=a.parentNode,c=l.getNodeIndex(a);if(!b)throw new C("NOT_FOUND_ERR");a=this.comparePoint(b,c);b=this.comparePoint(b,c+1);return 0>a?0l.comparePoints(a,b,this.startContainer,this.startOffset)?-1:0=g&&0<=d:0>g&&0=l.comparePoints(a,b,this.endContainer,this.endOffset)},intersectsRange:function(b,c){x(this);if(a(b)!=a(this))throw new C("WRONG_DOCUMENT_ERR");var d=l.comparePoints(this.startContainer,this.startOffset,b.endContainer,b.endOffset),e=l.comparePoints(this.endContainer,this.endOffset,b.startContainer,b.startOffset);return c?0>=d&&0<=e:0>d&&0=this.comparePoint(a,l.getNodeLength(a))},containsRange:function(a){return this.intersection(a).equals(a)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var c=b.getNodes([3]);return 012");w.close();var H=p.getIframeWindow(l).getSelection(), -C=w.documentElement.lastChild.firstChild,E=w.createRange();E.setStart(C,1);E.collapse(!0);H.addRange(E);w=1==H.rangeCount;H.removeAllRanges();var M=E.cloneRange();E.setStart(C,0);M.setEnd(C,2);H.addRange(E);H.addRange(M);O=2==H.rangeCount;E.detach();M.detach();s.removeChild(l)}b.features.selectionSupportsMultipleRanges=O;b.features.collapsedNonEditableSelectionsSupported=w;var F=!1;s&&r.isHostMethod(s,"createControlRange")&&(s=s.createControlRange(),r.areHostProperties(s,["item","add"])&&(F=!0)); -b.features.implementsControlRange=F;D=J?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var P;r.isHostMethod(z,"getRangeAt")?P=function(a,b){try{return a.getRangeAt(b)}catch(c){return null}}:J&&(P=function(a){var c=p.getDocument(a.anchorNode),c=b.createRange(c);c.setStart(a.anchorNode,a.anchorOffset);c.setEnd(a.focusNode,a.focusOffset);c.collapsed!==this.isCollapsed&&(c.setStart(a.focusNode,a.focusOffset), -c.setEnd(a.anchorNode,a.anchorOffset));return c});b.getSelection=function(a){var a=a||window,b=a._rangySelection,c=B(a),e=x?d(a):null;b?(b.nativeSelection=c,b.docSelection=e,b.refresh(a)):(b=new m(c,e,a),a._rangySelection=b);return b};b.getIframeSelection=function(a){return b.getSelection(p.getIframeWindow(a))};s=m.prototype;if(!G&&J&&r.areHostMethods(z,["removeAllRanges","addRange"])){s.removeAllRanges=function(){this.nativeSelection.removeAllRanges();f(this)};var K=function(a,c){var d=t.getRangeDocument(c), -d=b.createRange(d);d.collapseToPoint(c.endContainer,c.endOffset);a.nativeSelection.addRange(h(d));a.nativeSelection.extend(c.startContainer,c.startOffset);a.refresh()};s.addRange=R?function(a,c){if(F&&x&&"Control"==this.docSelection.type)k(this,a);else if(c&&N)K(this,a);else{var d;O?d=this.rangeCount:(this.removeAllRanges(),d=0);this.nativeSelection.addRange(h(a));this.rangeCount=this.nativeSelection.rangeCount;this.rangeCount==d+1?(b.config.checkSelectionRanges&&(d=P(this.nativeSelection,this.rangeCount- -1))&&!t.rangesEqual(d,a)&&(a=new q(d)),this._ranges[this.rangeCount-1]=a,e(this,a,L(this.nativeSelection)),this.isCollapsed=D(this)):this.refresh()}}:function(a,b){b&&N?K(this,a):(this.nativeSelection.addRange(h(a)),this.refresh())};s.setRanges=function(a){if(F&&1a||a>=this.rangeCount)throw new y("INDEX_SIZE_ERR");return this._ranges[a]};var I;if(G)I=function(a){var c;b.isSelectionValid(a.win)?c=a.docSelection.createRange():(c=p.getBody(a.win.document).createTextRange(),c.collapse(!0));"Control"==a.docSelection.type?j(a):c&&"undefined"!=typeof c.text? -g(a,c):f(a)};else if(r.isHostMethod(z,"getRangeAt")&&"number"==typeof z.rangeCount)I=function(a){if(F&&x&&"Control"==a.docSelection.type)j(a);else if(a._ranges.length=a.rangeCount=a.nativeSelection.rangeCount,a.rangeCount){for(var c=0,d=a.rangeCount;c+(/ipad|iphone|ipod/.test(a)&&a.match(/ os (\d+).+? like mac os x/)||[,0])[1]||this.isAndroid()&&4>+(a.match(/android (\d+)/)||[,0])[1]||-1!==a.indexOf("opera mobi")||-1!==a.indexOf("hpwos/");return b&&d&&e&&!a},isTouchDevice:function(){return this.supportsEvent("touchmove")},isIos:function(){return/ipad|iphone|ipod/i.test(this.USER_AGENT)},isAndroid:function(){return-1!==this.USER_AGENT.indexOf("Android")}, -supportsSandboxedIframes:function(){return a},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in document)},displaysCaretInEmptyContentEditableCorrectly:function(){return a},hasCurrentStyleProperty:function(){return"currentStyle"in c},hasHistoryIssue:function(){return d},insertsLineBreaksOnReturn:function(){return d},supportsPlaceholderAttributeOn:function(a){return"placeholder"in a},supportsEvent:function(a){var b;if(!(b="on"+a in c))c.setAttribute("on"+a,"return;"), -b="function"===typeof c["on"+a];return b},supportsEventsInIframeCorrectly:function(){return!h},supportsHTML5Tags:function(a){a=a.createElement("div");a.innerHTML="

foo
";return"
foo
"===a.innerHTML.toLowerCase()},supportsCommand:function(a,b){if(!i[b]){try{return a.queryCommandSupported(b)}catch(c){}try{return a.queryCommandEnabled(b)}catch(d){return!!g[b]}}return!1},doesAutoLinkingInContentEditable:function(){return a},canDisableAutoLinking:function(){return this.supportsCommand(document, -"AutoUrlDetect")},clearsContentEditableCorrectly:function(){return d||h||e},supportsGetAttributeCorrectly:function(){return"1"!=document.createElement("td").getAttribute("rowspan")},canSelectImagesInContentEditable:function(){return d||a||h},autoScrollsToCaret:function(){return!e},autoClosesUnclosedTags:function(){var a=c.cloneNode(!1),b;a.innerHTML="

";a=a.innerHTML.toLowerCase();b="

"===a||"

"===a;this.autoClosesUnclosedTags=function(){return b};return b}, -supportsNativeGetElementsByClassName:function(){return-1!==String(document.getElementsByClassName).indexOf("[native code]")},supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},needsSpaceAfterLineBreak:function(){return h},supportsSpeechApiOn:function(a){return 11<=(b.match(/Chrome\/(\d+)/)||[,0])[1]&&("onwebkitspeechchange"in a||"speech"in a)},crashesWhenDefineProperty:function(b){return a&&("XMLHttpRequest"===b||"XDomainRequest"===b)},doesAsyncFocus:function(){return a}, -hasProblemsSettingCaretAfterImg:function(){return a},hasUndoInContextMenu:function(){return d||f||h},hasInsertNodeIssue:function(){return h},hasIframeFocusIssue:function(){return a}}}(); -wysihtml5.lang.array=function(b){return{contains:function(c){if(b.indexOf)return-1!==b.indexOf(c);for(var a=0,d=b.length;a
"+i.data.replace(d,function(a,b){var c=(b.match(e)||[])[1]||"",d=h[c],b=b.replace(e,"");b.split(d).length>b.split(c).length&&(b+=c,c="");var g=d=b;b.length>f&&(g=g.substr(0,f)+"...");"www."===d.substr(0,4)&&(d="http://"+d);return''+ -g+""+c});for(j.removeChild(j.firstChild);j.firstChild;)g.insertBefore(j.firstChild,i);g.removeChild(i)}else{g=b.lang.array(i.childNodes).get();j=g.length;for(k=0;k["+a.childNodes.length+"]":a.nodeName:"[No node]"}function h(a){this._next=this.root=a}function n(a,b){this.node=a;this.offset=b}function m(a){this.code=this[a];this.codeName=a;this.message="DOMException: "+this.codeName} +var u="undefined",y=a.util;y.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||c.fail("document missing a Node creation method");y.isHostMethod(document,"getElementsByTagName")||c.fail("document missing getElementsByTagName method");var q=document.createElement("div");y.areHostMethods(q,["insertBefore","appendChild","cloneNode"])||c.fail("Incomplete Element implementation");y.isHostProperty(q,"innerHTML")||c.fail("Element is missing innerHTML property");q=document.createTextNode("test"); +y.areHostMethods(q,["splitText","deleteData","insertData","appendData","cloneNode"])||c.fail("Incomplete Text Node implementation");var r=function(a,b){for(var c=a.length;c--;)if(a[c]===b)return!0;return!1};h.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var a=this._current=this._next,b;if(this._current){b=a.firstChild;if(!b)for(b=null;a!==this.root&&!(b=a.nextSibling);)a=a.parentNode;this._next=b}return this._current},detach:function(){this._current=this._next=this.root= +null}};n.prototype={equals:function(a){return this.node===a.node&this.offset==a.offset},inspect:function(){return"[DomPosition("+g(this.node)+":"+this.offset+")]"}};m.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11};m.prototype.toString=function(){return this.message};a.dom={arrayContains:r,isHtmlNamespace:function(a){var b;return typeof a.namespaceURI==u||null===(b=a.namespaceURI)||"http://www.w3.org/1999/xhtml"== +b},parentElement:function(a){a=a.parentNode;return 1==a.nodeType?a:null},getNodeIndex:b,getNodeLength:function(a){var b;return f(a)?a.length:(b=a.childNodes)?b.length:0},getCommonAncestor:d,isAncestorOf:function(a,b,c){for(b=c?b:b.parentNode;b;){if(b===a)return!0;b=b.parentNode}return!1},getClosestAncestorIn:e,isCharacterDataNode:f,insertAfter:k,splitDataNode:function(a,b){var c=a.cloneNode(!1);c.deleteData(0,b);a.deleteData(b,a.length-b);k(c,a);return c},getDocument:l,getWindow:function(a){a=l(a); +if(typeof a.defaultView!=u)return a.defaultView;if(typeof a.parentWindow!=u)return a.parentWindow;throw Error("Cannot get a window object for node");},getIframeWindow:function(a){if(typeof a.contentWindow!=u)return a.contentWindow;if(typeof a.contentDocument!=u)return a.contentDocument.defaultView;throw Error("getIframeWindow: No Window object found for iframe element");},getIframeDocument:function(a){if(typeof a.contentDocument!=u)return a.contentDocument;if(typeof a.contentWindow!=u)return a.contentWindow.document; +throw Error("getIframeWindow: No Document object found for iframe element");},getBody:function(a){return y.isHostObject(a,"body")?a.body:a.getElementsByTagName("body")[0]},getRootContainer:function(a){for(var b;b=a.parentNode;)a=b;return a},comparePoints:function(a,c,h,g){var m;if(a==h)return c===g?0:c=b.childNodes.length?b.appendChild(a):b.insertBefore(a,b.childNodes[c]);return h}function g(a){for(var b,c,h=d(a.range).createDocumentFragment();c=a.next();){b=a.isPartiallySelectedSubtree();c=c.cloneNode(!b);b&&(b=a.getSubtreeIterator(),c.appendChild(g(b)),b.detach(!0));if(10==c.nodeType)throw new G("HIERARCHY_REQUEST_ERR");h.appendChild(c)}return h}function h(a,b,c){var d,e;for(c=c||{stop:!1};d=a.next();)if(a.isPartiallySelectedSubtree())if(!1=== +b(d)){c.stop=!0;break}else{if(d=a.getSubtreeIterator(),h(d,b,c),d.detach(!0),c.stop)break}else for(d=p.createIterator(d);e=d.next();)if(!1===b(e)){c.stop=!0;return}}function n(a){for(var b;a.next();)a.isPartiallySelectedSubtree()?(b=a.getSubtreeIterator(),n(b),b.detach(!0)):a.remove()}function m(a){for(var b,c=d(a.range).createDocumentFragment(),h;b=a.next();){a.isPartiallySelectedSubtree()?(b=b.cloneNode(!1),h=a.getSubtreeIterator(),b.appendChild(m(h)),h.detach(!0)):a.remove();if(10==b.nodeType)throw new G("HIERARCHY_REQUEST_ERR"); +c.appendChild(b)}return c}function u(a,b,c){var d=!(!b||!b.length),e,g=!!c;d&&(e=RegExp("^("+b.join("|")+")$"));var m=[];h(new q(a,!1),function(a){d&&!e.test(a.nodeType)||g&&!c(a)||m.push(a)});return m}function y(a){return"["+("undefined"==typeof a.getName?"Range":a.getName())+"("+p.inspectNode(a.startContainer)+":"+a.startOffset+", "+p.inspectNode(a.endContainer)+":"+a.endOffset+")]"}function q(a,b){this.range=a;this.clonePartiallySelectedTextNodes=b;if(!a.collapsed){this.sc=a.startContainer;this.so= +a.startOffset;this.ec=a.endContainer;this.eo=a.endOffset;var c=a.commonAncestorContainer;this.sc===this.ec&&p.isCharacterDataNode(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==c||p.isCharacterDataNode(this.sc)?p.getClosestAncestorIn(this.sc,c,!0):this.sc.childNodes[this.so],this._last=this.ec!==c||p.isCharacterDataNode(this.ec)?p.getClosestAncestorIn(this.ec,c,!0):this.ec.childNodes[this.eo-1])}}function r(a){this.code=this[a]; +this.codeName=a;this.message="RangeException: "+this.codeName}function s(a,b,c){this.nodes=u(a,b,c);this._next=this.nodes[0];this._position=0}function v(a){return function(b,c){for(var h,d=c?b:b.parentNode;d;){h=d.nodeType;if(p.arrayContains(a,h))return d;d=d.parentNode}return null}}function t(a,b){if(da(a,b))throw new r("INVALID_NODE_TYPE_ERR");}function x(a){if(!a.startContainer)throw new G("INVALID_STATE_ERR");}function C(a,b){if(!p.arrayContains(b,a.nodeType))throw new r("INVALID_NODE_TYPE_ERR"); +}function B(a,b){if(0>b||b>(p.isCharacterDataNode(a)?a.length:a.childNodes.length))throw new G("INDEX_SIZE_ERR");}function F(a,b){if(S(a,!0)!==S(b,!0))throw new G("WRONG_DOCUMENT_ERR");}function z(a){if(ea(a,!0))throw new G("NO_MODIFICATION_ALLOWED_ERR");}function D(a,b){if(!a)throw new G(b);}function J(a){return!p.arrayContains(X,a.nodeType)&&!S(a,!0)}function O(a,b){return b<=(p.isCharacterDataNode(a)?a.length:a.childNodes.length)}function A(a){x(a);if(J(a.startContainer)||J(a.endContainer)||!O(a.startContainer, +a.startOffset)||!O(a.endContainer,a.endOffset))throw Error("Range error: Range is no longer valid after DOM mutation ("+a.inspect()+")");}function I(){}function M(a){a.START_TO_START=T;a.START_TO_END=Y;a.END_TO_END=fa;a.END_TO_START=Z;a.NODE_BEFORE=$;a.NODE_AFTER=aa;a.NODE_BEFORE_AND_AFTER=ba;a.NODE_INSIDE=U}function P(a){M(a);M(a.prototype)}function N(a,b){return function(){A(this);var c=this.startContainer,d=this.startOffset,e=this.commonAncestorContainer,g=new q(this,!0);c!==e&&(c=p.getClosestAncestorIn(c, +e,!0),d=k(c),c=d.node,d=d.offset);h(g,z);g.reset();e=a(g);g.detach();b(this,c,d,c,d);return e}}function Q(c,h,d){function e(a,b){return function(c){x(this);C(c,K);C(R(c),X);c=(a?f:k)(c);(b?g:l)(this,c.node,c.offset)}}function g(a,b,c){var d=a.endContainer,e=a.endOffset;if(b!==a.startContainer||c!==a.startOffset){if(R(b)!=R(d)||1==p.comparePoints(b,c,d,e))d=b,e=c;h(a,b,c,d,e)}}function l(a,b,c){var d=a.startContainer,e=a.startOffset;if(b!==a.endContainer||c!==a.endOffset){if(R(b)!=R(d)||-1==p.comparePoints(b, +c,d,e))d=b,e=c;h(a,d,e,b,c)}}c.prototype=new I;a.util.extend(c.prototype,{setStart:function(a,b){x(this);t(a,!0);B(a,b);g(this,a,b)},setEnd:function(a,b){x(this);t(a,!0);B(a,b);l(this,a,b)},setStartBefore:e(!0,!0),setStartAfter:e(!1,!0),setEndBefore:e(!0,!1),setEndAfter:e(!1,!1),collapse:function(a){A(this);a?h(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):h(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(a){x(this); +t(a,!0);h(this,a,0,a,p.getNodeLength(a))},selectNode:function(a){x(this);t(a,!1);C(a,K);var b=f(a);a=k(a);h(this,b.node,b.offset,a.node,a.offset)},extractContents:N(m,h),deleteContents:N(n,h),canSurroundContents:function(){A(this);z(this.startContainer);z(this.endContainer);var a=new q(this,!0),c=a._first&&b(a._first,this)||a._last&&b(a._last,this);a.detach();return!c},detach:function(){d(this)},splitBoundaries:function(){A(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,d= +this.endOffset,e=a===c;p.isCharacterDataNode(c)&&0=p.getNodeIndex(a)&&d++,b=0);h(this,a,b,c,d)},normalizeBoundaries:function(){A(this);var a=this.startContainer,b=this.startOffset,c=this.endContainer,d=this.endOffset,e=function(a){var b=a.nextSibling;b&&b.nodeType==a.nodeType&&(c=a,d=a.length,a.appendData(b.data),b.parentNode.removeChild(b))},g=function(h){var e= +h.previousSibling;if(e&&e.nodeType==h.nodeType){a=h;var g=h.length;b=e.length;h.insertData(0,e.data);e.parentNode.removeChild(e);a==c?(d+=b,c=a):c==h.parentNode&&(e=p.getNodeIndex(h),d==e?(c=h,d=g):d>e&&d--)}},m=!0;p.isCharacterDataNode(c)?c.length==d&&e(c):(0x",V=3==ca.firstChild.nodeType}catch(ia){}a.features.htmlParsingConforms=V;var W="startContainer startOffset endContainer endOffset collapsed commonAncestorContainer".split(" "),T=0,Y=1,fa=2,Z=3,$=0,aa=1,ba=2,U=3;I.prototype={attachListener:function(a,b){this._listeners[a].push(b)},compareBoundaryPoints:function(a,b){A(this);F(this.startContainer,b.startContainer);var c=a==Z||a==T?"start":"end",h=a==Y||a==T?"start":"end";return p.comparePoints(this[c+"Container"],this[c+ +"Offset"],b[h+"Container"],b[h+"Offset"])},insertNode:function(a){A(this);C(a,ga);z(this.startContainer);if(p.isAncestorOf(a,this.startContainer,!0))throw new G("HIERARCHY_REQUEST_ERR");a=l(a,this.startContainer,this.startOffset);this.setStartBefore(a)},cloneContents:function(){A(this);var a,b;if(this.collapsed)return d(this).createDocumentFragment();if(this.startContainer===this.endContainer&&p.isCharacterDataNode(this.startContainer))return a=this.startContainer.cloneNode(!0),a.data=a.data.slice(this.startOffset, +this.endOffset),b=d(this).createDocumentFragment(),b.appendChild(a),b;b=new q(this,!0);a=g(b);b.detach();return a},canSurroundContents:function(){A(this);z(this.startContainer);z(this.endContainer);var a=new q(this,!0),c=a._first&&b(a._first,this)||a._last&&b(a._last,this);a.detach();return!c},surroundContents:function(a){C(a,ha);if(!this.canSurroundContents())throw new r("BAD_BOUNDARYPOINTS_ERR");var b=this.extractContents();if(a.hasChildNodes())for(;a.lastChild;)a.removeChild(a.lastChild);l(a,this.startContainer, +this.startOffset);a.appendChild(b);this.selectNode(a)},cloneRange:function(){A(this);for(var a=new E(d(this)),b=W.length,c;b--;)c=W[b],a[c]=this[c];return a},toString:function(){A(this);var a=this.startContainer;if(a===this.endContainer&&p.isCharacterDataNode(a))return 3==a.nodeType||4==a.nodeType?a.data.slice(this.startOffset,this.endOffset):"";var b=[],a=new q(this,!0);h(a,function(a){3!=a.nodeType&&4!=a.nodeType||b.push(a.data)});a.detach();return b.join("")},compareNode:function(a){A(this);var b= +a.parentNode,c=p.getNodeIndex(a);if(!b)throw new G("NOT_FOUND_ERR");a=this.comparePoint(b,c);b=this.comparePoint(b,c+1);return 0>a?0p.comparePoints(a,b,this.startContainer,this.startOffset)?-1:0=e&&0<=c:0>e&&0=p.comparePoints(a,b,this.endContainer,this.endOffset)}, +intersectsRange:function(a,b){A(this);if(d(a)!=d(this))throw new G("WRONG_DOCUMENT_ERR");var c=p.comparePoints(this.startContainer,this.startOffset,a.endContainer,a.endOffset),h=p.comparePoints(this.endContainer,this.endOffset,a.startContainer,a.startOffset);return b?0>=c&&0<=h:0>c&&0=this.comparePoint(a,p.getNodeLength(a))},containsRange:function(a){return this.intersection(a).equals(a)},containsNodeText:function(a){var b=this.cloneRange();b.selectNode(a);var c=b.getNodes([3]);return 012");b.close();var c=r.getIframeWindow(a).getSelection(), +d=b.documentElement.lastChild.firstChild,b=b.createRange();b.setStart(d,1);b.collapse(!0);c.addRange(b);Q=1==c.rangeCount;c.removeAllRanges();var e=b.cloneRange();b.setStart(d,0);e.setEnd(d,2);c.addRange(b);c.addRange(e);N=2==c.rangeCount;b.detach();e.detach();A.removeChild(a)}();a.features.selectionSupportsMultipleRanges=N;a.features.collapsedNonEditableSelectionsSupported=Q;var H=!1,w;A&&s.isHostMethod(A,"createControlRange")&&(w=A.createControlRange(),s.areHostProperties(w,["item","add"])&&(H= +!0));a.features.implementsControlRange=H;F=I?function(a){return a.anchorNode===a.focusNode&&a.anchorOffset===a.focusOffset}:function(a){return a.rangeCount?a.getRangeAt(a.rangeCount-1).collapsed:!1};var E;s.isHostMethod(z,"getRangeAt")?E=function(a,b){try{return a.getRangeAt(b)}catch(c){return null}}:I&&(E=function(b){var c=r.getDocument(b.anchorNode),c=a.createRange(c);c.setStart(b.anchorNode,b.anchorOffset);c.setEnd(b.focusNode,b.focusOffset);c.collapsed!==this.isCollapsed&&(c.setStart(b.focusNode, +b.focusOffset),c.setEnd(b.anchorNode,b.anchorOffset));return c});a.getSelection=function(a){a=a||window;var b=a._rangySelection,c=B(a),e=D?d(a):null;b?(b.nativeSelection=c,b.docSelection=e,b.refresh(a)):(b=new m(c,e,a),a._rangySelection=b);return b};a.getIframeSelection=function(b){return a.getSelection(r.getIframeWindow(b))};w=m.prototype;if(!J&&I&&s.areHostMethods(z,["removeAllRanges","addRange"])){w.removeAllRanges=function(){this.nativeSelection.removeAllRanges();f(this)};var p=function(b,c){var d= +v.getRangeDocument(c),d=a.createRange(d);d.collapseToPoint(c.endContainer,c.endOffset);b.nativeSelection.addRange(k(d));b.nativeSelection.extend(c.startContainer,c.startOffset);b.refresh()};w.addRange=P?function(b,c){if(H&&D&&"Control"==this.docSelection.type)n(this,b);else if(c&&M)p(this,b);else{var d;N?d=this.rangeCount:(this.removeAllRanges(),d=0);this.nativeSelection.addRange(k(b));this.rangeCount=this.nativeSelection.rangeCount;this.rangeCount==d+1?(a.config.checkSelectionRanges&&(d=E(this.nativeSelection, +this.rangeCount-1))&&!v.rangesEqual(d,b)&&(b=new t(d)),this._ranges[this.rangeCount-1]=b,e(this,b,K(this.nativeSelection)),this.isCollapsed=F(this)):this.refresh()}}:function(a,b){b&&M?p(this,a):(this.nativeSelection.addRange(k(a)),this.refresh())};w.setRanges=function(a){if(H&&1a||a>=this.rangeCount)throw new x("INDEX_SIZE_ERR");return this._ranges[a]};var L;if(J)L=function(b){var c;a.isSelectionValid(b.win)?c=b.docSelection.createRange():(c=r.getBody(b.win.document).createTextRange(),c.collapse(!0));"Control"==b.docSelection.type?h(b):c&&"undefined"!=typeof c.text? +g(b,c):f(b)};else if(s.isHostMethod(z,"getRangeAt")&&"number"==typeof z.rangeCount)L=function(b){if(H&&D&&"Control"==b.docSelection.type)h(b);else if(b._ranges.length=b.rangeCount=b.nativeSelection.rangeCount,b.rangeCount){for(var c=0,d=b.rangeCount;c+(/ipad|iphone|ipod/.test(a)&&a.match(/ os (\d+).+? like mac os x/)||[,0])[1];a=m||this.isAndroid()&&4>+(a.match(/android (\d+)/)||[,0])[1]||-1!==a.indexOf("opera mobi")||-1!==a.indexOf("hpwos/");return b&&d&&e&&!a},isTouchDevice:function(){return this.supportsEvent("touchmove")},isIos:function(){return/ipad|iphone|ipod/i.test(this.USER_AGENT)},isAndroid:function(){return-1!==this.USER_AGENT.indexOf("Android")},supportsSandboxedIframes:function(){return b},throwsMixedContentWarningWhenIframeSrcIsEmpty:function(){return!("querySelector"in +document)},displaysCaretInEmptyContentEditableCorrectly:function(){return b},hasCurrentStyleProperty:function(){return"currentStyle"in c},hasHistoryIssue:function(){return d&&"Mac"===navigator.platform.substr(0,3)},insertsLineBreaksOnReturn:function(){return d},supportsPlaceholderAttributeOn:function(a){return"placeholder"in a},supportsEvent:function(a){var b;(b="on"+a in c)||(c.setAttribute("on"+a,"return;"),b="function"===typeof c["on"+a]);return b},supportsEventsInIframeCorrectly:function(){return!k}, +supportsHTML5Tags:function(a){a=a.createElement("div");a.innerHTML="
foo
";return"
foo
"===a.innerHTML.toLowerCase()},supportsCommand:function(){var a={formatBlock:b,insertUnorderedList:b||e,insertOrderedList:b||e},c={insertHTML:d};return function(b,d){if(!a[d]){try{return b.queryCommandSupported(d)}catch(e){}try{return b.queryCommandEnabled(d)}catch(f){return!!c[d]}}return!1}}(),doesAutoLinkingInContentEditable:function(){return b},canDisableAutoLinking:function(){return this.supportsCommand(document, +"AutoUrlDetect")},clearsContentEditableCorrectly:function(){return d||k||e},supportsGetAttributeCorrectly:function(){return"1"!=document.createElement("td").getAttribute("rowspan")},canSelectImagesInContentEditable:function(){return d||b||k},autoScrollsToCaret:function(){return!e},autoClosesUnclosedTags:function(){var a=c.cloneNode(!1),b;a.innerHTML="

";a=a.innerHTML.toLowerCase();b="

"===a||"

"===a;this.autoClosesUnclosedTags=function(){return b};return b}, +supportsNativeGetElementsByClassName:function(){return-1!==String(document.getElementsByClassName).indexOf("[native code]")},supportsSelectionModify:function(){return"getSelection"in window&&"modify"in window.getSelection()},needsSpaceAfterLineBreak:function(){return k},supportsSpeechApiOn:function(b){return 11<=(a.match(/Chrome\/(\d+)/)||[,0])[1]&&("onwebkitspeechchange"in b||"speech"in b)},crashesWhenDefineProperty:function(a){return b&&("XMLHttpRequest"===a||"XDomainRequest"===a)},doesAsyncFocus:function(){return b}, +hasProblemsSettingCaretAfterImg:function(){return b},hasUndoInContextMenu:function(){return d||f||k},hasInsertNodeIssue:function(){return k},hasIframeFocusIssue:function(){return b},createsNestedInvalidMarkupAfterPaste:function(){return e}}}(); +wysihtml5.lang.array=function(a){return{contains:function(c){if(a.indexOf)return-1!==a.indexOf(c);for(var b=0,d=a.length;b"]/g,d={"&":"&","<":"<",">":">",'"':"""};wysihtml5.lang.string=function(e){e=String(e);return{trim:function(){return e.replace(a,"").replace(c,"")},interpolate:function(a){for(var b in a)e=this.replace("#{"+b+"}").by(a[b]);return e},replace:function(a){return{by:function(b){return e.split(a).join(b)}}},escapeHTML:function(){return e.replace(b,function(a){return d[a]})}}}})(); +(function(a){function c(a){return a.replace(e,function(a,b){var c=(b.match(f)||[])[1]||"",d=l[c];b=b.replace(f,"");b.split(d).length>b.split(c).length&&(b+=c,c="");var e=d=b;b.length>k&&(e=e.substr(0,k)+"...");"www."===d.substr(0,4)&&(d="http://"+d);return''+e+""+c})}function b(g){if(!d.contains(g.nodeName))if(g.nodeType===a.TEXT_NODE&&g.data.match(e)){var h=g.parentNode,f=a.lang.string(g.data).escapeHTML(),m;m=h.ownerDocument;var k=m._wysihtml5_tempElement;k||(k=m._wysihtml5_tempElement= +m.createElement("div"));m=k;m.innerHTML=""+c(f);for(m.removeChild(m.firstChild);m.firstChild;)h.insertBefore(m.firstChild,g);h.removeChild(g)}else{h=a.lang.array(g.childNodes).get();f=h.length;for(m=0;m=j.childNodes.length&&j.nodeName.toLowerCase()===d&&!j.attributes.length?j.firstChild:j}function c(a,b){var b=b.toLowerCase(),c;if(c="IMG"==a.nodeName)if(c="src"==b){var d;a:{try{d=a.complete&&!a.mozMatchesSelector(":-moz-broken");break a}catch(e){if(a.complete&&"complete"===a.readyState){d=!0;break a}}d=void 0}c= -!0===d}return c?a.src:i&&"outerHTML"in a?-1!=a.outerHTML.toLowerCase().indexOf(" "+b+"=")?a.getAttribute(b):null:a.getAttribute(b)}var a={1:function(a){var b,g,j=h.tags;g=a.nodeName.toLowerCase();b=a.scopeName;if(a._wysihtml5)return null;a._wysihtml5=1;if("wysihtml5-temp"===a.className)return null;b&&"HTML"!=b&&(g=b+":"+g);"outerHTML"in a&&!wysihtml5.browser.autoClosesUnclosedTags()&&("P"===a.nodeName&&"

"!==a.outerHTML.slice(-4).toLowerCase())&&(g="div");if(g in j){b=j[g];if(!b||b.remove)return null; -b="string"===typeof b?{rename_tag:b}:b}else if(a.firstChild)b={rename_tag:d};else return null;g=a.ownerDocument.createElement(b.rename_tag||g);var j={},f=b.set_class,k=b.add_class,i=b.set_attributes,m=b.check_attributes,n=h.classes,p=0,t=[];b=[];var u=[],r=[],w;i&&(j=wysihtml5.lang.object(i).clone());if(m)for(w in m)if(i=v[m[w]])i=i(c(a,w)),"string"===typeof i&&(j[w]=i);f&&t.push(f);if(k)for(w in k)if(i=q[k[w]])f=i(c(a,w)),"string"===typeof f&&t.push(f);n["_wysihtml5-temp-placeholder"]=1;(r=a.getAttribute("class"))&& -(t=t.concat(r.split(e)));for(k=t.length;p';a.stylesheets=d;return b.lang.string('#{stylesheets}').interpolate(a)},_unset:function(a,c,d,e){try{a[c]=d}catch(j){}try{a.__defineGetter__(c,function(){return d})}catch(k){}if(e)try{a.__defineSetter__(c, -function(){})}catch(m){}if(!b.browser.crashesWhenDefineProperty(c))try{var n={get:function(){return d}};e&&(n.set=function(){});Object.defineProperty(a,c,n)}catch(v){}}})})(wysihtml5);(function(){var b={className:"class"};wysihtml5.dom.setAttributes=function(c){return{on:function(a){for(var d in c)a.setAttribute(b[d]||d,c[d])}}}})(); -wysihtml5.dom.setStyles=function(b){return{on:function(c){c=c.style;if("string"===typeof b)c.cssText+=";"+b;else for(var a in b)"float"===a?(c.cssFloat=b[a],c.styleFloat=b[a]):c[a]=b[a]}}}; -(function(b){b.simulatePlaceholder=function(c,a,d){var e=function(){a.hasPlaceholderSet()&&a.clear();a.placeholderSet=!1;b.removeClass(a.element,"placeholder")},f=function(){a.isEmpty()&&(a.placeholderSet=!0,a.setValue(d),b.addClass(a.element,"placeholder"))};c.on("set_placeholder",f).on("unset_placeholder",e).on("focus:composer",e).on("paste:composer",e).on("blur:composer",f);f()}})(wysihtml5.dom); -(function(b){var c=document.documentElement;"textContent"in c?(b.setTextContent=function(a,b){a.textContent=b},b.getTextContent=function(a){return a.textContent}):"innerText"in c?(b.setTextContent=function(a,b){a.innerText=b},b.getTextContent=function(a){return a.innerText}):(b.setTextContent=function(a,b){a.nodeValue=b},b.getTextContent=function(a){return a.nodeValue})})(wysihtml5.dom); -wysihtml5.quirks.cleanPastedHTML=function(){var b={"a u":wysihtml5.dom.replaceWithChildNodes};return function(c,a,d){var a=a||b,d=d||c.ownerDocument||document,e="string"===typeof c,f,h,i,g=0,c=e?wysihtml5.dom.getAsDom(c,d):c;for(i in a){f=c.querySelectorAll(i);d=a[i];for(h=f.length;g 

"==a||"

 

 

"==a)b.innerHTML=""},0)};return function(c){wysihtml5.dom.observe(c.element,["cut","keydown"],b)}}(); -(function(b){b.quirks.getCorrectInnerHTML=function(c){var a=c.innerHTML;if(-1===a.indexOf("%7E"))return a;var c=c.querySelectorAll("[href*='~'], [src*='~']"),d,e,f,h;h=0;for(f=c.length;h'+b.INVISIBLE_SPACE+"
",g=this.getRange(this.doc),j;if(g){b.browser.hasInsertNodeIssue()?this.doc.execCommand("insertHTML", -!1,i):(i=g.createContextualFragment(i),g.insertNode(i));try{a(g.startContainer,g.endContainer)}catch(k){setTimeout(function(){throw k;},0)}(g=this.doc.querySelector("._wysihtml5-temp-placeholder"))?(i=rangy.createRange(this.doc),j=g.nextSibling,b.browser.hasInsertNodeIssue()&&j&&"BR"===j.nodeName?(j=this.doc.createTextNode(b.INVISIBLE_SPACE),c.insert(j).after(g),i.setStartBefore(j),i.setEndBefore(j)):(i.selectNode(g),i.deleteContents()),this.setSelection(i)):e.focus();d&&(e.scrollTop=f,e.scrollLeft= -h);try{g.parentNode.removeChild(g)}catch(m){}}else a(e,e)},executeAndRestoreSimple:function(a){var b,c,f=this.getRange(),h=this.doc.body,i;if(f){b=f.getNodes([3]);h=b[0]||f.startContainer;i=b[b.length-1]||f.endContainer;b=h===f.startContainer?f.startOffset:0;c=i===f.endContainer?f.endOffset:i.length;try{a(f.startContainer,f.endContainer)}catch(g){setTimeout(function(){throw g;},0)}a=rangy.createRange(this.doc);try{a.setStart(h,b)}catch(j){}try{a.setEnd(i,c)}catch(k){}try{this.setSelection(a)}catch(m){}}else a(h, -h)},set:function(a,b){var c=rangy.createRange(this.doc);c.setStart(a,b||0);this.setSelection(c)},insertHTML:function(a){var a=rangy.createRange(this.doc).createContextualFragment(a),b=a.lastChild;this.insertNode(a);b&&this.setAfter(b)},insertNode:function(a){var b=this.getRange();b&&b.insertNode(a)},surround:function(a){var b=this.getRange();if(b)try{b.surroundContents(a),this.selectNode(a)}catch(c){a.appendChild(b.extractContents()),b.insertNode(a)}},scrollIntoView:function(){var a=this.doc,c=a.documentElement.scrollHeight> -a.documentElement.offsetHeight,e;if(!(e=a._wysihtml5ScrollIntoViewElement))e=a.createElement("span"),e.innerHTML=b.INVISIBLE_SPACE;e=a._wysihtml5ScrollIntoViewElement=e;if(c){this.insertNode(e);var c=e,f=0;if(c.parentNode){do f+=c.offsetTop||0,c=c.offsetParent;while(c)}c=f;e.parentNode.removeChild(e);c>=a.body.scrollTop+a.documentElement.offsetHeight-5&&(a.body.scrollTop=c)}},selectLine:function(){b.browser.supportsSelectionModify()?this._selectLine_W3C():this.doc.selection&&this._selectLine_MSIE()}, -_selectLine_W3C:function(){var a=this.doc.defaultView.getSelection();a.modify("extend","left","lineboundary");a.modify("extend","right","lineboundary")},_selectLine_MSIE:function(){var a=this.doc.selection.createRange(),b=a.boundingTop,c=this.doc.body.scrollWidth,f;if(a.moveToPoint){0===b&&(f=this.doc.createElement("span"),this.insertNode(f),b=f.offsetTop,f.parentNode.removeChild(f));b+=1;for(f=-10;f"===h.innerHTML,b.selection.executeAndRestore(function(){e=wysihtml5.dom.convertToList(h,"ol")}),a&&b.selection.selectNode(e.querySelector("li"),!0))},state:function(b){b=b.selection.getSelectedNode();return wysihtml5.dom.getParentElement(b,{nodeName:"OL"})}}; -wysihtml5.commands.insertUnorderedList={exec:function(b,c){var a=b.doc,d=b.selection.getSelectedNode(),e=wysihtml5.dom.getParentElement(d,{nodeName:"UL"}),f=wysihtml5.dom.getParentElement(d,{nodeName:"OL"}),d="_wysihtml5-temp-"+(new Date).getTime(),h;!e&&!f&&b.commands.support(c)?a.execCommand(c,!1,null):e?b.selection.executeAndRestore(function(){wysihtml5.dom.resolveList(e,b.config.useLineBreaks)}):f?b.selection.executeAndRestore(function(){wysihtml5.dom.renameElement(f,"ul")}):(b.commands.exec("formatBlock", -"div",d),h=a.querySelector("."+d),a=""===h.innerHTML||h.innerHTML===wysihtml5.INVISIBLE_SPACE||"
"===h.innerHTML,b.selection.executeAndRestore(function(){e=wysihtml5.dom.convertToList(h,"ul")}),a&&b.selection.selectNode(e.querySelector("li"),!0))},state:function(b){b=b.selection.getSelectedNode();return wysihtml5.dom.getParentElement(b,{nodeName:"UL"})}}; -wysihtml5.commands.italic={exec:function(b,c){return wysihtml5.commands.formatInline.exec(b,c,"i")},state:function(b,c){return wysihtml5.commands.formatInline.state(b,c,"i")}};(function(b){var c=/wysiwyg-text-align-[0-9a-z]+/g;b.commands.justifyCenter={exec:function(a){return b.commands.formatBlock.exec(a,"formatBlock",null,"wysiwyg-text-align-center",c)},state:function(a){return b.commands.formatBlock.state(a,"formatBlock",null,"wysiwyg-text-align-center",c)}}})(wysihtml5); -(function(b){var c=/wysiwyg-text-align-[0-9a-z]+/g;b.commands.justifyLeft={exec:function(a){return b.commands.formatBlock.exec(a,"formatBlock",null,"wysiwyg-text-align-left",c)},state:function(a){return b.commands.formatBlock.state(a,"formatBlock",null,"wysiwyg-text-align-left",c)}}})(wysihtml5); -(function(b){var c=/wysiwyg-text-align-[0-9a-z]+/g;b.commands.justifyRight={exec:function(a){return b.commands.formatBlock.exec(a,"formatBlock",null,"wysiwyg-text-align-right",c)},state:function(a){return b.commands.formatBlock.state(a,"formatBlock",null,"wysiwyg-text-align-right",c)}}})(wysihtml5); -(function(b){var c=/wysiwyg-text-align-[0-9a-z]+/g;b.commands.justifyFull={exec:function(a){return b.commands.formatBlock.exec(a,"formatBlock",null,"wysiwyg-text-align-justify",c)},state:function(a){return b.commands.formatBlock.state(a,"formatBlock",null,"wysiwyg-text-align-justify",c)}}})(wysihtml5);wysihtml5.commands.redo={exec:function(b){return b.undoManager.redo()},state:function(){return!1}}; -wysihtml5.commands.underline={exec:function(b,c){return wysihtml5.commands.formatInline.exec(b,c,"u")},state:function(b,c){return wysihtml5.commands.formatInline.state(b,c,"u")}};wysihtml5.commands.undo={exec:function(b){return b.undoManager.undo()},state:function(){return!1}}; -(function(b){var c=''+b.INVISIBLE_SPACE+"",a=''+b.INVISIBLE_SPACE+"",d=b.dom;b.UndoManager=b.lang.Dispatcher.extend({constructor:function(a){this.editor=a;this.composer=a.composer;this.element=this.composer.element;this.position=0;this.historyStr=[];this.historyDom=[];this.transact();this._observe()},_observe:function(){var e=this,f=this.composer.sandbox.getDocument(),h;d.observe(this.element, -"keydown",function(a){if(!(a.altKey||!a.ctrlKey&&!a.metaKey)){var b=a.keyCode,c=90===b&&a.shiftKey||89===b;90===b&&!a.shiftKey?(e.undo(),a.preventDefault()):c&&(e.redo(),a.preventDefault())}});d.observe(this.element,"keydown",function(a){a=a.keyCode;a!==h&&(h=a,(8===a||46===a)&&e.transact())});if(b.browser.hasUndoInContextMenu()){var i,g,j=function(){for(var a;a=f.querySelector("._wysihtml5-temp");)a.parentNode.removeChild(a);clearInterval(i)};d.observe(this.element,"contextmenu",function(){j();e.composer.selection.executeAndRestoreSimple(function(){e.element.lastChild&& -e.composer.selection.setAfter(e.element.lastChild);f.execCommand("insertHTML",!1,c);f.execCommand("insertHTML",!1,a);f.execCommand("undo",!1,null)});i=setInterval(function(){f.getElementById("_wysihtml5-redo")?(j(),e.redo()):f.getElementById("_wysihtml5-undo")||(j(),e.undo())},400);g||(g=!0,d.observe(document,"mousedown",j),d.observe(f,["mousedown","paste","cut","copy"],j))})}this.editor.on("newword:composer",function(){e.transact()}).on("beforecommand:composer",function(){e.transact()})},transact:function(){var a= -this.historyStr[this.position-1],c=this.composer.getValue();if(c!==a){if(25<(this.historyStr.length=this.historyDom.length=this.position))this.historyStr.shift(),this.historyDom.shift(),this.position--;this.position++;var d=this.composer.selection.getRange(),a=d.startContainer||this.element,i=d.startOffset||0,g;a.nodeType===b.ELEMENT_NODE?d=a:(d=a.parentNode,g=this.getChildNodeIndex(d,a));d.setAttribute("data-wysihtml5-selection-offset",i);"undefined"!==typeof g&&d.setAttribute("data-wysihtml5-selection-node", +wysihtml5.dom.parse=function(){function a(c,e){var h=c.childNodes,g=h.length,f=b[c.nodeType],k=0,n,f=f&&f(c);if(!f)return null;for(k=0;k"===a.outerHTML.slice(-4).toLowerCase()|| +(g="div"));if(g in f){b=f[g];if(!b||b.remove)return null;b="string"===typeof b?{rename_tag:b}:b}else if(a.firstChild)b={rename_tag:d};else return null;g=a.ownerDocument.createElement(b.rename_tag||g);var f={},l=b.set_class,s=b.add_class,v=b.set_attributes,t=b.check_attributes,x=k.classes,C=0,B=[];b=[];var F=[],z=[],D;v&&(f=wysihtml5.lang.object(v).clone());if(t)for(D in t)if(v=h[t[D]])v=v(c(a,D)),"string"===typeof v&&(f[D]=v);l&&B.push(l);if(s)for(D in s)if(v=n[s[D]])l=v(c(a,D)),"string"===typeof l&& +B.push(l);x["_wysihtml5-temp-placeholder"]=1;(z=a.getAttribute("class"))&&(B=B.concat(z.split(e)));for(s=B.length;C';b.stylesheets=d;return a.lang.string('#{stylesheets}').interpolate(b)},_unset:function(b,c,d,e){try{b[c]=d}catch(h){}try{b.__defineGetter__(c,function(){return d})}catch(n){}if(e)try{b.__defineSetter__(c, +function(){})}catch(m){}if(!a.browser.crashesWhenDefineProperty(c))try{var u={get:function(){return d}};e&&(u.set=function(){});Object.defineProperty(b,c,u)}catch(y){}}})})(wysihtml5);(function(){var a={className:"class"};wysihtml5.dom.setAttributes=function(c){return{on:function(b){for(var d in c)b.setAttribute(a[d]||d,c[d])}}}})(); +wysihtml5.dom.setStyles=function(a){return{on:function(c){c=c.style;if("string"===typeof a)c.cssText+=";"+a;else for(var b in a)"float"===b?(c.cssFloat=a[b],c.styleFloat=a[b]):c[b]=a[b]}}}; +(function(a){a.simulatePlaceholder=function(c,b,d){var e=function(){b.hasPlaceholderSet()&&b.clear();b.placeholderSet=!1;a.removeClass(b.element,"placeholder")},f=function(){b.isEmpty()&&(b.placeholderSet=!0,b.setValue(d),a.addClass(b.element,"placeholder"))};c.on("set_placeholder",f).on("unset_placeholder",e).on("focus:composer",e).on("paste:composer",e).on("blur:composer",f);f()}})(wysihtml5.dom); +(function(a){var c=document.documentElement;"textContent"in c?(a.setTextContent=function(a,c){a.textContent=c},a.getTextContent=function(a){return a.textContent}):"innerText"in c?(a.setTextContent=function(a,c){a.innerText=c},a.getTextContent=function(a){return a.innerText}):(a.setTextContent=function(a,c){a.nodeValue=c},a.getTextContent=function(a){return a.nodeValue})})(wysihtml5.dom); +wysihtml5.quirks.cleanPastedHTML=function(){var a={"a u":wysihtml5.dom.replaceWithChildNodes};return function(c,b,d){b=b||a;d=d||c.ownerDocument||document;var e="string"===typeof c,f,k,l,g=0;c=e?wysihtml5.dom.getAsDom(c,d):c;for(l in b)for(f=c.querySelectorAll(l),d=b[l],k=f.length;g 

"==b||"

 

 

"==b)a.innerHTML=""},0)};return function(c){wysihtml5.dom.observe(c.element,["cut","keydown"],a)}}(); +(function(a){a.quirks.getCorrectInnerHTML=function(c){var b=c.innerHTML;if(-1===b.indexOf("%7E"))return b;c=c.querySelectorAll("[href*='~'], [src*='~']");var d,e,f,k;k=0;for(f=c.length;k'+a.INVISIBLE_SPACE+"",g=this.getRange(this.doc),h;if(g){a.browser.hasInsertNodeIssue()?this.doc.execCommand("insertHTML", +!1,l):(l=g.createContextualFragment(l),g.insertNode(l));try{b(g.startContainer,g.endContainer)}catch(n){setTimeout(function(){throw n;},0)}(g=this.doc.querySelector("._wysihtml5-temp-placeholder"))?(l=rangy.createRange(this.doc),h=g.nextSibling,a.browser.hasInsertNodeIssue()&&h&&"BR"===h.nodeName?(h=this.doc.createTextNode(a.INVISIBLE_SPACE),c.insert(h).after(g),l.setStartBefore(h),l.setEndBefore(h)):(l.selectNode(g),l.deleteContents()),this.setSelection(l)):e.focus();d&&(e.scrollTop=f,e.scrollLeft= +k);try{g.parentNode.removeChild(g)}catch(m){}}else b(e,e)},executeAndRestoreSimple:function(a){var c,e,f=this.getRange(),k=this.doc.body,l;if(f){c=f.getNodes([3]);k=c[0]||f.startContainer;l=c[c.length-1]||f.endContainer;c=k===f.startContainer?f.startOffset:0;e=l===f.endContainer?f.endOffset:l.length;try{a(f.startContainer,f.endContainer)}catch(g){setTimeout(function(){throw g;},0)}a=rangy.createRange(this.doc);try{a.setStart(k,c)}catch(h){}try{a.setEnd(l,e)}catch(n){}try{this.setSelection(a)}catch(m){}}else a(k, +k)},set:function(a,c){var e=rangy.createRange(this.doc);e.setStart(a,c||0);this.setSelection(e)},insertHTML:function(a){a=rangy.createRange(this.doc).createContextualFragment(a);var c=a.lastChild;this.insertNode(a);c&&this.setAfter(c)},insertNode:function(a){var c=this.getRange();c&&c.insertNode(a)},surround:function(a){var c=this.getRange();if(c)try{c.surroundContents(a),this.selectNode(a)}catch(e){a.appendChild(c.extractContents()),c.insertNode(a)}},scrollIntoView:function(){var b=this.doc,c=b.documentElement.scrollHeight> +b.documentElement.offsetHeight,e;(e=b._wysihtml5ScrollIntoViewElement)||(e=b.createElement("span"),e.innerHTML=a.INVISIBLE_SPACE);e=b._wysihtml5ScrollIntoViewElement=e;if(c){this.insertNode(e);var c=e,f=0;if(c.parentNode){do f+=c.offsetTop||0,c=c.offsetParent;while(c)}c=f;e.parentNode.removeChild(e);c>=b.body.scrollTop+b.documentElement.offsetHeight-5&&(b.body.scrollTop=c)}},selectLine:function(){a.browser.supportsSelectionModify()?this._selectLine_W3C():this.doc.selection&&this._selectLine_MSIE()}, +_selectLine_W3C:function(){var a=this.doc.defaultView.getSelection();a.modify("extend","left","lineboundary");a.modify("extend","right","lineboundary")},_selectLine_MSIE:function(){var a=this.doc.selection.createRange(),c=a.boundingTop,e=this.doc.body.scrollWidth,f;if(a.moveToPoint){0===c&&(f=this.doc.createElement("span"),this.insertNode(f),c=f.offsetTop,f.parentNode.removeChild(f));c+=1;for(f=-10;f"===k.innerHTML,a.selection.executeAndRestore(function(){e=wysihtml5.dom.convertToList(k,"ol")}),b&&a.selection.selectNode(e.querySelector("li"),!0)):b.execCommand(c,!1,null)},state:function(a){a=a.selection.getSelectedNode();return wysihtml5.dom.getParentElement(a,{nodeName:"OL"})}}; +wysihtml5.commands.insertUnorderedList={exec:function(a,c){var b=a.doc,d=a.selection.getSelectedNode(),e=wysihtml5.dom.getParentElement(d,{nodeName:"UL"}),f=wysihtml5.dom.getParentElement(d,{nodeName:"OL"}),d="_wysihtml5-temp-"+(new Date).getTime(),k;e||f||!a.commands.support(c)?e?a.selection.executeAndRestore(function(){wysihtml5.dom.resolveList(e,a.config.useLineBreaks)}):f?a.selection.executeAndRestore(function(){wysihtml5.dom.renameElement(f,"ul")}):(a.commands.exec("formatBlock","div",d),k=b.querySelector("."+ +d),b=""===k.innerHTML||k.innerHTML===wysihtml5.INVISIBLE_SPACE||"
"===k.innerHTML,a.selection.executeAndRestore(function(){e=wysihtml5.dom.convertToList(k,"ul")}),b&&a.selection.selectNode(e.querySelector("li"),!0)):b.execCommand(c,!1,null)},state:function(a){a=a.selection.getSelectedNode();return wysihtml5.dom.getParentElement(a,{nodeName:"UL"})}}; +wysihtml5.commands.italic={exec:function(a,c){return wysihtml5.commands.formatInline.exec(a,c,"i")},state:function(a,c){return wysihtml5.commands.formatInline.state(a,c,"i")}};(function(a){var c=/wysiwyg-text-align-[0-9a-z]+/g;a.commands.justifyCenter={exec:function(b,d){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-center",c)},state:function(b,d){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-center",c)}}})(wysihtml5); +(function(a){var c=/wysiwyg-text-align-[0-9a-z]+/g;a.commands.justifyLeft={exec:function(b,d){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-left",c)},state:function(b,d){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-left",c)}}})(wysihtml5); +(function(a){var c=/wysiwyg-text-align-[0-9a-z]+/g;a.commands.justifyRight={exec:function(b,d){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-right",c)},state:function(b,d){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-right",c)}}})(wysihtml5); +(function(a){var c=/wysiwyg-text-align-[0-9a-z]+/g;a.commands.justifyFull={exec:function(b,d){return a.commands.formatBlock.exec(b,"formatBlock",null,"wysiwyg-text-align-justify",c)},state:function(b,d){return a.commands.formatBlock.state(b,"formatBlock",null,"wysiwyg-text-align-justify",c)}}})(wysihtml5);wysihtml5.commands.redo={exec:function(a){return a.undoManager.redo()},state:function(a){return!1}}; +wysihtml5.commands.underline={exec:function(a,c){return wysihtml5.commands.formatInline.exec(a,c,"u")},state:function(a,c){return wysihtml5.commands.formatInline.state(a,c,"u")}};wysihtml5.commands.undo={exec:function(a){return a.undoManager.undo()},state:function(a){return!1}}; +(function(a){var c=''+a.INVISIBLE_SPACE+"",b=''+a.INVISIBLE_SPACE+"",d=a.dom;a.UndoManager=a.lang.Dispatcher.extend({constructor:function(a){this.editor=a;this.composer=a.composer;this.element=this.composer.element;this.position=0;this.historyStr=[];this.historyDom=[];this.transact();this._observe()},_observe:function(){var e=this,f=this.composer.sandbox.getDocument(),k;d.observe(this.element, +"keydown",function(a){if(!a.altKey&&(a.ctrlKey||a.metaKey)){var b=a.keyCode,c=90===b&&a.shiftKey||89===b;90!==b||a.shiftKey?c&&(e.redo(),a.preventDefault()):(e.undo(),a.preventDefault())}});d.observe(this.element,"keydown",function(a){a=a.keyCode;a!==k&&(k=a,8!==a&&46!==a||e.transact())});if(a.browser.hasUndoInContextMenu()){var l,g,h=function(){for(var a;a=f.querySelector("._wysihtml5-temp");)a.parentNode.removeChild(a);clearInterval(l)};d.observe(this.element,"contextmenu",function(){h();e.composer.selection.executeAndRestoreSimple(function(){e.element.lastChild&& +e.composer.selection.setAfter(e.element.lastChild);f.execCommand("insertHTML",!1,c);f.execCommand("insertHTML",!1,b);f.execCommand("undo",!1,null)});l=setInterval(function(){f.getElementById("_wysihtml5-redo")?(h(),e.redo()):f.getElementById("_wysihtml5-undo")||(h(),e.undo())},400);g||(g=!0,d.observe(document,"mousedown",h),d.observe(f,["mousedown","paste","cut","copy"],h))})}this.editor.on("newword:composer",function(){e.transact()}).on("beforecommand:composer",function(){e.transact()})},transact:function(){var b= +this.historyStr[this.position-1],c=this.composer.getValue();if(c!==b){25<(this.historyStr.length=this.historyDom.length=this.position)&&(this.historyStr.shift(),this.historyDom.shift(),this.position--);this.position++;var d=this.composer.selection.getRange(),b=d.startContainer||this.element,l=d.startOffset||0,g;b.nodeType===a.ELEMENT_NODE?d=b:(d=b.parentNode,g=this.getChildNodeIndex(d,b));d.setAttribute("data-wysihtml5-selection-offset",l);"undefined"!==typeof g&&d.setAttribute("data-wysihtml5-selection-node", g);g=this.element.cloneNode(!!c);this.historyDom.push(g);this.historyStr.push(c);d.removeAttribute("data-wysihtml5-selection-offset");d.removeAttribute("data-wysihtml5-selection-node")}},undo:function(){this.transact();this.undoPossible()&&(this.set(this.historyDom[--this.position-1]),this.editor.fire("undo:composer"))},redo:function(){this.redoPossible()&&(this.set(this.historyDom[++this.position-1]),this.editor.fire("redo:composer"))},undoPossible:function(){return 1",constructor:function(a,b,c){this.base(a,b,c);this.textarea=this.parent.textarea;this._initSandbox()},clear:function(){this.element.innerHTML=a.displaysCaretInEmptyContentEditableCorrectly()?"":this.CARET_HACK},getValue:function(a){var c=this.isEmpty()?"":b.quirks.getCorrectInnerHTML(this.element);a&&(c=this.parent.parse(c));return c=b.lang.string(c).replace(b.INVISIBLE_SPACE).by("")},setValue:function(a, -b){b&&(a=this.parent.parse(a));try{this.element.innerHTML=a}catch(c){this.element.innerText=a}},show:function(){this.iframe.style.display=this._displayStyle||"";this.textarea.element.disabled||(this.disable(),this.enable())},hide:function(){this._displayStyle=c.getStyle("display").from(this.iframe);"none"===this._displayStyle&&(this._displayStyle=null);this.iframe.style.display="none"},disable:function(){this.parent.fire("disable:composer");this.element.removeAttribute("contentEditable")},enable:function(){this.parent.fire("enable:composer"); -this.element.setAttribute("contentEditable","true")},focus:function(a){b.browser.doesAsyncFocus()&&this.hasPlaceholderSet()&&this.clear();this.base();var c=this.element.lastChild;a&&c&&("BR"===c.nodeName?this.selection.setBefore(this.element.lastChild):this.selection.setAfter(this.element.lastChild))},getTextContent:function(){return c.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==this.textarea.element.getAttribute("placeholder")&&this.placeholderSet},isEmpty:function(){var a= -this.element.innerHTML.toLowerCase();return""===a||"
"===a||"

"===a||"


"===a||this.hasPlaceholderSet()},_initSandbox:function(){var a=this;this.sandbox=new c.Sandbox(function(){a._create()},{stylesheets:this.config.stylesheets});this.iframe=this.sandbox.getIframe();var b=this.textarea.element;c.insert(this.iframe).after(b);if(b.form){var f=document.createElement("input");f.type="hidden";f.name="_wysihtml5_mode";f.value=1;c.insert(f).after(b)}},_create:function(){var d=this;this.doc= -this.sandbox.getDocument();this.element=this.doc.body;this.textarea=this.parent.textarea;this.element.innerHTML=this.textarea.getValue(!0);this.selection=new b.Selection(this.parent);this.commands=new b.Commands(this.parent);c.copyAttributes("className spellcheck title lang dir accessKey".split(" ")).from(this.textarea.element).to(this.element);c.addClass(this.element,this.config.composerClassName);this.config.style&&this.style();this.observe();var e=this.config.name;e&&(c.addClass(this.element,e), -c.addClass(this.iframe,e));this.enable();this.textarea.element.disabled&&this.disable();(e="string"===typeof this.config.placeholder?this.config.placeholder:this.textarea.element.getAttribute("placeholder"))&&c.simulatePlaceholder(this.parent,this,e);this.commands.exec("styleWithCSS",!1);this._initAutoLinking();this._initObjectResizing();this._initUndoManager();this._initLineBreaking();(this.textarea.element.hasAttribute("autofocus")||document.querySelector(":focus")==this.textarea.element)&&!a.isIos()&& -setTimeout(function(){d.focus(!0)},100);a.clearsContentEditableCorrectly()||b.quirks.ensureProperClearing(this);this.initSync&&this.config.sync&&this.initSync();this.textarea.hide();this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var d=this,e=a.canDisableAutoLinking(),f=a.doesAutoLinkingInContentEditable();e&&this.commands.exec("autoUrlDetect",!1);if(this.config.autoLink){if(!f||f&&e)this.parent.on("newword:composer",function(){c.getTextContent(d.element).match(c.autoLink.URL_REG_EXP)&& -d.selection.executeAndRestore(function(a,b){c.autoLink(b.parentNode)})}),c.observe(this.element,"blur",function(){c.autoLink(d.element)});var h=this.sandbox.getDocument().getElementsByTagName("a"),i=c.autoLink.URL_REG_EXP,g=function(a){a=b.lang.string(c.getTextContent(a)).trim();"www."===a.substr(0,4)&&(a="http://"+a);return a};c.observe(this.element,"keydown",function(a){if(h.length){var a=d.selection.getSelectedNode(a.target.ownerDocument),b=c.getParentElement(a,{nodeName:"A"},4),e;b&&(e=g(b),setTimeout(function(){var a= -g(b);a!==e&&a.match(i)&&b.setAttribute("href",a)},0))}})}},_initObjectResizing:function(){this.commands.exec("enableObjectResizing",!0);if(a.supportsEvent("resizeend")){var d=["width","height"],e=d.length,f=this.element;c.observe(f,"resizeend",function(a){var a=a.target||a.srcElement,c=a.style,g=0,j;if("IMG"===a.nodeName){for(;g p:first-child { margin-top: 0; }","._wysihtml5-temp { display: none; }",b.browser.isGecko?"body.placeholder { color: graytext !important; }":"body.placeholder { color: #a9a9a9 !important; }","img:-moz-broken { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"];b.views.Composer.prototype.style=function(){var g=this,j=a.querySelector(":focus"),k=this.textarea.element, -m=k.hasAttribute("placeholder"),n=m&&k.getAttribute("placeholder"),v=k.style.display,u=k.disabled,p;this.focusStylesHost=e.cloneNode(!1);this.blurStylesHost=e.cloneNode(!1);this.disabledStylesHost=e.cloneNode(!1);m&&k.removeAttribute("placeholder");k===j&&k.blur();k.disabled=!1;k.style.display=p="none";if(k.getAttribute("rows")&&"auto"===c.getStyle("height").from(k)||k.getAttribute("cols")&&"auto"===c.getStyle("width").from(k))k.style.display=p=v;c.copyStyles(h).from(k).to(this.iframe).andTo(this.blurStylesHost); -c.copyStyles(f).from(k).to(this.element).andTo(this.blurStylesHost);c.insertCSS(i).into(this.element.ownerDocument);k.disabled=!0;c.copyStyles(h).from(k).to(this.disabledStylesHost);c.copyStyles(f).from(k).to(this.disabledStylesHost);k.disabled=u;k.style.display=v;if(k.setActive)try{k.setActive()}catch(r){}else{var t=k.style,u=a.documentElement.scrollTop||a.body.scrollTop,q=a.documentElement.scrollLeft||a.body.scrollLeft,t={position:t.position,top:t.top,left:t.left,WebkitUserSelect:t.WebkitUserSelect}; -c.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(k);k.focus();c.setStyles(t).on(k);d.scrollTo&&d.scrollTo(q,u)}k.style.display=p;c.copyStyles(h).from(k).to(this.focusStylesHost);c.copyStyles(f).from(k).to(this.focusStylesHost);k.style.display=v;c.copyStyles(["display"]).from(k).to(this.iframe);var y=b.lang.array(h).without(["display"]);j?j.focus():k.blur();m&&k.setAttribute("placeholder",n);this.parent.on("focus:composer",function(){c.copyStyles(y).from(g.focusStylesHost).to(g.iframe); -c.copyStyles(f).from(g.focusStylesHost).to(g.element)});this.parent.on("blur:composer",function(){c.copyStyles(y).from(g.blurStylesHost).to(g.iframe);c.copyStyles(f).from(g.blurStylesHost).to(g.element)});this.parent.observe("disable:composer",function(){c.copyStyles(y).from(g.disabledStylesHost).to(g.iframe);c.copyStyles(f).from(g.disabledStylesHost).to(g.element)});this.parent.observe("enable:composer",function(){c.copyStyles(y).from(g.blurStylesHost).to(g.iframe);c.copyStyles(f).from(g.blurStylesHost).to(g.element)}); +(function(a){var c=a.dom,b=a.browser;a.views.Composer=a.views.View.extend({name:"composer",CARET_HACK:"
",constructor:function(a,b,c){this.base(a,b,c);this.textarea=this.parent.textarea;this._initSandbox()},clear:function(){this.element.innerHTML=b.displaysCaretInEmptyContentEditableCorrectly()?"":this.CARET_HACK},getValue:function(b){var c=this.isEmpty()?"":a.quirks.getCorrectInnerHTML(this.element);b&&(c=this.parent.parse(c));return c},setValue:function(a,b){b&&(a=this.parent.parse(a));try{this.element.innerHTML= +a}catch(c){this.element.innerText=a}},show:function(){this.iframe.style.display=this._displayStyle||"";this.textarea.element.disabled||(this.disable(),this.enable())},hide:function(){this._displayStyle=c.getStyle("display").from(this.iframe);"none"===this._displayStyle&&(this._displayStyle=null);this.iframe.style.display="none"},disable:function(){this.parent.fire("disable:composer");this.element.removeAttribute("contentEditable")},enable:function(){this.parent.fire("enable:composer");this.element.setAttribute("contentEditable", +"true")},focus:function(b){a.browser.doesAsyncFocus()&&this.hasPlaceholderSet()&&this.clear();this.base();var c=this.element.lastChild;b&&c&&("BR"===c.nodeName?this.selection.setBefore(this.element.lastChild):this.selection.setAfter(this.element.lastChild))},getTextContent:function(){return c.getTextContent(this.element)},hasPlaceholderSet:function(){return this.getTextContent()==this.textarea.element.getAttribute("placeholder")&&this.placeholderSet},isEmpty:function(){var a=this.element.innerHTML.toLowerCase(); +return""===a||"
"===a||"

"===a||"


"===a||this.hasPlaceholderSet()},_initSandbox:function(){var a=this;this.sandbox=new c.Sandbox(function(){a._create()},{stylesheets:this.config.stylesheets});this.iframe=this.sandbox.getIframe();var b=this.textarea.element;c.insert(this.iframe).after(b);if(b.form){var f=document.createElement("input");f.type="hidden";f.name="_wysihtml5_mode";f.value=1;c.insert(f).after(b)}},_create:function(){var d=this;this.doc=this.sandbox.getDocument();this.element= +this.doc.body;this.textarea=this.parent.textarea;this.element.innerHTML=this.textarea.getValue(!0);this.selection=new a.Selection(this.parent);this.commands=new a.Commands(this.parent);c.copyAttributes("className spellcheck title lang dir accessKey".split(" ")).from(this.textarea.element).to(this.element);c.addClass(this.element,this.config.composerClassName);this.config.style&&this.style();this.observe();var e=this.config.name;e&&(c.addClass(this.element,e),c.addClass(this.iframe,e));this.enable(); +this.textarea.element.disabled&&this.disable();(e="string"===typeof this.config.placeholder?this.config.placeholder:this.textarea.element.getAttribute("placeholder"))&&c.simulatePlaceholder(this.parent,this,e);this.commands.exec("styleWithCSS",!1);this._initAutoLinking();this._initObjectResizing();this._initUndoManager();this._initLineBreaking();!this.textarea.element.hasAttribute("autofocus")&&document.querySelector(":focus")!=this.textarea.element||b.isIos()||setTimeout(function(){d.focus(!0)}, +100);b.clearsContentEditableCorrectly()||a.quirks.ensureProperClearing(this);this.initSync&&this.config.sync&&this.initSync();this.textarea.hide();this.parent.fire("beforeload").fire("load")},_initAutoLinking:function(){var d=this,e=b.canDisableAutoLinking(),f=b.doesAutoLinkingInContentEditable();e&&this.commands.exec("autoUrlDetect",!1);if(this.config.autoLink){if(!f||f&&e)this.parent.on("newword:composer",function(){c.getTextContent(d.element).match(c.autoLink.URL_REG_EXP)&&d.selection.executeAndRestore(function(a, +b){c.autoLink(b.parentNode)})}),c.observe(this.element,"blur",function(){c.autoLink(d.element)});var k=this.sandbox.getDocument().getElementsByTagName("a"),l=c.autoLink.URL_REG_EXP,g=function(b){b=a.lang.string(c.getTextContent(b)).trim();"www."===b.substr(0,4)&&(b="http://"+b);return b};c.observe(this.element,"keydown",function(a){if(k.length){a=d.selection.getSelectedNode(a.target.ownerDocument);var b=c.getParentElement(a,{nodeName:"A"},4),e;b&&(e=g(b),setTimeout(function(){var a=g(b);a!==e&&a.match(l)&& +b.setAttribute("href",a)},0))}})}},_initObjectResizing:function(){this.commands.exec("enableObjectResizing",!0);if(b.supportsEvent("resizeend")){var d=["width","height"],e=d.length,f=this.element;c.observe(f,"resizeend",function(b){b=b.target||b.srcElement;var c=b.style,g=0,h;if("IMG"===b.nodeName){for(;g p:first-child { margin-top: 0; }","._wysihtml5-temp { display: none; }",a.browser.isGecko?"body.placeholder { color: graytext !important; }":"body.placeholder { color: #a9a9a9 !important; }","img:-moz-broken { -moz-force-broken-image-icon: 1; height: 24px; width: 24px; }"],g=function(a){if(a.setActive)try{a.setActive()}catch(e){}else{var f=a.style,g=b.documentElement.scrollTop|| +b.body.scrollTop,k=b.documentElement.scrollLeft||b.body.scrollLeft,f={position:f.position,top:f.top,left:f.left,WebkitUserSelect:f.WebkitUserSelect};c.setStyles({position:"absolute",top:"-99999px",left:"-99999px",WebkitUserSelect:"none"}).on(a);a.focus();c.setStyles(f).on(a);d.scrollTo&&d.scrollTo(k,g)}};a.views.Composer.prototype.style=function(){var d=this,n=b.querySelector(":focus"),m=this.textarea.element,u=m.hasAttribute("placeholder"),y=u&&m.getAttribute("placeholder"),q=m.style.display,r=m.disabled, +s;this.focusStylesHost=e.cloneNode(!1);this.blurStylesHost=e.cloneNode(!1);this.disabledStylesHost=e.cloneNode(!1);u&&m.removeAttribute("placeholder");m===n&&m.blur();m.disabled=!1;m.style.display=s="none";if(m.getAttribute("rows")&&"auto"===c.getStyle("height").from(m)||m.getAttribute("cols")&&"auto"===c.getStyle("width").from(m))m.style.display=s=q;c.copyStyles(k).from(m).to(this.iframe).andTo(this.blurStylesHost);c.copyStyles(f).from(m).to(this.element).andTo(this.blurStylesHost);c.insertCSS(l).into(this.element.ownerDocument); +m.disabled=!0;c.copyStyles(k).from(m).to(this.disabledStylesHost);c.copyStyles(f).from(m).to(this.disabledStylesHost);m.disabled=r;m.style.display=q;g(m);m.style.display=s;c.copyStyles(k).from(m).to(this.focusStylesHost);c.copyStyles(f).from(m).to(this.focusStylesHost);m.style.display=q;c.copyStyles(["display"]).from(m).to(this.iframe);var v=a.lang.array(k).without(["display"]);n?n.focus():m.blur();u&&m.setAttribute("placeholder",y);this.parent.on("focus:composer",function(){c.copyStyles(v).from(d.focusStylesHost).to(d.iframe); +c.copyStyles(f).from(d.focusStylesHost).to(d.element)});this.parent.on("blur:composer",function(){c.copyStyles(v).from(d.blurStylesHost).to(d.iframe);c.copyStyles(f).from(d.blurStylesHost).to(d.element)});this.parent.observe("disable:composer",function(){c.copyStyles(v).from(d.disabledStylesHost).to(d.iframe);c.copyStyles(f).from(d.disabledStylesHost).to(d.element)});this.parent.observe("enable:composer",function(){c.copyStyles(v).from(d.blurStylesHost).to(d.iframe);c.copyStyles(f).from(d.blurStylesHost).to(d.element)}); return this}})(wysihtml5); -(function(b){var c=b.dom,a=b.browser,d={66:"bold",73:"italic",85:"underline"};b.views.Composer.prototype.observe=function(){var e=this,f=this.getValue(),h=this.sandbox.getIframe(),i=this.element,g=a.supportsEventsInIframeCorrectly()?i:this.sandbox.getWindow();c.observe(h,"DOMNodeRemoved",function(){clearInterval(j);e.parent.fire("destroy:composer")});var j=setInterval(function(){c.contains(document.documentElement,h)||(clearInterval(j),e.parent.fire("destroy:composer"))},250);c.observe(g,"focus", -function(){e.parent.fire("focus").fire("focus:composer");setTimeout(function(){f=e.getValue()},0)});c.observe(g,"blur",function(){f!==e.getValue()&&e.parent.fire("change").fire("change:composer");e.parent.fire("blur").fire("blur:composer")});c.observe(i,"dragenter",function(){e.parent.fire("unset_placeholder")});c.observe(i,["drop","paste"],function(){setTimeout(function(){e.parent.fire("paste").fire("paste:composer")},0)});c.observe(i,"keyup",function(a){a=a.keyCode;(a===b.SPACE_KEY||a===b.ENTER_KEY)&& -e.parent.fire("newword:composer")});this.parent.on("paste:composer",function(){setTimeout(function(){e.parent.fire("newword:composer")},0)});a.canSelectImagesInContentEditable()||c.observe(i,"mousedown",function(a){var b=a.target;"IMG"===b.nodeName&&(e.selection.selectNode(b),a.preventDefault())});a.hasHistoryIssue()&&a.supportsSelectionModify()&&c.observe(i,"keydown",function(a){if(a.metaKey||a.ctrlKey){var b=a.keyCode,c=i.ownerDocument.defaultView.getSelection();if(37===b||39===b)37===b&&(c.modify("extend", -"left","lineboundary"),a.shiftKey||c.collapseToStart()),39===b&&(c.modify("extend","right","lineboundary"),a.shiftKey||c.collapseToEnd()),a.preventDefault()}});c.observe(i,"keydown",function(a){var b=d[a.keyCode];if((a.ctrlKey||a.metaKey)&&!a.altKey&&b)e.commands.exec(b),a.preventDefault()});c.observe(i,"keydown",function(a){var c=e.selection.getSelectedNode(!0),d=a.keyCode;if(c&&"IMG"===c.nodeName&&(d===b.BACKSPACE_KEY||d===b.DELETE_KEY))d=c.parentNode,d.removeChild(c),"A"===d.nodeName&&!d.firstChild&& -d.parentNode.removeChild(d),setTimeout(function(){b.quirks.redraw(i)},0),a.preventDefault()});a.hasIframeFocusIssue()&&(c.observe(this.iframe,"focus",function(){setTimeout(function(){e.doc.querySelector(":focus")!==e.element&&e.focus()},0)}),c.observe(this.element,"blur",function(){setTimeout(function(){e.selection.getSelection().removeAllRanges()},0)}));var k={IMG:"Image: ",A:"Link: "};c.observe(i,"mouseover",function(a){var a=a.target,b=a.nodeName;!("A"!==b&&"IMG"!==b)&&!a.hasAttribute("title")&& -(b=k[b]+(a.getAttribute("href")||a.getAttribute("src")),a.setAttribute("title",b))})}})(wysihtml5); -(function(b){b.views.Synchronizer=Base.extend({constructor:function(b,a,d){this.editor=b;this.textarea=a;this.composer=d;this._observe()},fromComposerToTextarea:function(c){this.textarea.setValue(b.lang.string(this.composer.getValue()).trim(),c)},fromTextareaToComposer:function(b){var a=this.textarea.getValue();a?this.composer.setValue(a,b):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(b){"textarea"===this.editor.currentView.name?this.fromTextareaToComposer(b):this.fromComposerToTextarea(b)}, -_observe:function(){var c,a=this,d=this.textarea.element.form,e=function(){c=setInterval(function(){a.fromComposerToTextarea()},400)},f=function(){clearInterval(c);c=null};e();d&&(b.dom.observe(d,"submit",function(){a.sync(!0)}),b.dom.observe(d,"reset",function(){setTimeout(function(){a.fromTextareaToComposer()},0)}));this.editor.on("change_view",function(b){"composer"===b&&!c?(a.fromTextareaToComposer(!0),e()):"textarea"===b&&(a.fromComposerToTextarea(!0),f())});this.editor.on("destroy:composer", +(function(a){var c=a.dom,b=a.browser,d={66:"bold",73:"italic",85:"underline"};a.views.Composer.prototype.observe=function(){var e=this,f=this.getValue(),k=this.sandbox.getIframe(),l=this.element,g=b.supportsEventsInIframeCorrectly()?l:this.sandbox.getWindow();c.observe(k,"DOMNodeRemoved",function(){clearInterval(h);e.parent.fire("destroy:composer")});var h=setInterval(function(){c.contains(document.documentElement,k)||(clearInterval(h),e.parent.fire("destroy:composer"))},250);c.observe(g,"focus", +function(){e.parent.fire("focus").fire("focus:composer");setTimeout(function(){f=e.getValue()},0)});c.observe(g,"blur",function(){f!==e.getValue()&&e.parent.fire("change").fire("change:composer");e.parent.fire("blur").fire("blur:composer")});c.observe(l,"dragenter",function(){e.parent.fire("unset_placeholder")});c.observe(l,["drop","paste"],function(){setTimeout(function(){e.parent.fire("paste").fire("paste:composer")},0)});c.observe(l,"keyup",function(b){b=b.keyCode;b!==a.SPACE_KEY&&b!==a.ENTER_KEY|| +e.parent.fire("newword:composer")});this.parent.on("paste:composer",function(){setTimeout(function(){e.parent.fire("newword:composer")},0)});b.canSelectImagesInContentEditable()||c.observe(l,"mousedown",function(a){var b=a.target;"IMG"===b.nodeName&&(e.selection.selectNode(b),a.preventDefault())});b.hasHistoryIssue()&&b.supportsSelectionModify()&&c.observe(l,"keydown",function(a){if(a.metaKey||a.ctrlKey){var b=a.keyCode,c=l.ownerDocument.defaultView.getSelection();if(37===b||39===b)37===b&&(c.modify("extend", +"left","lineboundary"),a.shiftKey||c.collapseToStart()),39===b&&(c.modify("extend","right","lineboundary"),a.shiftKey||c.collapseToEnd()),a.preventDefault()}});c.observe(l,"keydown",function(a){var b=d[a.keyCode];(a.ctrlKey||a.metaKey)&&!a.altKey&&b&&(e.commands.exec(b),a.preventDefault())});c.observe(l,"keydown",function(b){var c=e.selection.getSelectedNode(!0),d=b.keyCode;!c||"IMG"!==c.nodeName||d!==a.BACKSPACE_KEY&&d!==a.DELETE_KEY||(d=c.parentNode,d.removeChild(c),"A"!==d.nodeName||d.firstChild|| +d.parentNode.removeChild(d),setTimeout(function(){a.quirks.redraw(l)},0),b.preventDefault())});b.hasIframeFocusIssue()&&(c.observe(this.iframe,"focus",function(){setTimeout(function(){e.doc.querySelector(":focus")!==e.element&&e.focus()},0)}),c.observe(this.element,"blur",function(){setTimeout(function(){e.selection.getSelection().removeAllRanges()},0)}));var n={IMG:"Image: ",A:"Link: "};c.observe(l,"mouseover",function(a){a=a.target;var b=a.nodeName;"A"!==b&&"IMG"!==b||a.hasAttribute("title")||(b= +n[b]+(a.getAttribute("href")||a.getAttribute("src")),a.setAttribute("title",b))})}})(wysihtml5); +(function(a){a.views.Synchronizer=Base.extend({constructor:function(a,b,d){this.editor=a;this.textarea=b;this.composer=d;this._observe()},fromComposerToTextarea:function(c){this.textarea.setValue(a.lang.string(this.composer.getValue()).trim(),c)},fromTextareaToComposer:function(a){var b=this.textarea.getValue();b?this.composer.setValue(b,a):(this.composer.clear(),this.editor.fire("set_placeholder"))},sync:function(a){"textarea"===this.editor.currentView.name?this.fromTextareaToComposer(a):this.fromComposerToTextarea(a)}, +_observe:function(){var c,b=this,d=this.textarea.element.form,e=function(){c=setInterval(function(){b.fromComposerToTextarea()},400)},f=function(){clearInterval(c);c=null};e();d&&(a.dom.observe(d,"submit",function(){b.sync(!0)}),a.dom.observe(d,"reset",function(){setTimeout(function(){b.fromTextareaToComposer()},0)}));this.editor.on("change_view",function(a){"composer"!==a||c?"textarea"===a&&(b.fromComposerToTextarea(!0),f()):(b.fromTextareaToComposer(!0),e())});this.editor.on("destroy:composer", f)}})})(wysihtml5); -wysihtml5.views.Textarea=wysihtml5.views.View.extend({name:"textarea",constructor:function(b,c,a){this.base(b,c,a);this._observe()},clear:function(){this.element.value=""},getValue:function(b){var c=this.isEmpty()?"":this.element.value;b&&(c=this.parent.parse(c));return c},setValue:function(b,c){c&&(b=this.parent.parse(b));this.element.value=b},hasPlaceholderSet:function(){var b=wysihtml5.browser.supportsPlaceholderAttributeOn(this.element),c=this.element.getAttribute("placeholder")||null,a=this.element.value; -return b&&!a||a===c},isEmpty:function(){return!wysihtml5.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var b=this.element,c=this.parent,a={focusin:"focus",focusout:"blur"},d=wysihtml5.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];c.on("beforeload",function(){wysihtml5.dom.observe(b,d,function(b){b=a[b.type]||b.type;c.fire(b).fire(b+":textarea")});wysihtml5.dom.observe(b,["paste","drop"],function(){setTimeout(function(){c.fire("paste").fire("paste:textarea")}, +wysihtml5.views.Textarea=wysihtml5.views.View.extend({name:"textarea",constructor:function(a,c,b){this.base(a,c,b);this._observe()},clear:function(){this.element.value=""},getValue:function(a){var c=this.isEmpty()?"":this.element.value;a&&(c=this.parent.parse(c));return c},setValue:function(a,c){c&&(a=this.parent.parse(a));this.element.value=a},hasPlaceholderSet:function(){var a=wysihtml5.browser.supportsPlaceholderAttributeOn(this.element),c=this.element.getAttribute("placeholder")||null,b=this.element.value; +return a&&!b||b===c},isEmpty:function(){return!wysihtml5.lang.string(this.element.value).trim()||this.hasPlaceholderSet()},_observe:function(){var a=this.element,c=this.parent,b={focusin:"focus",focusout:"blur"},d=wysihtml5.browser.supportsEvent("focusin")?["focusin","focusout","change"]:["focus","blur","change"];c.on("beforeload",function(){wysihtml5.dom.observe(a,d,function(a){a=b[a.type]||a.type;c.fire(a).fire(a+":textarea")});wysihtml5.dom.observe(a,["paste","drop"],function(){setTimeout(function(){c.fire("paste").fire("paste:textarea")}, 0)})})}}); -(function(b){var c=b.dom;b.toolbar.Dialog=b.lang.Dispatcher.extend({constructor:function(a,b){this.link=a;this.container=b},_observe:function(){if(!this._observed){var a=this,d=function(b){var c=a._serialize();c==a.elementToChange?a.fire("edit",c):a.fire("save",c);a.hide();b.preventDefault();b.stopPropagation()};c.observe(a.link,"click",function(){c.hasClass(a.link,"wysihtml5-command-dialog-opened")&&setTimeout(function(){a.hide()},0)});c.observe(this.container,"keydown",function(c){var e=c.keyCode; -e===b.ENTER_KEY&&d(c);e===b.ESCAPE_KEY&&a.hide()});c.delegate(this.container,"[data-wysihtml5-dialog-action=save]","click",d);c.delegate(this.container,"[data-wysihtml5-dialog-action=cancel]","click",function(b){a.fire("cancel");a.hide();b.preventDefault();b.stopPropagation()});for(var e=this.container.querySelectorAll("input, select, textarea"),f=0,h=e.length,i=function(){clearInterval(a.interval)};f