AdfRichUIPeer.createPeerClass(AdfDhtmlEditableValuePeer,"AdfDhtmlRichTextEditorPeer",!1);
AdfDhtmlRichTextEditorPeer.InitSubclass=function(){AdfRichUIPeer.addSuppressedPPRAttributes(this,AdfRichTextEditor.EDIT_MODE);AdfRichUIPeer.addComponentEventHandlers(this,AdfActionEvent.ACTION_EVENT_TYPE,AdfUIInputEvent.CLICK_EVENT_TYPE,AdfUIInputEvent.FOCUS_EVENT_TYPE,AdfUIInputEvent.MOUSE_DOWN_EVENT_TYPE,AdfUIInputEvent.MOUSE_UP_EVENT_TYPE,AdfUIInputEvent.KEY_DOWN_EVENT_TYPE,AdfUIInputEvent.KEY_UP_EVENT_TYPE);AdfRichUIPeer.addComponentPropertyGetters(this,AdfRichTextEditor.LABEL);AdfRichUIPeer.addComponentPropertyChanges(this,
AdfRichTextEditor.LABEL);AdfObject.ensureClassInitialization(AdfDhtmlInputBasePeer);this.InitConstants()};
AdfDhtmlRichTextEditorPeer.InitConstants=function(){null==this._CONTENT_FIELD_SUB_ID&&(this._TOOLBAR_POPUP_CONTAINER_ID="_tbPopCont",this._TOOLBAR_POPUP_INPUT_CONTAINER_ID="_tbPopInpCont",this._TOOLBAR_POPUP_LINK_INPUT_ID="_tbPopLnkInput",this._TOOLBAR_POPUP_LINK_SELECTED_INPUT_ID="_tbPopLnkSelectedInput",this._CONTENT_INPUT_CONTAINER_SUBID="_cic",this._CONTENT_FIELD_SUB_ID="cont",this._SOURCE_FIELD_SUB_ID="src",this._FIELD_ID_ATTR_NAME="__afrRichTextEditorFieldId",this._SOURCE_FIELD_ID_ATTR_NAME=
"__afrRichTextEditorSourceFieldId",this.STYLE_BOLD="style_bold",this.STYLE_ITALIC="style_italic",this.STYLE_UNDERLINE="style_underline",this.STYLE_STRIKETHROUGH="style_strikethrough",this.STYLE_LIST_UNORDERED="style_list_unordered",this.STYLE_LIST_ORDERED="style_list_ordered",this.STYLE_INDENT="style_indent",this.STYLE_OUTDENT="style_outdent",this.STYLE_JUSTIFY_LEFT="style_justify_left",this.STYLE_JUSTIFY_CENTER="style_justify_center",this.STYLE_JUSTIFY_RIGHT="style_justify_right",this.STYLE_JUSTIFY_FULL=
"style_justify_full",this.STYLE_SUPERSCRIPT="style_superscript",this.STYLE_SUBSCRIPT="style_subscript",this.STYLE_COLOR_FOREGROUND="style_color_foreground",this.STYLE_COLOR_BACKGROUND="style_color_background",this.STYLE_FONT_SIZE="style_font_size",this.STYLE_FONT_NAME="style_font_name",this.COMMAND_UNDO="cmd_undo",this.COMMAND_REDO="cmd_redo",this.COMMAND_LINK="cmd_link",this.COMMAND_UNLINK="cmd_unlink",this.COMMAND_CLEAR_STYLING="cmd_clear_styling",this.COMMAND_INSERT="cmd_insert",this.COMMAND_MODE_RICH_TEXT=
"cmd_mode_rich_text",this.COMMAND_MODE_CODE="cmd_mode_code",this._execCommandMap={},this._execCommandMap[this.STYLE_BOLD]="bold",this._execCommandMap[this.STYLE_ITALIC]="italic",this._execCommandMap[this.STYLE_UNDERLINE]="underline",this._execCommandMap[this.STYLE_STRIKETHROUGH]="strikethrough",this._execCommandMap[this.STYLE_LIST_UNORDERED]="insertunorderedlist",this._execCommandMap[this.STYLE_LIST_ORDERED]="insertorderedlist",this._execCommandMap[this.STYLE_INDENT]="indent",this._execCommandMap[this.STYLE_OUTDENT]=
"outdent",this._execCommandMap[this.STYLE_JUSTIFY_LEFT]="justifyleft",this._execCommandMap[this.STYLE_JUSTIFY_CENTER]="justifycenter",this._execCommandMap[this.STYLE_JUSTIFY_RIGHT]="justifyright",this._execCommandMap[this.STYLE_JUSTIFY_FULL]="justifyfull",this._execCommandMap[this.STYLE_SUPERSCRIPT]="superscript",this._execCommandMap[this.STYLE_SUBSCRIPT]="subscript",this._execCommandMap[this.STYLE_COLOR_FOREGROUND]="forecolor",this._execCommandMap[this.STYLE_COLOR_BACKGROUND]="backcolor",this._execCommandMap[this.STYLE_FONT_SIZE]=
"fontsize",this._execCommandMap[this.STYLE_FONT_NAME]="fontname",this._execCommandMap[this.COMMAND_UNDO]="undo",this._execCommandMap[this.COMMAND_REDO]="redo",this._execCommandMap[this.COMMAND_LINK]="createlink",this._execCommandMap[this.COMMAND_UNLINK]="unlink",this._execCommandMap[this.COMMAND_CLEAR_STYLING]="removeformat",this._execCommandMap[this.COMMAND_INSERT]="insert",this._execCommandMap[this.COMMAND_MODE_RICH_TEXT]="moderichtext",this._execCommandMap[this.COMMAND_MODE_CODE]="modecode",this._COLOR_REGEX=
/rgba?\((\d+),\s*(\d+),\s*(\d+)(,\s*((\d+)))?\)/)};AdfDhtmlRichTextEditorPeer.HandleTimerUpdate=function(a){if(a=AdfPage.PAGE.findComponent(a))a=a.getPeer(),a._updateValue(),a._handleContextChangedForCommands()};AdfDhtmlRichTextEditorPeer.prototype.Init=function(a){AdfDhtmlRichTextEditorPeer.superclass.Init.call(this,a);this._ignoreEvents={}};
AdfDhtmlRichTextEditorPeer.prototype.InitDomElement=function(a,b){var d=a.getReadOnly();if(!d){var e=a.getClientId(),f=AdfRichUIPeer.CreateSubId(e,AdfDhtmlRichTextEditorPeer._CONTENT_FIELD_SUB_ID);AdfAgent.AGENT.setExpandoProperty(b,AdfDhtmlRichTextEditorPeer._FIELD_ID_ATTR_NAME,f);e=AdfRichUIPeer.CreateSubId(e,AdfDhtmlRichTextEditorPeer._SOURCE_FIELD_SUB_ID);AdfAgent.AGENT.setExpandoProperty(b,AdfDhtmlRichTextEditorPeer._SOURCE_FIELD_ID_ATTR_NAME,e);AdfPage.PAGE.registerLoadingComponent(a)}AdfDhtmlRichTextEditorPeer.superclass.InitDomElement.call(this,
a,b);this._isTouch=AdfAgent.AGENT.getCapabilities()[AdfAgent.CAP_TOUCH_SCREEN]!=AdfAgent.CAP_TOUCH_SCREEN_NONE;d||("source"==a.getEditMode()&&(this._codeEditingMode=!0),"popup"===a.getToolbarDisplay()&&(this._toolbarPopupListenerInitialized=!1),this._createIframe(a))};
AdfDhtmlRichTextEditorPeer.prototype.GetReadyState=function(){var a=this.getComponent();if((a=this._getContentField(a))&&"1"===a.getAttribute("data-afr-rte-loaded")){AdfLogger.LOGGER.fine("AdfDhtmlRichTextEditorPeer.GetReadyState: RTE loaded");try{if("complete"===a.contentWindow.document.readyState)return AdfLogger.LOGGER.fine("AdfDhtmlRichTextEditorPeer.GetReadyState: RTE ready"),AdfUIComponent.STATE_COMPLETE;AdfLogger.LOGGER.fine("AdfDhtmlRichTextEditorPeer.GetReadyState: RTE inner document not yet ready");
return AdfUIComponent.STATE_LOADING}catch(b){return AdfLogger.LOGGER.fine("AdfDhtmlRichTextEditor.GetReadyState: exception.","Nothing more to do"),AdfUIComponent.STATE_COMPLETE}}AdfLogger.LOGGER.fine("AdfDhtmlRichTextEditorPeer.GetReadyState: richTextEditor's onload has not fired");return AdfUIComponent.STATE_LOADING};AdfDhtmlRichTextEditorPeer.prototype._isContainerStretched=function(){return AdfDomUtils.containsCSSClassName(AdfRichUIPeer.getDomNodeForComponent(this.getComponent()),"p_AFStretched")};
AdfDhtmlRichTextEditorPeer.prototype.needsResizeNotify=function(a){return!0};AdfDhtmlRichTextEditorPeer.prototype.ResizeNotify=function(a,b,d,e){if(this._isContainerStretched()&&(b=AdfAgent.AGENT,d=this.getComponent().getClientId(),a=b.getElementById(AdfRichUIPeer.CreateSubId(d,AdfDhtmlRichTextEditorPeer._CONTENT_INPUT_CONTAINER_SUBID)),b=b.getElementById(AdfRichUIPeer.CreateSubId(d,"content")).childNodes,a)){for(var f=d=0,g=b.length;f<g;f++)b[f]!==a&&(d+=b[f].offsetHeight);a.style.height=e-d+"px"}};
AdfDhtmlRichTextEditorPeer.prototype.GetInlineEditor=function(a){return AdfDhtmlSimpleLabelEditor.getInlineEditor()};AdfDhtmlRichTextEditorPeer.prototype.isEmpty=function(a){a||(a=this.GetSubmittedValue(this.getComponent(),this.getDomElement()));a=a.replace(/(<([^>]+)>)/ig,"");a=AdfStrings.trim(a);return 0==a.length};AdfDhtmlRichTextEditorPeer.prototype.getCurrentContent=function(a,b){return AdfEditingAgent.getInstance().getInlineFrameContent(this._getContentField(a),b)};
AdfDhtmlRichTextEditorPeer.prototype.addBinding=function(a,b,d,e,f,g){AdfAssert.assertString(a);AdfAssert.assertString(d);"style"==d.substring(0,5)?(AdfAssert.assertString(f),AdfAssert.assertStringOrNull(g),void 0==g&&(g=AdfActionEvent.ACTION_EVENT_TYPE),this._addStyleBinding(a,f,d,g)):"cmd"==d.substring(0,3)?this._addCommandBinding(a,b,d,e):AdfLogger.LOGGER.severe("Unable to add binding [",d,"] for ",a," to ",this.getComponent().getClientId())};
AdfDhtmlRichTextEditorPeer.prototype.setCodeEditingMode=function(a){var b=this._codeEditingMode;null==b&&(b=!1);if(b!=a){this._codeEditingMode=a;b=this.getComponent();a?b.setProperty("editMode","source",!0):b.setProperty("editMode","wysiwyg",!0);var d=this._toolboxClientId;if(null==d){var e=b.getClientId();this._toolboxClientId=d=e+"_afrToolbox";this._modeButtonRichTextClientId=e+"_afrModeRichText";this._modeButtonCodeClientId=e+"_afrModeCode"}d=AdfPage.PAGE.findComponent(d);this.visitChildren(d,
AdfDhtmlRichTextEditorPeer._toolboxVisitChildrenCallback,this,!0);var f=AdfEditingAgent.getInstance(),d=this._getContentField(b),e=this._getSourceCodeField(b);a?(a=this.getCurrentContent(b),e.value=""+a,d.blur(),this._removeSelection(),d.style.display="none",e.style.display="block",e.focus()):(e.blur(),e.style.display="none",d.style.display="block",d.focus(),f.setInlineFrameContent(d,e.value),this.focus(b),AdfEditingAgent.getInstance().setInlineFrameContentEditable(d),this._ignoreNextContextChanged=
!0)}};
AdfDhtmlRichTextEditorPeer.prototype.Focus=function(){var a=this.getComponent();if(this._codeEditingMode)this._getSourceCodeField(a).focus();else{a=this._getContentField(a);if("IFRAME"==a.nodeName&&a!=document.activeElement)try{var b=a.parentElement,d=b.hasAttribute("tabindex");d||b.setAttribute("tabindex","0");AdfFocusUtils.focusElement(b);d||b.removeAttribute("tabindex")}catch(e){}AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM&&11==AdfAgent.AGENT.getVersion()?this._hadFirstFocus&&!this._isComponentHavingFocus()&&AdfFocusUtils.focusElement(a):
AdfFocusUtils.focusElement(a);this._stopDialogsFromBeingInactivatedDueToIframes()}};AdfDhtmlRichTextEditorPeer.prototype._isComponentHavingFocus=function(){var a=AdfAgent.AGENT.getDomDocument().activeElement,b=this.getComponent(),b=this._codeEditingMode?this._getSourceCodeField(b):this._getContentField(b);return a&&a.id==b.id};AdfDhtmlRichTextEditorPeer.prototype.executeCommand=function(a,b){this._execCommand(a,b)};
AdfDhtmlRichTextEditorPeer.prototype.getSelectionRange=function(a){var b=AdfEditingAgent.getInstance();a=this._getContentField(a);return b.getSelectionRange(a)};
AdfDhtmlRichTextEditorPeer.prototype.GetComponentLabel=function(a,b){var d=b.getElementsByTagName("LABEL"),d=d.length?d[0]:null;if(null!=d){var e=a.getClientId(),f=AdfRichUIPeer.CreateSubId(e,"content");if(d.htmlFor==f)return AdfAgent.AGENT.getTextContent(d);e=AdfRichUIPeer.CreateSubId(e,AdfDhtmlRichTextEditorPeer._SOURCE_FIELD_SUB_ID);if(d.htmlFor==e)return AdfAgent.AGENT.getTextContent(d)}return null};
AdfDhtmlRichTextEditorPeer.prototype.HandleComponentFocus=function(a){AdfDhtmlRichTextEditorPeer.superclass.HandleComponentFocus.call(this,a);a=this.getComponent();if(!a.getReadOnly()&&(this._stopDialogsFromBeingInactivatedDueToIframes(),!this._commandBeingProcessed)){var b=AdfPage.PAGE.getActiveDomElement(),d=this._getContentField(a);b==d&&(this.focus(a),b=this._getSourceCodeField(a).value,AdfDhtmlInputBasePeer.setLastValue(d,b));"popup"===a.getToolbarDisplay()&&!AdfDomUtils.isVisible(this._getToolbarPopupNode(a))&&
this._showToolbarPopup()}};AdfDhtmlRichTextEditorPeer.prototype.HandleComponentClick=function(a){AdfDhtmlRichTextEditorPeer.superclass.HandleComponentClick.call(this,a);(a=a.getNativeEventTarget())&&"LABEL"==a.nodeName&&this.focus(this.getComponent())};AdfDhtmlRichTextEditorPeer.prototype.HandleComponentMouseDown=function(a){this._handleClonedEvent(a)};AdfDhtmlRichTextEditorPeer.prototype.HandleComponentMouseUp=function(a){this._handleClonedEvent(a)};
AdfDhtmlRichTextEditorPeer.prototype.HandleComponentKeyDown=function(a){this._handleClonedEvent(a)};AdfDhtmlRichTextEditorPeer.prototype.HandleComponentKeyUp=function(a){this._handleClonedEvent(a)};
AdfDhtmlRichTextEditorPeer.prototype.GetSubmittedValue=function(a,b){if(this._isTouch&&this.WasSubmitted(a)){var d=this._getContentField(a),e=this.getCurrentContent(a),d=AdfDhtmlInputBasePeer.getLastValue(d);d!=e&&void 0!==d&&this._updateValue()}if(a.getReadOnly())return e=AdfDhtmlEditableValuePeer.getContentNode(a,b),e.innerHTML;e=this._getSourceCodeField(a);return e.value};
AdfDhtmlRichTextEditorPeer.prototype.SetDisplayValue=function(a,b,d){AdfAssert.assertString(d);a.getReadOnly()?b.innerHTML=d:(b=this._getSourceCodeField(a).value,a=this._getContentField(a),this._setInlineFrameContent(a,b))};AdfDhtmlRichTextEditorPeer.prototype.HandleComponentAction=function(a){this._styleBindingActionListener(a);this._commandBindingActionListener(a)};AdfDhtmlRichTextEditorPeer.prototype.ShowFormatHint=function(){return!0};
AdfDhtmlRichTextEditorPeer.prototype.ComponentRemoved=function(a){var b=a.getReadOnly();b||page.unregisterLoadingComponent(a);!b&&!a.getDisabled()&&(this._removeStyleBindings(a),this._removeCommandBindings(a),this._removeContextChangeListeners(a),this._loadCallback&&(AdfAgent.AGENT.removeBubbleEventListener(this._getContentField(a),"load",this._loadCallback),delete this._loadCallback),AdfRichTextEditorBehaviorManager.getInstance().unregisterComponent(a),delete this._hadFirstFocus,delete this._lastSelectionRange);
AdfDhtmlRichTextEditorPeer.superclass.ComponentRemoved.call(this,a)};AdfDhtmlRichTextEditorPeer.prototype.ScrollIntoView=function(a,b,d){this.getDomElement().scrollIntoView();var e=this.getDomDocument(),f=a.getReadOnly(),g;f||(g=this._getContentField(a),e=AdfEditingAgent.getInstance().getInlineFrameDocument(g));a=null;null!=d&&((a=e.getElementById(d))?a.scrollIntoView():AdfLogger.LOGGER.warning("Invalid subTargetId specified:"+d));b&&(a?AdfFocusUtils.focusElement(a):f||AdfFocusUtils.focusElement(g))};
AdfDhtmlRichTextEditorPeer.prototype._stopDialogsFromBeingInactivatedDueToIframes=function(){var a=!0,b,d=AdfAgent.AGENT.getDomDocument().activeElement;d&&(b=d.tagName);"IFRAME"==b&&(a=!1);a&&AdfPage.PAGE.getAutoDismissalManager().cancelBlurTimeout()};
AdfDhtmlRichTextEditorPeer._toolboxVisitChildrenCallback=function(a){var b=0,d=this._codeEditingMode;if(a instanceof AdfRichCommandToolbarButton){var e=a.getClientId();e!=this._modeButtonRichTextClientId&&e!=this._modeButtonCodeClientId&&(a.setProperty("selected",!1,!1,AdfUIComponent.PROPAGATE_IF_KNOWN_PROPERTY),a.setProperty("disabled",d,!1,AdfUIComponent.PROPAGATE_IF_KNOWN_PROPERTY),b=1)}else a instanceof AdfRichSelectOneChoice||a instanceof AdfRichInputNumberSpinbox||a instanceof AdfRichInputColor?
(a.setProperty("disabled",d,!1,AdfUIComponent.PROPAGATE_IF_KNOWN_PROPERTY),b=1):a instanceof AdfRichPanelGroupLayout&&(a=AdfRichUIPeer.getDomElementForComponent(a),d?AdfDomUtils.addCSSClassName(a,AdfRichUIPeer.DISABLED_STYLECLASS):AdfDomUtils.removeCSSClassName(a,AdfRichUIPeer.DISABLED_STYLECLASS),b=1);return b};
AdfDhtmlRichTextEditorPeer.prototype._handleMouseUp=function(a){this._handleContextChanged();var b=navigator.userAgent.toLowerCase();a=a.target;-1!=b.indexOf("chrome")&&"html"==a.nodeName.toLowerCase()&&a.getElementsByTagName("body")[0].focus()};AdfDhtmlRichTextEditorPeer.prototype._handleContextChanged=function(){this._ignoreNextContextChanged?delete this._ignoreNextContextChanged:!0!=this._codeEditingMode&&(this._saveSelection(),this._handleContextChangedForCommands(),this._handleContextChangedForStyles())};
AdfDhtmlRichTextEditorPeer.prototype._handleKeyDown=function(a){var b=AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM,d=AdfAgent.AGENT.getPlatform()==AdfAgent.GECKO_PLATFORM,e=187,f=e,g=189;if(b){var h=this._keyTimer;h&&clearTimeout(h);h="AdfDhtmlRichTextEditorPeer.HandleTimerUpdate('"+this.getComponent().getClientId()+"')";this._keyTimer=setTimeout(h,3E3)}d&&(e=61,f=107,g=109);d=a.keyCode;if(9==d)a.shiftKey&&(this._mouseDownOrTabBack=!0),e=this.getComponent(),f=e.getEditMode(),g=this._getToolbarPopupNode(e),
d="popup"===e.getToolbarDisplay()&&AdfDomUtils.isVisible(g),"wysiwyg"==f?d?(AdfAgent.AGENT.preventDefault(a),a.shiftKey?AdfFocusUtils.focusElement(AdfFocusUtils.getLastTabStop(g)):AdfFocusUtils.focusNextTabStop(this._getContentField(e))):(AdfEditingAgent.getInstance().handleTab(this._getContentField(e),a),b&&(a.shiftKey?this._tabBack=!0:this._tabForward=!0)):d&&(AdfAgent.AGENT.preventDefault(a),a.shiftKey?AdfFocusUtils.focusElement(AdfFocusUtils.getLastFocusableDescendant(g)):AdfFocusUtils.focusNextTabStop(this._getSourceCodeField(e)));
else if(a.ctrlKey){b=!0;if(a.altKey)switch(d){case e:case f:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_SUPERSCRIPT);break;case g:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_SUBSCRIPT);break;case 121:(e=AdfPage.PAGE.findComponent(this.getComponent().getClientId()+"_afrToolbox"))&&e.focus();break;default:b=!1}else if(a.shiftKey)switch(d){case 72:this._execCommand(AdfDhtmlRichTextEditorPeer.COMMAND_UNLINK);break;case 77:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_OUTDENT);break;
case 83:this._execCommand(AdfDhtmlRichTextEditorPeer.COMMAND_CLEAR_STYLING);break;case 87:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_COLOR_FOREGROUND);break;default:b=!1}else switch(d){case 53:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_STRIKETHROUGH);break;case 66:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_BOLD);break;case 69:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_JUSTIFY_CENTER);break;case 72:window.setTimeout(this.createCallback(this._cmdCreateLink),0);break;
case 73:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_ITALIC);break;case 74:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_JUSTIFY_FULL);break;case 76:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_JUSTIFY_LEFT);break;case 77:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_INDENT);break;case 82:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_JUSTIFY_RIGHT);break;case 85:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_UNDERLINE);break;case 87:this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_COLOR_BACKGROUND);
break;case 219:e=this._getOneThroughSevenFontSize(this._queryCommandValue(AdfDhtmlRichTextEditorPeer.STYLE_FONT_SIZE));1<e&&this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_FONT_SIZE,+e-1);break;case 221:e=this._getOneThroughSevenFontSize(this._queryCommandValue(AdfDhtmlRichTextEditorPeer.STYLE_FONT_SIZE));7>e&&this._execCommand(AdfDhtmlRichTextEditorPeer.STYLE_FONT_SIZE,+e+1);break;default:b=!1}b&&AdfAgent.AGENT.eatEvent(a)}};AdfDhtmlRichTextEditorPeer.prototype._cmdCreateLink=function(){return this._execCommand(AdfDhtmlRichTextEditorPeer.COMMAND_LINK)};
AdfDhtmlRichTextEditorPeer.prototype._saveSelection=function(){var a=AdfEditingAgent.getInstance(),b=a.getSelectionRange(this._getContentField(this.getComponent()));this._isTouch?null!=b&&(this._lastSelectionRange=b):this._lastSelectionRange=b;var d=this.getComponent();if("popup"===d.getToolbarDisplay()){var e=this._getToolbarPopupInputContainer(d);AdfDomUtils.isVisible(e)&&this._getToolbarPopupDisplayedTextComp(d).setValue(a.getSelectionRangeString(b))}};
AdfDhtmlRichTextEditorPeer.prototype._handleClonedEvent=function(a){var b=a.getNativeEvent();if(null!=this._clonedEventMap&&null!=this._clonedEventMap[b]){var d=this,e=this._clonedEventMap[b];a.cancel=function(){AdfDomUIInputEvent.superclass.cancel.call(a);AdfAgent.AGENT.preventDefault(b);AdfAgent.AGENT.preventDefault(e);delete d._clonedEventMap[b]}}};AdfDhtmlRichTextEditorPeer.prototype._removeSelection=function(){delete this._lastSelectionRange};
AdfDhtmlRichTextEditorPeer.prototype._restoreSelection=function(){null!=this._lastSelectionRange&&AdfEditingAgent.getInstance().setSelectionRange(this._getContentField(this.getComponent()),this._lastSelectionRange)};
AdfDhtmlRichTextEditorPeer.prototype._handleContextChangedForCommands=function(){if(void 0==this._commandObservers)return!1;var a=this.getComponent(),b=this._getContentField(a),d=AdfEditingAgent.getInstance(),e=this._commandObservers,f=e.length,g=this._oldCommandValues;void 0==g&&(g={});for(var h={},k=0;k<f;k++){var l=e[k],m=l.command,l=AdfPage.PAGE.findComponent(l.componentId);AdfAssert.assert(l);if(void 0===h[m]){var n=AdfDhtmlRichTextEditorPeer._execCommandMap[m];h[m]=null==n?null:d.queryCommandEnabled(a,
b,n)}m===AdfDhtmlRichTextEditorPeer.COMMAND_LINK&&"popup"===a.getToolbarDisplay()&&this._updateToolbarPopupURLVal();if(g[m]!==h[m])switch(m){case AdfDhtmlRichTextEditorPeer.COMMAND_INSERT:case AdfDhtmlRichTextEditorPeer.COMMAND_MODE_RICH_TEXT:case AdfDhtmlRichTextEditorPeer.COMMAND_MODE_CODE:break;default:l.setProperty("disabled",!h[m],!1,!1)}}this._oldCommandValues=h};
AdfDhtmlRichTextEditorPeer.prototype._handleContextChangedForStyles=function(){var a=AdfAgent.AGENT;if(void 0==this._styleObservers)return!1;var b=this._styleObservers.length,d=this._oldStyleValues;void 0==d&&(d={});for(var e={},f=0;f<b;f++){var g=this._styleObservers[f],h=g.styleKey,k=AdfPage.PAGE.findComponent(g.componentId);AdfAssert.assert(k);var l=null;void 0==e[h]?(l=this._getSelectionStyling(h),null!=l&&(e[h]=l)):l=e[h];if(d[h]!==l&&null!=l){var m=!1;if(h==AdfDhtmlRichTextEditorPeer.STYLE_COLOR_BACKGROUND||
h==AdfDhtmlRichTextEditorPeer.STYLE_COLOR_FOREGROUND)l=AdfEditingAgent.getInstance().getColor(l);else if(h==AdfDhtmlRichTextEditorPeer.STYLE_FONT_SIZE)l=this._getOneThroughSevenFontSize(l),0<l&&8>l?l+="":(l="2",m=!0);else if(h==AdfDhtmlRichTextEditorPeer.STYLE_FONT_NAME&&k instanceof AdfRichSelectOneChoice){var n=k.getSelectItems(),p=n.length,q=!1;if(null!=l&&(l=(""+l).replace(/'/g,""),-1!=navigator.userAgent.toLowerCase().indexOf("chrome")||this._isTouch&&a.getPlatform()==AdfAgent.WEBKIT_PLATFORM))l=
(""+l).replace(/, /gi,",");for(var r=0;r<p;r++)if(n[r].getLabel()==l){l=n[r].getValue();q=!0;break}if(!q){for(var r=Number.MAX_VALUE,s,u,t=0;t<p;t++)if(-1<(s=n[t].getValue().search(l)))s<r&&(r=s,u=n[t].getValue()),q=!0;if(!q)for(t=1;t<p;t++)if(-1<(s=l.search(n[t].getLabel())))s<r&&(r=s,u=n[t].getValue()),q=!0;l=q?u:n[0].getValue()}}m||this._getIndeterminateStyling(h);m=k.getProperty(g.propertyName);AdfUIUtils.compareValues(m,l)||("value"==g.propertyName&&this._ignoreNextEvent(h),k.setProperty(g.propertyName,
l,!1,!1))}}this._oldStyleValues=e};AdfDhtmlRichTextEditorPeer.prototype._getOneThroughSevenFontSize=function(a){var b=""+a,d=b.indexOf("px");-1!=d?(a=parseInt(b.substring(0,d)),a=10>=a?1:13>=a?2:16>=a?3:18>=a?4:24>=a?5:32>=a?6:7):a=parseInt(a)||2;return a};
AdfDhtmlRichTextEditorPeer.prototype._createIframe=function(a){var b=AdfAgent.AGENT,d=this._getContentField(a),e=AdfPage.PAGE,f=this.getDomDocument().createElement("IFRAME");f.frameBorder="0";var g=d.style.cssText;0<g.length&&(f.style.cssText=g);f.className=d.className;f.id=d.id;f.title=e.getLookAndFeel().getTranslatedString("af_richTextEditor.IFRAME_TITLE");if("lazy"==a.getContentDelivery())f.src=e.getLazyFetchURI(a.getClientId());else if((a=d.getAttribute("src"))&&""!=a)f.src=a;this._loadCallback=
this.createCallback(this._handleLoad);b.addBubbleEventListener(f,"load",this._loadCallback);d.parentNode.replaceChild(f,d);b.elementsRemoved(d);b.elementsAdded(f)};AdfDhtmlRichTextEditorPeer.prototype._makeEditable=function(a){a=this._getContentField(a);AdfAssert.assertDomElement(a);AdfEditingAgent.getInstance().setInlineFrameContentEditable(a);this._addContextChangeListeners(a)};
AdfDhtmlRichTextEditorPeer.prototype._setInlineFrameContent=function(a,b){AdfAssert.assertDomElement(a,"IFRAME");AdfAssert.assertString(b);var d=AdfEditingAgent.getInstance(),e=d.getInlineFrameDocument(a);d.setRTL(e);this._setInlineFrameStyle(e);e=e.body;""==b&&(b=d.getDefaultContent());e.innerHTML=b};
AdfDhtmlRichTextEditorPeer.prototype._setInlineFrameStyle=function(a){a=a.body.style;var b=this._inlineFrameBodyInlineStyle;if(null==b){var d=AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM,e=AdfPage.PAGE,b=e.getLookAndFeel().getSkinProperty("af|richTextEditor-tr-field-inline-style");d&&void 0==b?e.scheduleTimer(this,this._updateInlineFrameStyle,b,0,{isSynchronized:!0}):this._updateInlineFrameStyle(b);a.cssText=this._inlineFrameBodyInlineStyle}else a.cssText=b};
AdfDhtmlRichTextEditorPeer.prototype._updateInlineFrameStyle=function(a){void 0==a&&(a=AdfPage.PAGE.getLookAndFeel().getSkinProperty("af|richTextEditor-tr-field-inline-style"));this._inlineFrameBodyInlineStyle=a=a.replace(/ /g,";").replace(/\+/g," ").replace(/_/g,":")};
AdfDhtmlRichTextEditorPeer.prototype._getContentField=function(a){a=AdfAgent.AGENT.getExpandoProperty(AdfRichUIPeer.getDomElementForComponent(a),AdfDhtmlRichTextEditorPeer._FIELD_ID_ATTR_NAME);a=AdfAgent.AGENT.getElementById(a);AdfAssert.assertDomElement(a);return a};
AdfDhtmlRichTextEditorPeer.prototype._getSourceCodeField=function(a){a=AdfAgent.AGENT.getExpandoProperty(AdfRichUIPeer.getDomElementForComponent(a),AdfDhtmlRichTextEditorPeer._SOURCE_FIELD_ID_ATTR_NAME);a=AdfAgent.AGENT.getElementById(a);AdfAssert.assertDomElement(a);return a};
AdfDhtmlRichTextEditorPeer.prototype._execCommand=function(a,b){var d=AdfAgent.AGENT;if(!0!=this._codeEditingMode||a==AdfDhtmlRichTextEditorPeer.COMMAND_MODE_RICH_TEXT||a==AdfDhtmlRichTextEditorPeer.COMMAND_INSERT){AdfAssert.assertString(a);var e=AdfDhtmlRichTextEditorPeer._execCommandMap[a];AdfAssert.assertString(e);var f=this.getComponent(),g;a==AdfDhtmlRichTextEditorPeer.COMMAND_INSERT&&!0==this._codeEditingMode?g=this._getSourceCodeField(f):(g=this._getContentField(f),AdfAssert.assertDomElement(g,
"IFRAME"),this._isTouch&&d.getPlatform()==AdfAgent.WEBKIT_PLATFORM&&g.focus(),this._restoreSelection());d=AdfEditingAgent.getInstance();d.isEmptySelection(g)?this._invokeAdditionalCommands(f,g,e,b)&&d.execCommand(f,g,e,b):d.execCommand(f,g,e,b)}};
AdfDhtmlRichTextEditorPeer.prototype._invokeAdditionalCommands=function(a,b,d,e){var f=[],g,h=[AdfDhtmlRichTextEditorPeer.STYLE_BOLD,AdfDhtmlRichTextEditorPeer.STYLE_ITALIC,AdfDhtmlRichTextEditorPeer.STYLE_UNDERLINE,AdfDhtmlRichTextEditorPeer.STYLE_STRIKETHROUGH,AdfDhtmlRichTextEditorPeer.STYLE_SUPERSCRIPT,AdfDhtmlRichTextEditorPeer.STYLE_SUBSCRIPT],k=this._oldStyleValues;if(void 0==k)return!0;switch(d){case "bold":case "italic":case "underline":case "strikethrough":case "superscript":case "subscript":break;
default:return!0}var l=!0,m;for(m=0;m<h.length;++m)if(g=AdfDhtmlRichTextEditorPeer._execCommandMap[h[m]],void 0!=g)if(g==d)k[h[m]]&&!this._getSelectionStyling(h[m])&&(l=!1);else{var n=k[h[m]],p=this._getSelectionStyling(h[m]);void 0!==n&&n!=p&&(f[f.length]=g)}d=AdfEditingAgent.getInstance();for(m=0;m<f.length;++m)d.execCommand(a,b,f[m],e);return l};
AdfDhtmlRichTextEditorPeer.prototype._queryCommandValue=function(a){AdfAssert.assertString(a);a=AdfDhtmlRichTextEditorPeer._execCommandMap[a];AdfAssert.assertString(a);var b=this.getComponent(),b=this._getContentField(b);AdfAssert.assertDomElement(b,"IFRAME");return AdfEditingAgent.getInstance().queryCommandValue(b,a)};
AdfDhtmlRichTextEditorPeer.prototype._styleBindingActionListener=function(a){if(!(void 0==this._styleObservers||this._commandBeingProcessed)){this._commandBeingProcessed=!0;for(var b=a.getSource().getClientId(),d=this._styleObservers,e=d.length,f=0;f<e;f++){var g=d[f];if(g.componentId==b){a.setPartial(!0);if(!this._isIgnoreNextEvent(g.styleKey)){if(g.eventType==AdfActionEvent.ACTION_EVENT_TYPE)this._toggleSelectionStyling(g.styleKey);else if(g.eventType==AdfValueChangeEvent.VALUE_CHANGE_TYPE){var h=
a.getNewValue();h&&(h._class&&"TrColor"==h._class)&&(h=(new TrColorConverter(["#RRGGBB"],!1)).getAsString(h),g.styleKey==AdfDhtmlRichTextEditorPeer.STYLE_COLOR_BACKGROUND&&(this._oldStyleValues[g.styleKey]=h));this._execCommand(g.styleKey,h)}else AdfLogger.LOGGER.severe("This eventType (",eventType,") is not supported by richTextEditor.");this._handleContextChanged()}this._hadFirstFocus&&this.focus(this.getComponent());a.cancel()}}this._updateValue();delete this._commandBeingProcessed}};
AdfDhtmlRichTextEditorPeer.prototype._commandBindingActionListener=function(a){if(!(void 0==this._commandObservers||this._commandBeingProcessed)){this._commandBeingProcessed=!0;for(var b=a.getSource().getClientId(),d=this._commandObservers,e=d.length,f=!1,g=0;g<e;g++){var h=d[g];if(h.componentId==b){a.setPartial(!0);var k=h.command;this._execCommand(k,h.commandParameter);this._handleContextChanged();a.cancel();k==AdfDhtmlRichTextEditorPeer.COMMAND_INSERT&&(f=!0)}}this._updateValue();f&&(a=this.getComponent(),
this.Validate(a,this.GetSubmittedValue(a,this.getDomElement())));delete this._commandBeingProcessed}};AdfDhtmlRichTextEditorPeer.prototype._toggleSelectionStyling=function(a){AdfAssert.assertString(a);return this._execCommand(a,null)};
AdfDhtmlRichTextEditorPeer.prototype._addContextChangeListeners=function(a){var b=this.getComponent(),d=AdfAgent.AGENT,e=AdfEditingAgent.getInstance(),f=e.getFocusBlurElement(a);this._focusCallback=this.createCallback(this._handleFocus);this._blurCallback=this.createCallback(this._handleBlur);if(this._isTouch&&d.getPlatform()==AdfAgent.WEBKIT_PLATFORM){d.addBubbleEventListener(a,"blur",this._blurCallback);var g=this;this._clickCallback=this.createCallback(this._handleClick);d.addBubbleEventListener(f,
"click",this._clickCallback)}d.addBubbleEventListener(f,"blur",this._blurCallback);d.addBubbleEventListener(f,"focus",this._focusCallback);b=this._getSourceCodeField(b);this._sourceBlurCallback=this.createCallback(this._handleBlur);this._sourceFocusCallback=this.createCallback(this._handleFocus);d.addBubbleEventListener(b,"blur",this._sourceBlurCallback);d.addBubbleEventListener(b,"focus",this._sourceFocusCallback);a=e.getInlineFrameDocument(a);this._keyDownCallback=this.createCallback(this._handleKeyDown);
d.addBubbleEventListener(a,"keydown",this._keyDownCallback);d.addBubbleEventListener(b,"keydown",this._keyDownCallback);this._contextChangeCallback=this.createCallback(this._handleContextChanged);this._mouseUpCallBack=this.createCallback(this._handleMouseUp);d.addBubbleEventListener(a,"mouseup",this._mouseUpCallBack);d.addBubbleEventListener(a,"keyup",this._contextChangeCallback);this._dragEndCallback=this.createCallback(this._handleDragEnd);d.addBubbleEventListener(a,"dragend",this._dragEndCallback);
this._mouseDownCallback=this.createCallback(this._handleMouseDown);d.addBubbleEventListener(this.getDomElement(),"mousedown",this._mouseDownCallback);AdfAgent.AGENT.getPlatform()!=AdfAgent.IE_PLATFORM&&d.addBubbleEventListener(a,"blur",this._contextChangeCallback);this._isTouch&&AdfAgent.guessOS()!=AdfAgent.WINDOWS_OS&&(g=this,this._saveSelectionInterval=setInterval(function(){g._saveSelection()},500),d.getPlatform()==AdfAgent.WEBKIT_PLATFORM&&536>d.getVersion()&&(this._handleCopyCallback=this.createCallback(this._handleCopy),
this.getDomDocument().addEventListener("copy",this._handleCopyCallback,!0),this._handlePasteCallback=this.createCallback(this._handlePaste),this.getDomDocument().addEventListener("paste",this._handlePasteCallback,!0)));this._redistributeEventsToNewTargetCallback=this.createCallback(this._redistributeEventsToNewTarget);d.addEventBubbles(a,this._redistributeEventsToNewTargetCallback)};
AdfDhtmlRichTextEditorPeer.prototype._removeContextChangeListeners=function(a){var b=AdfAgent.AGENT,d=this._getContentField(a),e=AdfEditingAgent.getInstance(),f=e.getFocusBlurElement(d);this._isTouch&&b.getPlatform()==AdfAgent.WEBKIT_PLATFORM?(b.removeBubbleEventListener(d,"blur",this._blurCallback),AdfAgent.guessOS()!=AdfAgent.ANDROID_OS&&b.removeBubbleEventListener(f,"blur",this._iOSBlurCallback),b.removeBubbleEventListener(f,"click",this._clickCallback),delete this._clickCallback):b.removeBubbleEventListener(f,
"blur",this._blurCallback);delete this._blurCallback;b.removeBubbleEventListener(f,"focus",this._focusCallback);delete this._focusCallback;a=this._getSourceCodeField(a);b.removeBubbleEventListener(a,"blur",this._sourceBlurCallback);delete this._sourceBlurCallback;b.removeBubbleEventListener(a,"focus",this._sourceFocusCallback);delete this._sourceFocusCallback;d=e.getInlineFrameDocument(d);b.removeBubbleEventListener(d,"mouseup",this._mouseUpCallBack);delete this._mouseUpCallBack;b.removeBubbleEventListener(d,
"keyup",this._contextChangeCallback);AdfAgent.AGENT.getPlatform()!=AdfAgent.IE_PLATFORM&&b.removeBubbleEventListener(d,"blur",this._contextChangeCallback);delete this._contextChangeCallback;b.removeBubbleEventListener(d,"keydown",this._keyDownCallback);delete this._keyDownCallback;b.removeEventBubbles(d,this._redistributeEventsToNewTargetCallback);delete this._redistributeEventsToNewTargetCallback;this._isTouch&&this._saveSelectionInterval&&clearInterval(this._saveSelectionInterval)};
AdfDhtmlRichTextEditorPeer.prototype._redistributeEventsToNewTarget=function(a){var b=this.getComponent();a||(a=this._getContentField(b).contentWindow.event);var d=AdfAgent.AGENT;if(d.isKeyboardEvent(a)||d.isMouseEvent(a))b=AdfAgent.AGENT.cloneEvent(a,this._getSourceCodeField(b)),this._clonedEventMap||(this._clonedEventMap=[]),this._clonedEventMap[b]=a,AdfPage.PAGE._redistribute(b)};
AdfDhtmlRichTextEditorPeer.prototype._handleFocus=function(a){var b=AdfAgent.AGENT;if(!this._commandBeingProcessed){var d=this.getComponent();this._hadFirstFocus||(this._hadFirstFocus=!0);var e=AdfAgent.AGENT.getComponentEvent(d,a),f=this._getContentField(d);AdfPage.PAGE.__setActiveDomNodeInfo(f,d.getClientId());this._codeEditingMode?d=this._getSourceCodeField(d):(d=AdfEditingAgent.getInstance().getContentWindow(f),d=d.document);d==a.originalTarget&&e.getEventPhase()==AdfBaseEvent.CAPTURING_PHASE&&
e.nextEventPhase();this.HandleComponentFocus(e)}if(this._isTouch&&(b.getPlatform()==AdfAgent.WEBKIT_PLATFORM&&AdfAgent.guessOS()!=AdfAgent.ANDROID_OS)&&b._getTouchEventListeners&&(a=b._getTouchEventListeners()))for(b=0;b<a.length;b++)this.getDomDocument().removeEventListener(a[b].eventType,a[b].listener,a[b].capture)};
AdfDhtmlRichTextEditorPeer.prototype._handleLoad=function(a){var b=AdfEditingAgent.getInstance();a=this.getComponent();AdfAssert.assertObject(a,"Unexpected unbound peer for load event on iframe.");var d=this._getContentField(a);AdfAssert.assertDomElement(d);var e=!a.getDisabled()&&!b.isDesignMode(d);if(b.isDesignModeReloadingFrame()&&e)this._makeEditable(a);else{var f=this._getSourceCodeField(a);AdfAssert.assertDomElement(f);if("lazy"!=a.getContentDelivery())this._setInlineFrameContent(d,f.value);
else{var g=this.getCurrentContent(a,!0);f.value=g;b=b.getInlineFrameDocument(d);this._setInlineFrameStyle(b)}e&&this._makeEditable(a);a.getReadOnly()||AdfRichTextEditorBehaviorManager.getInstance().registerComponent(a);d.setAttribute("data-afr-rte-loaded","1")}};
AdfDhtmlRichTextEditorPeer.prototype._handleBlur=function(a){a=AdfAgent.AGENT;if(!this._commandBeingProcessed){var b=this.getComponent(),d=this._getContentField(b),e=AdfDhtmlInputBasePeer.getLastValue(d);this._tabForward?(delete this._tabForward,AdfFocusUtils.focusNextTabStop(AdfPage.PAGE.getActiveDomElement())):this._tabBack&&(delete this._tabBack,AdfFocusUtils.focusPreviousTabStop(AdfPage.PAGE.getActiveDomElement()));this._updateValue();this._mouseDownOrTabBack&&delete this._mouseDownOrTabBack;
var f=!1,g=this._getSourceCodeField(b).value;e!=g&&void 0!==e&&(f=!0);if(f&&(!this._mouseDownOrTabBack||!b.getValid(b.getClientId())))this.Validate(b,this.GetSubmittedValue(b,this.getDomElement())),AdfDhtmlInputBasePeer.setLastValue(d,g)}if(this._isTouch&&(a.getPlatform()==AdfAgent.WEBKIT_PLATFORM&&AdfAgent.guessOS()!=AdfAgent.ANDROID_OS)&&(this._keyboardClose(),a._getTouchEventListeners&&(a=a._getTouchEventListeners())))for(b=0;b<a.length;b++)this.getDomDocument().addEventListener(a[b].eventType,
a[b].listener,a[b].capture)};AdfDhtmlRichTextEditorPeer.prototype._handleClick=function(a){this.Focus()};AdfDhtmlRichTextEditorPeer.prototype._handleMouseDown=function(a){this._mouseDownOrTabBack=!0};AdfDhtmlRichTextEditorPeer.prototype._handleDragEnd=function(a){AdfAgent.AGENT.getPlatform()==AdfAgent.IE_PLATFORM?((a=this._keyTimer)&&clearTimeout(a),AdfPage.PAGE.scheduleTimer(this,AdfDhtmlRichTextEditorPeer.HandleTimerUpdate,this.getComponent().getClientId(),0)):this._handleContextChanged()};
AdfDhtmlRichTextEditorPeer.prototype._handleCopy=function(a){if(a.clipboardData&&null!=this._lastSelectionRange&&(this._isInPopup()||!AdfPage.PAGE.getModalityManager().isGlassPaneVisible())){var b=this.getDomDocument(),d=b.createElement("div");d.style.position="absolute";d.style.left="-1000px";d.style.top="-1000px";d.contentEditable="true";d.textContent=this._lastSelectionRange.toString();b.body.appendChild(d);a=b.createRange();a.selectNodeContents(d);var e=window.getSelection();e.removeAllRanges();
e.addRange(a);b.execCommand("copy",!1,null);setTimeout(function(){b.body.removeChild(d)},500)}};
AdfDhtmlRichTextEditorPeer.prototype._handlePaste=function(a){var b=AdfAgent.AGENT;if(a.clipboardData&&(this._isInPopup()||!AdfPage.PAGE.getModalityManager().isGlassPaneVisible())){if(this._isInPopup()&&b.getPlatform()==AdfAgent.WEBKIT_PLATFORM&&536>b.getVersion()){if(this._hasPasteEvent)return;this._hasPasteEvent=!0;var d=this;setTimeout(function(){delete d._hasPasteEvent},500)}a=a.clipboardData.getData("Text");this._execCommand("cmd_insert",a)}};
AdfDhtmlRichTextEditorPeer.prototype._updateValue=function(){var a=this.getComponent(),b=this._getContentField(a);this._keyTimer&&(clearTimeout(this._keyTimer),delete this._keyTimer);if("none"!=b.style.display){var d=this._getSourceCodeField(a),e=AdfEditingAgent.getInstance(),f=this.getCurrentContent(a);-1!=navigator.userAgent.toLowerCase().indexOf("chrome")&&f.includes("span")&&(f=f.replace(/; /gi,";").replace(/: /gi,":"));d.value=f;e.updateValueHistory(a,b,f)}};
AdfDhtmlRichTextEditorPeer.prototype._getSelectionStyling=function(a){AdfAssert.assertString(a);a=AdfDhtmlRichTextEditorPeer._execCommandMap[a];AdfAssert.assertString(a);return AdfEditingAgent.getInstance().queryCommandState(this._getContentField(this.getComponent()),a)};
AdfDhtmlRichTextEditorPeer.prototype._getIndeterminateStyling=function(a){AdfAssert.assertString(a);a=AdfDhtmlRichTextEditorPeer._execCommandMap[a];AdfAssert.assertString(a);return AdfEditingAgent.getInstance().queryCommandIndeterminate(this._getContentField(this.getComponent()),a)};
AdfDhtmlRichTextEditorPeer.prototype._addStyleBinding=function(a,b,d,e){AdfAssert.assertString(a);AdfAssert.assertString(b);AdfAssert.assertString(d);AdfAssert.assertStringOrNull(e);void 0==e&&(e=AdfActionEvent.ACTION_EVENT_TYPE);var f=AdfPage.PAGE.findComponent(a);a={componentId:a,propertyName:b,styleKey:d,eventType:e};this._styleObservers||(this._styleObservers=[]);this._styleObservers.push(a);(e!=AdfActionEvent.ACTION_EVENT_TYPE||!f.isDescendant(this.getComponent()))&&f.addEventListener(e,this._styleBindingActionListener,
this)};AdfDhtmlRichTextEditorPeer.prototype._removeStyleBindings=function(a){var b=this._styleObservers;if(void 0!=b)for(var d=b.length,e=this._styleBindingActionListener,f=0;f<d;f++){var g=b[f],h=AdfPage.PAGE.findComponent(g.componentId);void 0!=h&&(g.eventType!=AdfActionEvent.ACTION_EVENT_TYPE||!h.isDescendant(a))&&h.removeEventListener(g.eventType,e,this)}};
AdfDhtmlRichTextEditorPeer.prototype._addCommandBinding=function(a,b,d,e){AdfAssert.assertString(a);AdfAssert.assertString(d);this._commandObservers||(this._commandObservers=[]);for(var f=this._commandObservers.length,g=null,h=0;h<f;h++){var k=this._commandObservers[h];if(k.componentId==a&&k.command==d){k.commandParameter=e;g=k;break}}null==g&&(g={componentId:a,command:d,commandParameter:e},this._commandObservers.push(g));b.isDescendant(this.getComponent())||b.addEventListener(AdfActionEvent.ACTION_EVENT_TYPE,
this._commandBindingActionListener,this)};AdfDhtmlRichTextEditorPeer.prototype._removeCommandBindings=function(a){var b=this._commandObservers;if(void 0!=b)for(var d=b.length,e=this._commandBindingActionListener,f=0;f<d;f++){var g=AdfPage.PAGE.findComponent(b[f].componentId);void 0!=g&&(g.isDescendant(a)||g.removeEventListener(AdfActionEvent.ACTION_EVENT_TYPE,e,this))}};
AdfDhtmlRichTextEditorPeer.prototype._ignoreNextEvent=function(a){AdfAssert.assertString(a);void 0==this._ignoreEvents[a]&&(this._ignoreEvents[a]=0);this._ignoreEvents[a]++};AdfDhtmlRichTextEditorPeer.prototype._isIgnoreNextEvent=function(a){AdfAssert.assertString(a);if(void 0==this._ignoreEvents[a]||0==this._ignoreEvents[a])return!1;this._ignoreEvents[a]--;return!0};
AdfDhtmlRichTextEditorPeer.prototype._isInPopup=function(){var a=null;try{a=this.getComponent().getParent()}catch(b){}if(null==a)return!1;for(;null!=a;){if(a instanceof AdfRichPopup)return!0;try{a=a.getParent()}catch(d){return!1}if(null==a)return!1}};
AdfDhtmlRichTextEditorPeer.prototype._keyboardClose=function(){var a=AdfEditingAgent.getInstance(),b=this._getContentField(this.getComponent()),d=a.getInlineFrameDocument(b),a=a.getFocusBlurElement(b),d=d.createElement("input");d.type="text";d.style.position="absolute";d.style.left="0px";d.style.top="0px";d.style.height="0px";d.style.width="0px";d.style.opacity="0";a.appendChild(d);d.focus();d.blur();a.removeChild(d)};AdfDhtmlRichTextEditorPeer.prototype._emptySelection=function(a){return!a||0==AdfEditingAgent.getInstance().getSelectionRangeString(a).length};
AdfDhtmlRichTextEditorPeer.prototype._toolbarPopupURLBlur=function(a){a.getEventPhase()==AdfBaseEvent.AT_TARGET_PHASE&&!this._emptySelection(this._lastSelectionRange)&&(a=a.getCurrentTarget().getValue(),"about:blank"!==a&&(/^http:\/\//.test(a)||(a="http://"+a),this._execCommand(AdfDhtmlRichTextEditorPeer.COMMAND_LINK,a),this._saveSelection()))};
AdfDhtmlRichTextEditorPeer.prototype._toolbarPopupDisplayedTextBlur=function(a){if(a.getEventPhase()==AdfBaseEvent.AT_TARGET_PHASE){var b=this._lastSelectionRange,d=AdfEditingAgent.getInstance();this._emptySelection(b)||(a=a.getCurrentTarget().getValue(),b=d.getSelectionRangeString(b),a!==b&&this._execCommand(AdfDhtmlRichTextEditorPeer.COMMAND_INSERT,a))}};
AdfDhtmlRichTextEditorPeer.prototype._getToolbarPopupNode=function(a){return AdfAgent.AGENT.getElementById(AdfRichUIPeer.CreateSubId(a.getClientId(),AdfDhtmlRichTextEditorPeer._TOOLBAR_POPUP_CONTAINER_ID))};AdfDhtmlRichTextEditorPeer.prototype._getToolbarPopupInputContainer=function(a){return AdfAgent.AGENT.getElementById(a.getId()+AdfDhtmlRichTextEditorPeer._TOOLBAR_POPUP_INPUT_CONTAINER_ID)};
AdfDhtmlRichTextEditorPeer.prototype._getToolbarPopupURLComp=function(a){return AdfPage.PAGE.findComponent(a.getId()+AdfDhtmlRichTextEditorPeer._TOOLBAR_POPUP_LINK_INPUT_ID)};AdfDhtmlRichTextEditorPeer.prototype._getToolbarPopupDisplayedTextComp=function(a){return AdfPage.PAGE.findComponent(a.getId()+AdfDhtmlRichTextEditorPeer._TOOLBAR_POPUP_LINK_SELECTED_INPUT_ID)};
AdfDhtmlRichTextEditorPeer.prototype._showToolbarPopup=function(a){var b=AdfAgent.AGENT;a=this.getComponent();var d=a.getClientId(),e=b.getElementById(AdfRichUIPeer.CreateSubId(d,AdfDhtmlRichTextEditorPeer._CONTENT_INPUT_CONTAINER_SUBID)),b=this._getToolbarPopupNode(a),f={};f[AdfDhtmlPopupHints.AUTODISMISS]=AdfDhtmlPopupHints.AUTODISMISS_ALWAYS;f[AdfDhtmlPopupHints.ALIGN_ELEMENT]=e;f[AdfRichPopup.HINT_ALIGN]=AdfRichPopup.ALIGN_BEFORE_START;f[AdfDhtmlPopupHints.FOCUS]=!1;AdfDomUtils.setVisible(b,!0);
if(!this._toolbarPopupListenerInitialized){var e=this._getToolbarPopupDisplayedTextComp(a),g=this._getToolbarPopupURLComp(a),h=function(a){a=a.getCurrentTarget();AdfDhtmlEditableValuePeer.getContentNode(a,a.getPeer().getDomElement()).select()};g.addEventListener(AdfUIInputEvent.BLUR_EVENT_TYPE,this._toolbarPopupURLBlur,this);g.addEventListener(AdfUIInputEvent.FOCUS_EVENT_TYPE,h,this);e.addEventListener(AdfUIInputEvent.BLUR_EVENT_TYPE,this._toolbarPopupDisplayedTextBlur,this);e.addEventListener(AdfUIInputEvent.FOCUS_EVENT_TYPE,
h,this);this._toolbarPopupListenerInitialized=!0}this.showPopup(a,b,f,d)};
AdfDhtmlRichTextEditorPeer.prototype.PopupClosed=function(a,b,d){AdfDhtmlRichTextEditorPeer.superclass.PopupClosed.call(this,a,b);d=this._getToolbarPopupNode(a);if(d==b&&AdfDomUtils.isVisible(d)){d=AdfAgent.AGENT;var e=a.getId(),f=this.getComponent().getClientId();a=d.getElementById(AdfRichUIPeer.CreateSubId(f,"content"));f=d.getElementById(AdfRichUIPeer.CreateSubId(f,AdfDhtmlRichTextEditorPeer._CONTENT_INPUT_CONTAINER_SUBID));d=d.getElementById(e+AdfDhtmlRichTextEditorPeer._TOOLBAR_POPUP_INPUT_CONTAINER_ID);
a.insertBefore(b,f);AdfDomUtils.setVisible(d,!1);AdfDomUtils.setVisible(b,!1)}};AdfDhtmlRichTextEditorPeer.prototype._updateToolbarPopupURLVal=function(){var a=this.getComponent(),b=this._getToolbarPopupInputContainer(a);AdfDomUtils.isVisible(b)&&(b=this._getToolbarPopupURLComp(a),a=AdfEditingAgent.getInstance()._getLinkURLForSelection(a,this._getContentField(a)),b.setValue(a))};
AdfDhtmlRichTextEditorPeer.prototype._processToolbarPopupAddLinkCmd=function(a){var b=this.getComponent(),d=this._lastSelectionRange,e=AdfEditingAgent.getInstance();if(!this._emptySelection(d)){var f=this._getToolbarPopupInputContainer(b);if(AdfDomUtils.isVisible(f))AdfDomUtils.setVisible(f,!1);else{var g=this._getToolbarPopupDisplayedTextComp(b),b=this._getToolbarPopupURLComp(b);g.setValue(e.getSelectionRangeString(d));b.setValue(a);AdfDomUtils.setVisible(f,!0)}}};