diff --git a/www/common/onlyoffice/v5/sdkjs/cell/sdk-all-min.js b/www/common/onlyoffice/v5/sdkjs/cell/sdk-all-min.js index 46eb40705..c4cb6f2ac 100644 --- a/www/common/onlyoffice/v5/sdkjs/cell/sdk-all-min.js +++ b/www/common/onlyoffice/v5/sdkjs/cell/sdk-all-min.js @@ -1812,7 +1812,7 @@ function(){this.isPreOpenLocks=false;for(var i=0;i");if(-1!=nIndex)_html_format=_html_format.substring(0,nIndex+"".length);this.CommonIframe_PasteStart(_html_format,_text_format); -return false}if(_text_format&&_text_format!=""){this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Text,_text_format);g_clipboardBase.Paste_End();return false}var items=_clipboard.items;if(null!=items&&0!=items.length){g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCount=items.length;g_clipboardBase.PasteImagesCounter=0;for(var i=0;i';if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount=0}};reader.onabort=reader.onerror=function(e){g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter== -g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount=0}};try{reader.readAsDataURL(blob)}catch(err){g_clipboardBase.PasteImagesCounter++}}else g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount)g_clipboardBase.Paste_End();return false}}g_clipboardBase.Paste_End(); -return false},_private_onbeforepaste:function(e,isAttackEmulate){this._console_log("onbeforepaste");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select();return}return false},_private_onbeforecopy_select:function(){if(AscBrowser.isIE){this._console_log("onbeforecopy_select");this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus(); -this.StartFocus();this.CommonDiv_Select()}},_private_onbeforecopy:function(e,isAttackEmulate){this._console_log("onbeforecopy");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}return false},Init:function(_api){this.Api=_api;window["AscCommon"].g_specialPasteHelper.Init(_api);this.ClosureParams.getData=function(type){var _clipboard=this._e&& -this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.getData)return null;var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{return _clipboard.getData(_type)}catch(e){}return null};this.ClosureParams.setData=function(type,_data){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.setData)return null;var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type= -"Text";try{_clipboard.setData(_type,_data)}catch(e){}};if(!AscBrowser.isIE){document.oncopy=function(e){return g_clipboardBase._private_oncopy(e)};document.oncut=function(e){return g_clipboardBase._private_oncut(e)};document.onpaste=function(e){return g_clipboardBase._private_onpaste(e)};document["onbeforecopy"]=function(e){return g_clipboardBase._private_onbeforecopy(e)};document["onbeforecut"]=function(e){return g_clipboardBase._private_onbeforecopy(e)};document["onbeforepaste"]=function(e){return g_clipboardBase._private_onbeforepaste(e)}}else{document.addEventListener("copy", -function(e){return g_clipboardBase._private_oncopy(e)});document.addEventListener("cut",function(e){return g_clipboardBase._private_oncut(e)});document.addEventListener("paste",function(e){return g_clipboardBase._private_onpaste(e)});document.addEventListener("beforepaste",function(e){return g_clipboardBase._private_onbeforepaste(e)});document.addEventListener("beforecopy",function(e){return g_clipboardBase._private_onbeforecopy(e)});document.addEventListener("beforecut",function(e){return g_clipboardBase._private_onbeforecopy(e)})}if(this.IsCopyCutOnlyInEditable|| -this.IsPasteOnlyInEditable)document.onkeydown=function(e){if(!g_clipboardBase.Api.asc_IsFocus(true)||g_clipboardBase.Api.isLongAction())return;var isAltGr=AscCommon.getAltGr(e);if(isAltGr)return;var isCtrl=e.ctrlKey===true||e.metaKey===true;var isShift=e.shiftKey;var keyCode=e.keyCode;if(g_clipboardBase.IsCopyCutOnlyInEditable){var bIsBeforeCopyCutEmulate=false;var _cut=false;if(isCtrl&&!isShift&&(keyCode==67||keyCode==88))bIsBeforeCopyCutEmulate=true;if(!isCtrl&&isShift&&keyCode==45){bIsBeforeCopyCutEmulate= -true;_cut=true}if(bIsBeforeCopyCutEmulate){g_clipboardBase._console_log("emulate_beforecopycut");var isEmulate=false;try{isEmulate=_cut?document.execCommand("beforecut"):document.execCommand("beforecopy")}catch(err){}g_clipboardBase._private_onbeforecopy(undefined,!isEmulate)}}if(g_clipboardBase.IsPasteOnlyInEditable){var bIsBeforePasteEmulate=false;if(isCtrl&&!isShift&&keyCode==86)bIsBeforePasteEmulate=true;if(!isCtrl&&isShift&&keyCode==45)bIsBeforePasteEmulate=true;if(bIsBeforePasteEmulate){g_clipboardBase._console_log("emulate_beforepaste"); -var isEmulate=false;try{isEmulate=document.execCommand("beforepaste")}catch(err$14){}g_clipboardBase._private_onbeforepaste(undefined,!isEmulate)}}};if(AscBrowser.isSafari&&false){this.CommonDiv=this.CommonDiv_Check();setInterval(function(){if(g_clipboardBase.Api.asc_IsFocus(true))g_clipboardBase.CommonDiv.focus()},100)}},IsWorking:function(){return this.CopyFlag||this.PasteFlag?true:false},StartFocus:function(){this.EndFocus(false);this.CopyPasteFocus=true;this.CopyPasteFocusTimer=setTimeout(function(){g_clipboardBase.EndFocus()}, -1E3)},EndFocus:function(isFocusToEditor){this.CopyPasteFocus=false;if(-1!=this.CopyPasteFocusTimer){clearTimeout(this.CopyPasteFocusTimer);this.CopyPasteFocusTimer=-1;if(false!==isFocusToEditor&&null!=this.inputContext)if(this.inputContext.HtmlArea)this.inputContext.HtmlArea.focus()}},IsFocus:function(){return this.CopyPasteFocus},CommonDiv_Check:function(){var ElemToSelect=document.getElementById(this.CommonDivId);if(!ElemToSelect){ElemToSelect=document.createElement("div");ElemToSelect.id=this.CommonDivId; -ElemToSelect.className=this.CommonDivClassName;ElemToSelect.style.position="fixed";ElemToSelect.style.left="0px";ElemToSelect.style.top="-100px";ElemToSelect.style.width="10000px";ElemToSelect.style.height="100px";ElemToSelect.style.overflow="hidden";ElemToSelect.style.zIndex=-1E3;ElemToSelect.style.MozUserSelect="text";ElemToSelect.style.fontFamily="onlyofficeDefaultFont";ElemToSelect.style.fontSize="11pt";ElemToSelect.style.color="black";ElemToSelect.style["-khtml-user-select"]="text";ElemToSelect.style["-o-user-select"]= -"text";ElemToSelect.style["user-select"]="text";ElemToSelect.style["-webkit-user-select"]="text";ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());var _parent=""==this.CommonDivIdParent?document.body:document.getElementById(this.CommonDivIdParent);_parent.appendChild(ElemToSelect)}else ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());return ElemToSelect},CommonDiv_Select:function(){var ElemToSelect=this.CommonDiv;if(window.getSelection){var selection=window.getSelection(); -var rangeToSelect=document.createRange();var is_gecko=AscBrowser.isGecko;if(is_gecko){ElemToSelect.appendChild(document.createTextNode("\u00a0"));ElemToSelect.insertBefore(document.createTextNode("\u00a0"),ElemToSelect.firstChild);rangeToSelect.setStartAfter(ElemToSelect.firstChild);rangeToSelect.setEndBefore(ElemToSelect.lastChild)}else{var aChildNodes=ElemToSelect.childNodes;if(aChildNodes.length==1){var elem=aChildNodes[0];var wrap=document.createElement("b");wrap.setAttribute("style","font-weight:normal; background-color: transparent; color: transparent;"); -elem=ElemToSelect.removeChild(elem);wrap.appendChild(elem);ElemToSelect.appendChild(wrap)}rangeToSelect.selectNodeContents(ElemToSelect)}selection.removeAllRanges();selection.addRange(rangeToSelect)}else if(document.body.createTextRange){var rangeToSelect=document.body.createTextRange();rangeToSelect.moveToElementText(ElemToSelect);rangeToSelect.select()}},CommonDiv_Start:function(){this.ClosureParams.overflowBody=document.body.style.overflow;document.body.style.overflow="hidden";this.ClosureParams.backgroundcolorBody= -document.body.style["background-color"];document.body.style["background-color"]="transparent";var ElemToSelect=this.CommonDiv;ElemToSelect.style.display="block";while(ElemToSelect.hasChildNodes())ElemToSelect.removeChild(ElemToSelect.lastChild);document.body.style.MozUserSelect="text";delete document.body.style["-khtml-user-select"];delete document.body.style["-o-user-select"];delete document.body.style["user-select"];document.body.style["-webkit-user-select"]="text";ElemToSelect.style.MozUserSelect= -"all"},CommonDiv_End:function(){var ElemToSelect=this.CommonDiv;if(ElemToSelect){ElemToSelect.style.display=AscBrowser.isSafari?"block":"none";ElemToSelect.style.MozUserSelect="none"}document.body.style.MozUserSelect="none";document.body.style["-khtml-user-select"]="none";document.body.style["-o-user-select"]="none";document.body.style["user-select"]="none";document.body.style["-webkit-user-select"]="none";document.body.style["background-color"]=this.ClosureParams.backgroundcolorBody;document.body.style.overflow= -this.ClosureParams.overflowBody;this.CopyFlag=false;this.bCut=false;this.EndFocus()},CommonDiv_Copy:function(){this.CopyFlag=true;this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.ClosureParams.isDivCopy=true;this.DivOnCopyHtmlPresent=false;this.DivOnCopyText="";this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.ClosureParams.isDivCopy=false;if(!this.DivOnCopyHtmlPresent&& -this.DivOnCopyText!="")this.CommonDiv.innerHTML=this.DivOnCopyText;this.DivOnCopyHtmlPresent=false;this.DivOnCopyText="";this.CommonDiv_Select();window.setTimeout(function(){g_clipboardBase.CommonDiv_End()},0)},CommonDiv_Execute_CopyCut:function(){if(this.IsCopyCutOnlyInEditable)this._private_onbeforecopy(undefined,true)},CommonIframe_PasteStart:function(_html_data,text_data){var ifr=document.getElementById(this.CommonIframeId);if(!ifr){ifr=document.createElement("iframe");ifr.name=this.CommonIframeId; -ifr.id=this.CommonIframeId;ifr.style.position="absolute";ifr.style.top="-100px";ifr.style.left="0px";ifr.style.width="10000px";ifr.style.height="100px";ifr.style.overflow="hidden";ifr.style.zIndex=-1E3;ifr.setAttribute("sandbox","allow-same-origin");document.body.appendChild(ifr);this.CommonIframe=ifr}else ifr.style.width="10000px";var frameWindow=window.frames[this.CommonIframeId];if(frameWindow){frameWindow.document.open();frameWindow.document.write(_html_data);frameWindow.document.close();if(null!= -frameWindow.document&&null!=frameWindow.document.body){ifr.style.display="block";this.pastedFrom=definePastedFrom(frameWindow.document);this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.HtmlElement,frameWindow.document.body,ifr,text_data)}}ifr.style.width="100px";g_clipboardBase.Paste_End()},CommonIframe_PasteEnd:function(){if(this.CommonIframe&&this.CommonIframe.style.display!="none"){this.CommonIframe.blur();this.CommonIframe.style.display="none"}},Paste_End:function(){this.CommonIframe_PasteEnd(); -this.Api.decrementCounterLongAction();this.PasteFlag=false;this.EndFocus();if(this.needClearBuffer){this.ClearBuffer();this.needClearBuffer=false}},pushData:function(_format,_data){if(null==this.LastCopyBinary)this.LastCopyBinary=[];this.LastCopyBinary.push({type:_format,data:_data});if(this.ClosureParams.isDivCopy===true){if(!this.isCopyOutEnabled())return;if(_format==AscCommon.c_oAscClipboardDataFormat.Html){this.CommonDiv.innerHTML=_data;this.DivOnCopyHtmlPresent=true}if(_format==AscCommon.c_oAscClipboardDataFormat.Text)this.DivOnCopyText= -_data;return}var _data_format="";switch(_format){case AscCommon.c_oAscClipboardDataFormat.Html:_data_format="text/html";break;case AscCommon.c_oAscClipboardDataFormat.Text:_data_format="text/plain";break;case AscCommon.c_oAscClipboardDataFormat.Internal:_data_format="text/x-custom";break;default:break}if(_data_format!=""&&_data!==null&&this.isCopyOutEnabled())if(_data_format=="text/x-custom")this.ClosureParams.setData(_data_format,"asc_internalData2;"+_data);else this.ClosureParams.setData(_data_format, -_data)},Button_Copy:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("copy")}catch(err){_ret=false}if(!_ret){this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal)}return _ret}, -Button_Cut:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("cut")}catch(err){_ret=false}if(!_ret){this.LastCopyBinary=null;this.bCut=true;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal); -this.Api.asc_SelectionCut();this.bCut=false}return _ret},Button_Paste:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);var _ret=false;try{_ret=document.execCommand("paste")}catch(err){_ret=false}if(!_ret&&null!=this.LastCopyBinary){var _data=null;var _isInternal=false;for(var i=0;i0)this.Api.asc_PasteData(this.LastCopyBinary[0].type,this.LastCopyBinary[0].data)}return _ret},ClearBuffer:function(){if(-1!=this.clearBufferTimerId)clearTimeout(this.clearBufferTimerId);this.clearBufferTimerId=setTimeout(function(){if(AscCommon.g_clipboardBase)AscCommon.g_clipboardBase.clearBufferTimerId=-1},500);this.Button_Copy()},isCopyOutEnabled:function(){if(this.Api&&this.Api.isCopyOutEnabled)return this.Api.isCopyOutEnabled(); -return true}};function definePastedFrom(doc){if(!doc)return null;var res=null;var metaTags=doc.getElementsByTagName("meta");for(var i=0;i>1)+"px;top:"+-this.HtmlAreaOffset+ -"px;";_style+="background:transparent;border:none;position:absolute;text-shadow:0 0 0 #000;outline:none;color:transparent;width:"+this.HtmlAreaWidth+"px;height:50px;";_style+="overflow:hidden;padding:0px;margin:0px;font-family:arial;resize:none;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;";_style+="touch-action: none;-webkit-touch-callout: none;color:transparent;caret-color:transparent;";_style+=AscCommon.AscBrowser.isAppleDevices?"font-size:0px;": -"font-size:8px;";this.HtmlArea.setAttribute("style",_style);this.HtmlArea.setAttribute("spellcheck",false);this.HtmlArea.setAttribute("autocapitalize","none");this.HtmlArea.setAttribute("autocomplete","off");this.HtmlArea.setAttribute("autocorrect","off");this.HtmlDiv.appendChild(this.HtmlArea);if(true){var oHtmlDivScrollable=document.createElement("div");oHtmlDivScrollable.id="area_id_main";oHtmlDivScrollable.setAttribute("style","background:transparent;border:none;position:absolute;padding:0px;margin:0px;z-index:0;pointer-events:none;"); -var parentStyle=getComputedStyle(oHtmlParent);oHtmlDivScrollable.style.left=parentStyle.left;oHtmlDivScrollable.style.top=parentStyle.top;oHtmlDivScrollable.style.width=parentStyle.width;oHtmlDivScrollable.style.height=parentStyle.height;oHtmlDivScrollable.style.overflow="hidden";oHtmlDivScrollable.appendChild(this.HtmlDiv);oHtmlParent.parentNode.appendChild(oHtmlDivScrollable)}else oHtmlParent.appendChild(this.HtmlDiv);var oThis=this;this.HtmlArea["onkeydown"]=function(e){if(AscCommon.AscBrowser.isSafariMacOs){var cmdButton= -e.ctrlKey||e.metaKey?true:false;var buttonCode=e.keyCode==67||e.keyCode==88||e.keyCode==86;if(cmdButton&&buttonCode)oThis.IsDisableKeyPress=true;else oThis.IsDisableKeyPress=false}return oThis.onKeyDown(e)};this.HtmlArea["onkeypress"]=function(e){if(oThis.IsDisableKeyPress==true){oThis.IsDisableKeyPress=false;var cmdButton=e.ctrlKey||e.metaKey?true:false;if(cmdButton)return}return oThis.onKeyPress(e)};this.HtmlArea["onkeyup"]=function(e){oThis.IsDisableKeyPress=false;return oThis.onKeyUp(e)};this.HtmlArea.addEventListener("input", -function(e){return oThis.onInput(e)},false);this.HtmlArea.addEventListener("compositionstart",function(e){return oThis.onCompositionStart(e)},false);this.HtmlArea.addEventListener("compositionupdate",function(e){return oThis.onCompositionUpdate(e)},false);this.HtmlArea.addEventListener("compositionend",function(e){return oThis.onCompositionEnd(e)},false);this.show();this.Api.Input_UpdatePos();if(AscCommon.AscBrowser.isAndroid)this.HtmlArea.onclick=function(e){var _this=AscCommon.g_inputContext;if(-1!= -_this.virtualKeyboardClickTimeout){clearTimeout(_this.virtualKeyboardClickTimeout);_this.virtualKeyboardClickTimeout=-1}_this.apiCompositeEnd();if(!_this.virtualKeyboardClickPrevent)return;_this.setReadOnlyWrapper(true);_this.virtualKeyboardClickPrevent=false;AscCommon.stopEvent(e);_this.virtualKeyboardClickTimeout=setTimeout(function(){_this.setReadOnlyWrapper(false);_this.virtualKeyboardClickTimeout=-1},1);return false}},onResize:function(_editorContainerId){var _elem=document.getElementById("area_id_main"); -var _elemSrc=document.getElementById(_editorContainerId);if(!_elem||!_elemSrc)return;if(AscCommon.AscBrowser.isChrome){var rectObject=_elemSrc.getBoundingClientRect();this.FixedPosCheckElementX=rectObject.left;this.FixedPosCheckElementY=rectObject.top}var _width=_elemSrc.style.width;if((null==_width||""==_width)&&window.getComputedStyle){var _s=window.getComputedStyle(_elemSrc);_elem.style.left=_s.left;_elem.style.top=_s.top;_elem.style.width=_s.width;_elem.style.height=_s.height}else{_elem.style.left= -_elemSrc.style.left;_elem.style.top=_elemSrc.style.top;_elem.style.width=_width;_elem.style.height=_elemSrc.style.height}if(this.Api.isMobileVersion){var _elem1=document.getElementById("area_id_parent");var _elem2=document.getElementById("area_id");_elem1.parentNode.style.pointerEvents="";_elem1.style.left="0px";_elem1.style.top="-1000px";_elem1.style.right="0px";_elem1.style.bottom="-100px";_elem1.style.width="auto";_elem1.style.height="auto";_elem2.style.left="0px";_elem2.style.top="0px";_elem2.style.right= -"0px";_elem2.style.bottom="0px";_elem2.style.width="100%";_elem2.style.height="100%";if(AscCommon.AscBrowser.isIE){document.body.style["msTouchAction"]="none";document.body.style["touchAction"]="none"}}var _editorSdk=document.getElementById("editor_sdk");this.editorSdkW=_editorSdk.clientWidth;this.editorSdkH=_editorSdk.clientHeight},checkFocus:function(){if(this.Api.asc_IsFocus()&&!AscCommon.g_clipboardBase.IsFocus()&&!AscCommon.g_clipboardBase.IsWorking())if(document.activeElement!=this.HtmlArea)this.HtmlArea.focus()}, -move:function(x,y){if(this.Api.isMobileVersion)return;var oTarget=document.getElementById(this.TargetId);if(!oTarget)return;var xPos=x?x:parseInt(oTarget.style.left);var yPos=(y?y:parseInt(oTarget.style.top))+parseInt(oTarget.style.height);if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)xPos=-100;if(!this.isDebug&&!this.isSystem){this.HtmlDiv.style.left=xPos+this.FixedPosCheckElementX+"px";this.HtmlDiv.style.top=yPos+this.FixedPosCheckElementY+this.TargetOffsetY+this.HtmlAreaOffset+ -"px";this.HtmlArea.scrollTop=this.HtmlArea.scrollHeight}else this.debugCalculatePlace(xPos+this.FixedPosCheckElementX,yPos+this.FixedPosCheckElementY+this.TargetOffsetY);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onTargetPositionChanged")},emulateKeyDownApi:function(code){var _e={altKey:false,ctrlKey:false,shiftKey:false,target:null,charCode:0,which:code,keyCode:code,code:"",preventDefault:function(){},stopPropagation:function(){}};this.Api.onKeyDown(_e);this.Api.onKeyUp(_e)},clear:function(isFromFocus){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML= -"";else this.HtmlArea.value="";if(isFromFocus!==true)this.HtmlArea.focus();this.TextBeforeComposition="";this.Text="";this.Target=0;this.CompositionStart=0;this.CompositionEnd=0;this.IsComposition=false;this.keyPressInput="";if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperClear")},getAreaValue:function(){return this.TextArea_Not_ContentEditableDiv?this.HtmlArea.value:this.HtmlArea.innerText},setReadOnly:function(isLock){if(isLock)this.ReadOnlyCounter++;else this.ReadOnlyCounter--; -this.setReadOnlyWrapper(0>=this.ReadOnlyCounter?false:true)},setReadOnlyWrapper:function(val){this.HtmlArea.readOnly=this.Api.isViewMode?true:val},show:function(){if(this.isDebug||this.isSystem){this.log("ti: show");document.getElementById("area_id_main").style.zIndex=10;this.HtmlArea.style.top="0px";this.HtmlArea.style.width="100%";this.HtmlArea.style.height="100%";this.HtmlArea.style.background="#FFFFFF";this.HtmlArea.style.color="black";this.HtmlDiv.style.zIndex=90;this.HtmlDiv.style.border="2px solid #4363A4"; -this.isShow=true}},unshow:function(isAttack){if(this.isDebug||this.isSystem||true==isAttack){this.log("ti: unshow");document.getElementById("area_id_main").style.zIndex=0;this.HtmlArea.style.top=-this.HtmlAreaOffset+"px";this.HtmlArea.style.width="1000px";this.HtmlArea.style.height="50px";this.HtmlArea.style.background="transparent";this.HtmlArea.style.color="transparent";this.HtmlDiv.style.zIndex=0;this.HtmlDiv.style.border="none";this.isShow=false}},debugCalculatePlace:function(x,y){var _left=x; -var _top=y;if(undefined==_left)_left=parseInt(this.HtmlDiv.style.left);if(undefined==_top)_top=parseInt(this.HtmlDiv.style.top);var _r_max=this.editorSdkW;var _b_max=this.editorSdkH;_r_max-=60;if(_r_max-_left>50)this.debugTexBoxMaxW=_r_max-_left;else{_left=_r_max-50;this.debugTexBoxMaxW=50}_b_max-=40;if(_b_max-_top>50)this.debugTexBoxMaxH=_b_max-_top;else{_top=_b_max-50;this.debugTexBoxMaxH=50}if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)_left=-100;this.HtmlDiv.style.left=_left+ -"px";this.HtmlDiv.style.top=_top+"px";var _height=22;var _t=this.getAreaValue();if(0!=_t.length){var _editorSdk=document.getElementById("editor_sdk");var _p=document.createElement("p");_p.style.zIndex="-1";_p.style.position="absolute";_p.style.fontFamily="arial";_p.style.fontSize="12pt";_p.style.left="0px";_p.style.width=this.debugTexBoxMaxW+"px";_editorSdk.appendChild(_p);_t=_t.replace(/ /g," ");_p.innerHTML=""+_t+"";var _width=_p.firstChild.offsetWidth;_width=Math.min(_width+20, -this.debugTexBoxMaxW);if(AscCommon.AscBrowser.isIE)_width+=10;var area=document.createElement("textarea");area.style.zIndex="-1";area.id="area2_id";area.rows=1;area.setAttribute("style","font-family:arial;font-size:12pt;position:absolute;resize:none;padding:0px;margin:0px;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;");area.style.overflow="hidden";area.style.width=_width+"px";_editorSdk.appendChild(area);area.value=this.getAreaValue();_height= -area.clientHeight;if(area.scrollHeight>_height)_height=area.scrollHeight;_editorSdk.removeChild(_p);_editorSdk.removeChild(area)}if(_height>this.debugTexBoxMaxH)_height=this.debugTexBoxMaxH;this.HtmlDiv.style.width=_width+"px";this.HtmlDiv.style.height=_height+"px";var oldZindex=parseInt(this.HtmlDiv.style.zIndex);var newZindex=oldZindex==90?"89":"90";this.HtmlDiv.style.zIndex=newZindex},onInput:function(e,isFromCompositionUpdate){if(this.Api.isLongAction()||this.Api.isViewMode){AscCommon.stopEvent(e); -return false}if(this.isSystem){if(!this.isShow)this.show();this.debugCalculatePlace(undefined,undefined);return}if(this.isKeyPressOnUp&&this.keyPressOnUpCodes.length>0){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";this.TextBeforeComposition="";this.Text="";AscCommon.stopEvent(e);return false}this.log("ti: onInput");this.Text=this.getAreaValue();this.Text=this.Text.split(" ").join(" ");var codes=[];if(this.IsComposition||this.ApiIsComposition){var ieStart= --1;var ieEnd=-1;if(true){var target=e.target;if(target["msGetInputContext"]){var ctx=target["msGetInputContext"]();if(ctx){ieStart=ctx["compositionStartOffset"];ieEnd=ctx["compositionEndOffset"]}}}this.CompositionEnd=this.Text.length;this.CompositionStart=this.TextBeforeComposition.length;var textReplace=this.Text.substr(this.CompositionStart);var iter;for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes, -true);if(!isAsync){if(ieStart>this.CompositionStart){textReplace=textReplace.substr(0,ieStart-this.CompositionStart);codes=[];for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiCompositeReplace(codes);this.apiCompositeEnd();this.TextBeforeComposition=this.Text.substr(0,ieStart);this.apiCompositeStart();this.CompositionStart=ieStart;codes=[];textReplace=this.Text.substr(this.CompositionStart);for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value()); -this.apiCompositeReplace(codes)}else this.apiCompositeReplace(codes);if(!this.IsComposition){this.apiCompositeEnd();this.TextBeforeComposition=this.Text}}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeReplace(codes);this.apiCompositeEnd();this.clear();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}}else{var textToApi=this.Text.substr(this.TextBeforeComposition.length);for(var iter=textToApi.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value()); -if(codes.length>0)this.apiInputText(codes);this.TextBeforeComposition=this.Text}if(!this.IsComposition)if(this.Text.length>0){var _lastCode=this.Text.charCodeAt(this.Text.length-1);if(_lastCode==12290||_lastCode==46){AscCommon.stopEvent(e);if(AscCommon.AscBrowser.isIE&&!AscCommon.AscBrowser.isIeEdge)setTimeout(function(){window["AscCommon"].g_inputContext.clear();window["AscCommon"].g_inputContext.HtmlArea.focus()},0);else this.clear();return false}}},emulateNativeKeyDown:function(e,target){var oEvent= -document.createEvent("KeyboardEvent");Object.defineProperty(oEvent,"keyCode",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"which",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"shiftKey",{get:function(){return this.shiftKeyVal}});Object.defineProperty(oEvent,"altKey",{get:function(){return this.altKeyVal}});Object.defineProperty(oEvent,"metaKey",{get:function(){return this.metaKeyVal}});Object.defineProperty(oEvent,"ctrlKey",{get:function(){return this.ctrlKeyVal}}); -if(AscCommon.AscBrowser.isIE)oEvent.preventDefault=function(){try{Object.defineProperty(this,"defaultPrevented",{get:function(){return true}})}catch(err){}};var k=e.keyCode;if(oEvent.initKeyboardEvent)oEvent.initKeyboardEvent("keydown",true,true,window,false,false,false,false,k,k);else oEvent.initKeyEvent("keydown",true,true,window,false,false,false,false,k,0);oEvent.keyCodeVal=k;oEvent.shiftKeyVal=e.shiftKey;oEvent.altKeyVal=e.altKey;oEvent.metaKeyVal=e.metaKey;oEvent.ctrlKeyVal=e.ctrlKey;var _elem= -target?target:_getElementKeyboardDown(this.nativeFocusElement,3);_elem.dispatchEvent(oEvent);return oEvent.defaultPrevented},isSpaceSymbol:function(e){if(e.keyCode==32)return true;if(e.keyCode==229&&(e.code=="space"||e.code=="Space"||e.key=="Spacebar"))return true;return false},systemInputEnable:function(isEnabled){if(this.isSystem==isEnabled)return;this.isSystem=isEnabled;this.HtmlArea.style.left=this.isSystem?"0px":"-"+(this.HtmlAreaWidth>>1)+"px";this.clear();if(this.isShow)this.unshow(true);if(this.Api.WordControl&& -this.Api.WordControl.m_oLogicDocument&&this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState)this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState()},debugInputEnable:function(isEnabled){if(this.isDebug==isEnabled)return;this.isDebug=isEnabled;this.HtmlArea.style.left=this.isDebug?"0px":"-"+(this.HtmlAreaWidth>>1)+"px"},apiInputText:function(codes){var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){this.apiCompositeStart();this.apiCompositeReplace(codes); -this.apiCompositeEnd()}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd();this.setReadOnly(false)});this.setReadOnly(true);return false}},onKeyDown:function(e){if(this.Api.isLongAction()){AscCommon.stopEvent(e);return false}if(this.isInputHelpersPresent)switch(e.keyCode){case 9:case 13:case 38:case 40:case 33:case 34:case 35:case 36:case 27:{window.g_asc_plugins.onPluginEvent2("onKeyDown",{"keyCode":e.keyCode}, -this.isInputHelpers);AscCommon.stopEvent(e);return false}case 32:{if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}default:break}else if(32==e.keyCode);if(this.isSystem&&this.isShow){if(e.keyCode==13){var text=this.getAreaValue();var codes=[];for(var iter=text.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiInputText(codes);this.clear();this.unshow();AscCommon.stopEvent(e);return false}else if(e.keyCode==27){this.clear(); -this.unshow();AscCommon.stopEvent(e);return false}return}if(null!=this.nativeFocusElement)if(this.emulateNativeKeyDown(e)){e.preventDefault();return false}var _code=e.keyCode;if(_code!=8&&_code!=46)this.KeyDownFlag=true;AscCommon.check_KeyboardEvent(e);var arrCodes=this.Api.getAddedTextOnKeyDown(AscCommon.global_keyboardEvent);var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(arrCodes,true);if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.onKeyDown(e);this.onKeyUp(e); -this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}var ret=this.Api.onKeyDown(e);switch(e.keyCode){case 8:{var oldKeyPressInput=this.keyPressInput;this.clear();if(oldKeyPressInput.length>1){this.keyPressInput=oldKeyPressInput.substr(0,oldKeyPressInput.length-1);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}return false}case 9:case 13:case 37:case 38:case 39:case 40:case 33:case 34:case 35:case 36:{this.clear(); +_internal!=""&&_internal.indexOf("asc_internalData2;")==0){this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Internal,_internal.substr("asc_internalData2;".length),null,_text_format);g_clipboardBase.Paste_End();return false}var _html_format=this.ClosureParams.getData("text/html");_html_format=_html_format.replace(/]+>/g,"");if(!_html_format){this.PasteFlag=false;g_clipboardBase.Paste_End();return false}if(_html_format&&_html_format!=""){var nIndex=_html_format.indexOf("");if(-1!= +nIndex)_html_format=_html_format.substring(0,nIndex+"".length);this.CommonIframe_PasteStart(_html_format,_text_format);return false}if(_text_format&&_text_format!=""){this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Text,_text_format);g_clipboardBase.Paste_End();return false}var items=_clipboard.items;if(null!=items&&0!=items.length){g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCount=items.length;g_clipboardBase.PasteImagesCounter=0;for(var i=0;i';if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount= +0}};reader.onabort=reader.onerror=function(e){g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount=0}};try{reader.readAsDataURL(blob)}catch(err){g_clipboardBase.PasteImagesCounter++}}else g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter== +g_clipboardBase.PasteImagesCount)g_clipboardBase.Paste_End();return false}}g_clipboardBase.Paste_End();return false},_private_onbeforepaste:function(e,isAttackEmulate){this._console_log("onbeforepaste");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select();return}return false},_private_onbeforecopy_select:function(){if(AscBrowser.isIE){this._console_log("onbeforecopy_select");this.CommonDiv= +this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}},_private_onbeforecopy:function(e,isAttackEmulate){this._console_log("onbeforecopy");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}return false},Init:function(_api){this.Api=_api;window["AscCommon"].g_specialPasteHelper.Init(_api); +this.ClosureParams.getData=function(type){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.getData)return null;var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{return _clipboard.getData(_type)}catch(e){}return null};this.ClosureParams.setData=function(type,_data){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.setData)return null; +var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{_clipboard.setData(_type,_data)}catch(e){}};if(!AscBrowser.isIE){document.oncopy=function(e){return g_clipboardBase._private_oncopy(e)};document.oncut=function(e){return g_clipboardBase._private_oncut(e)};document.onpaste=function(e){return g_clipboardBase._private_onpaste(e)};document["onbeforecopy"]=function(e){return g_clipboardBase._private_onbeforecopy(e)};document["onbeforecut"]=function(e){return g_clipboardBase._private_onbeforecopy(e)}; +document["onbeforepaste"]=function(e){return g_clipboardBase._private_onbeforepaste(e)}}else{document.addEventListener("copy",function(e){return g_clipboardBase._private_oncopy(e)});document.addEventListener("cut",function(e){return g_clipboardBase._private_oncut(e)});document.addEventListener("paste",function(e){return g_clipboardBase._private_onpaste(e)});document.addEventListener("beforepaste",function(e){return g_clipboardBase._private_onbeforepaste(e)});document.addEventListener("beforecopy", +function(e){return g_clipboardBase._private_onbeforecopy(e)});document.addEventListener("beforecut",function(e){return g_clipboardBase._private_onbeforecopy(e)})}if(this.IsCopyCutOnlyInEditable||this.IsPasteOnlyInEditable)document.onkeydown=function(e){if(!g_clipboardBase.Api.asc_IsFocus(true)||g_clipboardBase.Api.isLongAction())return;var isAltGr=AscCommon.getAltGr(e);if(isAltGr)return;var isCtrl=e.ctrlKey===true||e.metaKey===true;var isShift=e.shiftKey;var keyCode=e.keyCode;if(g_clipboardBase.IsCopyCutOnlyInEditable){var bIsBeforeCopyCutEmulate= +false;var _cut=false;if(isCtrl&&!isShift&&(keyCode==67||keyCode==88))bIsBeforeCopyCutEmulate=true;if(!isCtrl&&isShift&&keyCode==45){bIsBeforeCopyCutEmulate=true;_cut=true}if(bIsBeforeCopyCutEmulate){g_clipboardBase._console_log("emulate_beforecopycut");var isEmulate=false;try{isEmulate=_cut?document.execCommand("beforecut"):document.execCommand("beforecopy")}catch(err){}g_clipboardBase._private_onbeforecopy(undefined,!isEmulate)}}if(g_clipboardBase.IsPasteOnlyInEditable){var bIsBeforePasteEmulate= +false;if(isCtrl&&!isShift&&keyCode==86)bIsBeforePasteEmulate=true;if(!isCtrl&&isShift&&keyCode==45)bIsBeforePasteEmulate=true;if(bIsBeforePasteEmulate){g_clipboardBase._console_log("emulate_beforepaste");var isEmulate=false;try{isEmulate=document.execCommand("beforepaste")}catch(err$14){}g_clipboardBase._private_onbeforepaste(undefined,!isEmulate)}}};if(AscBrowser.isSafari&&false){this.CommonDiv=this.CommonDiv_Check();setInterval(function(){if(g_clipboardBase.Api.asc_IsFocus(true))g_clipboardBase.CommonDiv.focus()}, +100)}},IsWorking:function(){return this.CopyFlag||this.PasteFlag?true:false},StartFocus:function(){this.EndFocus(false);this.CopyPasteFocus=true;this.CopyPasteFocusTimer=setTimeout(function(){g_clipboardBase.EndFocus()},1E3)},EndFocus:function(isFocusToEditor){this.CopyPasteFocus=false;if(-1!=this.CopyPasteFocusTimer){clearTimeout(this.CopyPasteFocusTimer);this.CopyPasteFocusTimer=-1;if(false!==isFocusToEditor&&null!=this.inputContext)if(this.inputContext.HtmlArea)this.inputContext.HtmlArea.focus()}}, +IsFocus:function(){return this.CopyPasteFocus},CommonDiv_Check:function(){var ElemToSelect=document.getElementById(this.CommonDivId);if(!ElemToSelect){ElemToSelect=document.createElement("div");ElemToSelect.id=this.CommonDivId;ElemToSelect.className=this.CommonDivClassName;ElemToSelect.style.position="fixed";ElemToSelect.style.left="0px";ElemToSelect.style.top="-100px";ElemToSelect.style.width="10000px";ElemToSelect.style.height="100px";ElemToSelect.style.overflow="hidden";ElemToSelect.style.zIndex= +-1E3;ElemToSelect.style.MozUserSelect="text";ElemToSelect.style.fontFamily="onlyofficeDefaultFont";ElemToSelect.style.fontSize="11pt";ElemToSelect.style.color="black";ElemToSelect.style["-khtml-user-select"]="text";ElemToSelect.style["-o-user-select"]="text";ElemToSelect.style["user-select"]="text";ElemToSelect.style["-webkit-user-select"]="text";ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());var _parent=""==this.CommonDivIdParent?document.body:document.getElementById(this.CommonDivIdParent); +_parent.appendChild(ElemToSelect)}else ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());return ElemToSelect},CommonDiv_Select:function(){var ElemToSelect=this.CommonDiv;if(window.getSelection){var selection=window.getSelection();var rangeToSelect=document.createRange();var is_gecko=AscBrowser.isGecko;if(is_gecko){ElemToSelect.appendChild(document.createTextNode("\u00a0"));ElemToSelect.insertBefore(document.createTextNode("\u00a0"),ElemToSelect.firstChild);rangeToSelect.setStartAfter(ElemToSelect.firstChild); +rangeToSelect.setEndBefore(ElemToSelect.lastChild)}else{var aChildNodes=ElemToSelect.childNodes;if(aChildNodes.length==1){var elem=aChildNodes[0];var wrap=document.createElement("b");wrap.setAttribute("style","font-weight:normal; background-color: transparent; color: transparent;");elem=ElemToSelect.removeChild(elem);wrap.appendChild(elem);ElemToSelect.appendChild(wrap)}rangeToSelect.selectNodeContents(ElemToSelect)}selection.removeAllRanges();selection.addRange(rangeToSelect)}else if(document.body.createTextRange){var rangeToSelect= +document.body.createTextRange();rangeToSelect.moveToElementText(ElemToSelect);rangeToSelect.select()}},CommonDiv_Start:function(){this.ClosureParams.overflowBody=document.body.style.overflow;document.body.style.overflow="hidden";this.ClosureParams.backgroundcolorBody=document.body.style["background-color"];document.body.style["background-color"]="transparent";var ElemToSelect=this.CommonDiv;ElemToSelect.style.display="block";while(ElemToSelect.hasChildNodes())ElemToSelect.removeChild(ElemToSelect.lastChild); +document.body.style.MozUserSelect="text";delete document.body.style["-khtml-user-select"];delete document.body.style["-o-user-select"];delete document.body.style["user-select"];document.body.style["-webkit-user-select"]="text";ElemToSelect.style.MozUserSelect="all"},CommonDiv_End:function(){var ElemToSelect=this.CommonDiv;if(ElemToSelect){ElemToSelect.style.display=AscBrowser.isSafari?"block":"none";ElemToSelect.style.MozUserSelect="none"}document.body.style.MozUserSelect="none";document.body.style["-khtml-user-select"]= +"none";document.body.style["-o-user-select"]="none";document.body.style["user-select"]="none";document.body.style["-webkit-user-select"]="none";document.body.style["background-color"]=this.ClosureParams.backgroundcolorBody;document.body.style.overflow=this.ClosureParams.overflowBody;this.CopyFlag=false;this.bCut=false;this.EndFocus()},CommonDiv_Copy:function(){this.CopyFlag=true;this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.ClosureParams.isDivCopy=true;this.DivOnCopyHtmlPresent= +false;this.DivOnCopyText="";this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.ClosureParams.isDivCopy=false;if(!this.DivOnCopyHtmlPresent&&this.DivOnCopyText!="")this.CommonDiv.innerHTML=this.DivOnCopyText;this.DivOnCopyHtmlPresent=false;this.DivOnCopyText="";this.CommonDiv_Select();window.setTimeout(function(){g_clipboardBase.CommonDiv_End()},0)},CommonDiv_Execute_CopyCut:function(){if(this.IsCopyCutOnlyInEditable)this._private_onbeforecopy(undefined, +true)},CommonIframe_PasteStart:function(_html_data,text_data){var ifr=document.getElementById(this.CommonIframeId);if(!ifr){ifr=document.createElement("iframe");ifr.name=this.CommonIframeId;ifr.id=this.CommonIframeId;ifr.style.position="absolute";ifr.style.top="-100px";ifr.style.left="0px";ifr.style.width="10000px";ifr.style.height="100px";ifr.style.overflow="hidden";ifr.style.zIndex=-1E3;ifr.setAttribute("sandbox","allow-same-origin");document.body.appendChild(ifr);this.CommonIframe=ifr}else ifr.style.width= +"10000px";var frameWindow=window.frames[this.CommonIframeId];if(frameWindow){frameWindow.document.open();frameWindow.document.write(_html_data);frameWindow.document.close();if(null!=frameWindow.document&&null!=frameWindow.document.body){ifr.style.display="block";this.pastedFrom=definePastedFrom(frameWindow.document);this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.HtmlElement,frameWindow.document.body,ifr,text_data)}}ifr.style.width="100px";g_clipboardBase.Paste_End()},CommonIframe_PasteEnd:function(){if(this.CommonIframe&& +this.CommonIframe.style.display!="none"){this.CommonIframe.blur();this.CommonIframe.style.display="none"}},Paste_End:function(){this.CommonIframe_PasteEnd();this.Api.decrementCounterLongAction();this.PasteFlag=false;this.EndFocus();if(this.needClearBuffer){this.ClearBuffer();this.needClearBuffer=false}},pushData:function(_format,_data){if(null==this.LastCopyBinary)this.LastCopyBinary=[];this.LastCopyBinary.push({type:_format,data:_data});if(this.ClosureParams.isDivCopy===true){if(!this.isCopyOutEnabled())return; +if(_format==AscCommon.c_oAscClipboardDataFormat.Html){this.CommonDiv.innerHTML=_data;this.DivOnCopyHtmlPresent=true}if(_format==AscCommon.c_oAscClipboardDataFormat.Text)this.DivOnCopyText=_data;return}var _data_format="";switch(_format){case AscCommon.c_oAscClipboardDataFormat.Html:_data_format="text/html";break;case AscCommon.c_oAscClipboardDataFormat.Text:_data_format="text/plain";break;case AscCommon.c_oAscClipboardDataFormat.Internal:_data_format="text/x-custom";break;default:break}if(_data_format!= +""&&_data!==null&&this.isCopyOutEnabled())if(_data_format=="text/x-custom")this.ClosureParams.setData(_data_format,"asc_internalData2;"+_data);else this.ClosureParams.setData(_data_format,_data)},Button_Copy:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("copy")}catch(err){_ret= +false}if(!_ret){this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal)}return _ret},Button_Cut:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("cut")}catch(err){_ret= +false}if(!_ret){this.LastCopyBinary=null;this.bCut=true;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.Api.asc_SelectionCut();this.bCut=false}return _ret},Button_Paste:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);var _ret=false;try{_ret=document.execCommand("paste")}catch(err){_ret= +false}if(!_ret&&null!=this.LastCopyBinary){var _data=null;var _isInternal=false;for(var i=0;i0)this.Api.asc_PasteData(this.LastCopyBinary[0].type,this.LastCopyBinary[0].data)}return _ret},ClearBuffer:function(){if(-1!=this.clearBufferTimerId)clearTimeout(this.clearBufferTimerId); +this.clearBufferTimerId=setTimeout(function(){if(AscCommon.g_clipboardBase)AscCommon.g_clipboardBase.clearBufferTimerId=-1},500);this.Button_Copy()},isCopyOutEnabled:function(){if(this.Api&&this.Api.isCopyOutEnabled)return this.Api.isCopyOutEnabled();return true}};function definePastedFrom(doc){if(!doc)return null;var res=null;var metaTags=doc.getElementsByTagName("meta");for(var i=0;i>1)+"px;top:"+-this.HtmlAreaOffset+"px;";_style+="background:transparent;border:none;position:absolute;text-shadow:0 0 0 #000;outline:none;color:transparent;width:"+this.HtmlAreaWidth+"px;height:50px;";_style+="overflow:hidden;padding:0px;margin:0px;font-family:arial;resize:none;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;"; +_style+="touch-action: none;-webkit-touch-callout: none;color:transparent;caret-color:transparent;";_style+=AscCommon.AscBrowser.isAppleDevices?"font-size:0px;":"font-size:8px;";this.HtmlArea.setAttribute("style",_style);this.HtmlArea.setAttribute("spellcheck",false);this.HtmlArea.setAttribute("autocapitalize","none");this.HtmlArea.setAttribute("autocomplete","off");this.HtmlArea.setAttribute("autocorrect","off");this.HtmlDiv.appendChild(this.HtmlArea);if(true){var oHtmlDivScrollable=document.createElement("div"); +oHtmlDivScrollable.id="area_id_main";oHtmlDivScrollable.setAttribute("style","background:transparent;border:none;position:absolute;padding:0px;margin:0px;z-index:0;pointer-events:none;");var parentStyle=getComputedStyle(oHtmlParent);oHtmlDivScrollable.style.left=parentStyle.left;oHtmlDivScrollable.style.top=parentStyle.top;oHtmlDivScrollable.style.width=parentStyle.width;oHtmlDivScrollable.style.height=parentStyle.height;oHtmlDivScrollable.style.overflow="hidden";oHtmlDivScrollable.appendChild(this.HtmlDiv); +oHtmlParent.parentNode.appendChild(oHtmlDivScrollable)}else oHtmlParent.appendChild(this.HtmlDiv);var oThis=this;this.HtmlArea["onkeydown"]=function(e){if(AscCommon.AscBrowser.isSafariMacOs){var cmdButton=e.ctrlKey||e.metaKey?true:false;var buttonCode=e.keyCode==67||e.keyCode==88||e.keyCode==86;if(cmdButton&&buttonCode)oThis.IsDisableKeyPress=true;else oThis.IsDisableKeyPress=false}return oThis.onKeyDown(e)};this.HtmlArea["onkeypress"]=function(e){if(oThis.IsDisableKeyPress==true){oThis.IsDisableKeyPress= +false;var cmdButton=e.ctrlKey||e.metaKey?true:false;if(cmdButton)return}return oThis.onKeyPress(e)};this.HtmlArea["onkeyup"]=function(e){oThis.IsDisableKeyPress=false;return oThis.onKeyUp(e)};this.HtmlArea.addEventListener("input",function(e){return oThis.onInput(e)},false);this.HtmlArea.addEventListener("compositionstart",function(e){return oThis.onCompositionStart(e)},false);this.HtmlArea.addEventListener("compositionupdate",function(e){return oThis.onCompositionUpdate(e)},false);this.HtmlArea.addEventListener("compositionend", +function(e){return oThis.onCompositionEnd(e)},false);this.show();this.Api.Input_UpdatePos();if(AscCommon.AscBrowser.isAndroid)this.HtmlArea.onclick=function(e){var _this=AscCommon.g_inputContext;if(-1!=_this.virtualKeyboardClickTimeout){clearTimeout(_this.virtualKeyboardClickTimeout);_this.virtualKeyboardClickTimeout=-1}_this.apiCompositeEnd();if(!_this.virtualKeyboardClickPrevent)return;_this.setReadOnlyWrapper(true);_this.virtualKeyboardClickPrevent=false;AscCommon.stopEvent(e);_this.virtualKeyboardClickTimeout= +setTimeout(function(){_this.setReadOnlyWrapper(false);_this.virtualKeyboardClickTimeout=-1},1);return false}},onResize:function(_editorContainerId){var _elem=document.getElementById("area_id_main");var _elemSrc=document.getElementById(_editorContainerId);if(!_elem||!_elemSrc)return;if(AscCommon.AscBrowser.isChrome){var rectObject=_elemSrc.getBoundingClientRect();this.FixedPosCheckElementX=rectObject.left;this.FixedPosCheckElementY=rectObject.top}var _width=_elemSrc.style.width;if((null==_width||""== +_width)&&window.getComputedStyle){var _s=window.getComputedStyle(_elemSrc);_elem.style.left=_s.left;_elem.style.top=_s.top;_elem.style.width=_s.width;_elem.style.height=_s.height}else{_elem.style.left=_elemSrc.style.left;_elem.style.top=_elemSrc.style.top;_elem.style.width=_width;_elem.style.height=_elemSrc.style.height}if(this.Api.isMobileVersion){var _elem1=document.getElementById("area_id_parent");var _elem2=document.getElementById("area_id");_elem1.parentNode.style.pointerEvents="";_elem1.style.left= +"0px";_elem1.style.top="-1000px";_elem1.style.right="0px";_elem1.style.bottom="-100px";_elem1.style.width="auto";_elem1.style.height="auto";_elem2.style.left="0px";_elem2.style.top="0px";_elem2.style.right="0px";_elem2.style.bottom="0px";_elem2.style.width="100%";_elem2.style.height="100%";if(AscCommon.AscBrowser.isIE){document.body.style["msTouchAction"]="none";document.body.style["touchAction"]="none"}}var _editorSdk=document.getElementById("editor_sdk");this.editorSdkW=_editorSdk.clientWidth;this.editorSdkH= +_editorSdk.clientHeight},checkFocus:function(){if(this.Api.asc_IsFocus()&&!AscCommon.g_clipboardBase.IsFocus()&&!AscCommon.g_clipboardBase.IsWorking())if(document.activeElement!=this.HtmlArea)this.HtmlArea.focus()},move:function(x,y){if(this.Api.isMobileVersion)return;var oTarget=document.getElementById(this.TargetId);if(!oTarget)return;var xPos=x?x:parseInt(oTarget.style.left);var yPos=(y?y:parseInt(oTarget.style.top))+parseInt(oTarget.style.height);if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)xPos= +-100;if(!this.isDebug&&!this.isSystem){this.HtmlDiv.style.left=xPos+this.FixedPosCheckElementX+"px";this.HtmlDiv.style.top=yPos+this.FixedPosCheckElementY+this.TargetOffsetY+this.HtmlAreaOffset+"px";this.HtmlArea.scrollTop=this.HtmlArea.scrollHeight}else this.debugCalculatePlace(xPos+this.FixedPosCheckElementX,yPos+this.FixedPosCheckElementY+this.TargetOffsetY);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onTargetPositionChanged")},emulateKeyDownApi:function(code){var _e={altKey:false, +ctrlKey:false,shiftKey:false,target:null,charCode:0,which:code,keyCode:code,code:"",preventDefault:function(){},stopPropagation:function(){}};this.Api.onKeyDown(_e);this.Api.onKeyUp(_e)},clear:function(isFromFocus){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";if(isFromFocus!==true)this.HtmlArea.focus();this.TextBeforeComposition="";this.Text="";this.Target=0;this.CompositionStart=0;this.CompositionEnd=0;this.IsComposition=false;this.keyPressInput= +"";if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperClear")},getAreaValue:function(){return this.TextArea_Not_ContentEditableDiv?this.HtmlArea.value:this.HtmlArea.innerText},setReadOnly:function(isLock){if(isLock)this.ReadOnlyCounter++;else this.ReadOnlyCounter--;this.setReadOnlyWrapper(0>=this.ReadOnlyCounter?false:true)},setReadOnlyWrapper:function(val){this.HtmlArea.readOnly=this.Api.isViewMode?true:val},show:function(){if(this.isDebug||this.isSystem){this.log("ti: show"); +document.getElementById("area_id_main").style.zIndex=10;this.HtmlArea.style.top="0px";this.HtmlArea.style.width="100%";this.HtmlArea.style.height="100%";this.HtmlArea.style.background="#FFFFFF";this.HtmlArea.style.color="black";this.HtmlDiv.style.zIndex=90;this.HtmlDiv.style.border="2px solid #4363A4";this.isShow=true}},unshow:function(isAttack){if(this.isDebug||this.isSystem||true==isAttack){this.log("ti: unshow");document.getElementById("area_id_main").style.zIndex=0;this.HtmlArea.style.top=-this.HtmlAreaOffset+ +"px";this.HtmlArea.style.width="1000px";this.HtmlArea.style.height="50px";this.HtmlArea.style.background="transparent";this.HtmlArea.style.color="transparent";this.HtmlDiv.style.zIndex=0;this.HtmlDiv.style.border="none";this.isShow=false}},debugCalculatePlace:function(x,y){var _left=x;var _top=y;if(undefined==_left)_left=parseInt(this.HtmlDiv.style.left);if(undefined==_top)_top=parseInt(this.HtmlDiv.style.top);var _r_max=this.editorSdkW;var _b_max=this.editorSdkH;_r_max-=60;if(_r_max-_left>50)this.debugTexBoxMaxW= +_r_max-_left;else{_left=_r_max-50;this.debugTexBoxMaxW=50}_b_max-=40;if(_b_max-_top>50)this.debugTexBoxMaxH=_b_max-_top;else{_top=_b_max-50;this.debugTexBoxMaxH=50}if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)_left=-100;this.HtmlDiv.style.left=_left+"px";this.HtmlDiv.style.top=_top+"px";var _height=22;var _t=this.getAreaValue();if(0!=_t.length){var _editorSdk=document.getElementById("editor_sdk");var _p=document.createElement("p");_p.style.zIndex="-1";_p.style.position="absolute"; +_p.style.fontFamily="arial";_p.style.fontSize="12pt";_p.style.left="0px";_p.style.width=this.debugTexBoxMaxW+"px";_editorSdk.appendChild(_p);_t=_t.replace(/ /g," ");_p.innerHTML=""+_t+"";var _width=_p.firstChild.offsetWidth;_width=Math.min(_width+20,this.debugTexBoxMaxW);if(AscCommon.AscBrowser.isIE)_width+=10;var area=document.createElement("textarea");area.style.zIndex="-1";area.id="area2_id";area.rows=1;area.setAttribute("style","font-family:arial;font-size:12pt;position:absolute;resize:none;padding:0px;margin:0px;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;"); +area.style.overflow="hidden";area.style.width=_width+"px";_editorSdk.appendChild(area);area.value=this.getAreaValue();_height=area.clientHeight;if(area.scrollHeight>_height)_height=area.scrollHeight;_editorSdk.removeChild(_p);_editorSdk.removeChild(area)}if(_height>this.debugTexBoxMaxH)_height=this.debugTexBoxMaxH;this.HtmlDiv.style.width=_width+"px";this.HtmlDiv.style.height=_height+"px";var oldZindex=parseInt(this.HtmlDiv.style.zIndex);var newZindex=oldZindex==90?"89":"90";this.HtmlDiv.style.zIndex= +newZindex},onInput:function(e,isFromCompositionUpdate){if(this.Api.isLongAction()||this.Api.isViewMode){AscCommon.stopEvent(e);return false}if(this.isSystem){if(!this.isShow)this.show();this.debugCalculatePlace(undefined,undefined);return}if(this.isKeyPressOnUp&&this.keyPressOnUpCodes.length>0){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";this.TextBeforeComposition="";this.Text="";AscCommon.stopEvent(e);return false}this.log("ti: onInput");this.Text= +this.getAreaValue();this.Text=this.Text.split(" ").join(" ");var codes=[];if(this.IsComposition||this.ApiIsComposition){var ieStart=-1;var ieEnd=-1;if(true){var target=e.target;if(target["msGetInputContext"]){var ctx=target["msGetInputContext"]();if(ctx){ieStart=ctx["compositionStartOffset"];ieEnd=ctx["compositionEndOffset"]}}}this.CompositionEnd=this.Text.length;this.CompositionStart=this.TextBeforeComposition.length;var textReplace=this.Text.substr(this.CompositionStart);var iter;for(iter= +textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){if(ieStart>this.CompositionStart){textReplace=textReplace.substr(0,ieStart-this.CompositionStart);codes=[];for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiCompositeReplace(codes);this.apiCompositeEnd();this.TextBeforeComposition=this.Text.substr(0,ieStart);this.apiCompositeStart();this.CompositionStart= +ieStart;codes=[];textReplace=this.Text.substr(this.CompositionStart);for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiCompositeReplace(codes)}else this.apiCompositeReplace(codes);if(!this.IsComposition){this.apiCompositeEnd();this.TextBeforeComposition=this.Text}}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeReplace(codes);this.apiCompositeEnd();this.clear();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true); +return false}}else{var textToApi=this.Text.substr(this.TextBeforeComposition.length);for(var iter=textToApi.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());if(codes.length>0)this.apiInputText(codes);this.TextBeforeComposition=this.Text}if(!this.IsComposition)if(this.Text.length>0){var _lastCode=this.Text.charCodeAt(this.Text.length-1);if(_lastCode==12290||_lastCode==46){AscCommon.stopEvent(e);if(AscCommon.AscBrowser.isIE&&!AscCommon.AscBrowser.isIeEdge)setTimeout(function(){window["AscCommon"].g_inputContext.clear(); +window["AscCommon"].g_inputContext.HtmlArea.focus()},0);else this.clear();return false}}},emulateNativeKeyDown:function(e,target){var oEvent=document.createEvent("KeyboardEvent");Object.defineProperty(oEvent,"keyCode",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"which",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"shiftKey",{get:function(){return this.shiftKeyVal}});Object.defineProperty(oEvent,"altKey",{get:function(){return this.altKeyVal}}); +Object.defineProperty(oEvent,"metaKey",{get:function(){return this.metaKeyVal}});Object.defineProperty(oEvent,"ctrlKey",{get:function(){return this.ctrlKeyVal}});if(AscCommon.AscBrowser.isIE)oEvent.preventDefault=function(){try{Object.defineProperty(this,"defaultPrevented",{get:function(){return true}})}catch(err){}};var k=e.keyCode;if(oEvent.initKeyboardEvent)oEvent.initKeyboardEvent("keydown",true,true,window,false,false,false,false,k,k);else oEvent.initKeyEvent("keydown",true,true,window,false, +false,false,false,k,0);oEvent.keyCodeVal=k;oEvent.shiftKeyVal=e.shiftKey;oEvent.altKeyVal=e.altKey;oEvent.metaKeyVal=e.metaKey;oEvent.ctrlKeyVal=e.ctrlKey;var _elem=target?target:_getElementKeyboardDown(this.nativeFocusElement,3);_elem.dispatchEvent(oEvent);return oEvent.defaultPrevented},isSpaceSymbol:function(e){if(e.keyCode==32)return true;if(e.keyCode==229&&(e.code=="space"||e.code=="Space"||e.key=="Spacebar"))return true;return false},systemInputEnable:function(isEnabled){if(this.isSystem==isEnabled)return; +this.isSystem=isEnabled;this.HtmlArea.style.left=this.isSystem?"0px":"-"+(this.HtmlAreaWidth>>1)+"px";this.clear();if(this.isShow)this.unshow(true);if(this.Api.WordControl&&this.Api.WordControl.m_oLogicDocument&&this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState)this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState()},debugInputEnable:function(isEnabled){if(this.isDebug==isEnabled)return;this.isDebug=isEnabled;this.HtmlArea.style.left=this.isDebug?"0px":"-"+(this.HtmlAreaWidth>> +1)+"px"},apiInputText:function(codes){var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd()}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd();this.setReadOnly(false)});this.setReadOnly(true);return false}},onKeyDown:function(e){if(this.Api.isLongAction()){AscCommon.stopEvent(e);return false}if(this.isInputHelpersPresent)switch(e.keyCode){case 9:case 13:case 38:case 40:case 33:case 34:case 35:case 36:case 27:{window.g_asc_plugins.onPluginEvent2("onKeyDown", +{"keyCode":e.keyCode},this.isInputHelpers);AscCommon.stopEvent(e);return false}case 32:{if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}default:break}else if(32==e.keyCode);if(this.isSystem&&this.isShow){if(e.keyCode==13){var text=this.getAreaValue();var codes=[];for(var iter=text.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiInputText(codes);this.clear();this.unshow();AscCommon.stopEvent(e);return false}else if(e.keyCode== +27){this.clear();this.unshow();AscCommon.stopEvent(e);return false}return}if(null!=this.nativeFocusElement)if(this.emulateNativeKeyDown(e)){e.preventDefault();return false}var _code=e.keyCode;if(_code!=8&&_code!=46)this.KeyDownFlag=true;AscCommon.check_KeyboardEvent(e);var arrCodes=this.Api.getAddedTextOnKeyDown(AscCommon.global_keyboardEvent);var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(arrCodes,true);if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.onKeyDown(e); +this.onKeyUp(e);this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}var ret=this.Api.onKeyDown(e);switch(e.keyCode){case 8:{var oldKeyPressInput=this.keyPressInput;this.clear();if(oldKeyPressInput.length>1){this.keyPressInput=oldKeyPressInput.substr(0,oldKeyPressInput.length-1);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}return false}case 9:case 13:case 37:case 38:case 39:case 40:case 33:case 34:case 35:case 36:{this.clear(); return false}case 46:case 45:{if(!AscCommon.global_keyboardEvent.CtrlKey&&!AscCommon.global_keyboardEvent.ShiftKey){this.clear();return false}}default:break}if(e.keyCode==32&&AscCommon.global_keyboardEvent.CtrlKey&&!AscCommon.global_keyboardEvent.ShiftKey)if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onClick");return ret},onKeyPress:function(e){if(this.Api.isLongAction()||!this.Api.asc_IsFocus()||this.Api.isViewMode){AscCommon.stopEvent(e);return false}if(this.isSystem)return;if(this.KeyDownFlag)this.KeyPressFlag= true;if(this.IsComposition)return;if(e.which==13&&e.keyCode==13||e.which==10&&e.keyCode==10){AscCommon.stopEvent(e);return false}var c=e.which||e.keyCode;var isAsync=c>=32?AscFonts.FontPickerByCharacter.checkTextLight([c],true):false;if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace([c]);this.apiCompositeEnd();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}if(this.isKeyPressOnUp){var isSaveCode= true;switch(e.which){case 46:{isSaveCode=false;break}default:break}if(isSaveCode){if(this.isKeyPressOnUpStackedMode)this.keyPressOnUpCodes.push({which:e.which,charCode:e.charCode,keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,preventDefault:function(){}});return}}var ret=this.Api.onKeyPress(e);switch(e.which){case 46:{AscCommon.stopEvent(e);this.clear();return false}default:break}this.keyPressInput+=String.fromCharCode(e.which);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput", diff --git a/www/common/onlyoffice/v5/sdkjs/slide/sdk-all-min.js b/www/common/onlyoffice/v5/sdkjs/slide/sdk-all-min.js index d993b70c8..8b48bea48 100644 --- a/www/common/onlyoffice/v5/sdkjs/slide/sdk-all-min.js +++ b/www/common/onlyoffice/v5/sdkjs/slide/sdk-all-min.js @@ -1668,7 +1668,7 @@ function(){this.isPreOpenLocks=false;for(var i=0;i");if(-1!=nIndex)_html_format=_html_format.substring(0,nIndex+"".length);this.CommonIframe_PasteStart(_html_format,_text_format); -return false}if(_text_format&&_text_format!=""){this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Text,_text_format);g_clipboardBase.Paste_End();return false}var items=_clipboard.items;if(null!=items&&0!=items.length){g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCount=items.length;g_clipboardBase.PasteImagesCounter=0;for(var i=0;i';if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount=0}};reader.onabort=reader.onerror=function(e){g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter== -g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount=0}};try{reader.readAsDataURL(blob)}catch(err){g_clipboardBase.PasteImagesCounter++}}else g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount)g_clipboardBase.Paste_End();return false}}g_clipboardBase.Paste_End(); -return false},_private_onbeforepaste:function(e,isAttackEmulate){this._console_log("onbeforepaste");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select();return}return false},_private_onbeforecopy_select:function(){if(AscBrowser.isIE){this._console_log("onbeforecopy_select");this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus(); -this.StartFocus();this.CommonDiv_Select()}},_private_onbeforecopy:function(e,isAttackEmulate){this._console_log("onbeforecopy");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}return false},Init:function(_api){this.Api=_api;window["AscCommon"].g_specialPasteHelper.Init(_api);this.ClosureParams.getData=function(type){var _clipboard=this._e&& -this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.getData)return null;var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{return _clipboard.getData(_type)}catch(e){}return null};this.ClosureParams.setData=function(type,_data){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.setData)return null;var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type= -"Text";try{_clipboard.setData(_type,_data)}catch(e){}};if(!AscBrowser.isIE){document.oncopy=function(e){return g_clipboardBase._private_oncopy(e)};document.oncut=function(e){return g_clipboardBase._private_oncut(e)};document.onpaste=function(e){return g_clipboardBase._private_onpaste(e)};document["onbeforecopy"]=function(e){return g_clipboardBase._private_onbeforecopy(e)};document["onbeforecut"]=function(e){return g_clipboardBase._private_onbeforecopy(e)};document["onbeforepaste"]=function(e){return g_clipboardBase._private_onbeforepaste(e)}}else{document.addEventListener("copy", -function(e){return g_clipboardBase._private_oncopy(e)});document.addEventListener("cut",function(e){return g_clipboardBase._private_oncut(e)});document.addEventListener("paste",function(e){return g_clipboardBase._private_onpaste(e)});document.addEventListener("beforepaste",function(e){return g_clipboardBase._private_onbeforepaste(e)});document.addEventListener("beforecopy",function(e){return g_clipboardBase._private_onbeforecopy(e)});document.addEventListener("beforecut",function(e){return g_clipboardBase._private_onbeforecopy(e)})}if(this.IsCopyCutOnlyInEditable|| -this.IsPasteOnlyInEditable)document.onkeydown=function(e){if(!g_clipboardBase.Api.asc_IsFocus(true)||g_clipboardBase.Api.isLongAction())return;var isAltGr=AscCommon.getAltGr(e);if(isAltGr)return;var isCtrl=e.ctrlKey===true||e.metaKey===true;var isShift=e.shiftKey;var keyCode=e.keyCode;if(g_clipboardBase.IsCopyCutOnlyInEditable){var bIsBeforeCopyCutEmulate=false;var _cut=false;if(isCtrl&&!isShift&&(keyCode==67||keyCode==88))bIsBeforeCopyCutEmulate=true;if(!isCtrl&&isShift&&keyCode==45){bIsBeforeCopyCutEmulate= -true;_cut=true}if(bIsBeforeCopyCutEmulate){g_clipboardBase._console_log("emulate_beforecopycut");var isEmulate=false;try{isEmulate=_cut?document.execCommand("beforecut"):document.execCommand("beforecopy")}catch(err){}g_clipboardBase._private_onbeforecopy(undefined,!isEmulate)}}if(g_clipboardBase.IsPasteOnlyInEditable){var bIsBeforePasteEmulate=false;if(isCtrl&&!isShift&&keyCode==86)bIsBeforePasteEmulate=true;if(!isCtrl&&isShift&&keyCode==45)bIsBeforePasteEmulate=true;if(bIsBeforePasteEmulate){g_clipboardBase._console_log("emulate_beforepaste"); -var isEmulate=false;try{isEmulate=document.execCommand("beforepaste")}catch(err$19){}g_clipboardBase._private_onbeforepaste(undefined,!isEmulate)}}};if(AscBrowser.isSafari&&false){this.CommonDiv=this.CommonDiv_Check();setInterval(function(){if(g_clipboardBase.Api.asc_IsFocus(true))g_clipboardBase.CommonDiv.focus()},100)}},IsWorking:function(){return this.CopyFlag||this.PasteFlag?true:false},StartFocus:function(){this.EndFocus(false);this.CopyPasteFocus=true;this.CopyPasteFocusTimer=setTimeout(function(){g_clipboardBase.EndFocus()}, -1E3)},EndFocus:function(isFocusToEditor){this.CopyPasteFocus=false;if(-1!=this.CopyPasteFocusTimer){clearTimeout(this.CopyPasteFocusTimer);this.CopyPasteFocusTimer=-1;if(false!==isFocusToEditor&&null!=this.inputContext)if(this.inputContext.HtmlArea)this.inputContext.HtmlArea.focus()}},IsFocus:function(){return this.CopyPasteFocus},CommonDiv_Check:function(){var ElemToSelect=document.getElementById(this.CommonDivId);if(!ElemToSelect){ElemToSelect=document.createElement("div");ElemToSelect.id=this.CommonDivId; -ElemToSelect.className=this.CommonDivClassName;ElemToSelect.style.position="fixed";ElemToSelect.style.left="0px";ElemToSelect.style.top="-100px";ElemToSelect.style.width="10000px";ElemToSelect.style.height="100px";ElemToSelect.style.overflow="hidden";ElemToSelect.style.zIndex=-1E3;ElemToSelect.style.MozUserSelect="text";ElemToSelect.style.fontFamily="onlyofficeDefaultFont";ElemToSelect.style.fontSize="11pt";ElemToSelect.style.color="black";ElemToSelect.style["-khtml-user-select"]="text";ElemToSelect.style["-o-user-select"]= -"text";ElemToSelect.style["user-select"]="text";ElemToSelect.style["-webkit-user-select"]="text";ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());var _parent=""==this.CommonDivIdParent?document.body:document.getElementById(this.CommonDivIdParent);_parent.appendChild(ElemToSelect)}else ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());return ElemToSelect},CommonDiv_Select:function(){var ElemToSelect=this.CommonDiv;if(window.getSelection){var selection=window.getSelection(); -var rangeToSelect=document.createRange();var is_gecko=AscBrowser.isGecko;if(is_gecko){ElemToSelect.appendChild(document.createTextNode("\u00a0"));ElemToSelect.insertBefore(document.createTextNode("\u00a0"),ElemToSelect.firstChild);rangeToSelect.setStartAfter(ElemToSelect.firstChild);rangeToSelect.setEndBefore(ElemToSelect.lastChild)}else{var aChildNodes=ElemToSelect.childNodes;if(aChildNodes.length==1){var elem=aChildNodes[0];var wrap=document.createElement("b");wrap.setAttribute("style","font-weight:normal; background-color: transparent; color: transparent;"); -elem=ElemToSelect.removeChild(elem);wrap.appendChild(elem);ElemToSelect.appendChild(wrap)}rangeToSelect.selectNodeContents(ElemToSelect)}selection.removeAllRanges();selection.addRange(rangeToSelect)}else if(document.body.createTextRange){var rangeToSelect=document.body.createTextRange();rangeToSelect.moveToElementText(ElemToSelect);rangeToSelect.select()}},CommonDiv_Start:function(){this.ClosureParams.overflowBody=document.body.style.overflow;document.body.style.overflow="hidden";this.ClosureParams.backgroundcolorBody= -document.body.style["background-color"];document.body.style["background-color"]="transparent";var ElemToSelect=this.CommonDiv;ElemToSelect.style.display="block";while(ElemToSelect.hasChildNodes())ElemToSelect.removeChild(ElemToSelect.lastChild);document.body.style.MozUserSelect="text";delete document.body.style["-khtml-user-select"];delete document.body.style["-o-user-select"];delete document.body.style["user-select"];document.body.style["-webkit-user-select"]="text";ElemToSelect.style.MozUserSelect= -"all"},CommonDiv_End:function(){var ElemToSelect=this.CommonDiv;if(ElemToSelect){ElemToSelect.style.display=AscBrowser.isSafari?"block":"none";ElemToSelect.style.MozUserSelect="none"}document.body.style.MozUserSelect="none";document.body.style["-khtml-user-select"]="none";document.body.style["-o-user-select"]="none";document.body.style["user-select"]="none";document.body.style["-webkit-user-select"]="none";document.body.style["background-color"]=this.ClosureParams.backgroundcolorBody;document.body.style.overflow= -this.ClosureParams.overflowBody;this.CopyFlag=false;this.bCut=false;this.EndFocus()},CommonDiv_Copy:function(){this.CopyFlag=true;this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.ClosureParams.isDivCopy=true;this.DivOnCopyHtmlPresent=false;this.DivOnCopyText="";this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.ClosureParams.isDivCopy=false;if(!this.DivOnCopyHtmlPresent&& -this.DivOnCopyText!="")this.CommonDiv.innerHTML=this.DivOnCopyText;this.DivOnCopyHtmlPresent=false;this.DivOnCopyText="";this.CommonDiv_Select();window.setTimeout(function(){g_clipboardBase.CommonDiv_End()},0)},CommonDiv_Execute_CopyCut:function(){if(this.IsCopyCutOnlyInEditable)this._private_onbeforecopy(undefined,true)},CommonIframe_PasteStart:function(_html_data,text_data){var ifr=document.getElementById(this.CommonIframeId);if(!ifr){ifr=document.createElement("iframe");ifr.name=this.CommonIframeId; -ifr.id=this.CommonIframeId;ifr.style.position="absolute";ifr.style.top="-100px";ifr.style.left="0px";ifr.style.width="10000px";ifr.style.height="100px";ifr.style.overflow="hidden";ifr.style.zIndex=-1E3;ifr.setAttribute("sandbox","allow-same-origin");document.body.appendChild(ifr);this.CommonIframe=ifr}else ifr.style.width="10000px";var frameWindow=window.frames[this.CommonIframeId];if(frameWindow){frameWindow.document.open();frameWindow.document.write(_html_data);frameWindow.document.close();if(null!= -frameWindow.document&&null!=frameWindow.document.body){ifr.style.display="block";this.pastedFrom=definePastedFrom(frameWindow.document);this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.HtmlElement,frameWindow.document.body,ifr,text_data)}}ifr.style.width="100px";g_clipboardBase.Paste_End()},CommonIframe_PasteEnd:function(){if(this.CommonIframe&&this.CommonIframe.style.display!="none"){this.CommonIframe.blur();this.CommonIframe.style.display="none"}},Paste_End:function(){this.CommonIframe_PasteEnd(); -this.Api.decrementCounterLongAction();this.PasteFlag=false;this.EndFocus();if(this.needClearBuffer){this.ClearBuffer();this.needClearBuffer=false}},pushData:function(_format,_data){if(null==this.LastCopyBinary)this.LastCopyBinary=[];this.LastCopyBinary.push({type:_format,data:_data});if(this.ClosureParams.isDivCopy===true){if(!this.isCopyOutEnabled())return;if(_format==AscCommon.c_oAscClipboardDataFormat.Html){this.CommonDiv.innerHTML=_data;this.DivOnCopyHtmlPresent=true}if(_format==AscCommon.c_oAscClipboardDataFormat.Text)this.DivOnCopyText= -_data;return}var _data_format="";switch(_format){case AscCommon.c_oAscClipboardDataFormat.Html:_data_format="text/html";break;case AscCommon.c_oAscClipboardDataFormat.Text:_data_format="text/plain";break;case AscCommon.c_oAscClipboardDataFormat.Internal:_data_format="text/x-custom";break;default:break}if(_data_format!=""&&_data!==null&&this.isCopyOutEnabled())if(_data_format=="text/x-custom")this.ClosureParams.setData(_data_format,"asc_internalData2;"+_data);else this.ClosureParams.setData(_data_format, -_data)},Button_Copy:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("copy")}catch(err){_ret=false}if(!_ret){this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal)}return _ret}, -Button_Cut:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("cut")}catch(err){_ret=false}if(!_ret){this.LastCopyBinary=null;this.bCut=true;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal); -this.Api.asc_SelectionCut();this.bCut=false}return _ret},Button_Paste:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);var _ret=false;try{_ret=document.execCommand("paste")}catch(err){_ret=false}if(!_ret&&null!=this.LastCopyBinary){var _data=null;var _isInternal=false;for(var i=0;i0)this.Api.asc_PasteData(this.LastCopyBinary[0].type,this.LastCopyBinary[0].data)}return _ret},ClearBuffer:function(){if(-1!=this.clearBufferTimerId)clearTimeout(this.clearBufferTimerId);this.clearBufferTimerId=setTimeout(function(){if(AscCommon.g_clipboardBase)AscCommon.g_clipboardBase.clearBufferTimerId=-1},500);this.Button_Copy()},isCopyOutEnabled:function(){if(this.Api&&this.Api.isCopyOutEnabled)return this.Api.isCopyOutEnabled(); -return true}};function definePastedFrom(doc){if(!doc)return null;var res=null;var metaTags=doc.getElementsByTagName("meta");for(var i=0;i>1)+"px;top:"+-this.HtmlAreaOffset+ -"px;";_style+="background:transparent;border:none;position:absolute;text-shadow:0 0 0 #000;outline:none;color:transparent;width:"+this.HtmlAreaWidth+"px;height:50px;";_style+="overflow:hidden;padding:0px;margin:0px;font-family:arial;resize:none;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;";_style+="touch-action: none;-webkit-touch-callout: none;color:transparent;caret-color:transparent;";_style+=AscCommon.AscBrowser.isAppleDevices?"font-size:0px;": -"font-size:8px;";this.HtmlArea.setAttribute("style",_style);this.HtmlArea.setAttribute("spellcheck",false);this.HtmlArea.setAttribute("autocapitalize","none");this.HtmlArea.setAttribute("autocomplete","off");this.HtmlArea.setAttribute("autocorrect","off");this.HtmlDiv.appendChild(this.HtmlArea);if(true){var oHtmlDivScrollable=document.createElement("div");oHtmlDivScrollable.id="area_id_main";oHtmlDivScrollable.setAttribute("style","background:transparent;border:none;position:absolute;padding:0px;margin:0px;z-index:0;pointer-events:none;"); -var parentStyle=getComputedStyle(oHtmlParent);oHtmlDivScrollable.style.left=parentStyle.left;oHtmlDivScrollable.style.top=parentStyle.top;oHtmlDivScrollable.style.width=parentStyle.width;oHtmlDivScrollable.style.height=parentStyle.height;oHtmlDivScrollable.style.overflow="hidden";oHtmlDivScrollable.appendChild(this.HtmlDiv);oHtmlParent.parentNode.appendChild(oHtmlDivScrollable)}else oHtmlParent.appendChild(this.HtmlDiv);var oThis=this;this.HtmlArea["onkeydown"]=function(e){if(AscCommon.AscBrowser.isSafariMacOs){var cmdButton= -e.ctrlKey||e.metaKey?true:false;var buttonCode=e.keyCode==67||e.keyCode==88||e.keyCode==86;if(cmdButton&&buttonCode)oThis.IsDisableKeyPress=true;else oThis.IsDisableKeyPress=false}return oThis.onKeyDown(e)};this.HtmlArea["onkeypress"]=function(e){if(oThis.IsDisableKeyPress==true){oThis.IsDisableKeyPress=false;var cmdButton=e.ctrlKey||e.metaKey?true:false;if(cmdButton)return}return oThis.onKeyPress(e)};this.HtmlArea["onkeyup"]=function(e){oThis.IsDisableKeyPress=false;return oThis.onKeyUp(e)};this.HtmlArea.addEventListener("input", -function(e){return oThis.onInput(e)},false);this.HtmlArea.addEventListener("compositionstart",function(e){return oThis.onCompositionStart(e)},false);this.HtmlArea.addEventListener("compositionupdate",function(e){return oThis.onCompositionUpdate(e)},false);this.HtmlArea.addEventListener("compositionend",function(e){return oThis.onCompositionEnd(e)},false);this.show();this.Api.Input_UpdatePos();if(AscCommon.AscBrowser.isAndroid)this.HtmlArea.onclick=function(e){var _this=AscCommon.g_inputContext;if(-1!= -_this.virtualKeyboardClickTimeout){clearTimeout(_this.virtualKeyboardClickTimeout);_this.virtualKeyboardClickTimeout=-1}_this.apiCompositeEnd();if(!_this.virtualKeyboardClickPrevent)return;_this.setReadOnlyWrapper(true);_this.virtualKeyboardClickPrevent=false;AscCommon.stopEvent(e);_this.virtualKeyboardClickTimeout=setTimeout(function(){_this.setReadOnlyWrapper(false);_this.virtualKeyboardClickTimeout=-1},1);return false}},onResize:function(_editorContainerId){var _elem=document.getElementById("area_id_main"); -var _elemSrc=document.getElementById(_editorContainerId);if(!_elem||!_elemSrc)return;if(AscCommon.AscBrowser.isChrome){var rectObject=_elemSrc.getBoundingClientRect();this.FixedPosCheckElementX=rectObject.left;this.FixedPosCheckElementY=rectObject.top}var _width=_elemSrc.style.width;if((null==_width||""==_width)&&window.getComputedStyle){var _s=window.getComputedStyle(_elemSrc);_elem.style.left=_s.left;_elem.style.top=_s.top;_elem.style.width=_s.width;_elem.style.height=_s.height}else{_elem.style.left= -_elemSrc.style.left;_elem.style.top=_elemSrc.style.top;_elem.style.width=_width;_elem.style.height=_elemSrc.style.height}if(this.Api.isMobileVersion){var _elem1=document.getElementById("area_id_parent");var _elem2=document.getElementById("area_id");_elem1.parentNode.style.pointerEvents="";_elem1.style.left="0px";_elem1.style.top="-1000px";_elem1.style.right="0px";_elem1.style.bottom="-100px";_elem1.style.width="auto";_elem1.style.height="auto";_elem2.style.left="0px";_elem2.style.top="0px";_elem2.style.right= -"0px";_elem2.style.bottom="0px";_elem2.style.width="100%";_elem2.style.height="100%";if(AscCommon.AscBrowser.isIE){document.body.style["msTouchAction"]="none";document.body.style["touchAction"]="none"}}var _editorSdk=document.getElementById("editor_sdk");this.editorSdkW=_editorSdk.clientWidth;this.editorSdkH=_editorSdk.clientHeight},checkFocus:function(){if(this.Api.asc_IsFocus()&&!AscCommon.g_clipboardBase.IsFocus()&&!AscCommon.g_clipboardBase.IsWorking())if(document.activeElement!=this.HtmlArea)this.HtmlArea.focus()}, -move:function(x,y){if(this.Api.isMobileVersion)return;var oTarget=document.getElementById(this.TargetId);if(!oTarget)return;var xPos=x?x:parseInt(oTarget.style.left);var yPos=(y?y:parseInt(oTarget.style.top))+parseInt(oTarget.style.height);if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)xPos=-100;if(!this.isDebug&&!this.isSystem){this.HtmlDiv.style.left=xPos+this.FixedPosCheckElementX+"px";this.HtmlDiv.style.top=yPos+this.FixedPosCheckElementY+this.TargetOffsetY+this.HtmlAreaOffset+ -"px";this.HtmlArea.scrollTop=this.HtmlArea.scrollHeight}else this.debugCalculatePlace(xPos+this.FixedPosCheckElementX,yPos+this.FixedPosCheckElementY+this.TargetOffsetY);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onTargetPositionChanged")},emulateKeyDownApi:function(code){var _e={altKey:false,ctrlKey:false,shiftKey:false,target:null,charCode:0,which:code,keyCode:code,code:"",preventDefault:function(){},stopPropagation:function(){}};this.Api.onKeyDown(_e);this.Api.onKeyUp(_e)},clear:function(isFromFocus){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML= -"";else this.HtmlArea.value="";if(isFromFocus!==true)this.HtmlArea.focus();this.TextBeforeComposition="";this.Text="";this.Target=0;this.CompositionStart=0;this.CompositionEnd=0;this.IsComposition=false;this.keyPressInput="";if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperClear")},getAreaValue:function(){return this.TextArea_Not_ContentEditableDiv?this.HtmlArea.value:this.HtmlArea.innerText},setReadOnly:function(isLock){if(isLock)this.ReadOnlyCounter++;else this.ReadOnlyCounter--; -this.setReadOnlyWrapper(0>=this.ReadOnlyCounter?false:true)},setReadOnlyWrapper:function(val){this.HtmlArea.readOnly=this.Api.isViewMode?true:val},show:function(){if(this.isDebug||this.isSystem){this.log("ti: show");document.getElementById("area_id_main").style.zIndex=10;this.HtmlArea.style.top="0px";this.HtmlArea.style.width="100%";this.HtmlArea.style.height="100%";this.HtmlArea.style.background="#FFFFFF";this.HtmlArea.style.color="black";this.HtmlDiv.style.zIndex=90;this.HtmlDiv.style.border="2px solid #4363A4"; -this.isShow=true}},unshow:function(isAttack){if(this.isDebug||this.isSystem||true==isAttack){this.log("ti: unshow");document.getElementById("area_id_main").style.zIndex=0;this.HtmlArea.style.top=-this.HtmlAreaOffset+"px";this.HtmlArea.style.width="1000px";this.HtmlArea.style.height="50px";this.HtmlArea.style.background="transparent";this.HtmlArea.style.color="transparent";this.HtmlDiv.style.zIndex=0;this.HtmlDiv.style.border="none";this.isShow=false}},debugCalculatePlace:function(x,y){var _left=x; -var _top=y;if(undefined==_left)_left=parseInt(this.HtmlDiv.style.left);if(undefined==_top)_top=parseInt(this.HtmlDiv.style.top);var _r_max=this.editorSdkW;var _b_max=this.editorSdkH;_r_max-=60;if(_r_max-_left>50)this.debugTexBoxMaxW=_r_max-_left;else{_left=_r_max-50;this.debugTexBoxMaxW=50}_b_max-=40;if(_b_max-_top>50)this.debugTexBoxMaxH=_b_max-_top;else{_top=_b_max-50;this.debugTexBoxMaxH=50}if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)_left=-100;this.HtmlDiv.style.left=_left+ -"px";this.HtmlDiv.style.top=_top+"px";var _height=22;var _t=this.getAreaValue();if(0!=_t.length){var _editorSdk=document.getElementById("editor_sdk");var _p=document.createElement("p");_p.style.zIndex="-1";_p.style.position="absolute";_p.style.fontFamily="arial";_p.style.fontSize="12pt";_p.style.left="0px";_p.style.width=this.debugTexBoxMaxW+"px";_editorSdk.appendChild(_p);_t=_t.replace(/ /g," ");_p.innerHTML=""+_t+"";var _width=_p.firstChild.offsetWidth;_width=Math.min(_width+20, -this.debugTexBoxMaxW);if(AscCommon.AscBrowser.isIE)_width+=10;var area=document.createElement("textarea");area.style.zIndex="-1";area.id="area2_id";area.rows=1;area.setAttribute("style","font-family:arial;font-size:12pt;position:absolute;resize:none;padding:0px;margin:0px;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;");area.style.overflow="hidden";area.style.width=_width+"px";_editorSdk.appendChild(area);area.value=this.getAreaValue();_height= -area.clientHeight;if(area.scrollHeight>_height)_height=area.scrollHeight;_editorSdk.removeChild(_p);_editorSdk.removeChild(area)}if(_height>this.debugTexBoxMaxH)_height=this.debugTexBoxMaxH;this.HtmlDiv.style.width=_width+"px";this.HtmlDiv.style.height=_height+"px";var oldZindex=parseInt(this.HtmlDiv.style.zIndex);var newZindex=oldZindex==90?"89":"90";this.HtmlDiv.style.zIndex=newZindex},onInput:function(e,isFromCompositionUpdate){if(this.Api.isLongAction()||this.Api.isViewMode){AscCommon.stopEvent(e); -return false}if(this.isSystem){if(!this.isShow)this.show();this.debugCalculatePlace(undefined,undefined);return}if(this.isKeyPressOnUp&&this.keyPressOnUpCodes.length>0){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";this.TextBeforeComposition="";this.Text="";AscCommon.stopEvent(e);return false}this.log("ti: onInput");this.Text=this.getAreaValue();this.Text=this.Text.split(" ").join(" ");var codes=[];if(this.IsComposition||this.ApiIsComposition){var ieStart= --1;var ieEnd=-1;if(true){var target=e.target;if(target["msGetInputContext"]){var ctx=target["msGetInputContext"]();if(ctx){ieStart=ctx["compositionStartOffset"];ieEnd=ctx["compositionEndOffset"]}}}this.CompositionEnd=this.Text.length;this.CompositionStart=this.TextBeforeComposition.length;var textReplace=this.Text.substr(this.CompositionStart);var iter;for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes, -true);if(!isAsync){if(ieStart>this.CompositionStart){textReplace=textReplace.substr(0,ieStart-this.CompositionStart);codes=[];for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiCompositeReplace(codes);this.apiCompositeEnd();this.TextBeforeComposition=this.Text.substr(0,ieStart);this.apiCompositeStart();this.CompositionStart=ieStart;codes=[];textReplace=this.Text.substr(this.CompositionStart);for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value()); -this.apiCompositeReplace(codes)}else this.apiCompositeReplace(codes);if(!this.IsComposition){this.apiCompositeEnd();this.TextBeforeComposition=this.Text}}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeReplace(codes);this.apiCompositeEnd();this.clear();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}}else{var textToApi=this.Text.substr(this.TextBeforeComposition.length);for(var iter=textToApi.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value()); -if(codes.length>0)this.apiInputText(codes);this.TextBeforeComposition=this.Text}if(!this.IsComposition)if(this.Text.length>0){var _lastCode=this.Text.charCodeAt(this.Text.length-1);if(_lastCode==12290||_lastCode==46){AscCommon.stopEvent(e);if(AscCommon.AscBrowser.isIE&&!AscCommon.AscBrowser.isIeEdge)setTimeout(function(){window["AscCommon"].g_inputContext.clear();window["AscCommon"].g_inputContext.HtmlArea.focus()},0);else this.clear();return false}}},emulateNativeKeyDown:function(e,target){var oEvent= -document.createEvent("KeyboardEvent");Object.defineProperty(oEvent,"keyCode",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"which",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"shiftKey",{get:function(){return this.shiftKeyVal}});Object.defineProperty(oEvent,"altKey",{get:function(){return this.altKeyVal}});Object.defineProperty(oEvent,"metaKey",{get:function(){return this.metaKeyVal}});Object.defineProperty(oEvent,"ctrlKey",{get:function(){return this.ctrlKeyVal}}); -if(AscCommon.AscBrowser.isIE)oEvent.preventDefault=function(){try{Object.defineProperty(this,"defaultPrevented",{get:function(){return true}})}catch(err){}};var k=e.keyCode;if(oEvent.initKeyboardEvent)oEvent.initKeyboardEvent("keydown",true,true,window,false,false,false,false,k,k);else oEvent.initKeyEvent("keydown",true,true,window,false,false,false,false,k,0);oEvent.keyCodeVal=k;oEvent.shiftKeyVal=e.shiftKey;oEvent.altKeyVal=e.altKey;oEvent.metaKeyVal=e.metaKey;oEvent.ctrlKeyVal=e.ctrlKey;var _elem= -target?target:_getElementKeyboardDown(this.nativeFocusElement,3);_elem.dispatchEvent(oEvent);return oEvent.defaultPrevented},isSpaceSymbol:function(e){if(e.keyCode==32)return true;if(e.keyCode==229&&(e.code=="space"||e.code=="Space"||e.key=="Spacebar"))return true;return false},systemInputEnable:function(isEnabled){if(this.isSystem==isEnabled)return;this.isSystem=isEnabled;this.HtmlArea.style.left=this.isSystem?"0px":"-"+(this.HtmlAreaWidth>>1)+"px";this.clear();if(this.isShow)this.unshow(true);if(this.Api.WordControl&& -this.Api.WordControl.m_oLogicDocument&&this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState)this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState()},debugInputEnable:function(isEnabled){if(this.isDebug==isEnabled)return;this.isDebug=isEnabled;this.HtmlArea.style.left=this.isDebug?"0px":"-"+(this.HtmlAreaWidth>>1)+"px"},apiInputText:function(codes){var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){this.apiCompositeStart();this.apiCompositeReplace(codes); -this.apiCompositeEnd()}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd();this.setReadOnly(false)});this.setReadOnly(true);return false}},onKeyDown:function(e){if(this.Api.isLongAction()){AscCommon.stopEvent(e);return false}if(this.isInputHelpersPresent)switch(e.keyCode){case 9:case 13:case 38:case 40:case 33:case 34:case 35:case 36:case 27:{window.g_asc_plugins.onPluginEvent2("onKeyDown",{"keyCode":e.keyCode}, -this.isInputHelpers);AscCommon.stopEvent(e);return false}case 32:{if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}default:break}else if(32==e.keyCode);if(this.isSystem&&this.isShow){if(e.keyCode==13){var text=this.getAreaValue();var codes=[];for(var iter=text.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiInputText(codes);this.clear();this.unshow();AscCommon.stopEvent(e);return false}else if(e.keyCode==27){this.clear(); -this.unshow();AscCommon.stopEvent(e);return false}return}if(null!=this.nativeFocusElement)if(this.emulateNativeKeyDown(e)){e.preventDefault();return false}var _code=e.keyCode;if(_code!=8&&_code!=46)this.KeyDownFlag=true;AscCommon.check_KeyboardEvent(e);var arrCodes=this.Api.getAddedTextOnKeyDown(AscCommon.global_keyboardEvent);var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(arrCodes,true);if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.onKeyDown(e);this.onKeyUp(e); -this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}var ret=this.Api.onKeyDown(e);switch(e.keyCode){case 8:{var oldKeyPressInput=this.keyPressInput;this.clear();if(oldKeyPressInput.length>1){this.keyPressInput=oldKeyPressInput.substr(0,oldKeyPressInput.length-1);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}return false}case 9:case 13:case 37:case 38:case 39:case 40:case 33:case 34:case 35:case 36:{this.clear(); +_internal!=""&&_internal.indexOf("asc_internalData2;")==0){this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Internal,_internal.substr("asc_internalData2;".length),null,_text_format);g_clipboardBase.Paste_End();return false}var _html_format=this.ClosureParams.getData("text/html");_html_format=_html_format.replace(/]+>/g,"");if(!_html_format){this.PasteFlag=false;g_clipboardBase.Paste_End();return false}if(_html_format&&_html_format!=""){var nIndex=_html_format.indexOf("");if(-1!= +nIndex)_html_format=_html_format.substring(0,nIndex+"".length);this.CommonIframe_PasteStart(_html_format,_text_format);return false}if(_text_format&&_text_format!=""){this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Text,_text_format);g_clipboardBase.Paste_End();return false}var items=_clipboard.items;if(null!=items&&0!=items.length){g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCount=items.length;g_clipboardBase.PasteImagesCounter=0;for(var i=0;i';if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount= +0}};reader.onabort=reader.onerror=function(e){g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount=0}};try{reader.readAsDataURL(blob)}catch(err){g_clipboardBase.PasteImagesCounter++}}else g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter== +g_clipboardBase.PasteImagesCount)g_clipboardBase.Paste_End();return false}}g_clipboardBase.Paste_End();return false},_private_onbeforepaste:function(e,isAttackEmulate){this._console_log("onbeforepaste");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select();return}return false},_private_onbeforecopy_select:function(){if(AscBrowser.isIE){this._console_log("onbeforecopy_select");this.CommonDiv= +this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}},_private_onbeforecopy:function(e,isAttackEmulate){this._console_log("onbeforecopy");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}return false},Init:function(_api){this.Api=_api;window["AscCommon"].g_specialPasteHelper.Init(_api); +this.ClosureParams.getData=function(type){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.getData)return null;var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{return _clipboard.getData(_type)}catch(e){}return null};this.ClosureParams.setData=function(type,_data){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.setData)return null; +var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{_clipboard.setData(_type,_data)}catch(e){}};if(!AscBrowser.isIE){document.oncopy=function(e){return g_clipboardBase._private_oncopy(e)};document.oncut=function(e){return g_clipboardBase._private_oncut(e)};document.onpaste=function(e){return g_clipboardBase._private_onpaste(e)};document["onbeforecopy"]=function(e){return g_clipboardBase._private_onbeforecopy(e)};document["onbeforecut"]=function(e){return g_clipboardBase._private_onbeforecopy(e)}; +document["onbeforepaste"]=function(e){return g_clipboardBase._private_onbeforepaste(e)}}else{document.addEventListener("copy",function(e){return g_clipboardBase._private_oncopy(e)});document.addEventListener("cut",function(e){return g_clipboardBase._private_oncut(e)});document.addEventListener("paste",function(e){return g_clipboardBase._private_onpaste(e)});document.addEventListener("beforepaste",function(e){return g_clipboardBase._private_onbeforepaste(e)});document.addEventListener("beforecopy", +function(e){return g_clipboardBase._private_onbeforecopy(e)});document.addEventListener("beforecut",function(e){return g_clipboardBase._private_onbeforecopy(e)})}if(this.IsCopyCutOnlyInEditable||this.IsPasteOnlyInEditable)document.onkeydown=function(e){if(!g_clipboardBase.Api.asc_IsFocus(true)||g_clipboardBase.Api.isLongAction())return;var isAltGr=AscCommon.getAltGr(e);if(isAltGr)return;var isCtrl=e.ctrlKey===true||e.metaKey===true;var isShift=e.shiftKey;var keyCode=e.keyCode;if(g_clipboardBase.IsCopyCutOnlyInEditable){var bIsBeforeCopyCutEmulate= +false;var _cut=false;if(isCtrl&&!isShift&&(keyCode==67||keyCode==88))bIsBeforeCopyCutEmulate=true;if(!isCtrl&&isShift&&keyCode==45){bIsBeforeCopyCutEmulate=true;_cut=true}if(bIsBeforeCopyCutEmulate){g_clipboardBase._console_log("emulate_beforecopycut");var isEmulate=false;try{isEmulate=_cut?document.execCommand("beforecut"):document.execCommand("beforecopy")}catch(err){}g_clipboardBase._private_onbeforecopy(undefined,!isEmulate)}}if(g_clipboardBase.IsPasteOnlyInEditable){var bIsBeforePasteEmulate= +false;if(isCtrl&&!isShift&&keyCode==86)bIsBeforePasteEmulate=true;if(!isCtrl&&isShift&&keyCode==45)bIsBeforePasteEmulate=true;if(bIsBeforePasteEmulate){g_clipboardBase._console_log("emulate_beforepaste");var isEmulate=false;try{isEmulate=document.execCommand("beforepaste")}catch(err$19){}g_clipboardBase._private_onbeforepaste(undefined,!isEmulate)}}};if(AscBrowser.isSafari&&false){this.CommonDiv=this.CommonDiv_Check();setInterval(function(){if(g_clipboardBase.Api.asc_IsFocus(true))g_clipboardBase.CommonDiv.focus()}, +100)}},IsWorking:function(){return this.CopyFlag||this.PasteFlag?true:false},StartFocus:function(){this.EndFocus(false);this.CopyPasteFocus=true;this.CopyPasteFocusTimer=setTimeout(function(){g_clipboardBase.EndFocus()},1E3)},EndFocus:function(isFocusToEditor){this.CopyPasteFocus=false;if(-1!=this.CopyPasteFocusTimer){clearTimeout(this.CopyPasteFocusTimer);this.CopyPasteFocusTimer=-1;if(false!==isFocusToEditor&&null!=this.inputContext)if(this.inputContext.HtmlArea)this.inputContext.HtmlArea.focus()}}, +IsFocus:function(){return this.CopyPasteFocus},CommonDiv_Check:function(){var ElemToSelect=document.getElementById(this.CommonDivId);if(!ElemToSelect){ElemToSelect=document.createElement("div");ElemToSelect.id=this.CommonDivId;ElemToSelect.className=this.CommonDivClassName;ElemToSelect.style.position="fixed";ElemToSelect.style.left="0px";ElemToSelect.style.top="-100px";ElemToSelect.style.width="10000px";ElemToSelect.style.height="100px";ElemToSelect.style.overflow="hidden";ElemToSelect.style.zIndex= +-1E3;ElemToSelect.style.MozUserSelect="text";ElemToSelect.style.fontFamily="onlyofficeDefaultFont";ElemToSelect.style.fontSize="11pt";ElemToSelect.style.color="black";ElemToSelect.style["-khtml-user-select"]="text";ElemToSelect.style["-o-user-select"]="text";ElemToSelect.style["user-select"]="text";ElemToSelect.style["-webkit-user-select"]="text";ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());var _parent=""==this.CommonDivIdParent?document.body:document.getElementById(this.CommonDivIdParent); +_parent.appendChild(ElemToSelect)}else ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());return ElemToSelect},CommonDiv_Select:function(){var ElemToSelect=this.CommonDiv;if(window.getSelection){var selection=window.getSelection();var rangeToSelect=document.createRange();var is_gecko=AscBrowser.isGecko;if(is_gecko){ElemToSelect.appendChild(document.createTextNode("\u00a0"));ElemToSelect.insertBefore(document.createTextNode("\u00a0"),ElemToSelect.firstChild);rangeToSelect.setStartAfter(ElemToSelect.firstChild); +rangeToSelect.setEndBefore(ElemToSelect.lastChild)}else{var aChildNodes=ElemToSelect.childNodes;if(aChildNodes.length==1){var elem=aChildNodes[0];var wrap=document.createElement("b");wrap.setAttribute("style","font-weight:normal; background-color: transparent; color: transparent;");elem=ElemToSelect.removeChild(elem);wrap.appendChild(elem);ElemToSelect.appendChild(wrap)}rangeToSelect.selectNodeContents(ElemToSelect)}selection.removeAllRanges();selection.addRange(rangeToSelect)}else if(document.body.createTextRange){var rangeToSelect= +document.body.createTextRange();rangeToSelect.moveToElementText(ElemToSelect);rangeToSelect.select()}},CommonDiv_Start:function(){this.ClosureParams.overflowBody=document.body.style.overflow;document.body.style.overflow="hidden";this.ClosureParams.backgroundcolorBody=document.body.style["background-color"];document.body.style["background-color"]="transparent";var ElemToSelect=this.CommonDiv;ElemToSelect.style.display="block";while(ElemToSelect.hasChildNodes())ElemToSelect.removeChild(ElemToSelect.lastChild); +document.body.style.MozUserSelect="text";delete document.body.style["-khtml-user-select"];delete document.body.style["-o-user-select"];delete document.body.style["user-select"];document.body.style["-webkit-user-select"]="text";ElemToSelect.style.MozUserSelect="all"},CommonDiv_End:function(){var ElemToSelect=this.CommonDiv;if(ElemToSelect){ElemToSelect.style.display=AscBrowser.isSafari?"block":"none";ElemToSelect.style.MozUserSelect="none"}document.body.style.MozUserSelect="none";document.body.style["-khtml-user-select"]= +"none";document.body.style["-o-user-select"]="none";document.body.style["user-select"]="none";document.body.style["-webkit-user-select"]="none";document.body.style["background-color"]=this.ClosureParams.backgroundcolorBody;document.body.style.overflow=this.ClosureParams.overflowBody;this.CopyFlag=false;this.bCut=false;this.EndFocus()},CommonDiv_Copy:function(){this.CopyFlag=true;this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.ClosureParams.isDivCopy=true;this.DivOnCopyHtmlPresent= +false;this.DivOnCopyText="";this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.ClosureParams.isDivCopy=false;if(!this.DivOnCopyHtmlPresent&&this.DivOnCopyText!="")this.CommonDiv.innerHTML=this.DivOnCopyText;this.DivOnCopyHtmlPresent=false;this.DivOnCopyText="";this.CommonDiv_Select();window.setTimeout(function(){g_clipboardBase.CommonDiv_End()},0)},CommonDiv_Execute_CopyCut:function(){if(this.IsCopyCutOnlyInEditable)this._private_onbeforecopy(undefined, +true)},CommonIframe_PasteStart:function(_html_data,text_data){var ifr=document.getElementById(this.CommonIframeId);if(!ifr){ifr=document.createElement("iframe");ifr.name=this.CommonIframeId;ifr.id=this.CommonIframeId;ifr.style.position="absolute";ifr.style.top="-100px";ifr.style.left="0px";ifr.style.width="10000px";ifr.style.height="100px";ifr.style.overflow="hidden";ifr.style.zIndex=-1E3;ifr.setAttribute("sandbox","allow-same-origin");document.body.appendChild(ifr);this.CommonIframe=ifr}else ifr.style.width= +"10000px";var frameWindow=window.frames[this.CommonIframeId];if(frameWindow){frameWindow.document.open();frameWindow.document.write(_html_data);frameWindow.document.close();if(null!=frameWindow.document&&null!=frameWindow.document.body){ifr.style.display="block";this.pastedFrom=definePastedFrom(frameWindow.document);this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.HtmlElement,frameWindow.document.body,ifr,text_data)}}ifr.style.width="100px";g_clipboardBase.Paste_End()},CommonIframe_PasteEnd:function(){if(this.CommonIframe&& +this.CommonIframe.style.display!="none"){this.CommonIframe.blur();this.CommonIframe.style.display="none"}},Paste_End:function(){this.CommonIframe_PasteEnd();this.Api.decrementCounterLongAction();this.PasteFlag=false;this.EndFocus();if(this.needClearBuffer){this.ClearBuffer();this.needClearBuffer=false}},pushData:function(_format,_data){if(null==this.LastCopyBinary)this.LastCopyBinary=[];this.LastCopyBinary.push({type:_format,data:_data});if(this.ClosureParams.isDivCopy===true){if(!this.isCopyOutEnabled())return; +if(_format==AscCommon.c_oAscClipboardDataFormat.Html){this.CommonDiv.innerHTML=_data;this.DivOnCopyHtmlPresent=true}if(_format==AscCommon.c_oAscClipboardDataFormat.Text)this.DivOnCopyText=_data;return}var _data_format="";switch(_format){case AscCommon.c_oAscClipboardDataFormat.Html:_data_format="text/html";break;case AscCommon.c_oAscClipboardDataFormat.Text:_data_format="text/plain";break;case AscCommon.c_oAscClipboardDataFormat.Internal:_data_format="text/x-custom";break;default:break}if(_data_format!= +""&&_data!==null&&this.isCopyOutEnabled())if(_data_format=="text/x-custom")this.ClosureParams.setData(_data_format,"asc_internalData2;"+_data);else this.ClosureParams.setData(_data_format,_data)},Button_Copy:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("copy")}catch(err){_ret= +false}if(!_ret){this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal)}return _ret},Button_Cut:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("cut")}catch(err){_ret= +false}if(!_ret){this.LastCopyBinary=null;this.bCut=true;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.Api.asc_SelectionCut();this.bCut=false}return _ret},Button_Paste:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);var _ret=false;try{_ret=document.execCommand("paste")}catch(err){_ret= +false}if(!_ret&&null!=this.LastCopyBinary){var _data=null;var _isInternal=false;for(var i=0;i0)this.Api.asc_PasteData(this.LastCopyBinary[0].type,this.LastCopyBinary[0].data)}return _ret},ClearBuffer:function(){if(-1!=this.clearBufferTimerId)clearTimeout(this.clearBufferTimerId); +this.clearBufferTimerId=setTimeout(function(){if(AscCommon.g_clipboardBase)AscCommon.g_clipboardBase.clearBufferTimerId=-1},500);this.Button_Copy()},isCopyOutEnabled:function(){if(this.Api&&this.Api.isCopyOutEnabled)return this.Api.isCopyOutEnabled();return true}};function definePastedFrom(doc){if(!doc)return null;var res=null;var metaTags=doc.getElementsByTagName("meta");for(var i=0;i>1)+"px;top:"+-this.HtmlAreaOffset+"px;";_style+="background:transparent;border:none;position:absolute;text-shadow:0 0 0 #000;outline:none;color:transparent;width:"+this.HtmlAreaWidth+"px;height:50px;";_style+="overflow:hidden;padding:0px;margin:0px;font-family:arial;resize:none;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;"; +_style+="touch-action: none;-webkit-touch-callout: none;color:transparent;caret-color:transparent;";_style+=AscCommon.AscBrowser.isAppleDevices?"font-size:0px;":"font-size:8px;";this.HtmlArea.setAttribute("style",_style);this.HtmlArea.setAttribute("spellcheck",false);this.HtmlArea.setAttribute("autocapitalize","none");this.HtmlArea.setAttribute("autocomplete","off");this.HtmlArea.setAttribute("autocorrect","off");this.HtmlDiv.appendChild(this.HtmlArea);if(true){var oHtmlDivScrollable=document.createElement("div"); +oHtmlDivScrollable.id="area_id_main";oHtmlDivScrollable.setAttribute("style","background:transparent;border:none;position:absolute;padding:0px;margin:0px;z-index:0;pointer-events:none;");var parentStyle=getComputedStyle(oHtmlParent);oHtmlDivScrollable.style.left=parentStyle.left;oHtmlDivScrollable.style.top=parentStyle.top;oHtmlDivScrollable.style.width=parentStyle.width;oHtmlDivScrollable.style.height=parentStyle.height;oHtmlDivScrollable.style.overflow="hidden";oHtmlDivScrollable.appendChild(this.HtmlDiv); +oHtmlParent.parentNode.appendChild(oHtmlDivScrollable)}else oHtmlParent.appendChild(this.HtmlDiv);var oThis=this;this.HtmlArea["onkeydown"]=function(e){if(AscCommon.AscBrowser.isSafariMacOs){var cmdButton=e.ctrlKey||e.metaKey?true:false;var buttonCode=e.keyCode==67||e.keyCode==88||e.keyCode==86;if(cmdButton&&buttonCode)oThis.IsDisableKeyPress=true;else oThis.IsDisableKeyPress=false}return oThis.onKeyDown(e)};this.HtmlArea["onkeypress"]=function(e){if(oThis.IsDisableKeyPress==true){oThis.IsDisableKeyPress= +false;var cmdButton=e.ctrlKey||e.metaKey?true:false;if(cmdButton)return}return oThis.onKeyPress(e)};this.HtmlArea["onkeyup"]=function(e){oThis.IsDisableKeyPress=false;return oThis.onKeyUp(e)};this.HtmlArea.addEventListener("input",function(e){return oThis.onInput(e)},false);this.HtmlArea.addEventListener("compositionstart",function(e){return oThis.onCompositionStart(e)},false);this.HtmlArea.addEventListener("compositionupdate",function(e){return oThis.onCompositionUpdate(e)},false);this.HtmlArea.addEventListener("compositionend", +function(e){return oThis.onCompositionEnd(e)},false);this.show();this.Api.Input_UpdatePos();if(AscCommon.AscBrowser.isAndroid)this.HtmlArea.onclick=function(e){var _this=AscCommon.g_inputContext;if(-1!=_this.virtualKeyboardClickTimeout){clearTimeout(_this.virtualKeyboardClickTimeout);_this.virtualKeyboardClickTimeout=-1}_this.apiCompositeEnd();if(!_this.virtualKeyboardClickPrevent)return;_this.setReadOnlyWrapper(true);_this.virtualKeyboardClickPrevent=false;AscCommon.stopEvent(e);_this.virtualKeyboardClickTimeout= +setTimeout(function(){_this.setReadOnlyWrapper(false);_this.virtualKeyboardClickTimeout=-1},1);return false}},onResize:function(_editorContainerId){var _elem=document.getElementById("area_id_main");var _elemSrc=document.getElementById(_editorContainerId);if(!_elem||!_elemSrc)return;if(AscCommon.AscBrowser.isChrome){var rectObject=_elemSrc.getBoundingClientRect();this.FixedPosCheckElementX=rectObject.left;this.FixedPosCheckElementY=rectObject.top}var _width=_elemSrc.style.width;if((null==_width||""== +_width)&&window.getComputedStyle){var _s=window.getComputedStyle(_elemSrc);_elem.style.left=_s.left;_elem.style.top=_s.top;_elem.style.width=_s.width;_elem.style.height=_s.height}else{_elem.style.left=_elemSrc.style.left;_elem.style.top=_elemSrc.style.top;_elem.style.width=_width;_elem.style.height=_elemSrc.style.height}if(this.Api.isMobileVersion){var _elem1=document.getElementById("area_id_parent");var _elem2=document.getElementById("area_id");_elem1.parentNode.style.pointerEvents="";_elem1.style.left= +"0px";_elem1.style.top="-1000px";_elem1.style.right="0px";_elem1.style.bottom="-100px";_elem1.style.width="auto";_elem1.style.height="auto";_elem2.style.left="0px";_elem2.style.top="0px";_elem2.style.right="0px";_elem2.style.bottom="0px";_elem2.style.width="100%";_elem2.style.height="100%";if(AscCommon.AscBrowser.isIE){document.body.style["msTouchAction"]="none";document.body.style["touchAction"]="none"}}var _editorSdk=document.getElementById("editor_sdk");this.editorSdkW=_editorSdk.clientWidth;this.editorSdkH= +_editorSdk.clientHeight},checkFocus:function(){if(this.Api.asc_IsFocus()&&!AscCommon.g_clipboardBase.IsFocus()&&!AscCommon.g_clipboardBase.IsWorking())if(document.activeElement!=this.HtmlArea)this.HtmlArea.focus()},move:function(x,y){if(this.Api.isMobileVersion)return;var oTarget=document.getElementById(this.TargetId);if(!oTarget)return;var xPos=x?x:parseInt(oTarget.style.left);var yPos=(y?y:parseInt(oTarget.style.top))+parseInt(oTarget.style.height);if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)xPos= +-100;if(!this.isDebug&&!this.isSystem){this.HtmlDiv.style.left=xPos+this.FixedPosCheckElementX+"px";this.HtmlDiv.style.top=yPos+this.FixedPosCheckElementY+this.TargetOffsetY+this.HtmlAreaOffset+"px";this.HtmlArea.scrollTop=this.HtmlArea.scrollHeight}else this.debugCalculatePlace(xPos+this.FixedPosCheckElementX,yPos+this.FixedPosCheckElementY+this.TargetOffsetY);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onTargetPositionChanged")},emulateKeyDownApi:function(code){var _e={altKey:false, +ctrlKey:false,shiftKey:false,target:null,charCode:0,which:code,keyCode:code,code:"",preventDefault:function(){},stopPropagation:function(){}};this.Api.onKeyDown(_e);this.Api.onKeyUp(_e)},clear:function(isFromFocus){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";if(isFromFocus!==true)this.HtmlArea.focus();this.TextBeforeComposition="";this.Text="";this.Target=0;this.CompositionStart=0;this.CompositionEnd=0;this.IsComposition=false;this.keyPressInput= +"";if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperClear")},getAreaValue:function(){return this.TextArea_Not_ContentEditableDiv?this.HtmlArea.value:this.HtmlArea.innerText},setReadOnly:function(isLock){if(isLock)this.ReadOnlyCounter++;else this.ReadOnlyCounter--;this.setReadOnlyWrapper(0>=this.ReadOnlyCounter?false:true)},setReadOnlyWrapper:function(val){this.HtmlArea.readOnly=this.Api.isViewMode?true:val},show:function(){if(this.isDebug||this.isSystem){this.log("ti: show"); +document.getElementById("area_id_main").style.zIndex=10;this.HtmlArea.style.top="0px";this.HtmlArea.style.width="100%";this.HtmlArea.style.height="100%";this.HtmlArea.style.background="#FFFFFF";this.HtmlArea.style.color="black";this.HtmlDiv.style.zIndex=90;this.HtmlDiv.style.border="2px solid #4363A4";this.isShow=true}},unshow:function(isAttack){if(this.isDebug||this.isSystem||true==isAttack){this.log("ti: unshow");document.getElementById("area_id_main").style.zIndex=0;this.HtmlArea.style.top=-this.HtmlAreaOffset+ +"px";this.HtmlArea.style.width="1000px";this.HtmlArea.style.height="50px";this.HtmlArea.style.background="transparent";this.HtmlArea.style.color="transparent";this.HtmlDiv.style.zIndex=0;this.HtmlDiv.style.border="none";this.isShow=false}},debugCalculatePlace:function(x,y){var _left=x;var _top=y;if(undefined==_left)_left=parseInt(this.HtmlDiv.style.left);if(undefined==_top)_top=parseInt(this.HtmlDiv.style.top);var _r_max=this.editorSdkW;var _b_max=this.editorSdkH;_r_max-=60;if(_r_max-_left>50)this.debugTexBoxMaxW= +_r_max-_left;else{_left=_r_max-50;this.debugTexBoxMaxW=50}_b_max-=40;if(_b_max-_top>50)this.debugTexBoxMaxH=_b_max-_top;else{_top=_b_max-50;this.debugTexBoxMaxH=50}if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)_left=-100;this.HtmlDiv.style.left=_left+"px";this.HtmlDiv.style.top=_top+"px";var _height=22;var _t=this.getAreaValue();if(0!=_t.length){var _editorSdk=document.getElementById("editor_sdk");var _p=document.createElement("p");_p.style.zIndex="-1";_p.style.position="absolute"; +_p.style.fontFamily="arial";_p.style.fontSize="12pt";_p.style.left="0px";_p.style.width=this.debugTexBoxMaxW+"px";_editorSdk.appendChild(_p);_t=_t.replace(/ /g," ");_p.innerHTML=""+_t+"";var _width=_p.firstChild.offsetWidth;_width=Math.min(_width+20,this.debugTexBoxMaxW);if(AscCommon.AscBrowser.isIE)_width+=10;var area=document.createElement("textarea");area.style.zIndex="-1";area.id="area2_id";area.rows=1;area.setAttribute("style","font-family:arial;font-size:12pt;position:absolute;resize:none;padding:0px;margin:0px;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;"); +area.style.overflow="hidden";area.style.width=_width+"px";_editorSdk.appendChild(area);area.value=this.getAreaValue();_height=area.clientHeight;if(area.scrollHeight>_height)_height=area.scrollHeight;_editorSdk.removeChild(_p);_editorSdk.removeChild(area)}if(_height>this.debugTexBoxMaxH)_height=this.debugTexBoxMaxH;this.HtmlDiv.style.width=_width+"px";this.HtmlDiv.style.height=_height+"px";var oldZindex=parseInt(this.HtmlDiv.style.zIndex);var newZindex=oldZindex==90?"89":"90";this.HtmlDiv.style.zIndex= +newZindex},onInput:function(e,isFromCompositionUpdate){if(this.Api.isLongAction()||this.Api.isViewMode){AscCommon.stopEvent(e);return false}if(this.isSystem){if(!this.isShow)this.show();this.debugCalculatePlace(undefined,undefined);return}if(this.isKeyPressOnUp&&this.keyPressOnUpCodes.length>0){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";this.TextBeforeComposition="";this.Text="";AscCommon.stopEvent(e);return false}this.log("ti: onInput");this.Text= +this.getAreaValue();this.Text=this.Text.split(" ").join(" ");var codes=[];if(this.IsComposition||this.ApiIsComposition){var ieStart=-1;var ieEnd=-1;if(true){var target=e.target;if(target["msGetInputContext"]){var ctx=target["msGetInputContext"]();if(ctx){ieStart=ctx["compositionStartOffset"];ieEnd=ctx["compositionEndOffset"]}}}this.CompositionEnd=this.Text.length;this.CompositionStart=this.TextBeforeComposition.length;var textReplace=this.Text.substr(this.CompositionStart);var iter;for(iter= +textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){if(ieStart>this.CompositionStart){textReplace=textReplace.substr(0,ieStart-this.CompositionStart);codes=[];for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiCompositeReplace(codes);this.apiCompositeEnd();this.TextBeforeComposition=this.Text.substr(0,ieStart);this.apiCompositeStart();this.CompositionStart= +ieStart;codes=[];textReplace=this.Text.substr(this.CompositionStart);for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiCompositeReplace(codes)}else this.apiCompositeReplace(codes);if(!this.IsComposition){this.apiCompositeEnd();this.TextBeforeComposition=this.Text}}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeReplace(codes);this.apiCompositeEnd();this.clear();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true); +return false}}else{var textToApi=this.Text.substr(this.TextBeforeComposition.length);for(var iter=textToApi.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());if(codes.length>0)this.apiInputText(codes);this.TextBeforeComposition=this.Text}if(!this.IsComposition)if(this.Text.length>0){var _lastCode=this.Text.charCodeAt(this.Text.length-1);if(_lastCode==12290||_lastCode==46){AscCommon.stopEvent(e);if(AscCommon.AscBrowser.isIE&&!AscCommon.AscBrowser.isIeEdge)setTimeout(function(){window["AscCommon"].g_inputContext.clear(); +window["AscCommon"].g_inputContext.HtmlArea.focus()},0);else this.clear();return false}}},emulateNativeKeyDown:function(e,target){var oEvent=document.createEvent("KeyboardEvent");Object.defineProperty(oEvent,"keyCode",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"which",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"shiftKey",{get:function(){return this.shiftKeyVal}});Object.defineProperty(oEvent,"altKey",{get:function(){return this.altKeyVal}}); +Object.defineProperty(oEvent,"metaKey",{get:function(){return this.metaKeyVal}});Object.defineProperty(oEvent,"ctrlKey",{get:function(){return this.ctrlKeyVal}});if(AscCommon.AscBrowser.isIE)oEvent.preventDefault=function(){try{Object.defineProperty(this,"defaultPrevented",{get:function(){return true}})}catch(err){}};var k=e.keyCode;if(oEvent.initKeyboardEvent)oEvent.initKeyboardEvent("keydown",true,true,window,false,false,false,false,k,k);else oEvent.initKeyEvent("keydown",true,true,window,false, +false,false,false,k,0);oEvent.keyCodeVal=k;oEvent.shiftKeyVal=e.shiftKey;oEvent.altKeyVal=e.altKey;oEvent.metaKeyVal=e.metaKey;oEvent.ctrlKeyVal=e.ctrlKey;var _elem=target?target:_getElementKeyboardDown(this.nativeFocusElement,3);_elem.dispatchEvent(oEvent);return oEvent.defaultPrevented},isSpaceSymbol:function(e){if(e.keyCode==32)return true;if(e.keyCode==229&&(e.code=="space"||e.code=="Space"||e.key=="Spacebar"))return true;return false},systemInputEnable:function(isEnabled){if(this.isSystem==isEnabled)return; +this.isSystem=isEnabled;this.HtmlArea.style.left=this.isSystem?"0px":"-"+(this.HtmlAreaWidth>>1)+"px";this.clear();if(this.isShow)this.unshow(true);if(this.Api.WordControl&&this.Api.WordControl.m_oLogicDocument&&this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState)this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState()},debugInputEnable:function(isEnabled){if(this.isDebug==isEnabled)return;this.isDebug=isEnabled;this.HtmlArea.style.left=this.isDebug?"0px":"-"+(this.HtmlAreaWidth>> +1)+"px"},apiInputText:function(codes){var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd()}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd();this.setReadOnly(false)});this.setReadOnly(true);return false}},onKeyDown:function(e){if(this.Api.isLongAction()){AscCommon.stopEvent(e);return false}if(this.isInputHelpersPresent)switch(e.keyCode){case 9:case 13:case 38:case 40:case 33:case 34:case 35:case 36:case 27:{window.g_asc_plugins.onPluginEvent2("onKeyDown", +{"keyCode":e.keyCode},this.isInputHelpers);AscCommon.stopEvent(e);return false}case 32:{if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}default:break}else if(32==e.keyCode);if(this.isSystem&&this.isShow){if(e.keyCode==13){var text=this.getAreaValue();var codes=[];for(var iter=text.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiInputText(codes);this.clear();this.unshow();AscCommon.stopEvent(e);return false}else if(e.keyCode== +27){this.clear();this.unshow();AscCommon.stopEvent(e);return false}return}if(null!=this.nativeFocusElement)if(this.emulateNativeKeyDown(e)){e.preventDefault();return false}var _code=e.keyCode;if(_code!=8&&_code!=46)this.KeyDownFlag=true;AscCommon.check_KeyboardEvent(e);var arrCodes=this.Api.getAddedTextOnKeyDown(AscCommon.global_keyboardEvent);var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(arrCodes,true);if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.onKeyDown(e); +this.onKeyUp(e);this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}var ret=this.Api.onKeyDown(e);switch(e.keyCode){case 8:{var oldKeyPressInput=this.keyPressInput;this.clear();if(oldKeyPressInput.length>1){this.keyPressInput=oldKeyPressInput.substr(0,oldKeyPressInput.length-1);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}return false}case 9:case 13:case 37:case 38:case 39:case 40:case 33:case 34:case 35:case 36:{this.clear(); return false}case 46:case 45:{if(!AscCommon.global_keyboardEvent.CtrlKey&&!AscCommon.global_keyboardEvent.ShiftKey){this.clear();return false}}default:break}if(e.keyCode==32&&AscCommon.global_keyboardEvent.CtrlKey&&!AscCommon.global_keyboardEvent.ShiftKey)if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onClick");return ret},onKeyPress:function(e){if(this.Api.isLongAction()||!this.Api.asc_IsFocus()||this.Api.isViewMode){AscCommon.stopEvent(e);return false}if(this.isSystem)return;if(this.KeyDownFlag)this.KeyPressFlag= true;if(this.IsComposition)return;if(e.which==13&&e.keyCode==13||e.which==10&&e.keyCode==10){AscCommon.stopEvent(e);return false}var c=e.which||e.keyCode;var isAsync=c>=32?AscFonts.FontPickerByCharacter.checkTextLight([c],true):false;if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace([c]);this.apiCompositeEnd();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}if(this.isKeyPressOnUp){var isSaveCode= true;switch(e.which){case 46:{isSaveCode=false;break}default:break}if(isSaveCode){if(this.isKeyPressOnUpStackedMode)this.keyPressOnUpCodes.push({which:e.which,charCode:e.charCode,keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,preventDefault:function(){}});return}}var ret=this.Api.onKeyPress(e);switch(e.which){case 46:{AscCommon.stopEvent(e);this.clear();return false}default:break}this.keyPressInput+=String.fromCharCode(e.which);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput", diff --git a/www/common/onlyoffice/v5/sdkjs/word/sdk-all-min.js b/www/common/onlyoffice/v5/sdkjs/word/sdk-all-min.js index e1996e324..947a79ccb 100644 --- a/www/common/onlyoffice/v5/sdkjs/word/sdk-all-min.js +++ b/www/common/onlyoffice/v5/sdkjs/word/sdk-all-min.js @@ -1677,7 +1677,7 @@ function(){this.isPreOpenLocks=false;for(var i=0;i");if(-1!= -nIndex)_html_format=_html_format.substring(0,nIndex+"".length);this.CommonIframe_PasteStart(_html_format,_text_format);return false}if(_text_format&&_text_format!=""){this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Text,_text_format);g_clipboardBase.Paste_End();return false}var items=_clipboard.items;if(null!=items&&0!=items.length){g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCount=items.length;g_clipboardBase.PasteImagesCounter=0;for(var i=0;i';if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount= -0}};reader.onabort=reader.onerror=function(e){g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount=0}};try{reader.readAsDataURL(blob)}catch(err){g_clipboardBase.PasteImagesCounter++}}else g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter== -g_clipboardBase.PasteImagesCount)g_clipboardBase.Paste_End();return false}}g_clipboardBase.Paste_End();return false},_private_onbeforepaste:function(e,isAttackEmulate){this._console_log("onbeforepaste");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select();return}return false},_private_onbeforecopy_select:function(){if(AscBrowser.isIE){this._console_log("onbeforecopy_select");this.CommonDiv= -this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}},_private_onbeforecopy:function(e,isAttackEmulate){this._console_log("onbeforecopy");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}return false},Init:function(_api){this.Api=_api;window["AscCommon"].g_specialPasteHelper.Init(_api); -this.ClosureParams.getData=function(type){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.getData)return null;var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{return _clipboard.getData(_type)}catch(e){}return null};this.ClosureParams.setData=function(type,_data){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.setData)return null; -var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{_clipboard.setData(_type,_data)}catch(e){}};if(!AscBrowser.isIE){document.oncopy=function(e){return g_clipboardBase._private_oncopy(e)};document.oncut=function(e){return g_clipboardBase._private_oncut(e)};document.onpaste=function(e){return g_clipboardBase._private_onpaste(e)};document["onbeforecopy"]=function(e){return g_clipboardBase._private_onbeforecopy(e)};document["onbeforecut"]=function(e){return g_clipboardBase._private_onbeforecopy(e)}; -document["onbeforepaste"]=function(e){return g_clipboardBase._private_onbeforepaste(e)}}else{document.addEventListener("copy",function(e){return g_clipboardBase._private_oncopy(e)});document.addEventListener("cut",function(e){return g_clipboardBase._private_oncut(e)});document.addEventListener("paste",function(e){return g_clipboardBase._private_onpaste(e)});document.addEventListener("beforepaste",function(e){return g_clipboardBase._private_onbeforepaste(e)});document.addEventListener("beforecopy", -function(e){return g_clipboardBase._private_onbeforecopy(e)});document.addEventListener("beforecut",function(e){return g_clipboardBase._private_onbeforecopy(e)})}if(this.IsCopyCutOnlyInEditable||this.IsPasteOnlyInEditable)document.onkeydown=function(e){if(!g_clipboardBase.Api.asc_IsFocus(true)||g_clipboardBase.Api.isLongAction())return;var isAltGr=AscCommon.getAltGr(e);if(isAltGr)return;var isCtrl=e.ctrlKey===true||e.metaKey===true;var isShift=e.shiftKey;var keyCode=e.keyCode;if(g_clipboardBase.IsCopyCutOnlyInEditable){var bIsBeforeCopyCutEmulate= -false;var _cut=false;if(isCtrl&&!isShift&&(keyCode==67||keyCode==88))bIsBeforeCopyCutEmulate=true;if(!isCtrl&&isShift&&keyCode==45){bIsBeforeCopyCutEmulate=true;_cut=true}if(bIsBeforeCopyCutEmulate){g_clipboardBase._console_log("emulate_beforecopycut");var isEmulate=false;try{isEmulate=_cut?document.execCommand("beforecut"):document.execCommand("beforecopy")}catch(err){}g_clipboardBase._private_onbeforecopy(undefined,!isEmulate)}}if(g_clipboardBase.IsPasteOnlyInEditable){var bIsBeforePasteEmulate= -false;if(isCtrl&&!isShift&&keyCode==86)bIsBeforePasteEmulate=true;if(!isCtrl&&isShift&&keyCode==45)bIsBeforePasteEmulate=true;if(bIsBeforePasteEmulate){g_clipboardBase._console_log("emulate_beforepaste");var isEmulate=false;try{isEmulate=document.execCommand("beforepaste")}catch(err$9){}g_clipboardBase._private_onbeforepaste(undefined,!isEmulate)}}};if(AscBrowser.isSafari&&false){this.CommonDiv=this.CommonDiv_Check();setInterval(function(){if(g_clipboardBase.Api.asc_IsFocus(true))g_clipboardBase.CommonDiv.focus()}, -100)}},IsWorking:function(){return this.CopyFlag||this.PasteFlag?true:false},StartFocus:function(){this.EndFocus(false);this.CopyPasteFocus=true;this.CopyPasteFocusTimer=setTimeout(function(){g_clipboardBase.EndFocus()},1E3)},EndFocus:function(isFocusToEditor){this.CopyPasteFocus=false;if(-1!=this.CopyPasteFocusTimer){clearTimeout(this.CopyPasteFocusTimer);this.CopyPasteFocusTimer=-1;if(false!==isFocusToEditor&&null!=this.inputContext)if(this.inputContext.HtmlArea)this.inputContext.HtmlArea.focus()}}, -IsFocus:function(){return this.CopyPasteFocus},CommonDiv_Check:function(){var ElemToSelect=document.getElementById(this.CommonDivId);if(!ElemToSelect){ElemToSelect=document.createElement("div");ElemToSelect.id=this.CommonDivId;ElemToSelect.className=this.CommonDivClassName;ElemToSelect.style.position="fixed";ElemToSelect.style.left="0px";ElemToSelect.style.top="-100px";ElemToSelect.style.width="10000px";ElemToSelect.style.height="100px";ElemToSelect.style.overflow="hidden";ElemToSelect.style.zIndex= --1E3;ElemToSelect.style.MozUserSelect="text";ElemToSelect.style.fontFamily="onlyofficeDefaultFont";ElemToSelect.style.fontSize="11pt";ElemToSelect.style.color="black";ElemToSelect.style["-khtml-user-select"]="text";ElemToSelect.style["-o-user-select"]="text";ElemToSelect.style["user-select"]="text";ElemToSelect.style["-webkit-user-select"]="text";ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());var _parent=""==this.CommonDivIdParent?document.body:document.getElementById(this.CommonDivIdParent); -_parent.appendChild(ElemToSelect)}else ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());return ElemToSelect},CommonDiv_Select:function(){var ElemToSelect=this.CommonDiv;if(window.getSelection){var selection=window.getSelection();var rangeToSelect=document.createRange();var is_gecko=AscBrowser.isGecko;if(is_gecko){ElemToSelect.appendChild(document.createTextNode("\u00a0"));ElemToSelect.insertBefore(document.createTextNode("\u00a0"),ElemToSelect.firstChild);rangeToSelect.setStartAfter(ElemToSelect.firstChild); -rangeToSelect.setEndBefore(ElemToSelect.lastChild)}else{var aChildNodes=ElemToSelect.childNodes;if(aChildNodes.length==1){var elem=aChildNodes[0];var wrap=document.createElement("b");wrap.setAttribute("style","font-weight:normal; background-color: transparent; color: transparent;");elem=ElemToSelect.removeChild(elem);wrap.appendChild(elem);ElemToSelect.appendChild(wrap)}rangeToSelect.selectNodeContents(ElemToSelect)}selection.removeAllRanges();selection.addRange(rangeToSelect)}else if(document.body.createTextRange){var rangeToSelect= -document.body.createTextRange();rangeToSelect.moveToElementText(ElemToSelect);rangeToSelect.select()}},CommonDiv_Start:function(){this.ClosureParams.overflowBody=document.body.style.overflow;document.body.style.overflow="hidden";this.ClosureParams.backgroundcolorBody=document.body.style["background-color"];document.body.style["background-color"]="transparent";var ElemToSelect=this.CommonDiv;ElemToSelect.style.display="block";while(ElemToSelect.hasChildNodes())ElemToSelect.removeChild(ElemToSelect.lastChild); -document.body.style.MozUserSelect="text";delete document.body.style["-khtml-user-select"];delete document.body.style["-o-user-select"];delete document.body.style["user-select"];document.body.style["-webkit-user-select"]="text";ElemToSelect.style.MozUserSelect="all"},CommonDiv_End:function(){var ElemToSelect=this.CommonDiv;if(ElemToSelect){ElemToSelect.style.display=AscBrowser.isSafari?"block":"none";ElemToSelect.style.MozUserSelect="none"}document.body.style.MozUserSelect="none";document.body.style["-khtml-user-select"]= -"none";document.body.style["-o-user-select"]="none";document.body.style["user-select"]="none";document.body.style["-webkit-user-select"]="none";document.body.style["background-color"]=this.ClosureParams.backgroundcolorBody;document.body.style.overflow=this.ClosureParams.overflowBody;this.CopyFlag=false;this.bCut=false;this.EndFocus()},CommonDiv_Copy:function(){this.CopyFlag=true;this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.ClosureParams.isDivCopy=true;this.DivOnCopyHtmlPresent= -false;this.DivOnCopyText="";this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.ClosureParams.isDivCopy=false;if(!this.DivOnCopyHtmlPresent&&this.DivOnCopyText!="")this.CommonDiv.innerHTML=this.DivOnCopyText;this.DivOnCopyHtmlPresent=false;this.DivOnCopyText="";this.CommonDiv_Select();window.setTimeout(function(){g_clipboardBase.CommonDiv_End()},0)},CommonDiv_Execute_CopyCut:function(){if(this.IsCopyCutOnlyInEditable)this._private_onbeforecopy(undefined, -true)},CommonIframe_PasteStart:function(_html_data,text_data){var ifr=document.getElementById(this.CommonIframeId);if(!ifr){ifr=document.createElement("iframe");ifr.name=this.CommonIframeId;ifr.id=this.CommonIframeId;ifr.style.position="absolute";ifr.style.top="-100px";ifr.style.left="0px";ifr.style.width="10000px";ifr.style.height="100px";ifr.style.overflow="hidden";ifr.style.zIndex=-1E3;ifr.setAttribute("sandbox","allow-same-origin");document.body.appendChild(ifr);this.CommonIframe=ifr}else ifr.style.width= -"10000px";var frameWindow=window.frames[this.CommonIframeId];if(frameWindow){frameWindow.document.open();frameWindow.document.write(_html_data);frameWindow.document.close();if(null!=frameWindow.document&&null!=frameWindow.document.body){ifr.style.display="block";this.pastedFrom=definePastedFrom(frameWindow.document);this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.HtmlElement,frameWindow.document.body,ifr,text_data)}}ifr.style.width="100px";g_clipboardBase.Paste_End()},CommonIframe_PasteEnd:function(){if(this.CommonIframe&& -this.CommonIframe.style.display!="none"){this.CommonIframe.blur();this.CommonIframe.style.display="none"}},Paste_End:function(){this.CommonIframe_PasteEnd();this.Api.decrementCounterLongAction();this.PasteFlag=false;this.EndFocus();if(this.needClearBuffer){this.ClearBuffer();this.needClearBuffer=false}},pushData:function(_format,_data){if(null==this.LastCopyBinary)this.LastCopyBinary=[];this.LastCopyBinary.push({type:_format,data:_data});if(this.ClosureParams.isDivCopy===true){if(!this.isCopyOutEnabled())return; -if(_format==AscCommon.c_oAscClipboardDataFormat.Html){this.CommonDiv.innerHTML=_data;this.DivOnCopyHtmlPresent=true}if(_format==AscCommon.c_oAscClipboardDataFormat.Text)this.DivOnCopyText=_data;return}var _data_format="";switch(_format){case AscCommon.c_oAscClipboardDataFormat.Html:_data_format="text/html";break;case AscCommon.c_oAscClipboardDataFormat.Text:_data_format="text/plain";break;case AscCommon.c_oAscClipboardDataFormat.Internal:_data_format="text/x-custom";break;default:break}if(_data_format!= -""&&_data!==null&&this.isCopyOutEnabled())if(_data_format=="text/x-custom")this.ClosureParams.setData(_data_format,"asc_internalData2;"+_data);else this.ClosureParams.setData(_data_format,_data)},Button_Copy:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("copy")}catch(err){_ret= -false}if(!_ret){this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal)}return _ret},Button_Cut:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("cut")}catch(err){_ret= -false}if(!_ret){this.LastCopyBinary=null;this.bCut=true;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.Api.asc_SelectionCut();this.bCut=false}return _ret},Button_Paste:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true,true);var _ret=false;try{_ret=document.execCommand("paste")}catch(err){_ret= -false}if(!_ret&&null!=this.LastCopyBinary){var _data=null;var _isInternal=false;for(var i=0;i0)this.Api.asc_PasteData(this.LastCopyBinary[0].type,this.LastCopyBinary[0].data)}return _ret},ClearBuffer:function(){if(-1!=this.clearBufferTimerId)clearTimeout(this.clearBufferTimerId); -this.clearBufferTimerId=setTimeout(function(){if(AscCommon.g_clipboardBase)AscCommon.g_clipboardBase.clearBufferTimerId=-1},500);this.Button_Copy()},isCopyOutEnabled:function(){if(this.Api&&this.Api.isCopyOutEnabled)return this.Api.isCopyOutEnabled();return true}};function definePastedFrom(doc){if(!doc)return null;var res=null;var metaTags=doc.getElementsByTagName("meta");for(var i=0;i>1)+"px;top:"+-this.HtmlAreaOffset+"px;";_style+="background:transparent;border:none;position:absolute;text-shadow:0 0 0 #000;outline:none;color:transparent;width:"+this.HtmlAreaWidth+"px;height:50px;";_style+="overflow:hidden;padding:0px;margin:0px;font-family:arial;resize:none;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;"; -_style+="touch-action: none;-webkit-touch-callout: none;color:transparent;caret-color:transparent;";_style+=AscCommon.AscBrowser.isAppleDevices?"font-size:0px;":"font-size:8px;";this.HtmlArea.setAttribute("style",_style);this.HtmlArea.setAttribute("spellcheck",false);this.HtmlArea.setAttribute("autocapitalize","none");this.HtmlArea.setAttribute("autocomplete","off");this.HtmlArea.setAttribute("autocorrect","off");this.HtmlDiv.appendChild(this.HtmlArea);if(true){var oHtmlDivScrollable=document.createElement("div"); -oHtmlDivScrollable.id="area_id_main";oHtmlDivScrollable.setAttribute("style","background:transparent;border:none;position:absolute;padding:0px;margin:0px;z-index:0;pointer-events:none;");var parentStyle=getComputedStyle(oHtmlParent);oHtmlDivScrollable.style.left=parentStyle.left;oHtmlDivScrollable.style.top=parentStyle.top;oHtmlDivScrollable.style.width=parentStyle.width;oHtmlDivScrollable.style.height=parentStyle.height;oHtmlDivScrollable.style.overflow="hidden";oHtmlDivScrollable.appendChild(this.HtmlDiv); -oHtmlParent.parentNode.appendChild(oHtmlDivScrollable)}else oHtmlParent.appendChild(this.HtmlDiv);var oThis=this;this.HtmlArea["onkeydown"]=function(e){if(AscCommon.AscBrowser.isSafariMacOs){var cmdButton=e.ctrlKey||e.metaKey?true:false;var buttonCode=e.keyCode==67||e.keyCode==88||e.keyCode==86;if(cmdButton&&buttonCode)oThis.IsDisableKeyPress=true;else oThis.IsDisableKeyPress=false}return oThis.onKeyDown(e)};this.HtmlArea["onkeypress"]=function(e){if(oThis.IsDisableKeyPress==true){oThis.IsDisableKeyPress= -false;var cmdButton=e.ctrlKey||e.metaKey?true:false;if(cmdButton)return}return oThis.onKeyPress(e)};this.HtmlArea["onkeyup"]=function(e){oThis.IsDisableKeyPress=false;return oThis.onKeyUp(e)};this.HtmlArea.addEventListener("input",function(e){return oThis.onInput(e)},false);this.HtmlArea.addEventListener("compositionstart",function(e){return oThis.onCompositionStart(e)},false);this.HtmlArea.addEventListener("compositionupdate",function(e){return oThis.onCompositionUpdate(e)},false);this.HtmlArea.addEventListener("compositionend", -function(e){return oThis.onCompositionEnd(e)},false);this.show();this.Api.Input_UpdatePos();if(AscCommon.AscBrowser.isAndroid)this.HtmlArea.onclick=function(e){var _this=AscCommon.g_inputContext;if(-1!=_this.virtualKeyboardClickTimeout){clearTimeout(_this.virtualKeyboardClickTimeout);_this.virtualKeyboardClickTimeout=-1}_this.apiCompositeEnd();if(!_this.virtualKeyboardClickPrevent)return;_this.setReadOnlyWrapper(true);_this.virtualKeyboardClickPrevent=false;AscCommon.stopEvent(e);_this.virtualKeyboardClickTimeout= -setTimeout(function(){_this.setReadOnlyWrapper(false);_this.virtualKeyboardClickTimeout=-1},1);return false}},onResize:function(_editorContainerId){var _elem=document.getElementById("area_id_main");var _elemSrc=document.getElementById(_editorContainerId);if(!_elem||!_elemSrc)return;if(AscCommon.AscBrowser.isChrome){var rectObject=_elemSrc.getBoundingClientRect();this.FixedPosCheckElementX=rectObject.left;this.FixedPosCheckElementY=rectObject.top}var _width=_elemSrc.style.width;if((null==_width||""== -_width)&&window.getComputedStyle){var _s=window.getComputedStyle(_elemSrc);_elem.style.left=_s.left;_elem.style.top=_s.top;_elem.style.width=_s.width;_elem.style.height=_s.height}else{_elem.style.left=_elemSrc.style.left;_elem.style.top=_elemSrc.style.top;_elem.style.width=_width;_elem.style.height=_elemSrc.style.height}if(this.Api.isMobileVersion){var _elem1=document.getElementById("area_id_parent");var _elem2=document.getElementById("area_id");_elem1.parentNode.style.pointerEvents="";_elem1.style.left= -"0px";_elem1.style.top="-1000px";_elem1.style.right="0px";_elem1.style.bottom="-100px";_elem1.style.width="auto";_elem1.style.height="auto";_elem2.style.left="0px";_elem2.style.top="0px";_elem2.style.right="0px";_elem2.style.bottom="0px";_elem2.style.width="100%";_elem2.style.height="100%";if(AscCommon.AscBrowser.isIE){document.body.style["msTouchAction"]="none";document.body.style["touchAction"]="none"}}var _editorSdk=document.getElementById("editor_sdk");this.editorSdkW=_editorSdk.clientWidth;this.editorSdkH= -_editorSdk.clientHeight},checkFocus:function(){if(this.Api.asc_IsFocus()&&!AscCommon.g_clipboardBase.IsFocus()&&!AscCommon.g_clipboardBase.IsWorking())if(document.activeElement!=this.HtmlArea)this.HtmlArea.focus()},move:function(x,y){if(this.Api.isMobileVersion)return;var oTarget=document.getElementById(this.TargetId);if(!oTarget)return;var xPos=x?x:parseInt(oTarget.style.left);var yPos=(y?y:parseInt(oTarget.style.top))+parseInt(oTarget.style.height);if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)xPos= --100;if(!this.isDebug&&!this.isSystem){this.HtmlDiv.style.left=xPos+this.FixedPosCheckElementX+"px";this.HtmlDiv.style.top=yPos+this.FixedPosCheckElementY+this.TargetOffsetY+this.HtmlAreaOffset+"px";this.HtmlArea.scrollTop=this.HtmlArea.scrollHeight}else this.debugCalculatePlace(xPos+this.FixedPosCheckElementX,yPos+this.FixedPosCheckElementY+this.TargetOffsetY);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onTargetPositionChanged")},emulateKeyDownApi:function(code){var _e={altKey:false, -ctrlKey:false,shiftKey:false,target:null,charCode:0,which:code,keyCode:code,code:"",preventDefault:function(){},stopPropagation:function(){}};this.Api.onKeyDown(_e);this.Api.onKeyUp(_e)},clear:function(isFromFocus){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";if(isFromFocus!==true)this.HtmlArea.focus();this.TextBeforeComposition="";this.Text="";this.Target=0;this.CompositionStart=0;this.CompositionEnd=0;this.IsComposition=false;this.keyPressInput= -"";if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperClear")},getAreaValue:function(){return this.TextArea_Not_ContentEditableDiv?this.HtmlArea.value:this.HtmlArea.innerText},setReadOnly:function(isLock){if(isLock)this.ReadOnlyCounter++;else this.ReadOnlyCounter--;this.setReadOnlyWrapper(0>=this.ReadOnlyCounter?false:true)},setReadOnlyWrapper:function(val){this.HtmlArea.readOnly=this.Api.isViewMode?true:val},show:function(){if(this.isDebug||this.isSystem){this.log("ti: show"); -document.getElementById("area_id_main").style.zIndex=10;this.HtmlArea.style.top="0px";this.HtmlArea.style.width="100%";this.HtmlArea.style.height="100%";this.HtmlArea.style.background="#FFFFFF";this.HtmlArea.style.color="black";this.HtmlDiv.style.zIndex=90;this.HtmlDiv.style.border="2px solid #4363A4";this.isShow=true}},unshow:function(isAttack){if(this.isDebug||this.isSystem||true==isAttack){this.log("ti: unshow");document.getElementById("area_id_main").style.zIndex=0;this.HtmlArea.style.top=-this.HtmlAreaOffset+ -"px";this.HtmlArea.style.width="1000px";this.HtmlArea.style.height="50px";this.HtmlArea.style.background="transparent";this.HtmlArea.style.color="transparent";this.HtmlDiv.style.zIndex=0;this.HtmlDiv.style.border="none";this.isShow=false}},debugCalculatePlace:function(x,y){var _left=x;var _top=y;if(undefined==_left)_left=parseInt(this.HtmlDiv.style.left);if(undefined==_top)_top=parseInt(this.HtmlDiv.style.top);var _r_max=this.editorSdkW;var _b_max=this.editorSdkH;_r_max-=60;if(_r_max-_left>50)this.debugTexBoxMaxW= -_r_max-_left;else{_left=_r_max-50;this.debugTexBoxMaxW=50}_b_max-=40;if(_b_max-_top>50)this.debugTexBoxMaxH=_b_max-_top;else{_top=_b_max-50;this.debugTexBoxMaxH=50}if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)_left=-100;this.HtmlDiv.style.left=_left+"px";this.HtmlDiv.style.top=_top+"px";var _height=22;var _t=this.getAreaValue();if(0!=_t.length){var _editorSdk=document.getElementById("editor_sdk");var _p=document.createElement("p");_p.style.zIndex="-1";_p.style.position="absolute"; -_p.style.fontFamily="arial";_p.style.fontSize="12pt";_p.style.left="0px";_p.style.width=this.debugTexBoxMaxW+"px";_editorSdk.appendChild(_p);_t=_t.replace(/ /g," ");_p.innerHTML=""+_t+"";var _width=_p.firstChild.offsetWidth;_width=Math.min(_width+20,this.debugTexBoxMaxW);if(AscCommon.AscBrowser.isIE)_width+=10;var area=document.createElement("textarea");area.style.zIndex="-1";area.id="area2_id";area.rows=1;area.setAttribute("style","font-family:arial;font-size:12pt;position:absolute;resize:none;padding:0px;margin:0px;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;"); -area.style.overflow="hidden";area.style.width=_width+"px";_editorSdk.appendChild(area);area.value=this.getAreaValue();_height=area.clientHeight;if(area.scrollHeight>_height)_height=area.scrollHeight;_editorSdk.removeChild(_p);_editorSdk.removeChild(area)}if(_height>this.debugTexBoxMaxH)_height=this.debugTexBoxMaxH;this.HtmlDiv.style.width=_width+"px";this.HtmlDiv.style.height=_height+"px";var oldZindex=parseInt(this.HtmlDiv.style.zIndex);var newZindex=oldZindex==90?"89":"90";this.HtmlDiv.style.zIndex= -newZindex},onInput:function(e,isFromCompositionUpdate){if(this.Api.isLongAction()||this.Api.isViewMode){AscCommon.stopEvent(e);return false}if(this.isSystem){if(!this.isShow)this.show();this.debugCalculatePlace(undefined,undefined);return}if(this.isKeyPressOnUp&&this.keyPressOnUpCodes.length>0){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";this.TextBeforeComposition="";this.Text="";AscCommon.stopEvent(e);return false}this.log("ti: onInput");this.Text= -this.getAreaValue();this.Text=this.Text.split(" ").join(" ");var codes=[];if(this.IsComposition||this.ApiIsComposition){var ieStart=-1;var ieEnd=-1;if(true){var target=e.target;if(target["msGetInputContext"]){var ctx=target["msGetInputContext"]();if(ctx){ieStart=ctx["compositionStartOffset"];ieEnd=ctx["compositionEndOffset"]}}}this.CompositionEnd=this.Text.length;this.CompositionStart=this.TextBeforeComposition.length;var textReplace=this.Text.substr(this.CompositionStart);var iter;for(iter= -textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){if(ieStart>this.CompositionStart){textReplace=textReplace.substr(0,ieStart-this.CompositionStart);codes=[];for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiCompositeReplace(codes);this.apiCompositeEnd();this.TextBeforeComposition=this.Text.substr(0,ieStart);this.apiCompositeStart();this.CompositionStart= -ieStart;codes=[];textReplace=this.Text.substr(this.CompositionStart);for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiCompositeReplace(codes)}else this.apiCompositeReplace(codes);if(!this.IsComposition){this.apiCompositeEnd();this.TextBeforeComposition=this.Text}}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeReplace(codes);this.apiCompositeEnd();this.clear();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true); -return false}}else{var textToApi=this.Text.substr(this.TextBeforeComposition.length);for(var iter=textToApi.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());if(codes.length>0)this.apiInputText(codes);this.TextBeforeComposition=this.Text}if(!this.IsComposition)if(this.Text.length>0){var _lastCode=this.Text.charCodeAt(this.Text.length-1);if(_lastCode==12290||_lastCode==46){AscCommon.stopEvent(e);if(AscCommon.AscBrowser.isIE&&!AscCommon.AscBrowser.isIeEdge)setTimeout(function(){window["AscCommon"].g_inputContext.clear(); -window["AscCommon"].g_inputContext.HtmlArea.focus()},0);else this.clear();return false}}},emulateNativeKeyDown:function(e,target){var oEvent=document.createEvent("KeyboardEvent");Object.defineProperty(oEvent,"keyCode",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"which",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"shiftKey",{get:function(){return this.shiftKeyVal}});Object.defineProperty(oEvent,"altKey",{get:function(){return this.altKeyVal}}); -Object.defineProperty(oEvent,"metaKey",{get:function(){return this.metaKeyVal}});Object.defineProperty(oEvent,"ctrlKey",{get:function(){return this.ctrlKeyVal}});if(AscCommon.AscBrowser.isIE)oEvent.preventDefault=function(){try{Object.defineProperty(this,"defaultPrevented",{get:function(){return true}})}catch(err){}};var k=e.keyCode;if(oEvent.initKeyboardEvent)oEvent.initKeyboardEvent("keydown",true,true,window,false,false,false,false,k,k);else oEvent.initKeyEvent("keydown",true,true,window,false, -false,false,false,k,0);oEvent.keyCodeVal=k;oEvent.shiftKeyVal=e.shiftKey;oEvent.altKeyVal=e.altKey;oEvent.metaKeyVal=e.metaKey;oEvent.ctrlKeyVal=e.ctrlKey;var _elem=target?target:_getElementKeyboardDown(this.nativeFocusElement,3);_elem.dispatchEvent(oEvent);return oEvent.defaultPrevented},isSpaceSymbol:function(e){if(e.keyCode==32)return true;if(e.keyCode==229&&(e.code=="space"||e.code=="Space"||e.key=="Spacebar"))return true;return false},systemInputEnable:function(isEnabled){if(this.isSystem==isEnabled)return; -this.isSystem=isEnabled;this.HtmlArea.style.left=this.isSystem?"0px":"-"+(this.HtmlAreaWidth>>1)+"px";this.clear();if(this.isShow)this.unshow(true);if(this.Api.WordControl&&this.Api.WordControl.m_oLogicDocument&&this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState)this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState()},debugInputEnable:function(isEnabled){if(this.isDebug==isEnabled)return;this.isDebug=isEnabled;this.HtmlArea.style.left=this.isDebug?"0px":"-"+(this.HtmlAreaWidth>> -1)+"px"},apiInputText:function(codes){var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd()}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd();this.setReadOnly(false)});this.setReadOnly(true);return false}},onKeyDown:function(e){if(this.Api.isLongAction()){AscCommon.stopEvent(e);return false}if(this.isInputHelpersPresent)switch(e.keyCode){case 9:case 13:case 38:case 40:case 33:case 34:case 35:case 36:case 27:{window.g_asc_plugins.onPluginEvent2("onKeyDown", -{"keyCode":e.keyCode},this.isInputHelpers);AscCommon.stopEvent(e);return false}case 32:{if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}default:break}else if(32==e.keyCode);if(this.isSystem&&this.isShow){if(e.keyCode==13){var text=this.getAreaValue();var codes=[];for(var iter=text.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiInputText(codes);this.clear();this.unshow();AscCommon.stopEvent(e);return false}else if(e.keyCode== -27){this.clear();this.unshow();AscCommon.stopEvent(e);return false}return}if(null!=this.nativeFocusElement)if(this.emulateNativeKeyDown(e)){e.preventDefault();return false}var _code=e.keyCode;if(_code!=8&&_code!=46)this.KeyDownFlag=true;AscCommon.check_KeyboardEvent(e);var arrCodes=this.Api.getAddedTextOnKeyDown(AscCommon.global_keyboardEvent);var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(arrCodes,true);if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.onKeyDown(e); -this.onKeyUp(e);this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}var ret=this.Api.onKeyDown(e);switch(e.keyCode){case 8:{var oldKeyPressInput=this.keyPressInput;this.clear();if(oldKeyPressInput.length>1){this.keyPressInput=oldKeyPressInput.substr(0,oldKeyPressInput.length-1);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}return false}case 9:case 13:case 37:case 38:case 39:case 40:case 33:case 34:case 35:case 36:{this.clear(); -return false}case 46:case 45:{if(!AscCommon.global_keyboardEvent.CtrlKey&&!AscCommon.global_keyboardEvent.ShiftKey){this.clear();return false}}default:break}if(e.keyCode==32&&AscCommon.global_keyboardEvent.CtrlKey&&!AscCommon.global_keyboardEvent.ShiftKey)if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onClick");return ret},onKeyPress:function(e){if(this.Api.isLongAction()||!this.Api.asc_IsFocus()||this.Api.isViewMode){AscCommon.stopEvent(e);return false}if(this.isSystem)return;if(this.KeyDownFlag)this.KeyPressFlag= -true;if(this.IsComposition)return;if(e.which==13&&e.keyCode==13||e.which==10&&e.keyCode==10){AscCommon.stopEvent(e);return false}var c=e.which||e.keyCode;var isAsync=c>=32?AscFonts.FontPickerByCharacter.checkTextLight([c],true):false;if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace([c]);this.apiCompositeEnd();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}if(this.isKeyPressOnUp){var isSaveCode= -true;switch(e.which){case 46:{isSaveCode=false;break}default:break}if(isSaveCode){if(this.isKeyPressOnUpStackedMode)this.keyPressOnUpCodes.push({which:e.which,charCode:e.charCode,keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,preventDefault:function(){}});return}}var ret=this.Api.onKeyPress(e);switch(e.which){case 46:{AscCommon.stopEvent(e);this.clear();return false}default:break}this.keyPressInput+=String.fromCharCode(e.which);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput", -{"text":this.keyPressInput});AscCommon.stopEvent(e);return ret},onKeyUp:function(e){if(this.Api.isLongAction()){AscCommon.stopEvent(e);return false}if(this.isSystem&&this.isShow)return;if(this.isKeyPressOnUp&&this.keyPressOnUpCodes.length>0){this.isKeyPressOnUp=false;for(var i=0;i0){var range=sel.getRangeAt(0);_offset=range.endOffset}}return _offset},checkTargetPosition:function(isCorrect){var _offset=this.getAreaPos();if(false!==isCorrect){var _value=this.getAreaValue();_offset-=_value.length-this.compositionValue.length}if(!this.IsLockTargetMode)if(_offset==0&&this.compositionValue.length==1)_offset=1;this.Api.Set_CursorPosInCompositeText(_offset); -this.unlockTarget()},lockTarget:function(){if(!this.IsLockTargetMode)return;if(-1!=this.LockerTargetTimer)clearTimeout(this.LockerTargetTimer);this.Api.asc_LockTargetUpdate(true);var oThis=this;this.LockerTargetTimer=setTimeout(function(){oThis.unlockTarget()},1E3)},unlockTarget:function(){if(!this.IsLockTargetMode)return;if(-1!=this.LockerTargetTimer)clearTimeout(this.LockerTargetTimer);this.LockerTargetTimer=-1;this.Api.asc_LockTargetUpdate(false)},clearLastCompositeText:function(){this.LastReplaceText= -[];this.IsLastReplaceFlag=false},apiCompositeStart:function(){},apiCompositeReplace:function(_value){if(this.Api.isLongAction())return false;if(!this.ApiIsComposition){this.Api.Begin_CompositeInput();this.clearLastCompositeText()}this.ApiIsComposition=true;if(this.IsLastReplaceFlag)if(_value.length==this.LastReplaceText.length){var isEqual=true;for(var nC=0;nC<_value.length;nC++)if(_value[nC]!=this.LastReplaceText[nC]){isEqual=false;break}if(isEqual)return}this.Api.Replace_CompositeText(_value);if(window.g_asc_plugins){this.keyPressInput= -String.fromCodePoint.apply(this,_value);window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}this.LastReplaceText=_value.slice();this.IsLastReplaceFlag=true},apiCompositeEnd:function(){if(!this.ApiIsComposition)return;this.ApiIsComposition=false;this.Api.End_CompositeInput();this.clearLastCompositeText()},onCompositionStart:function(e){if(this.isSystem)return;this.IsComposition=true;this.keyPressOnUpCodes=[]},onCompositionUpdate:function(e){if(this.isSystem)return; -this.IsComposition=true;this.keyPressOnUpCodes=[];this.onInput(e,true)},onCompositionEnd:function(e){if(this.isSystem)return;this.IsComposition=false;this.onInput(e,true)},setInterfaceEnableKeyEvents:function(value){this.InterfaceEnableKeyEvents=value;if(true==this.InterfaceEnableKeyEvents){if(document.activeElement){var _id=document.activeElement.id;if(_id=="area_id"||window.g_asc_plugins&&window.g_asc_plugins.checkRunnedFrameId(_id))return}this.HtmlArea.focus()}},externalEndCompositeInput:function(){this.clear()}, -externalChangeFocus:function(){if(!this.IsComposition)return false;setTimeout(function(){window["AscCommon"].g_inputContext.clear()},10);return true},isCompositionProcess:function(){return this.IsComposition},preventVirtualKeyboard:function(e){if(this.isHardCheckKeyboard)return;if(AscCommon.AscBrowser.isAndroid){this.setReadOnlyWrapper(true);this.virtualKeyboardClickPrevent=true;this.virtualKeyboardClickTimeout=setTimeout(function(){window["AscCommon"].g_inputContext.setReadOnlyWrapper(false);window["AscCommon"].g_inputContext.virtualKeyboardClickTimeout= --1},1)}},enableVirtualKeyboard:function(){if(this.isHardCheckKeyboard)return;if(AscCommon.AscBrowser.isAndroid){if(-1!=this.virtualKeyboardClickTimeout){clearTimeout(this.virtualKeyboardClickTimeout);this.virtualKeyboardClickTimeout=-1}this.setReadOnlyWrapper(false);this.virtualKeyboardClickPrevent=false}},preventVirtualKeyboard_Hard:function(){this.setReadOnlyWrapper(true)},enableVirtualKeyboard_Hard:function(){this.setReadOnlyWrapper(false)}};function _getAttirbute(_elem,_attr,_depth){var _elemTest= -_elem;for(var _level=0;_elemTest&&_level<_depth;++_level,_elemTest=_elemTest.parentNode){var _res=_elemTest.getAttribute?_elemTest.getAttribute(_attr):null;if(null!=_res)return _res}return null}function _getElementKeyboardDown(_elem,_depth){var _elemTest=_elem;for(var _level=0;_elemTest&&_level<_depth;++_level,_elemTest=_elemTest.parentNode){var _res=_elemTest.getAttribute?_elemTest.getAttribute("oo_editor_keyboard"):null;if(null!=_res)return _elemTest}return null}function _getDefaultKeyboardInput(_elem, -_depth){var _elemTest=_elem;for(var _level=0;_elemTest&&_level<_depth;++_level,_elemTest=_elemTest.parentNode){var _name=" "+_elemTest.className+" ";if(_name.indexOf(" dropdown-menu")>-1||_name.indexOf(" dropdown-toggle ")>-1||_name.indexOf(" dropdown-submenu ")>-1||_name.indexOf(" canfocused ")>-1)return"true"}return null}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CTextInput=CTextInput;window["AscCommon"].InitBrowserInputContext=function(api,target_id,parent_id){if(window["AscCommon"].g_inputContext)return; -window["AscCommon"].g_inputContext=new CTextInput(api);window["AscCommon"].g_inputContext.init(target_id,parent_id);window["AscCommon"].g_clipboardBase.Init(api);window["AscCommon"].g_clipboardBase.inputContext=window["AscCommon"].g_inputContext;if(window["AscCommon"].TextBoxInputMode===true)window["AscCommon"].g_inputContext.systemInputEnable(true);document.addEventListener("focus",function(e){var t=window["AscCommon"].g_inputContext;var _oldNativeFE=t.nativeFocusElement;t.nativeFocusElement=e.target; -if(t.IsComposition){t.apiCompositeEnd();t.externalEndCompositeInput()}if(!t.isSystem&&!t.isNoClearOnFocus)t.clear(true);t.isNoClearOnFocus=false;var _nativeFocusElementNoRemoveOnElementFocus=t.nativeFocusElementNoRemoveOnElementFocus;t.nativeFocusElementNoRemoveOnElementFocus=false;if(t.InterfaceEnableKeyEvents==false){t.nativeFocusElement=null;return}if(t.nativeFocusElement&&t.nativeFocusElement.id==t.HtmlArea.id){t.Api.asc_enableKeyEvents(true,true);if(_nativeFocusElementNoRemoveOnElementFocus)t.nativeFocusElement= -_oldNativeFE;else t.nativeFocusElement=null;return}if(t.nativeFocusElement&&t.nativeFocusElement.id==window["AscCommon"].g_clipboardBase.CommonDivId){t.nativeFocusElement=null;return}t.nativeFocusElementNoRemoveOnElementFocus=false;var _isElementEditable=false;if(t.nativeFocusElement){var _name=t.nativeFocusElement.nodeName;if(_name)_name=_name.toUpperCase();if("INPUT"==_name||"TEXTAREA"==_name)_isElementEditable=true;else if("DIV"==_name)if(t.nativeFocusElement.getAttribute("contenteditable")=="true")_isElementEditable= -true}if("IFRAME"==_name){t.Api.asc_enableKeyEvents(false,true);t.nativeFocusElement=null;return}var _oo_editor_input=_getAttirbute(t.nativeFocusElement,"oo_editor_input",3);var _oo_editor_keyboard=_getAttirbute(t.nativeFocusElement,"oo_editor_keyboard",3);if(!_oo_editor_input&&!_oo_editor_keyboard)_oo_editor_input=_getDefaultKeyboardInput(t.nativeFocusElement,3);if(_oo_editor_keyboard=="true")_oo_editor_input=undefined;if(_oo_editor_input=="true"){t.Api.asc_enableKeyEvents(false,true);t.nativeFocusElement= -null;return}if(_isElementEditable&&_oo_editor_input!="false"){t.Api.asc_enableKeyEvents(false,true);t.nativeFocusElement=null;return}if(_oo_editor_keyboard!="true")t.nativeFocusElement=null;var _elem=t.nativeFocusElement;t.nativeFocusElementNoRemoveOnElementFocus=true;AscCommon.AscBrowser.isMozilla?setTimeout(function(){t.HtmlArea.focus()},0):t.HtmlArea.focus();t.nativeFocusElement=_elem;t.Api.asc_enableKeyEvents(true,true)},true);if(!api.isMobileVersion&&!api.isEmbedVersion)window["AscCommon"].g_inputContext.HtmlArea.focus()}; -window["SetInputDebugMode"]=function(){if(!window["AscCommon"].g_inputContext)return;window["AscCommon"].g_inputContext.debugInputEnable(true);window["AscCommon"].g_inputContext.show()}})(window);"use strict";(function(window,undefined){function COleSize(w,h){this.w=w;this.h=h}COleSize.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.w);Writer.WriteLong(this.h)};COleSize.prototype.Read_FromBinary=function(Reader){this.w=Reader.GetLong();this.h=Reader.GetLong()};AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetData]= -AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetApplicationId]=AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetPixSizes]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetObjectFile]=AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetOleType]=AscDFH.CChangesDrawingsLong;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryDefRPr]=AscCommonWord.CTextPr; -function CChangesOleObjectBinary(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this,Class,Old,New,Color)}CChangesOleObjectBinary.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesOleObjectBinary.prototype.Type=AscDFH.historyitem_ImageShapeSetBinaryData;CChangesOleObjectBinary.prototype.private_SetValue=function(Value){this.Class.m_aBinaryData=Value};CChangesOleObjectBinary.prototype.WriteToBinary=function(Writer){Writer.WriteBool(this.New!==null);if(this.New!==null){Writer.WriteLong(this.New.length); -Writer.WriteBuffer(this.New,0,this.New.length)}};CChangesOleObjectBinary.prototype.ReadFromBinary=function(Reader){if(Reader.GetBool()){var length=Reader.GetLong();this.New=Reader.GetBuffer(length)}};AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetBinaryData]=CChangesOleObjectBinary;AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetData]=function(oClass,value){oClass.m_sData=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetApplicationId]=function(oClass,value){oClass.m_sApplicationId= -value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetPixSizes]=function(oClass,value){if(value){oClass.m_nPixWidth=value.w;oClass.m_nPixHeight=value.h}};AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ImageShapeSetPixSizes]=COleSize;AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetObjectFile]=function(oClass,value){oClass.m_sObjectFile=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetOleType]=function(oClass,value){oClass.m_nOleType=value};function COleObject(){AscFormat.CImageShape.call(this); -this.m_sData=null;this.m_sApplicationId=null;this.m_nPixWidth=null;this.m_nPixHeight=null;this.m_fDefaultSizeX=null;this.m_fDefaultSizeY=null;this.m_sObjectFile=null;this.m_nOleType=null;this.m_aBinaryData=null}COleObject.prototype=Object.create(AscFormat.CImageShape.prototype);COleObject.prototype.constructor=COleObject;COleObject.prototype.getObjectType=function(){return AscDFH.historyitem_type_OleObject};COleObject.prototype.setData=function(sData){AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this, -AscDFH.historyitem_ImageShapeSetData,this.m_sData,sData));this.m_sData=sData};COleObject.prototype.setApplicationId=function(sApplicationId){AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this,AscDFH.historyitem_ImageShapeSetApplicationId,this.m_sApplicationId,sApplicationId));this.m_sApplicationId=sApplicationId};COleObject.prototype.setPixSizes=function(nPixWidth,nPixHeight){AscCommon.History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ImageShapeSetPixSizes,new COleSize(this.m_nPixWidth, -this.m_nPixHeight),new COleSize(nPixWidth,nPixHeight)));this.m_nPixWidth=nPixWidth;this.m_nPixHeight=nPixHeight};COleObject.prototype.setObjectFile=function(sObjectFile){AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this,AscDFH.historyitem_ImageShapeSetObjectFile,this.m_sObjectFile,sObjectFile));this.m_sObjectFile=sObjectFile};COleObject.prototype.setOleType=function(nOleType){AscCommon.History.Add(new AscDFH.CChangesDrawingsLong(this,AscDFH.historyitem_ImageShapeSetOleType,this.m_nOleType, -nOleType));this.m_nOleType=nOleType};COleObject.prototype.setBinaryData=function(aBinaryData){AscCommon.History.Add(new CChangesOleObjectBinary(this,this.m_aBinaryData,aBinaryData,false));this.m_aBinaryData=aBinaryData};COleObject.prototype.canRotate=function(){return false};COleObject.prototype.copy=function(){var copy=new COleObject;if(this.nvPicPr)copy.setNvPicPr(this.nvPicPr.createDuplicate());if(this.spPr){copy.setSpPr(this.spPr.createDuplicate());copy.spPr.setParent(copy)}if(this.blipFill)copy.setBlipFill(this.blipFill.createDuplicate()); -if(this.style)copy.setStyle(this.style.createDuplicate());copy.setBDeleted(this.bDeleted);copy.setData(this.m_sData);copy.setApplicationId(this.m_sApplicationId);copy.setPixSizes(this.m_nPixWidth,this.m_nPixHeight);copy.setObjectFile(this.m_sObjectFile);copy.setOleType(this.m_nOleType);if(this.m_aBinaryData!==null)copy.setBinaryData(this.m_aBinaryData.slice(0,this.m_aBinaryData.length));if(this.macro!==null)copy.setMacro(this.macro);if(this.textLink!==null)copy.setTextLink(this.textLink);copy.cachedImage= -this.getBase64Img();copy.cachedPixH=this.cachedPixH;copy.cachedPixW=this.cachedPixW;return copy};COleObject.prototype.handleUpdateExtents=function(){if(!AscFormat.isRealNumber(this.m_fDefaultSizeX)||!AscFormat.isRealNumber(this.m_fDefaultSizeY))if(this.spPr&&this.spPr.xfrm&&AscFormat.isRealNumber(this.spPr.xfrm.extX)&&AscFormat.isRealNumber(this.spPr.xfrm.extY)&&this.spPr.xfrm.extX>0&&this.spPr.xfrm.extY>0){this.m_fDefaultSizeX=this.spPr.xfrm.extX;this.m_fDefaultSizeY=this.spPr.xfrm.extY}AscFormat.CImageShape.prototype.handleUpdateExtents.call(this, +var _text_format=this.ClosureParams.getData("text/plain");var _internal=this.ClosureParams.getData("text/x-custom");if(_internal&&_internal!=""&&_internal.indexOf("asc_internalData2;")==0){this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Internal,_internal.substr("asc_internalData2;".length),null,_text_format);g_clipboardBase.Paste_End();return false}var _html_format=this.ClosureParams.getData("text/html");_html_format=_html_format.replace(/]+>/g,"");if(!_html_format){this.PasteFlag= +false;g_clipboardBase.Paste_End();return false}if(_html_format&&_html_format!=""){var nIndex=_html_format.indexOf("");if(-1!=nIndex)_html_format=_html_format.substring(0,nIndex+"".length);this.CommonIframe_PasteStart(_html_format,_text_format);return false}if(_text_format&&_text_format!=""){this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.Text,_text_format);g_clipboardBase.Paste_End();return false}var items=_clipboard.items;if(null!=items&&0!=items.length){g_clipboardBase.PasteImagesBody= +"";g_clipboardBase.PasteImagesCount=items.length;g_clipboardBase.PasteImagesCounter=0;for(var i=0;i';if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+ +"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount=0}};reader.onabort=reader.onerror=function(e){g_clipboardBase.PasteImagesCounter++;if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount){g_clipboardBase.CommonIframe_PasteStart(""+g_clipboardBase.PasteImagesBody+"");g_clipboardBase.PasteImagesBody="";g_clipboardBase.PasteImagesCounter=0;g_clipboardBase.PasteImagesCount=0}};try{reader.readAsDataURL(blob)}catch(err){g_clipboardBase.PasteImagesCounter++}}else g_clipboardBase.PasteImagesCounter++; +if(g_clipboardBase.PasteImagesCounter==g_clipboardBase.PasteImagesCount)g_clipboardBase.Paste_End();return false}}g_clipboardBase.Paste_End();return false},_private_onbeforepaste:function(e,isAttackEmulate){this._console_log("onbeforepaste");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select();return}return false},_private_onbeforecopy_select:function(){if(AscBrowser.isIE){this._console_log("onbeforecopy_select"); +this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}},_private_onbeforecopy:function(e,isAttackEmulate){this._console_log("onbeforecopy");if(!this.Api.asc_IsFocus(true))return;{this.CommonDiv=this.CommonDiv_Check();this.CommonDiv_Start();this.CommonDiv.innerHTML=" ";this.CommonDiv.focus();this.StartFocus();this.CommonDiv_Select()}return false},Init:function(_api){this.Api= +_api;window["AscCommon"].g_specialPasteHelper.Init(_api);this.ClosureParams.getData=function(type){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData;if(!_clipboard||!_clipboard.getData)return null;var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{return _clipboard.getData(_type)}catch(e){}return null};this.ClosureParams.setData=function(type,_data){var _clipboard=this._e&&this._e.clipboardData?this._e.clipboardData:window.clipboardData; +if(!_clipboard||!_clipboard.setData)return null;var _type=type;if(AscBrowser.isIE&&(type=="text"||type=="text/plain"))_type="Text";try{_clipboard.setData(_type,_data)}catch(e){}};if(!AscBrowser.isIE){document.oncopy=function(e){return g_clipboardBase._private_oncopy(e)};document.oncut=function(e){return g_clipboardBase._private_oncut(e)};document.onpaste=function(e){return g_clipboardBase._private_onpaste(e)};document["onbeforecopy"]=function(e){return g_clipboardBase._private_onbeforecopy(e)};document["onbeforecut"]= +function(e){return g_clipboardBase._private_onbeforecopy(e)};document["onbeforepaste"]=function(e){return g_clipboardBase._private_onbeforepaste(e)}}else{document.addEventListener("copy",function(e){return g_clipboardBase._private_oncopy(e)});document.addEventListener("cut",function(e){return g_clipboardBase._private_oncut(e)});document.addEventListener("paste",function(e){return g_clipboardBase._private_onpaste(e)});document.addEventListener("beforepaste",function(e){return g_clipboardBase._private_onbeforepaste(e)}); +document.addEventListener("beforecopy",function(e){return g_clipboardBase._private_onbeforecopy(e)});document.addEventListener("beforecut",function(e){return g_clipboardBase._private_onbeforecopy(e)})}if(this.IsCopyCutOnlyInEditable||this.IsPasteOnlyInEditable)document.onkeydown=function(e){if(!g_clipboardBase.Api.asc_IsFocus(true)||g_clipboardBase.Api.isLongAction())return;var isAltGr=AscCommon.getAltGr(e);if(isAltGr)return;var isCtrl=e.ctrlKey===true||e.metaKey===true;var isShift=e.shiftKey;var keyCode= +e.keyCode;if(g_clipboardBase.IsCopyCutOnlyInEditable){var bIsBeforeCopyCutEmulate=false;var _cut=false;if(isCtrl&&!isShift&&(keyCode==67||keyCode==88))bIsBeforeCopyCutEmulate=true;if(!isCtrl&&isShift&&keyCode==45){bIsBeforeCopyCutEmulate=true;_cut=true}if(bIsBeforeCopyCutEmulate){g_clipboardBase._console_log("emulate_beforecopycut");var isEmulate=false;try{isEmulate=_cut?document.execCommand("beforecut"):document.execCommand("beforecopy")}catch(err){}g_clipboardBase._private_onbeforecopy(undefined, +!isEmulate)}}if(g_clipboardBase.IsPasteOnlyInEditable){var bIsBeforePasteEmulate=false;if(isCtrl&&!isShift&&keyCode==86)bIsBeforePasteEmulate=true;if(!isCtrl&&isShift&&keyCode==45)bIsBeforePasteEmulate=true;if(bIsBeforePasteEmulate){g_clipboardBase._console_log("emulate_beforepaste");var isEmulate=false;try{isEmulate=document.execCommand("beforepaste")}catch(err$9){}g_clipboardBase._private_onbeforepaste(undefined,!isEmulate)}}};if(AscBrowser.isSafari&&false){this.CommonDiv=this.CommonDiv_Check(); +setInterval(function(){if(g_clipboardBase.Api.asc_IsFocus(true))g_clipboardBase.CommonDiv.focus()},100)}},IsWorking:function(){return this.CopyFlag||this.PasteFlag?true:false},StartFocus:function(){this.EndFocus(false);this.CopyPasteFocus=true;this.CopyPasteFocusTimer=setTimeout(function(){g_clipboardBase.EndFocus()},1E3)},EndFocus:function(isFocusToEditor){this.CopyPasteFocus=false;if(-1!=this.CopyPasteFocusTimer){clearTimeout(this.CopyPasteFocusTimer);this.CopyPasteFocusTimer=-1;if(false!==isFocusToEditor&& +null!=this.inputContext)if(this.inputContext.HtmlArea)this.inputContext.HtmlArea.focus()}},IsFocus:function(){return this.CopyPasteFocus},CommonDiv_Check:function(){var ElemToSelect=document.getElementById(this.CommonDivId);if(!ElemToSelect){ElemToSelect=document.createElement("div");ElemToSelect.id=this.CommonDivId;ElemToSelect.className=this.CommonDivClassName;ElemToSelect.style.position="fixed";ElemToSelect.style.left="0px";ElemToSelect.style.top="-100px";ElemToSelect.style.width="10000px";ElemToSelect.style.height= +"100px";ElemToSelect.style.overflow="hidden";ElemToSelect.style.zIndex=-1E3;ElemToSelect.style.MozUserSelect="text";ElemToSelect.style.fontFamily="onlyofficeDefaultFont";ElemToSelect.style.fontSize="11pt";ElemToSelect.style.color="black";ElemToSelect.style["-khtml-user-select"]="text";ElemToSelect.style["-o-user-select"]="text";ElemToSelect.style["user-select"]="text";ElemToSelect.style["-webkit-user-select"]="text";ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());var _parent= +""==this.CommonDivIdParent?document.body:document.getElementById(this.CommonDivIdParent);_parent.appendChild(ElemToSelect)}else ElemToSelect.setAttribute("contentEditable",this.isCopyOutEnabled());return ElemToSelect},CommonDiv_Select:function(){var ElemToSelect=this.CommonDiv;if(window.getSelection){var selection=window.getSelection();var rangeToSelect=document.createRange();var is_gecko=AscBrowser.isGecko;if(is_gecko){ElemToSelect.appendChild(document.createTextNode("\u00a0"));ElemToSelect.insertBefore(document.createTextNode("\u00a0"), +ElemToSelect.firstChild);rangeToSelect.setStartAfter(ElemToSelect.firstChild);rangeToSelect.setEndBefore(ElemToSelect.lastChild)}else{var aChildNodes=ElemToSelect.childNodes;if(aChildNodes.length==1){var elem=aChildNodes[0];var wrap=document.createElement("b");wrap.setAttribute("style","font-weight:normal; background-color: transparent; color: transparent;");elem=ElemToSelect.removeChild(elem);wrap.appendChild(elem);ElemToSelect.appendChild(wrap)}rangeToSelect.selectNodeContents(ElemToSelect)}selection.removeAllRanges(); +selection.addRange(rangeToSelect)}else if(document.body.createTextRange){var rangeToSelect=document.body.createTextRange();rangeToSelect.moveToElementText(ElemToSelect);rangeToSelect.select()}},CommonDiv_Start:function(){this.ClosureParams.overflowBody=document.body.style.overflow;document.body.style.overflow="hidden";this.ClosureParams.backgroundcolorBody=document.body.style["background-color"];document.body.style["background-color"]="transparent";var ElemToSelect=this.CommonDiv;ElemToSelect.style.display= +"block";while(ElemToSelect.hasChildNodes())ElemToSelect.removeChild(ElemToSelect.lastChild);document.body.style.MozUserSelect="text";delete document.body.style["-khtml-user-select"];delete document.body.style["-o-user-select"];delete document.body.style["user-select"];document.body.style["-webkit-user-select"]="text";ElemToSelect.style.MozUserSelect="all"},CommonDiv_End:function(){var ElemToSelect=this.CommonDiv;if(ElemToSelect){ElemToSelect.style.display=AscBrowser.isSafari?"block":"none";ElemToSelect.style.MozUserSelect= +"none"}document.body.style.MozUserSelect="none";document.body.style["-khtml-user-select"]="none";document.body.style["-o-user-select"]="none";document.body.style["user-select"]="none";document.body.style["-webkit-user-select"]="none";document.body.style["background-color"]=this.ClosureParams.backgroundcolorBody;document.body.style.overflow=this.ClosureParams.overflowBody;this.CopyFlag=false;this.bCut=false;this.EndFocus()},CommonDiv_Copy:function(){this.CopyFlag=true;this.CommonDiv=this.CommonDiv_Check(); +this.CommonDiv_Start();this.ClosureParams.isDivCopy=true;this.DivOnCopyHtmlPresent=false;this.DivOnCopyText="";this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.ClosureParams.isDivCopy=false;if(!this.DivOnCopyHtmlPresent&&this.DivOnCopyText!="")this.CommonDiv.innerHTML=this.DivOnCopyText;this.DivOnCopyHtmlPresent=false;this.DivOnCopyText="";this.CommonDiv_Select();window.setTimeout(function(){g_clipboardBase.CommonDiv_End()}, +0)},CommonDiv_Execute_CopyCut:function(){if(this.IsCopyCutOnlyInEditable)this._private_onbeforecopy(undefined,true)},CommonIframe_PasteStart:function(_html_data,text_data){var ifr=document.getElementById(this.CommonIframeId);if(!ifr){ifr=document.createElement("iframe");ifr.name=this.CommonIframeId;ifr.id=this.CommonIframeId;ifr.style.position="absolute";ifr.style.top="-100px";ifr.style.left="0px";ifr.style.width="10000px";ifr.style.height="100px";ifr.style.overflow="hidden";ifr.style.zIndex=-1E3; +ifr.setAttribute("sandbox","allow-same-origin");document.body.appendChild(ifr);this.CommonIframe=ifr}else ifr.style.width="10000px";var frameWindow=window.frames[this.CommonIframeId];if(frameWindow){frameWindow.document.open();frameWindow.document.write(_html_data);frameWindow.document.close();if(null!=frameWindow.document&&null!=frameWindow.document.body){ifr.style.display="block";this.pastedFrom=definePastedFrom(frameWindow.document);this.Api.asc_PasteData(AscCommon.c_oAscClipboardDataFormat.HtmlElement, +frameWindow.document.body,ifr,text_data)}}ifr.style.width="100px";g_clipboardBase.Paste_End()},CommonIframe_PasteEnd:function(){if(this.CommonIframe&&this.CommonIframe.style.display!="none"){this.CommonIframe.blur();this.CommonIframe.style.display="none"}},Paste_End:function(){this.CommonIframe_PasteEnd();this.Api.decrementCounterLongAction();this.PasteFlag=false;this.EndFocus();if(this.needClearBuffer){this.ClearBuffer();this.needClearBuffer=false}},pushData:function(_format,_data){if(null==this.LastCopyBinary)this.LastCopyBinary= +[];this.LastCopyBinary.push({type:_format,data:_data});if(this.ClosureParams.isDivCopy===true){if(!this.isCopyOutEnabled())return;if(_format==AscCommon.c_oAscClipboardDataFormat.Html){this.CommonDiv.innerHTML=_data;this.DivOnCopyHtmlPresent=true}if(_format==AscCommon.c_oAscClipboardDataFormat.Text)this.DivOnCopyText=_data;return}var _data_format="";switch(_format){case AscCommon.c_oAscClipboardDataFormat.Html:_data_format="text/html";break;case AscCommon.c_oAscClipboardDataFormat.Text:_data_format= +"text/plain";break;case AscCommon.c_oAscClipboardDataFormat.Internal:_data_format="text/x-custom";break;default:break}if(_data_format!=""&&_data!==null&&this.isCopyOutEnabled())if(_data_format=="text/x-custom")this.ClosureParams.setData(_data_format,"asc_internalData2;"+_data);else this.ClosureParams.setData(_data_format,_data)},Button_Copy:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true, +true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("copy")}catch(err){_ret=false}if(!_ret){this.LastCopyBinary=null;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal)}return _ret},Button_Cut:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true, +true);this.CommonDiv_Execute_CopyCut();var _ret=false;try{_ret=document.execCommand("cut")}catch(err){_ret=false}if(!_ret){this.LastCopyBinary=null;this.bCut=true;this.checkCopy(AscCommon.c_oAscClipboardDataFormat.Text|AscCommon.c_oAscClipboardDataFormat.Html|AscCommon.c_oAscClipboardDataFormat.Internal);this.Api.asc_SelectionCut();this.bCut=false}return _ret},Button_Paste:function(){if(this.inputContext){if(this.inputContext.isHardCheckKeyboard)this.inputContext.enableVirtualKeyboard_Hard();this.inputContext.HtmlArea.focus()}this.Api.asc_enableKeyEvents(true, +true);var _ret=false;try{_ret=document.execCommand("paste")}catch(err){_ret=false}if(!_ret&&null!=this.LastCopyBinary){var _data=null;var _isInternal=false;for(var i=0;i0)this.Api.asc_PasteData(this.LastCopyBinary[0].type,this.LastCopyBinary[0].data)}return _ret}, +ClearBuffer:function(){if(-1!=this.clearBufferTimerId)clearTimeout(this.clearBufferTimerId);this.clearBufferTimerId=setTimeout(function(){if(AscCommon.g_clipboardBase)AscCommon.g_clipboardBase.clearBufferTimerId=-1},500);this.Button_Copy()},isCopyOutEnabled:function(){if(this.Api&&this.Api.isCopyOutEnabled)return this.Api.isCopyOutEnabled();return true}};function definePastedFrom(doc){if(!doc)return null;var res=null;var metaTags=doc.getElementsByTagName("meta");for(var i=0;i>1)+"px;top:"+-this.HtmlAreaOffset+"px;";_style+="background:transparent;border:none;position:absolute;text-shadow:0 0 0 #000;outline:none;color:transparent;width:"+ +this.HtmlAreaWidth+"px;height:50px;";_style+="overflow:hidden;padding:0px;margin:0px;font-family:arial;resize:none;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;";_style+="touch-action: none;-webkit-touch-callout: none;color:transparent;caret-color:transparent;";_style+=AscCommon.AscBrowser.isAppleDevices?"font-size:0px;":"font-size:8px;";this.HtmlArea.setAttribute("style",_style);this.HtmlArea.setAttribute("spellcheck",false);this.HtmlArea.setAttribute("autocapitalize", +"none");this.HtmlArea.setAttribute("autocomplete","off");this.HtmlArea.setAttribute("autocorrect","off");this.HtmlDiv.appendChild(this.HtmlArea);if(true){var oHtmlDivScrollable=document.createElement("div");oHtmlDivScrollable.id="area_id_main";oHtmlDivScrollable.setAttribute("style","background:transparent;border:none;position:absolute;padding:0px;margin:0px;z-index:0;pointer-events:none;");var parentStyle=getComputedStyle(oHtmlParent);oHtmlDivScrollable.style.left=parentStyle.left;oHtmlDivScrollable.style.top= +parentStyle.top;oHtmlDivScrollable.style.width=parentStyle.width;oHtmlDivScrollable.style.height=parentStyle.height;oHtmlDivScrollable.style.overflow="hidden";oHtmlDivScrollable.appendChild(this.HtmlDiv);oHtmlParent.parentNode.appendChild(oHtmlDivScrollable)}else oHtmlParent.appendChild(this.HtmlDiv);var oThis=this;this.HtmlArea["onkeydown"]=function(e){if(AscCommon.AscBrowser.isSafariMacOs){var cmdButton=e.ctrlKey||e.metaKey?true:false;var buttonCode=e.keyCode==67||e.keyCode==88||e.keyCode==86;if(cmdButton&& +buttonCode)oThis.IsDisableKeyPress=true;else oThis.IsDisableKeyPress=false}return oThis.onKeyDown(e)};this.HtmlArea["onkeypress"]=function(e){if(oThis.IsDisableKeyPress==true){oThis.IsDisableKeyPress=false;var cmdButton=e.ctrlKey||e.metaKey?true:false;if(cmdButton)return}return oThis.onKeyPress(e)};this.HtmlArea["onkeyup"]=function(e){oThis.IsDisableKeyPress=false;return oThis.onKeyUp(e)};this.HtmlArea.addEventListener("input",function(e){return oThis.onInput(e)},false);this.HtmlArea.addEventListener("compositionstart", +function(e){return oThis.onCompositionStart(e)},false);this.HtmlArea.addEventListener("compositionupdate",function(e){return oThis.onCompositionUpdate(e)},false);this.HtmlArea.addEventListener("compositionend",function(e){return oThis.onCompositionEnd(e)},false);this.show();this.Api.Input_UpdatePos();if(AscCommon.AscBrowser.isAndroid)this.HtmlArea.onclick=function(e){var _this=AscCommon.g_inputContext;if(-1!=_this.virtualKeyboardClickTimeout){clearTimeout(_this.virtualKeyboardClickTimeout);_this.virtualKeyboardClickTimeout= +-1}_this.apiCompositeEnd();if(!_this.virtualKeyboardClickPrevent)return;_this.setReadOnlyWrapper(true);_this.virtualKeyboardClickPrevent=false;AscCommon.stopEvent(e);_this.virtualKeyboardClickTimeout=setTimeout(function(){_this.setReadOnlyWrapper(false);_this.virtualKeyboardClickTimeout=-1},1);return false}},onResize:function(_editorContainerId){var _elem=document.getElementById("area_id_main");var _elemSrc=document.getElementById(_editorContainerId);if(!_elem||!_elemSrc)return;if(AscCommon.AscBrowser.isChrome){var rectObject= +_elemSrc.getBoundingClientRect();this.FixedPosCheckElementX=rectObject.left;this.FixedPosCheckElementY=rectObject.top}var _width=_elemSrc.style.width;if((null==_width||""==_width)&&window.getComputedStyle){var _s=window.getComputedStyle(_elemSrc);_elem.style.left=_s.left;_elem.style.top=_s.top;_elem.style.width=_s.width;_elem.style.height=_s.height}else{_elem.style.left=_elemSrc.style.left;_elem.style.top=_elemSrc.style.top;_elem.style.width=_width;_elem.style.height=_elemSrc.style.height}if(this.Api.isMobileVersion){var _elem1= +document.getElementById("area_id_parent");var _elem2=document.getElementById("area_id");_elem1.parentNode.style.pointerEvents="";_elem1.style.left="0px";_elem1.style.top="-1000px";_elem1.style.right="0px";_elem1.style.bottom="-100px";_elem1.style.width="auto";_elem1.style.height="auto";_elem2.style.left="0px";_elem2.style.top="0px";_elem2.style.right="0px";_elem2.style.bottom="0px";_elem2.style.width="100%";_elem2.style.height="100%";if(AscCommon.AscBrowser.isIE){document.body.style["msTouchAction"]= +"none";document.body.style["touchAction"]="none"}}var _editorSdk=document.getElementById("editor_sdk");this.editorSdkW=_editorSdk.clientWidth;this.editorSdkH=_editorSdk.clientHeight},checkFocus:function(){if(this.Api.asc_IsFocus()&&!AscCommon.g_clipboardBase.IsFocus()&&!AscCommon.g_clipboardBase.IsWorking())if(document.activeElement!=this.HtmlArea)this.HtmlArea.focus()},move:function(x,y){if(this.Api.isMobileVersion)return;var oTarget=document.getElementById(this.TargetId);if(!oTarget)return;var xPos= +x?x:parseInt(oTarget.style.left);var yPos=(y?y:parseInt(oTarget.style.top))+parseInt(oTarget.style.height);if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)xPos=-100;if(!this.isDebug&&!this.isSystem){this.HtmlDiv.style.left=xPos+this.FixedPosCheckElementX+"px";this.HtmlDiv.style.top=yPos+this.FixedPosCheckElementY+this.TargetOffsetY+this.HtmlAreaOffset+"px";this.HtmlArea.scrollTop=this.HtmlArea.scrollHeight}else this.debugCalculatePlace(xPos+this.FixedPosCheckElementX,yPos+this.FixedPosCheckElementY+ +this.TargetOffsetY);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onTargetPositionChanged")},emulateKeyDownApi:function(code){var _e={altKey:false,ctrlKey:false,shiftKey:false,target:null,charCode:0,which:code,keyCode:code,code:"",preventDefault:function(){},stopPropagation:function(){}};this.Api.onKeyDown(_e);this.Api.onKeyUp(_e)},clear:function(isFromFocus){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";if(isFromFocus!==true)this.HtmlArea.focus(); +this.TextBeforeComposition="";this.Text="";this.Target=0;this.CompositionStart=0;this.CompositionEnd=0;this.IsComposition=false;this.keyPressInput="";if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperClear")},getAreaValue:function(){return this.TextArea_Not_ContentEditableDiv?this.HtmlArea.value:this.HtmlArea.innerText},setReadOnly:function(isLock){if(isLock)this.ReadOnlyCounter++;else this.ReadOnlyCounter--;this.setReadOnlyWrapper(0>=this.ReadOnlyCounter?false:true)},setReadOnlyWrapper:function(val){this.HtmlArea.readOnly= +this.Api.isViewMode?true:val},show:function(){if(this.isDebug||this.isSystem){this.log("ti: show");document.getElementById("area_id_main").style.zIndex=10;this.HtmlArea.style.top="0px";this.HtmlArea.style.width="100%";this.HtmlArea.style.height="100%";this.HtmlArea.style.background="#FFFFFF";this.HtmlArea.style.color="black";this.HtmlDiv.style.zIndex=90;this.HtmlDiv.style.border="2px solid #4363A4";this.isShow=true}},unshow:function(isAttack){if(this.isDebug||this.isSystem||true==isAttack){this.log("ti: unshow"); +document.getElementById("area_id_main").style.zIndex=0;this.HtmlArea.style.top=-this.HtmlAreaOffset+"px";this.HtmlArea.style.width="1000px";this.HtmlArea.style.height="50px";this.HtmlArea.style.background="transparent";this.HtmlArea.style.color="transparent";this.HtmlDiv.style.zIndex=0;this.HtmlDiv.style.border="none";this.isShow=false}},debugCalculatePlace:function(x,y){var _left=x;var _top=y;if(undefined==_left)_left=parseInt(this.HtmlDiv.style.left);if(undefined==_top)_top=parseInt(this.HtmlDiv.style.top); +var _r_max=this.editorSdkW;var _b_max=this.editorSdkH;_r_max-=60;if(_r_max-_left>50)this.debugTexBoxMaxW=_r_max-_left;else{_left=_r_max-50;this.debugTexBoxMaxW=50}_b_max-=40;if(_b_max-_top>50)this.debugTexBoxMaxH=_b_max-_top;else{_top=_b_max-50;this.debugTexBoxMaxH=50}if(AscCommon.AscBrowser.isSafari&&AscCommon.AscBrowser.isMobile)_left=-100;this.HtmlDiv.style.left=_left+"px";this.HtmlDiv.style.top=_top+"px";var _height=22;var _t=this.getAreaValue();if(0!=_t.length){var _editorSdk=document.getElementById("editor_sdk"); +var _p=document.createElement("p");_p.style.zIndex="-1";_p.style.position="absolute";_p.style.fontFamily="arial";_p.style.fontSize="12pt";_p.style.left="0px";_p.style.width=this.debugTexBoxMaxW+"px";_editorSdk.appendChild(_p);_t=_t.replace(/ /g," ");_p.innerHTML=""+_t+"";var _width=_p.firstChild.offsetWidth;_width=Math.min(_width+20,this.debugTexBoxMaxW);if(AscCommon.AscBrowser.isIE)_width+=10;var area=document.createElement("textarea");area.style.zIndex="-1";area.id="area2_id"; +area.rows=1;area.setAttribute("style","font-family:arial;font-size:12pt;position:absolute;resize:none;padding:0px;margin:0px;font-weight:normal;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;");area.style.overflow="hidden";area.style.width=_width+"px";_editorSdk.appendChild(area);area.value=this.getAreaValue();_height=area.clientHeight;if(area.scrollHeight>_height)_height=area.scrollHeight;_editorSdk.removeChild(_p);_editorSdk.removeChild(area)}if(_height>this.debugTexBoxMaxH)_height= +this.debugTexBoxMaxH;this.HtmlDiv.style.width=_width+"px";this.HtmlDiv.style.height=_height+"px";var oldZindex=parseInt(this.HtmlDiv.style.zIndex);var newZindex=oldZindex==90?"89":"90";this.HtmlDiv.style.zIndex=newZindex},onInput:function(e,isFromCompositionUpdate){if(this.Api.isLongAction()||this.Api.isViewMode){AscCommon.stopEvent(e);return false}if(this.isSystem){if(!this.isShow)this.show();this.debugCalculatePlace(undefined,undefined);return}if(this.isKeyPressOnUp&&this.keyPressOnUpCodes.length> +0){if(!this.TextArea_Not_ContentEditableDiv)this.HtmlArea.innerHTML="";else this.HtmlArea.value="";this.TextBeforeComposition="";this.Text="";AscCommon.stopEvent(e);return false}this.log("ti: onInput");this.Text=this.getAreaValue();this.Text=this.Text.split(" ").join(" ");var codes=[];if(this.IsComposition||this.ApiIsComposition){var ieStart=-1;var ieEnd=-1;if(true){var target=e.target;if(target["msGetInputContext"]){var ctx=target["msGetInputContext"]();if(ctx){ieStart=ctx["compositionStartOffset"]; +ieEnd=ctx["compositionEndOffset"]}}}this.CompositionEnd=this.Text.length;this.CompositionStart=this.TextBeforeComposition.length;var textReplace=this.Text.substr(this.CompositionStart);var iter;for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){if(ieStart>this.CompositionStart){textReplace=textReplace.substr(0,ieStart-this.CompositionStart);codes=[];for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value()); +this.apiCompositeReplace(codes);this.apiCompositeEnd();this.TextBeforeComposition=this.Text.substr(0,ieStart);this.apiCompositeStart();this.CompositionStart=ieStart;codes=[];textReplace=this.Text.substr(this.CompositionStart);for(iter=textReplace.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiCompositeReplace(codes)}else this.apiCompositeReplace(codes);if(!this.IsComposition){this.apiCompositeEnd();this.TextBeforeComposition=this.Text}}else{AscFonts.FontPickerByCharacter.loadFonts(this, +function(){this.apiCompositeReplace(codes);this.apiCompositeEnd();this.clear();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}}else{var textToApi=this.Text.substr(this.TextBeforeComposition.length);for(var iter=textToApi.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());if(codes.length>0)this.apiInputText(codes);this.TextBeforeComposition=this.Text}if(!this.IsComposition)if(this.Text.length>0){var _lastCode=this.Text.charCodeAt(this.Text.length- +1);if(_lastCode==12290||_lastCode==46){AscCommon.stopEvent(e);if(AscCommon.AscBrowser.isIE&&!AscCommon.AscBrowser.isIeEdge)setTimeout(function(){window["AscCommon"].g_inputContext.clear();window["AscCommon"].g_inputContext.HtmlArea.focus()},0);else this.clear();return false}}},emulateNativeKeyDown:function(e,target){var oEvent=document.createEvent("KeyboardEvent");Object.defineProperty(oEvent,"keyCode",{get:function(){return this.keyCodeVal}});Object.defineProperty(oEvent,"which",{get:function(){return this.keyCodeVal}}); +Object.defineProperty(oEvent,"shiftKey",{get:function(){return this.shiftKeyVal}});Object.defineProperty(oEvent,"altKey",{get:function(){return this.altKeyVal}});Object.defineProperty(oEvent,"metaKey",{get:function(){return this.metaKeyVal}});Object.defineProperty(oEvent,"ctrlKey",{get:function(){return this.ctrlKeyVal}});if(AscCommon.AscBrowser.isIE)oEvent.preventDefault=function(){try{Object.defineProperty(this,"defaultPrevented",{get:function(){return true}})}catch(err){}};var k=e.keyCode;if(oEvent.initKeyboardEvent)oEvent.initKeyboardEvent("keydown", +true,true,window,false,false,false,false,k,k);else oEvent.initKeyEvent("keydown",true,true,window,false,false,false,false,k,0);oEvent.keyCodeVal=k;oEvent.shiftKeyVal=e.shiftKey;oEvent.altKeyVal=e.altKey;oEvent.metaKeyVal=e.metaKey;oEvent.ctrlKeyVal=e.ctrlKey;var _elem=target?target:_getElementKeyboardDown(this.nativeFocusElement,3);_elem.dispatchEvent(oEvent);return oEvent.defaultPrevented},isSpaceSymbol:function(e){if(e.keyCode==32)return true;if(e.keyCode==229&&(e.code=="space"||e.code=="Space"|| +e.key=="Spacebar"))return true;return false},systemInputEnable:function(isEnabled){if(this.isSystem==isEnabled)return;this.isSystem=isEnabled;this.HtmlArea.style.left=this.isSystem?"0px":"-"+(this.HtmlAreaWidth>>1)+"px";this.clear();if(this.isShow)this.unshow(true);if(this.Api.WordControl&&this.Api.WordControl.m_oLogicDocument&&this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState)this.Api.WordControl.m_oLogicDocument.Document_UpdateSelectionState()},debugInputEnable:function(isEnabled){if(this.isDebug== +isEnabled)return;this.isDebug=isEnabled;this.HtmlArea.style.left=this.isDebug?"0px":"-"+(this.HtmlAreaWidth>>1)+"px"},apiInputText:function(codes){var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(codes,true);if(!isAsync){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd()}else{AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace(codes);this.apiCompositeEnd();this.setReadOnly(false)});this.setReadOnly(true); +return false}},onKeyDown:function(e){if(this.Api.isLongAction()){AscCommon.stopEvent(e);return false}if(this.isInputHelpersPresent)switch(e.keyCode){case 9:case 13:case 38:case 40:case 33:case 34:case 35:case 36:case 27:{window.g_asc_plugins.onPluginEvent2("onKeyDown",{"keyCode":e.keyCode},this.isInputHelpers);AscCommon.stopEvent(e);return false}case 32:{if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}default:break}else if(32==e.keyCode); +if(this.isSystem&&this.isShow){if(e.keyCode==13){var text=this.getAreaValue();var codes=[];for(var iter=text.getUnicodeIterator();iter.check();iter.next())codes.push(iter.value());this.apiInputText(codes);this.clear();this.unshow();AscCommon.stopEvent(e);return false}else if(e.keyCode==27){this.clear();this.unshow();AscCommon.stopEvent(e);return false}return}if(null!=this.nativeFocusElement)if(this.emulateNativeKeyDown(e)){e.preventDefault();return false}var _code=e.keyCode;if(_code!=8&&_code!=46)this.KeyDownFlag= +true;AscCommon.check_KeyboardEvent(e);var arrCodes=this.Api.getAddedTextOnKeyDown(AscCommon.global_keyboardEvent);var isAsync=AscFonts.FontPickerByCharacter.checkTextLight(arrCodes,true);if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.onKeyDown(e);this.onKeyUp(e);this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}var ret=this.Api.onKeyDown(e);switch(e.keyCode){case 8:{var oldKeyPressInput=this.keyPressInput;this.clear();if(oldKeyPressInput.length> +1){this.keyPressInput=oldKeyPressInput.substr(0,oldKeyPressInput.length-1);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}return false}case 9:case 13:case 37:case 38:case 39:case 40:case 33:case 34:case 35:case 36:{this.clear();return false}case 46:case 45:{if(!AscCommon.global_keyboardEvent.CtrlKey&&!AscCommon.global_keyboardEvent.ShiftKey){this.clear();return false}}default:break}if(e.keyCode==32&&AscCommon.global_keyboardEvent.CtrlKey&& +!AscCommon.global_keyboardEvent.ShiftKey)if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onClick");return ret},onKeyPress:function(e){if(this.Api.isLongAction()||!this.Api.asc_IsFocus()||this.Api.isViewMode){AscCommon.stopEvent(e);return false}if(this.isSystem)return;if(this.KeyDownFlag)this.KeyPressFlag=true;if(this.IsComposition)return;if(e.which==13&&e.keyCode==13||e.which==10&&e.keyCode==10){AscCommon.stopEvent(e);return false}var c=e.which||e.keyCode;var isAsync=c>=32?AscFonts.FontPickerByCharacter.checkTextLight([c], +true):false;if(isAsync){AscFonts.FontPickerByCharacter.loadFonts(this,function(){this.apiCompositeStart();this.apiCompositeReplace([c]);this.apiCompositeEnd();this.setReadOnly(false)});AscCommon.stopEvent(e);this.setReadOnly(true);return false}if(this.isKeyPressOnUp){var isSaveCode=true;switch(e.which){case 46:{isSaveCode=false;break}default:break}if(isSaveCode){if(this.isKeyPressOnUpStackedMode)this.keyPressOnUpCodes.push({which:e.which,charCode:e.charCode,keyCode:e.keyCode,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey, +metaKey:e.metaKey,altKey:e.altKey,preventDefault:function(){}});return}}var ret=this.Api.onKeyPress(e);switch(e.which){case 46:{AscCommon.stopEvent(e);this.clear();return false}default:break}this.keyPressInput+=String.fromCharCode(e.which);if(window.g_asc_plugins)window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput});AscCommon.stopEvent(e);return ret},onKeyUp:function(e){if(this.Api.isLongAction()){AscCommon.stopEvent(e);return false}if(this.isSystem&&this.isShow)return; +if(this.isKeyPressOnUp&&this.keyPressOnUpCodes.length>0){this.isKeyPressOnUp=false;for(var i=0;i0){var range= +sel.getRangeAt(0);_offset=range.endOffset}}return _offset},checkTargetPosition:function(isCorrect){var _offset=this.getAreaPos();if(false!==isCorrect){var _value=this.getAreaValue();_offset-=_value.length-this.compositionValue.length}if(!this.IsLockTargetMode)if(_offset==0&&this.compositionValue.length==1)_offset=1;this.Api.Set_CursorPosInCompositeText(_offset);this.unlockTarget()},lockTarget:function(){if(!this.IsLockTargetMode)return;if(-1!=this.LockerTargetTimer)clearTimeout(this.LockerTargetTimer); +this.Api.asc_LockTargetUpdate(true);var oThis=this;this.LockerTargetTimer=setTimeout(function(){oThis.unlockTarget()},1E3)},unlockTarget:function(){if(!this.IsLockTargetMode)return;if(-1!=this.LockerTargetTimer)clearTimeout(this.LockerTargetTimer);this.LockerTargetTimer=-1;this.Api.asc_LockTargetUpdate(false)},clearLastCompositeText:function(){this.LastReplaceText=[];this.IsLastReplaceFlag=false},apiCompositeStart:function(){},apiCompositeReplace:function(_value){if(this.Api.isLongAction())return false; +if(!this.ApiIsComposition){this.Api.Begin_CompositeInput();this.clearLastCompositeText()}this.ApiIsComposition=true;if(this.IsLastReplaceFlag)if(_value.length==this.LastReplaceText.length){var isEqual=true;for(var nC=0;nC<_value.length;nC++)if(_value[nC]!=this.LastReplaceText[nC]){isEqual=false;break}if(isEqual)return}this.Api.Replace_CompositeText(_value);if(window.g_asc_plugins){this.keyPressInput=String.fromCodePoint.apply(this,_value);window.g_asc_plugins.onPluginEvent("onInputHelperInput",{"text":this.keyPressInput})}this.LastReplaceText= +_value.slice();this.IsLastReplaceFlag=true},apiCompositeEnd:function(){if(!this.ApiIsComposition)return;this.ApiIsComposition=false;this.Api.End_CompositeInput();this.clearLastCompositeText()},onCompositionStart:function(e){if(this.isSystem)return;this.IsComposition=true;this.keyPressOnUpCodes=[]},onCompositionUpdate:function(e){if(this.isSystem)return;this.IsComposition=true;this.keyPressOnUpCodes=[];this.onInput(e,true)},onCompositionEnd:function(e){if(this.isSystem)return;this.IsComposition=false; +this.onInput(e,true)},setInterfaceEnableKeyEvents:function(value){this.InterfaceEnableKeyEvents=value;if(true==this.InterfaceEnableKeyEvents){if(document.activeElement){var _id=document.activeElement.id;if(_id=="area_id"||window.g_asc_plugins&&window.g_asc_plugins.checkRunnedFrameId(_id))return}this.HtmlArea.focus()}},externalEndCompositeInput:function(){this.clear()},externalChangeFocus:function(){if(!this.IsComposition)return false;setTimeout(function(){window["AscCommon"].g_inputContext.clear()}, +10);return true},isCompositionProcess:function(){return this.IsComposition},preventVirtualKeyboard:function(e){if(this.isHardCheckKeyboard)return;if(AscCommon.AscBrowser.isAndroid){this.setReadOnlyWrapper(true);this.virtualKeyboardClickPrevent=true;this.virtualKeyboardClickTimeout=setTimeout(function(){window["AscCommon"].g_inputContext.setReadOnlyWrapper(false);window["AscCommon"].g_inputContext.virtualKeyboardClickTimeout=-1},1)}},enableVirtualKeyboard:function(){if(this.isHardCheckKeyboard)return; +if(AscCommon.AscBrowser.isAndroid){if(-1!=this.virtualKeyboardClickTimeout){clearTimeout(this.virtualKeyboardClickTimeout);this.virtualKeyboardClickTimeout=-1}this.setReadOnlyWrapper(false);this.virtualKeyboardClickPrevent=false}},preventVirtualKeyboard_Hard:function(){this.setReadOnlyWrapper(true)},enableVirtualKeyboard_Hard:function(){this.setReadOnlyWrapper(false)}};function _getAttirbute(_elem,_attr,_depth){var _elemTest=_elem;for(var _level=0;_elemTest&&_level<_depth;++_level,_elemTest=_elemTest.parentNode){var _res= +_elemTest.getAttribute?_elemTest.getAttribute(_attr):null;if(null!=_res)return _res}return null}function _getElementKeyboardDown(_elem,_depth){var _elemTest=_elem;for(var _level=0;_elemTest&&_level<_depth;++_level,_elemTest=_elemTest.parentNode){var _res=_elemTest.getAttribute?_elemTest.getAttribute("oo_editor_keyboard"):null;if(null!=_res)return _elemTest}return null}function _getDefaultKeyboardInput(_elem,_depth){var _elemTest=_elem;for(var _level=0;_elemTest&&_level<_depth;++_level,_elemTest=_elemTest.parentNode){var _name= +" "+_elemTest.className+" ";if(_name.indexOf(" dropdown-menu")>-1||_name.indexOf(" dropdown-toggle ")>-1||_name.indexOf(" dropdown-submenu ")>-1||_name.indexOf(" canfocused ")>-1)return"true"}return null}window["AscCommon"]=window["AscCommon"]||{};window["AscCommon"].CTextInput=CTextInput;window["AscCommon"].InitBrowserInputContext=function(api,target_id,parent_id){if(window["AscCommon"].g_inputContext)return;window["AscCommon"].g_inputContext=new CTextInput(api);window["AscCommon"].g_inputContext.init(target_id, +parent_id);window["AscCommon"].g_clipboardBase.Init(api);window["AscCommon"].g_clipboardBase.inputContext=window["AscCommon"].g_inputContext;if(window["AscCommon"].TextBoxInputMode===true)window["AscCommon"].g_inputContext.systemInputEnable(true);document.addEventListener("focus",function(e){var t=window["AscCommon"].g_inputContext;var _oldNativeFE=t.nativeFocusElement;t.nativeFocusElement=e.target;if(t.IsComposition){t.apiCompositeEnd();t.externalEndCompositeInput()}if(!t.isSystem&&!t.isNoClearOnFocus)t.clear(true); +t.isNoClearOnFocus=false;var _nativeFocusElementNoRemoveOnElementFocus=t.nativeFocusElementNoRemoveOnElementFocus;t.nativeFocusElementNoRemoveOnElementFocus=false;if(t.InterfaceEnableKeyEvents==false){t.nativeFocusElement=null;return}if(t.nativeFocusElement&&t.nativeFocusElement.id==t.HtmlArea.id){t.Api.asc_enableKeyEvents(true,true);if(_nativeFocusElementNoRemoveOnElementFocus)t.nativeFocusElement=_oldNativeFE;else t.nativeFocusElement=null;return}if(t.nativeFocusElement&&t.nativeFocusElement.id== +window["AscCommon"].g_clipboardBase.CommonDivId){t.nativeFocusElement=null;return}t.nativeFocusElementNoRemoveOnElementFocus=false;var _isElementEditable=false;if(t.nativeFocusElement){var _name=t.nativeFocusElement.nodeName;if(_name)_name=_name.toUpperCase();if("INPUT"==_name||"TEXTAREA"==_name)_isElementEditable=true;else if("DIV"==_name)if(t.nativeFocusElement.getAttribute("contenteditable")=="true")_isElementEditable=true}if("IFRAME"==_name){t.Api.asc_enableKeyEvents(false,true);t.nativeFocusElement= +null;return}var _oo_editor_input=_getAttirbute(t.nativeFocusElement,"oo_editor_input",3);var _oo_editor_keyboard=_getAttirbute(t.nativeFocusElement,"oo_editor_keyboard",3);if(!_oo_editor_input&&!_oo_editor_keyboard)_oo_editor_input=_getDefaultKeyboardInput(t.nativeFocusElement,3);if(_oo_editor_keyboard=="true")_oo_editor_input=undefined;if(_oo_editor_input=="true"){t.Api.asc_enableKeyEvents(false,true);t.nativeFocusElement=null;return}if(_isElementEditable&&_oo_editor_input!="false"){t.Api.asc_enableKeyEvents(false, +true);t.nativeFocusElement=null;return}if(_oo_editor_keyboard!="true")t.nativeFocusElement=null;var _elem=t.nativeFocusElement;t.nativeFocusElementNoRemoveOnElementFocus=true;AscCommon.AscBrowser.isMozilla?setTimeout(function(){t.HtmlArea.focus()},0):t.HtmlArea.focus();t.nativeFocusElement=_elem;t.Api.asc_enableKeyEvents(true,true)},true);if(!api.isMobileVersion&&!api.isEmbedVersion)window["AscCommon"].g_inputContext.HtmlArea.focus()};window["SetInputDebugMode"]=function(){if(!window["AscCommon"].g_inputContext)return; +window["AscCommon"].g_inputContext.debugInputEnable(true);window["AscCommon"].g_inputContext.show()}})(window);"use strict";(function(window,undefined){function COleSize(w,h){this.w=w;this.h=h}COleSize.prototype.Write_ToBinary=function(Writer){Writer.WriteLong(this.w);Writer.WriteLong(this.h)};COleSize.prototype.Read_FromBinary=function(Reader){this.w=Reader.GetLong();this.h=Reader.GetLong()};AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetData]=AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetApplicationId]= +AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetPixSizes]=AscDFH.CChangesDrawingsObjectNoId;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetObjectFile]=AscDFH.CChangesDrawingsString;AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetOleType]=AscDFH.CChangesDrawingsLong;AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ChartStyleEntryDefRPr]=AscCommonWord.CTextPr;function CChangesOleObjectBinary(Class,Old,New,Color){AscDFH.CChangesBaseProperty.call(this, +Class,Old,New,Color)}CChangesOleObjectBinary.prototype=Object.create(AscDFH.CChangesBaseProperty.prototype);CChangesOleObjectBinary.prototype.Type=AscDFH.historyitem_ImageShapeSetBinaryData;CChangesOleObjectBinary.prototype.private_SetValue=function(Value){this.Class.m_aBinaryData=Value};CChangesOleObjectBinary.prototype.WriteToBinary=function(Writer){Writer.WriteBool(this.New!==null);if(this.New!==null){Writer.WriteLong(this.New.length);Writer.WriteBuffer(this.New,0,this.New.length)}};CChangesOleObjectBinary.prototype.ReadFromBinary= +function(Reader){if(Reader.GetBool()){var length=Reader.GetLong();this.New=Reader.GetBuffer(length)}};AscDFH.changesFactory[AscDFH.historyitem_ImageShapeSetBinaryData]=CChangesOleObjectBinary;AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetData]=function(oClass,value){oClass.m_sData=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetApplicationId]=function(oClass,value){oClass.m_sApplicationId=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetPixSizes]=function(oClass, +value){if(value){oClass.m_nPixWidth=value.w;oClass.m_nPixHeight=value.h}};AscDFH.drawingsConstructorsMap[AscDFH.historyitem_ImageShapeSetPixSizes]=COleSize;AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetObjectFile]=function(oClass,value){oClass.m_sObjectFile=value};AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetOleType]=function(oClass,value){oClass.m_nOleType=value};function COleObject(){AscFormat.CImageShape.call(this);this.m_sData=null;this.m_sApplicationId=null;this.m_nPixWidth= +null;this.m_nPixHeight=null;this.m_fDefaultSizeX=null;this.m_fDefaultSizeY=null;this.m_sObjectFile=null;this.m_nOleType=null;this.m_aBinaryData=null}COleObject.prototype=Object.create(AscFormat.CImageShape.prototype);COleObject.prototype.constructor=COleObject;COleObject.prototype.getObjectType=function(){return AscDFH.historyitem_type_OleObject};COleObject.prototype.setData=function(sData){AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this,AscDFH.historyitem_ImageShapeSetData,this.m_sData, +sData));this.m_sData=sData};COleObject.prototype.setApplicationId=function(sApplicationId){AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this,AscDFH.historyitem_ImageShapeSetApplicationId,this.m_sApplicationId,sApplicationId));this.m_sApplicationId=sApplicationId};COleObject.prototype.setPixSizes=function(nPixWidth,nPixHeight){AscCommon.History.Add(new AscDFH.CChangesDrawingsObjectNoId(this,AscDFH.historyitem_ImageShapeSetPixSizes,new COleSize(this.m_nPixWidth,this.m_nPixHeight),new COleSize(nPixWidth, +nPixHeight)));this.m_nPixWidth=nPixWidth;this.m_nPixHeight=nPixHeight};COleObject.prototype.setObjectFile=function(sObjectFile){AscCommon.History.Add(new AscDFH.CChangesDrawingsString(this,AscDFH.historyitem_ImageShapeSetObjectFile,this.m_sObjectFile,sObjectFile));this.m_sObjectFile=sObjectFile};COleObject.prototype.setOleType=function(nOleType){AscCommon.History.Add(new AscDFH.CChangesDrawingsLong(this,AscDFH.historyitem_ImageShapeSetOleType,this.m_nOleType,nOleType));this.m_nOleType=nOleType};COleObject.prototype.setBinaryData= +function(aBinaryData){AscCommon.History.Add(new CChangesOleObjectBinary(this,this.m_aBinaryData,aBinaryData,false));this.m_aBinaryData=aBinaryData};COleObject.prototype.canRotate=function(){return false};COleObject.prototype.copy=function(){var copy=new COleObject;if(this.nvPicPr)copy.setNvPicPr(this.nvPicPr.createDuplicate());if(this.spPr){copy.setSpPr(this.spPr.createDuplicate());copy.spPr.setParent(copy)}if(this.blipFill)copy.setBlipFill(this.blipFill.createDuplicate());if(this.style)copy.setStyle(this.style.createDuplicate()); +copy.setBDeleted(this.bDeleted);copy.setData(this.m_sData);copy.setApplicationId(this.m_sApplicationId);copy.setPixSizes(this.m_nPixWidth,this.m_nPixHeight);copy.setObjectFile(this.m_sObjectFile);copy.setOleType(this.m_nOleType);if(this.m_aBinaryData!==null)copy.setBinaryData(this.m_aBinaryData.slice(0,this.m_aBinaryData.length));if(this.macro!==null)copy.setMacro(this.macro);if(this.textLink!==null)copy.setTextLink(this.textLink);copy.cachedImage=this.getBase64Img();copy.cachedPixH=this.cachedPixH; +copy.cachedPixW=this.cachedPixW;return copy};COleObject.prototype.handleUpdateExtents=function(){if(!AscFormat.isRealNumber(this.m_fDefaultSizeX)||!AscFormat.isRealNumber(this.m_fDefaultSizeY))if(this.spPr&&this.spPr.xfrm&&AscFormat.isRealNumber(this.spPr.xfrm.extX)&&AscFormat.isRealNumber(this.spPr.xfrm.extY)&&this.spPr.xfrm.extX>0&&this.spPr.xfrm.extY>0){this.m_fDefaultSizeX=this.spPr.xfrm.extX;this.m_fDefaultSizeY=this.spPr.xfrm.extY}AscFormat.CImageShape.prototype.handleUpdateExtents.call(this, [])};COleObject.prototype.checkTypeCorrect=function(){var bCorrectData=false;if(this.m_sData)bCorrectData=true;else if(this.m_sObjectFile)bCorrectData=true;if(!bCorrectData)return false;if(this.m_sApplicationId===null)return false;return true};window["AscFormat"]=window["AscFormat"]||{};window["AscFormat"].COleObject=COleObject})(window);"use strict";(function(window,undefined){function CDrawingDocContent(Parent,DrawingDocument,X,Y,XLimit,YLimit){CDocumentContent.call(this,Parent,DrawingDocument, X,Y,XLimit,YLimit,false,false,true);this.FullRecalc=new CDocumentRecalculateState;this.AllFields=[]}CDrawingDocContent.prototype=Object.create(CDocumentContent.prototype);CDrawingDocContent.prototype.constructor=CDrawingDocContent;CDrawingDocContent.prototype.CalculateAllFields=function(){var aParagraphs=this.Content;this.AllFields.length=0;for(var i=0;i