var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opener = _____WB$wombat$assign$function_____("opener");
var __aspxHEIsDocumentDragOver = false;
var __aspxHEDragDropDelay = 100;
var __aspxHEMarkID = "dxMID";
var __aspxHEMarkClassName = "dxMClassName";
var __aspxHEDesignViewDocumentCssClassName = "dxheDesignViewDoc";
var __aspxHEPreviewDocumentCssClassName = "dxhePreviewDoc";
var __aspxHEPreservedTagNamePrefix = "ASPxPreservedTag_";
ASPxClientHtmlEditorIDSuffix = {
ClientStateHiddenField: "_ClientState",
ContentHtmlHiddenField: "_Html",
StandardValidationHiddenField: "_SVHtml",
CurrentDialogHiddenField: "_CurDialog",
ValidationStateHiddenField: "_VS",
CssFilesHiddenField: "_CssFiles",
DesignViewIFrame: "_DesignIFrame",
DesignViewCell: "_DesignViewCell",
EditAreaCell: "_EdtCell",
ErrorFrame: "_EF",
ErrorTextCell: "_ETC",
ErrorFrameCloseButton: "_EFCB",
FakeFocusInput: "_FFI",
FakeFocusAnchor: "_FFA",
HtmlViewEdit: "_HtmlViewEdit",
MainCell: "_MainCell",
PopupDialogControl: "_DPP",
PopupMenu: "_PPM",
PreviewIFrame: "_PreviewIFrame",
PreviewCell: "_PreviewCell",
ButtonImageIdPostfix: "Img",
TabControl: "_TC",
Toolbar: "_TD",
ToolbarRow: "_TBRow",
StatusBarCell: "_SBarCell",
SpellChecker : "_SC",
SizeGrip : "_SG"
};
ASPxHtmlEditorEnterMode = {
Default: "Default",
BR: "BR",
P: "P"
};
var __aspxHESaveImageToServerCallbackPrefix = "ImageToServer";
var __aspxHEThumbnailImageWidthCallbackPrefix = "TNIW";
var __aspxHEThumbnailImageHeightCallbackPrefix = "TNIH";
var __aspxHEThumbnailImageFileNameCallbackPrefix = "TNIF";
var __aspxHESwitchToDesignViewCallbackPrefix = "ProcessHtml_Design";
var __aspxHESwitchToHtmlViewCallbackPrefix = "ProcessHtml_Html";
var __aspxHESwitchToPreviewCallbackPrefix = "ProcessHtml_Preview";
var __aspxHESpellCheckingCallbackPrefix = "SpellCheck";
var __aspxHESpellCheckingLoadControlCallbackPrefix = "SpellCheckLoadControl";
var __aspxHESpellCheckerOptionsCallbackPrefix = "SpellCheckerOptions";
var __aspxHEFileManagerCallbackPrefix = "FileManager";
var __aspxSaveImageToServerErrorCallbackPrefix = "ISE";
var __aspxSaveImageToServerNewUrlCallbackPrefix = "ISU";
var __aspxJSEventHadlersRegExpPattern = "(\\s(\\bon[a-zA-Z][a-z]+)\\s?\=\\s?[\'\"]?(javascript\:)?[\\w\(\\),\\' ]*;?[\\'\\\"]?)+";
var __aspxJSTagsRegExpPattern = "<(script)([^>]*)>[\\s\\S]*?(script)([^>]*)>";
var __aspxHEEmptyTagsRegExpPattern = "^<(p|div|address|h\\d|center|strong)(?=[ >])[^>]*>(?:\\s*| |
|
|
)(<\\/\\1>)?$";
var __aspxHEEmptyHtmlRegExpPattern = "^(
|
|
| )?$";
var __aspxProtectUrlsARegExpPattern = /]+")|(?:'[^'>]+')|(?:[^"' >]+))/gi;
var __aspxProtectUrlsImgRegExpPattern = /]+?(?:\2))|(?:[^"' >]+))/gi;
var __aspxProtectUrlsAreaRegExpPattern = /]+(?:'|"))|(?:[^"' >]+))/gi;
var __aspxRemoveSavedUrlsRegExpPattern = /\ssavedurl=((?:"[^">]+")|(?:'[^'>]+')|(?:[^"' >]+))/gi;
ASPxClientHtmlEditorView = {
Design: "D",
Html: "H",
Preview: "P"
};
ASPxClientHtmlEditorCommandEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
constructor: function(commandName, parameter, isSuccessful) {
this.constructor.prototype.constructor.call(this);
this.commandName = commandName;
this.parameter = parameter;
this.isSuccessful = isSuccessful;
}
});
ASPxClientHtmlEditorCustomDialogEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
constructor: function(name) {
this.constructor.prototype.constructor.call(this);
this.name = name;
}
});
ASPxClientHtmlEditorCustomDialogCloseEventArgsBase = _aspxCreateClass(ASPxClientHtmlEditorCustomDialogEventArgs, {
constructor: function(name, status) {
this.constructor.prototype.constructor.call(this, name);
this.status = status;
}
});
ASPxClientHtmlEditorCustomDialogClosingEventArgs = _aspxCreateClass(ASPxClientHtmlEditorCustomDialogCloseEventArgsBase, {
constructor: function(name, status) {
this.constructor.prototype.constructor.call(this, name, status);
this.handled = false;
}
});
ASPxClientHtmlEditorCustomDialogClosedEventArgs = _aspxCreateClass(ASPxClientHtmlEditorCustomDialogCloseEventArgsBase, {
constructor: function(name, status, data) {
this.constructor.prototype.constructor.call(this, name, status);
this.data = data;
}
});
ASPxClientHtmlEditorValidationEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
constructor: function(html, isValid, errorText) {
this.constructor.prototype.constructor.call(this);
this.html = html;
this.isValid = isValid;
this.errorText = errorText;
}
});
ASPxHtmlEditorsCollection = _aspxCreateClass(null, {
constructor: function() {
this.htmlEditors = {};
var instance = this;
aspxGetPostHandler().Post.AddHandler(function(s, e) {
instance.Synchronize();
});
},
Push: function(htmlEditor) {
aspxGetPostHandler().Update();
this.htmlEditors[htmlEditor.name] = htmlEditor;
},
Get: function(name) {
var instance = this.htmlEditors[name];
if(instance) {
if(instance.GetMainElement())
return instance;
delete this.htmlEditors[name];
}
return null;
},
ForEach: function(action) {
for(var name in this.htmlEditors) {
var instance = this.Get(name);
if(instance)
action(instance);
}
},
Synchronize: function() {
this.ForEach(function(instance) {
instance.Synchronize();
});
},
FocusActiveEditorToolbar: function() {
this.ForEach(function(instance) {
if(instance.isInFocus)
instance.FocusToolbar();
});
},
AreEditorsValidInContainer: function(container, validationGroup, checkInvisibleEditors) {
return this.ProcessingEditorsInContainer(function(editor) {
return editor.GetIsValid() ;
}, container, validationGroup, checkInvisibleEditors);
},
ClearEditorsInContainer: function(container, validationGroup, clearInvisibleEditors) {
this.ProcessingEditorsInContainer(function(editor) {
editor.SetHtml("");
editor.SetIsValid(true);
return true;
}, container, validationGroup, clearInvisibleEditors);
},
ValidateEditorsInContainer: function(container, validationGroup, validateInvisibleEditors) {
return this.ProcessingEditorsInContainer(function(editor) {
return editor.OnValidation(ASPxValidationType.MassValidation);
}, container, validationGroup, validateInvisibleEditors);
},
ProcessingEditorsInContainer: function(proc, container, validationGroup, validateInvisibleEditors) {
var isSuccess = true;
this.ForEach(function(instance) {
if(container == null || _aspxGetIsParent(container, instance.GetMainElement())) {
if((validationGroup == "" || instance.validationGroup == validationGroup)
&& (validateInvisibleEditors || instance.IsVisible())) {
isSuccess = proc(instance) && isSuccess;
}
}
});
return isSuccess;
}
});
ASPxHtmlEditorsCollection.Get = function() {
if(!ASPxHtmlEditorsCollection.instance)
ASPxHtmlEditorsCollection.instance = new ASPxHtmlEditorsCollection();
return ASPxHtmlEditorsCollection.instance;
};
ASPxHtmlEditorLayoutCalculator = _aspxCreateClass(null, {
UpdateLayout: function(htmlEditor, activeView, isInitializing) {
if(__aspxOpera)
this.ShowHideViewAreasDependingOnActiveView(htmlEditor, activeView);
if (!htmlEditor.IsVisible())
return;
this.HideViewAreas(htmlEditor);
this.UpdateToolbarRowDisplay(htmlEditor, activeView);
this.CollapseViewAreas(htmlEditor);
this.ShowHideViewAreasDependingOnActiveView(htmlEditor, activeView);
if (__aspxNetscapeFamily && !htmlEditor.IsHtmlView(activeView))
this.FixToolbarTableBorder_NS(htmlEditor);
htmlEditor.GetFakeFocusInputElement().style.top = "0px";
this.CalculateSizes(htmlEditor);
},
CalculateSizes: function(htmlEditor) {
if(htmlEditor.currentHeight == 0){
var mainElement = htmlEditor.GetMainElement();
var width = _aspxPxToInt(mainElement.style.width);
var height = _aspxPxToInt(mainElement.style.height);
if(width == 0) {
var percentWidth = _aspxPercentageToFloat(mainElement.style.width) * 100;
if(percentWidth > 0) {
htmlEditor.isWidthDefinedInPercent = true;
htmlEditor.initialMainElementWidth = mainElement.style.width;
htmlEditor.SetClientStateFieldValue("CurrentWidth", Math.round(percentWidth));
htmlEditor.percentSizeDiv = _aspxCreateHtmlElementFromString("");
_aspxInsertElementAfter(htmlEditor.percentSizeDiv, mainElement);
mainElement.parentNode.style.width = htmlEditor.initialMainElementWidth;
}
}
htmlEditor.currentHeight = (height == 0) ? mainElement.offsetHeight : height;
htmlEditor.currentWidth = (width == 0) ? mainElement.offsetWidth : width;
mainElement.style.height = "";
mainElement.style.width = "";
}
htmlEditor.SetClientStateFieldValue("IsPercentWidth", htmlEditor.isWidthDefinedInPercent ? 1 : 0);
if(htmlEditor.isFullscreenMode) {
htmlEditor.AdjustSizeInFullscreen();
return;
}
if(htmlEditor.isWidthDefinedInPercent)
htmlEditor.AdjustSizeInPercent();
else
htmlEditor.SetWidthInternal(htmlEditor.currentWidth, true, true);
htmlEditor.HideErrorFrame();
htmlEditor.SetHeightInternal(htmlEditor.currentHeight, true, true);
htmlEditor.UpdateErrorFrame();
},
ShowHideViewAreas: function(htmlEditor, showDesignView, showHtmlView, showPreview) {
var designViewTable = htmlEditor.GetDesignViewTable();
var htmlViewEdit = htmlEditor.GetHtmlViewEdit();
var previewTable = htmlEditor.GetPreviewTable();
if (designViewTable)
_aspxSetElementDisplay(designViewTable, showDesignView);
if (htmlViewEdit)
htmlViewEdit.SetVisible(showHtmlView);
if (previewTable)
_aspxSetElementDisplay(previewTable, showPreview);
},
HideViewAreas: function(htmlEditor) {
this.ShowHideViewAreas(htmlEditor, false, false, false);
},
UpdateToolbarRowDisplay: function(htmlEditor, activeView) {
this.ShowHideToolbarRow(htmlEditor, this.IsToolbarRowVisible(htmlEditor, activeView));
},
IsToolbarRowVisible: function(htmlEditor, activeView) {
return htmlEditor.IsDesignView(activeView);
},
ShowHideToolbarRow: function(htmlEditor, isDisplayed) {
var toolbarRow = htmlEditor.GetToolbarRow();
if (toolbarRow) {
_aspxSetElementDisplay(toolbarRow, isDisplayed);
}
},
CollapseViewAreas: function(htmlEditor) {
var designViewCell = htmlEditor.GetDesignViewCell();
var htmlEdit = htmlEditor.GetHtmlViewEdit();
var previewCell = htmlEditor.GetPreviewCell();
if (designViewCell)
designViewCell.style.height = "0";
if (htmlEdit && htmlEdit.GetInputElement())
htmlEdit.GetInputElement().style.height = "0";
if (previewCell)
previewCell.style.height = "0";
},
ShowHideViewAreasDependingOnActiveView: function(htmlEditor, activeView) {
this.ShowHideViewAreas(htmlEditor, htmlEditor.IsDesignView(activeView), htmlEditor.IsHtmlView(activeView), htmlEditor.IsPreview(activeView));
},
FixToolbarTableBorder_NS: function(htmlEditor) {
var table = htmlEditor.GetToolbarTable();
if (table) {
var borderCollapse = table.style.borderCollapse;
table.style.borderCollapse = "";
table.style.borderCollapse = borderCollapse;
}
}
});
__aspxHtmlEditorLayoutCalculator = null;
function aspxGetHtmlEditorLayoutCalculator() {
if (__aspxHtmlEditorLayoutCalculator == null)
__aspxHtmlEditorLayoutCalculator = new ASPxHtmlEditorLayoutCalculator();
return __aspxHtmlEditorLayoutCalculator;
}
ASPxClientHtmlEditorClientState = _aspxCreateClass(null, {
constructor: function(htmlEditor) {
this.htmlEditor = htmlEditor;
this.clientStateInput = null;
this.fieldsNameValueCollection = this.ParseStateStr();
},
GetClientStateInput: function() {
if (this.clientStateInput == null)
this.clientStateInput = this.FindClientStateInput();
return this.clientStateInput;
},
FindClientStateInput: function() {
return _aspxGetElementById(this.htmlEditor.name + ASPxClientHtmlEditorIDSuffix.ClientStateHiddenField);
},
SetFieldValue: function(name, value, saveToCookie) {
this.fieldsNameValueCollection[name] = value;
this.Save(this.fieldsNameValueCollection, saveToCookie);
},
ParseStateStr: function() {
var state = this.GetClientStateInput().value;
collection = {};
var startIndex = 0;
while(startIndex < state.length)
startIndex = this.ParseFieldRecord(state, startIndex, collection);
return collection;
},
ParseFieldRecord: function(state, startIndex, collection) {
var indexOfFirstSeparator = state.indexOf(ASPxClientHtmlEditorClientState.RecordSeparator, startIndex);
var fieldName = state.substr(startIndex, indexOfFirstSeparator - startIndex);
startIndex += fieldName.length + 1;
var indexOfSecondSeparator = state.indexOf(ASPxClientHtmlEditorClientState.RecordSeparator, startIndex);
var fieldValueLengthStr = state.substr(startIndex, indexOfSecondSeparator - startIndex);
startIndex += fieldValueLengthStr.length + 1;
var fieldValueLength = parseInt(fieldValueLengthStr);
var fieldValue = state.substr(startIndex, fieldValueLength);
startIndex += fieldValueLength;
collection[fieldName] = fieldValue;
return startIndex;
},
Save: function(collection, saveToCookie) {
var result = [];
for(var fieldName in collection) {
var value = collection[fieldName];
if (typeof(value) == "number")
value = value.toString();
if (typeof(value) == "string")
result.push(fieldName + ASPxClientHtmlEditorClientState.RecordSeparator + value.length + ASPxClientHtmlEditorClientState.RecordSeparator + value);
}
var state = result.join('');
this.GetClientStateInput().value = state;
if(saveToCookie && this.htmlEditor.cookieName != ""){
_aspxDelCookie(this.htmlEditor.cookieName);
_aspxSetCookie(this.htmlEditor.cookieName, state);
}
}
});
ASPxClientHtmlEditorClientState.RecordSeparator = '|';
ASPxClientHtmlEditor = _aspxCreateClass(ASPxClientControl, {
constructor: function(name) {
this.constructor.prototype.constructor.call(this, name);
this.allowDesignView = true;
this.allowHtmlView = true;
this.allowPreview = true;
this.allowContextMenu = true;
this.allowScripts = false;
this.allowInsertDirectImageUrls = true;
this.cssFileLinkArray = new Function("return " + this.GetCssFilesHiddenField().value)();
this.designViewIFrameDocumentStyleCssText = "";
this.previewIFrameDocumentStyleCssText = "";
this.html = "";
this.activeView = ASPxClientHtmlEditorView.Design;
this.uploadImageFileDirectoryPath = "";
this.updateDeprecatedElements = true;
this.clientValidationEnabled = false;
this.validationPatterns = [];
this.initialErrorText = "";
this.errorText = "";
this.isValid = true;
this.validationGroup = "";
this.notifyValidationSummariesToAcceptNewError = false;
this.templateHoverErrorFrameCloseButton = null;
this.enterMode = ASPxHtmlEditorEnterMode.Default;
this.clientState = new ASPxClientHtmlEditorClientState(this);
this.callbackOwner = null;
this.isDraggingInsideEditor = false;
this.isDropExternalContentExecuted = false;
this.dragDropTimerID = null;
this.beforePopupSelection = null;
this.CustomCommand = new ASPxClientEvent();
this.CommandExecuted = new ASPxClientEvent();
this.GotFocus = new ASPxClientEvent();
this.LostFocus = new ASPxClientEvent();
this.SelectionChanged = new ASPxClientEvent();
this.HtmlChanged = new ASPxClientEvent();
this.CustomDialogOpened = new ASPxClientEvent();
this.CustomDialogClosing = new ASPxClientEvent();
this.CustomDialogClosed = new ASPxClientEvent();
this.Validation = new ASPxClientEvent();
this.ContextMenuShowing = new ASPxClientEvent();
this.SpellingChecked = new ASPxClientEvent();
this.inSharePoint = false;
this.currentBgColor = null;
this.currentFontColor = null;
this.isWidthDefinedInPercent = false;
this.initialMainElementWidth = -1;
this.layoutCalculator = aspxGetHtmlEditorLayoutCalculator();
this.eventListener = null;
this.commandManager = null;
this.isErrorOnCallback = false;
this.isMouseDown = false;
this.isInFocus = false;
this.isSelectionRestored = false;
this.keyboardManager = null;
this.toolbar = null;
this.shortcutCmdID = null;
this.executingCommandName = null;
this.pasteContainer = null;
this.savedPreviewHtmlAfterSet = "";
this.isPreventKeyPressOnShowContextMenu = false;
this.isFocusedOnce = false;
this.htmlBackup = null;
this.cookieName = "";
this.cachedElementsManager = new ASPxCachedElementsManager(this);
this.sizingConfig.correction = true;
this.sizingConfig.adjustControl = true;
this.allowResize = false;
this.minWidth = 0;
this.minHeight = 0;
this.maxWidth = 0;
this.maxHeight = 0;
this.currentHeight = 0;
this.currentWidth = 0;
this.resizeTempVars = {};
this.percentResizeStarted = false;
this.isFullscreenMode = false;
this.fullscreenTempVars = {};
this.selection = null;
this.customComboBoxCollection = {};
this.spellCheckerHelper = new ASPxClientHtmlEditor.SpellCheckerHelper(this);
this.selectionHelper = new ASPxClientHtmlEditorSelection.ElementsSelectionHelper(this);
this.customDialogsCaptions = {};
this.shortcuts = null;
this.suspendHCEvt = -1;
},
InlineInitialize: function() {
this.htmlBackup = this.html;
this.InitAreas();
if(!this.NeedToolbarRtlPrecorrection())
this.UpdateLayout(this.activeView, false);
if (__aspxIE && __aspxBrowserMajorVersion < 9 && this.IsDesignView())
ASPxClientHtmlProcessingUtils.CleanWrongSizeAttribute(this.GetDesignViewIFrameDocumentBody());
var tabs = this.GetTabControl();
if(this.enabled && tabs)
tabs.SetEnabled(false);
if(this.IsStandardValidationEnabled())
this.SynchronizeForStandardValidation();
},
IsStandardValidationEnabled: function() {
return !!window.ValidatorHookupControl;
},
Initialize: function() {
ASPxClientControl.prototype.Initialize.call(this);
ASPxHtmlEditorsCollection.Get().Push(this);
if(this.enabled)
this.InitializeErrorFrames();
this.UpdateClientValidationState();
this.UpdateValidationSummaries(null , true );
if (!__aspxOpera && this.allowDesignView)
this.InitializeManagers();
if(this.allowDesignView && __aspxWebKitFamily && this.GetDesignViewIFrameElement().loadUnhandled)
this.OnDesignViewIframeLoad();
if(this.enabled && this.allowResize){
var sizeGrip = this.GetSizeGrip();
if(sizeGrip){
_aspxPreventElementDrag(sizeGrip);
var instance = this;
_aspxAttachEventToElement(sizeGrip, "mousedown", function(evt) {
instance.OnSizeGripMouseDown(evt);
});
_aspxAttachEventToDocument("mouseup", function(evt) {
instance.OnSizeGripMouseUp(evt);
});
_aspxAttachEventToDocument("mousemove", function(evt) {
instance.OnSizeGripMouseMove(evt);
});
}
}
var tabs = this.GetTabControl();
if(this.enabled && tabs)
tabs.SetEnabled(this.GetEnabled());
if(!this.clientEnabled)
this.SetEnabled(false);
},
AfterInitialize: function(){
this.constructor.prototype.AfterInitialize.call(this);
if(__aspxIE)
this.AdjustControl();
var _this = this;
var iframe = this.allowDesignView ? this.GetDesignViewIFrameElement() : null;
iframe = !iframe && this.allowPreview ? this.GetPreviewIFrameElement() : iframe;
if(iframe)
_aspxAttachEventToElement(iframe, "load", function(evt) { _this.OnIFrameLoad(); });
if(this.IsStandardValidationEnabled())
this.RedirectStandardValidators();
},
RedirectStandardValidators: function() {
var contentToValidate = this.GetStandardValidationHiddenField();
if(contentToValidate.Validators) {
for(var i = 0; i < contentToValidate.Validators.length; i++)
contentToValidate.Validators[i].controltovalidate = contentToValidate.id;
}
},
InitializeManagers: function() {
if (this.allowDesignView) {
this.commandManager = new CommandManager(this);
this.keyboardManager = new ASPxHtmlEditorKeyboardManager();
this.toolbar = this.GetToolbar();
this.InitializeEventListner();
this.InitializeShortcuts();
if(this.htmlToDelayedSet) {
this.SetHtml(this.htmlToDelayedSet.html, this.htmlToDelayedSet.clearUndoHistory);
this.htmlToDelayedSet = null;
}
}
},
InitAreas: function() {
if (this.allowDesignView)
this.InitDesignViewIFrame();
if (this.allowPreview)
this.InitPreviewIFrame();
if (this.allowHtmlView)
this.InitHtmlViewArea();
if(this.html != "") {
var self = this;
var handler = function() {
self.SetHtmlInternal(self.html);
};
var IFrameBody = null;
if(!this.IsHtmlView())
IFrameBody = this.IsDesignView() ? this.GetDesignViewIFrameDocumentBody() : this.GetPreviewIFrameDocumentBody();
if(!this.IsHtmlView() && !IFrameBody) {
var IFrameElement = this.IsDesignView() ? this.GetDesignViewIFrameElement() : this.GetPreviewIFrameElement();
_aspxAttachEventToElement(IFrameElement, "load", handler);
} else {
handler();
}
}
if(this.IsDesignView())
this.SetDesignModeAttribute();
},
InitializeErrorFrames: function() {
this.initialErrorText = this.errorText;
this.CreateErrorFrames();
},
InitDesignViewIFrame: function() {
this.InitIFrame(this.GetDesignViewIFrameName(), "", this.cssFileLinkArray);
this.InitDesignViewIFrameStyle();
},
InitPreviewIFrame: function() {
this.InitIFrame(this.GetPreviewIFrameName(), "", this.cssFileLinkArray);
this.InitPreviewIFrameStyle();
},
InitHtmlViewArea: function() {
this.DisableSpellCheckAttribute(this.GetHtmlViewEdit().GetInputElement());
this.GetHtmlViewEdit().heightCorrectionRequired = false;
if(__aspxWebKitFamily)
this.GetHtmlViewEdit().GetInputElement().style.resize = "none";
},
InitializeEventListner: function() {
this.eventListener = new EventListener(this);
},
InitializeShortcuts: function() {
var scs = ASPxHtmlEditorKeyboardManager.Shortcuts;
for(var i = 0; i < scs.length; i++)
this.keyboardManager.AddShortcut(scs[i][1], scs[i][0]);
if(this.shortcuts) {
for(var key in this.shortcuts) {
if(this.shortcuts.hasOwnProperty(key) && key != "None")
this.keyboardManager.AddShortcut(key, this.shortcuts[key]);
}
}
this.shortcutCmdID = null;
},
InitIFrame: function(iframeName, bodyContentHtml, cssFileLinkArray) {
var doc = ASPxIFrame.GetDocument(iframeName);
var element = ASPxIFrame.GetElement(iframeName);
if (doc != null && element != null) {
this.InitIFrameDocument(doc, bodyContentHtml, cssFileLinkArray);
if (__aspxOpera)
doc.body.style.height = "100%";
element.style.height = "100%";
doc.body.className = element.className;
if(this.rtl)
doc.body.dir = "rtl";
}
},
InitIFrameDocument: function(doc, bodyContentHtml, cssFileLinkArray) {
doc.open();
doc.write(this.GetIFrameDocumentHtml(bodyContentHtml));
doc.close();
doc.body.style.borderWidth = 0;
this.DisableSpellCheckAttribute(doc.body);
this.AddCssFileLinksToDocument(doc, cssFileLinkArray);
},
InitDesignViewIFrameStyle: function() {
if (this.designViewIFrameDocumentStyleCssText != "") {
var designViewIFrameDocumentStyleSheet = _aspxCreateStyleSheetInDocument(this.GetDesignViewDocument());
_aspxAddStyleSheetRule(designViewIFrameDocumentStyleSheet,
"." + __aspxHEDesignViewDocumentCssClassName, this.designViewIFrameDocumentStyleCssText);
this.GetDesignViewIFrameDocumentBody().className += " " + __aspxHEDesignViewDocumentCssClassName;
}
},
InitPreviewIFrameStyle: function() {
if (this.previewIFrameDocumentStyleCssText != "") {
var previewIFrameDocumentStyleSheet = _aspxCreateStyleSheetInDocument(this.GetPreviewDocument());
_aspxAddStyleSheetRule(previewIFrameDocumentStyleSheet,
"." + __aspxHEPreviewDocumentCssClassName, this.previewIFrameDocumentStyleCssText);
this.GetPreviewIFrameDocumentBody().className += " " + __aspxHEPreviewDocumentCssClassName;
}
},
AddCssFileLinksToDocument: function(doc, linkArray) {
for (var i = 0; i < linkArray.length; i++) {
_aspxAddStyleSheetLinkToDocument(doc, linkArray[i]);
}
},
OnIFrameLoad: function() {
if(this.commandManager && !(__aspxIE && __aspxBrowserMajorVersion < 9) && !this.iframeLoading) {
this.iframeLoading = true;
this.InitAreas();
if(this.allowDesignView)
this.InitializeEventListner();
if(_aspxIsExists(this.htmlBackup))
this.SetHtmlInternal(this.htmlBackup);
var _this = this;
window.setTimeout(function() {
_this.AdjustControl();
if(__aspxOpera)
_this.iframeLoading = false;
}, 10);
if(!__aspxOpera)
this.iframeLoading = false;
}
},
SetClientStateFieldValue: function(name, value, saveToCookie) {
this.clientState.SetFieldValue(name, value, saveToCookie);
},
GetDesignViewCell: function() {
return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.DesignViewCell);
},
GetDesignViewTable: function() {
return _aspxGetParentByTagName(this.GetDesignViewCell(), "table");
},
GetPreviewTable: function() {
return _aspxGetParentByTagName(this.GetPreviewCell(), "table");
},
GetPreviewCell: function() {
return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.PreviewCell);
},
GetHtmlViewEditCell: function() {
var htmlViewEditTable = _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.HtmlViewEdit);
return _aspxGetChildByTagName(htmlViewEditTable, "TD", 0);
},
GetDesignViewDocument: function() {
if(!this.allowDesignView)
return null;
return ASPxIFrame.GetDocument(this.GetDesignViewIFrameName());
},
GetDesignViewIFrameDocument: function() {
return this.GetDesignViewDocument();
},
GetDesignViewIFrameDocumentBody: function() {
return ASPxIFrame.GetDocumentBody(this.GetDesignViewIFrameName());
},
GetDesignViewIFrameWindow: function() {
return ASPxIFrame.GetWindow(this.GetDesignViewIFrameName());
},
GetEditAreaCell: function() {
return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.EditAreaCell);
},
GetViewCellID: function(view) {
if(view == ASPxClientHtmlEditorView.Design)
return ASPxClientHtmlEditorIDSuffix.DesignViewCell;
if(view == ASPxClientHtmlEditorView.Html)
return ASPxClientHtmlEditorIDSuffix.HtmlViewEdit;
if(view == ASPxClientHtmlEditorView.Preview)
return ASPxClientHtmlEditorIDSuffix.PreviewCell;
return "";
},
GetErrorFrameID: function(view) {
return this.name + this.GetViewCellID(view) + ASPxClientHtmlEditorIDSuffix.ErrorFrame;
},
GetErrorTextCellID: function(view) {
return this.name + this.GetViewCellID(view) + ASPxClientHtmlEditorIDSuffix.ErrorTextCell;
},
GetErrorFrameCloseButtonCellID: function(view) {
return this.name + this.GetViewCellID(view) + ASPxClientHtmlEditorIDSuffix.ErrorFrameCloseButton;
},
GetTemplateErrorFrameID: function() {
return this.name + ASPxClientHtmlEditorIDSuffix.ErrorFrame;
},
GetErrorFrame: function(view) {
return _aspxGetElementById(this.GetErrorFrameID(view));
},
GetErrorTextCell: function(view) {
return _aspxGetElementById(this.GetErrorTextCellID(view));
},
GetTemplateErrorFrame: function() {
return _aspxGetElementById(this.GetTemplateErrorFrameID());
},
GetDialogPopupControl: function() {
return aspxGetControlCollection().Get(this.name + ASPxClientHtmlEditorIDSuffix.PopupDialogControl);
},
GetDesignViewIFrameElement: function() {
return ASPxIFrame.GetElement(this.GetDesignViewIFrameName());
},
GetDesignViewIFrameName: function() {
return this.name + ASPxClientHtmlEditorIDSuffix.DesignViewIFrame;
},
GetPreviewIFrameName: function() {
return this.name + ASPxClientHtmlEditorIDSuffix.PreviewIFrame;
},
GetPreviewIFrameElement: function() {
return ASPxIFrame.GetElement(this.GetPreviewIFrameName());
},
GetPreviewDocument: function() {
if(!this.allowPreview)
return null;
return ASPxIFrame.GetDocument(this.GetPreviewIFrameName());
},
GetPreviewIFrameDocumentBody: function() {
return ASPxIFrame.GetDocumentBody(this.GetPreviewIFrameName());
},
GetElementDocument: function(element) {
return element.ownerDocument || element.document;
},
GetFakeFocusInputElement: function() {
return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.FakeFocusInput);
},
GetFakeFocusAnchorElement: function() {
var element = _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.FakeFocusAnchor);
if(!element || !element.parentNode) {
element = document.createElement("A");
_aspxSetAttribute(element, "href", "javascript:void('0')");
_aspxInsertElementAfter(element, this.GetMainElement());
}
return element;
},
GetHtmlViewEdit: function() {
return aspxGetControlCollection().Get(this.name + ASPxClientHtmlEditorIDSuffix.HtmlViewEdit);
},
GetMainCell: function() {
return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.MainCell);
},
GetContextMenu: function() {
return aspxGetControlCollection().Get(this.name + ASPxClientHtmlEditorIDSuffix.PopupMenu);
},
GetToolbar: function() {
return aspxGetControlCollection().Get(this.name + ASPxClientHtmlEditorIDSuffix.Toolbar);
},
GetTabControl: function() {
return aspxGetControlCollection().Get(this.name + ASPxClientHtmlEditorIDSuffix.TabControl);
},
GetToolbarRow: function() {
return this.GetChild(ASPxClientHtmlEditorIDSuffix.ToolbarRow);
},
GetToolbarTable: function() {
return _aspxGetParentByTagName(this.GetToolbarRow(), "table");
},
GetToolbarCell: function() {
return _aspxGetChildByTagName(this.GetToolbarRow(), "td", 0);
},
GetStatusBarCell: function() {
return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.StatusBarCell);
},
GetSizeGrip: function() {
return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.SizeGrip);
},
GetHiddenField: function(key, postfix, toMainCell) {
var hiddenField = this[key];
if(!hiddenField) {
var hiddenFieldName = this.name + postfix;
this[key] = hiddenField = _aspxCreateHiddenField(hiddenFieldName, hiddenFieldName);
var container = toMainCell ? this.GetMainCell() : this.GetMainElement().parentNode;
container.appendChild(hiddenField);
}
return hiddenField;
},
GetCurrentDialogHiddenField: function() {
return this.GetHiddenField("currentDialogHiddenField", ASPxClientHtmlEditorIDSuffix.CurrentDialogHiddenField);
},
GetHtmlSyncHiddenField: function() {
return this.GetHiddenField("contentHtmlHiddenField", ASPxClientHtmlEditorIDSuffix.ContentHtmlHiddenField);
},
GetStandardValidationHiddenField: function() {
return this.GetHiddenField("standardValidationHiddenField", ASPxClientHtmlEditorIDSuffix.StandardValidationHiddenField, true);
},
GetValidationStateHiddenField: function() {
return this.GetHiddenField("validationStateHiddenField", ASPxClientHtmlEditorIDSuffix.ValidationStateHiddenField);
},
GetCssFilesHiddenField: function() {
return _aspxGetElementById(this.name + ASPxClientHtmlEditorIDSuffix.CssFilesHiddenField);
},
UpdateLayout: function(activeView, isInitializing) {
if(this.GetMainElement().offsetWidth == 0)
return;
isInitializing = !!isInitializing;
if(this.isFullscreenMode)
this.AdjustSizeInFullscreen();
this.layoutCalculator.UpdateLayout(this, activeView, isInitializing);
},
UpdateToolbarAndMenu: function() {
if (this.allowDesignView && this.IsDesignView()) {
this.UpdateToolbarImmediately();
this.UpdateContextMenu();
}
},
RemoveChildrenFromFlow: function(parent, remove) {
if(__aspxIE && __aspxBrowserMajorVersion == 9) {
this.RemoveChildrenFromFlow = function(parent, remove) {
var elements = _aspxGetElementNodes(parent);
for(var i = 0, l = elements.length; i < l; i++)
elements[i].style.position = remove ? "absolute" : "";
};
}
else {
this.RemoveChildrenFromFlow = function(parent, remove) {
var elements = _aspxGetElementNodes(parent);
for(var i = 0, l = elements.length; i < l; i++)
_aspxSetElementDisplay(elements[i], !remove);
};
}
this.RemoveChildrenFromFlow(parent, remove);
},
AdjustSizeInPercent: function() {
var mainElement = this.GetMainElement();
var mainCell = this.GetMainCell();
this.RemoveChildrenFromFlow(mainCell, true);
var newOffsetWidth = this.percentSizeDiv.offsetWidth;
this.RemoveChildrenFromFlow(mainCell, false);
if(this.adjustResizeTimerID){
_aspxClearTimer(this.adjustResizeTimerID);
delete this.adjustResizeTimerID;
}
if(this.oldOffsetWidth != newOffsetWidth || newOffsetWidth != mainElement.offsetWidth) {
if(!this.percentResizeStarted) {
this.SaveStartSize();
this.percentResizeStarted = true;
}
this.SetDeltaWidthInternal(newOffsetWidth - this.resizeTempVars.startMainWidth, true);
var instance = this;
this.adjustResizeTimerID = _aspxSetTimeout(function() {
instance.percentResizeStarted = false;
}, 200);
}
this.oldOffsetWidth = newOffsetWidth;
},
AdjustControlCore: function() {
if(!_aspxIsExistsElement(this.GetMainElement()))
return;
if(this.resizeTempVars && this.resizeTempVars.isInMove)
return;
if(this.isInitialized && !this.IsDisplayed()){
return;
}
if (this.isFullscreenMode) {
this.AdjustSizeInFullscreen();
return;
}
if (this.IsVisible() && (!this.isInitialized || !this.isLoaded)) {
this.isLoaded = true;
this.UpdateLayout(this.activeView, true);
this.UpdateToolbarAndMenu();
var needSetFocus = !(__aspxNetscapeFamily || __aspxIE);
var scrollX = _aspxGetDocumentScrollLeft();
var scrollY = _aspxGetDocumentScrollTop();
if(this.IsDesignView() && this.GetEnabled()) {
this.SetDesignModeAttribute();
if (needSetFocus)
this.SetFocus();
}
this.percentResizeStarted = false;
if (this.IsDesignView() && needSetFocus) {
this.RemoveFocus();
window.scrollTo(scrollX, scrollY);
}
if (this.delayedFocus) {
this.SetFocus();
this.delayedFocus = null;
}
}
if(this.isWidthDefinedInPercent) {
this.AdjustSizeInPercent();
this.SaveCurrentSize(true, true, false);
}
},
IsStatusBarShown: function() {
return (this.allowDesignView ? 1 : 0) + (this.allowHtmlView ? 1 : 0) + (this.allowPreview ? 1 : 0) > 1;
},
SetDesignModeAttribute: function() {
var enabled = this.GetEnabled();
var doc = ASPxIFrame.GetDocument(this.GetDesignViewIFrameName());
if(doc) {
if(__aspxNetscapeFamily)
doc.designMode = enabled ? "on" : "off";
else
doc.body.contentEditable = enabled;
}
},
DisableSpellCheckAttribute: function(element) {
if (__aspxFirefox)
element.spellcheck = false;
},
ShowLoadingPanel: function() {
var container = this.GetMainElement();
this.CreateLoadingDiv(document.body, container);
this.CreateLoadingPanelWithAbsolutePosition(document.body, container);
},
GetEnabled: function(){
return this.clientEnabled && this.enabled;
},
SetEnabled: function(enabled) {
if(this.clientEnabled != enabled) {
ASPxClientControl.prototype.SetEnabled.call(this, enabled);
this.SetEnabledInternal(enabled);
}
},
SetEnabledInternal: function(enabled) {
this.SetDesignModeAttribute();
if(enabled)
this.UpdateToolbar();
},
Focus: function() {
this.SetFocus();
},
ClearFocusInput: function() {
var focusInputElement = this.GetFakeFocusInputElement();
if (focusInputElement)
focusInputElement.value = "";
},
SetActive: function() {
if (__aspxIE) {
var iFrame = this.GetDesignViewIFrameElement();
if (iFrame)
iFrame.setActive();
}
},
SetFocus: function() {
if (this.IsDesignView() && !this.isInFocus) {
if (this.IsIFrameReady()) {
var focusObj = __aspxWebKitFamily
? this.GetDesignViewIFrameDocumentBody()
: this.GetDesignViewIFrameWindow();
focusObj.focus();
if(__aspxIE || __aspxWebKitFamily)
this.UpdateToolbarAndMenu();
}
else
this.delayedFocus = true;
}
else if (this.IsHtmlView()) {
var htmlViewInput = this.GetHtmlViewEdit().GetInputElement();
htmlViewInput.focus();
_aspxSetCaretPosition(htmlViewInput, 0);
}
},
IsIFrameReady: function() {
return this.isInitialized && this.isLoaded;
},
RemoveFocus: function(byAnchor) {
this.isInFocus = false;
var scrollTop = _aspxGetDocumentScrollTop();
if(byAnchor) {
try {
this.GetFakeFocusAnchorElement().focus();
} catch(e) {}
_aspxSetDocumentScrollTop(scrollTop);
}
else {
var inputElement = this.GetFakeFocusInputElement();
_aspxRemoveAttribute(inputElement, "disabled");
try {
inputElement.focus();
}
catch (e) { }
if (__aspxIE || (__aspxWebKitFamily && !this.isInitialized)) {
try {
window.focus();
if(__aspxIE && __aspxBrowserMajorVersion < 8)
setTimeout(function() { _aspxSetDocumentScrollTop(scrollTop); }, 100);
}
catch (e) { }
}
inputElement.disabled = "disabled";
}
},
GetHtml: function() {
return this.ProcessHtmlToGetHtml(this.GetHtmlInternal());
},
GetHtmlInternal: function() {
var html = this.html;
if (this.IsDesignView() && this.IsExistsWindowInIFrame(this.GetDesignViewIFrameName()))
html = this.GetDesignViewIFrameDocumentBody().innerHTML;
else if (this.IsHtmlView() && _aspxIsExistsElement(this.GetHtmlViewEdit().GetMainElement()))
html = this.GetHtmlViewEdit().GetText();
else if (this.IsExistsWindowInIFrame(this.GetPreviewIFrameName()))
html = this.savedPreviewHtmlAfterSet;
return html;
},
SetHtml: function(html, clearUndoHistory) {
if(this.IsDesignView() && !this.commandManager) {
this.htmlToDelayedSet = {
"html": html,
"clearUndoHistory": clearUndoHistory
};
}
else {
clearUndoHistory = _aspxIsExists(clearUndoHistory) ? clearUndoHistory : true;
this.SetHtmlInternal(html);
if(clearUndoHistory) {
this.ClearUndoHistory();
this.executingCommandName = null;
}
this.OnHtmlChanged(false);
if(!clearUndoHistory)
this.SaveToUndoHistory();
}
},
SetHtmlInternal: function(html, newActiveView) {
if (!newActiveView)
newActiveView = this.activeView;
this.CallSuspendedHtmlChangedEvt();
html = this.ProcessHtmlToSetHtml(html, newActiveView);
if (this.allowDesignView && this.IsDesignView(newActiveView)) {
this.SetInnerHtmlToBody(this.GetDesignViewIFrameDocumentBody(), html);
this.ProcessDesignViewDocumentDomAfterSetHtml();
var instance = this;
window.setTimeout(function() {
instance.GetDesignViewIFrameDocumentBody().scrollTop = 0;
}, 0);
}
if (this.allowHtmlView && this.IsHtmlView(newActiveView))
this.GetHtmlViewEdit().SetText(html);
if (this.allowPreview && this.IsPreview(newActiveView)) {
ASPxClientHtmlEditor.SetInnerHtml(this.GetPreviewIFrameDocumentBody(), html);
this.savedPreviewHtmlAfterSet = this.GetPreviewIFrameDocumentBody().innerHTML;
this.ProcessPreviewDocumentDomAfterSetHtml();
}
},
ProcessHtmlToSetHtml: function(html, newActiveView) {
if (this.IsPreview(newActiveView) || this.IsDesignView(newActiveView)) {
html = ASPxClientHtmlEditor.PreserveTagsByName("noscript", html);
if (!this.allowScripts)
html = ASPxClientHtmlEditor.CleanHtmlScripts(html);
else {
var masked = this.MaskComments(html);
html = ASPxClientHtmlEditor.PreserveTagsByName("script", masked.html);
html = this.UnMaskComments(html, masked.comments);
}
if (this.IsDesignView(newActiveView)) {
if (__aspxIE)
html = ASPxClientHtmlProcessingUtils.ReplaceUnderlineSpanWithUTag(html);
if (this.updateDeprecatedElements)
html = ASPxClientHtmlProcessingUtils.ReplaceSpanWithFontTag(html);
}
} else if (this.IsHtmlView(newActiveView))
html = this.ConvertToEmptyHtml(html);
return html;
},
ProcessDesignViewDocumentDomAfterSetHtml: function() {
this.ProcessInnerHtml(this.GetDesignViewIFrameDocumentBody())
},
ProcessInnerHtml: function(container) {
ASPxClientHtmlProcessingUtils.ReplaceTableStyleBorderByAttribute(container);
ASPxClientHtmlProcessingUtils.AddEmptyBorderClassInTables(container);
},
ProcessPreviewDocumentDomAfterSetHtml: function() {
ASPxClientHtmlProcessingUtils.ReplaceLinkTargetWithBlank(this.GetPreviewIFrameDocumentBody());
},
ProcessHtmlToGetHtml: function(html) {
if (this.IsPreview() || this.IsDesignView()) {
html = this.ConvertToEmptyHtml(ASPxClientHtmlEditor.DepreserveTagsByName("noscript", html));
if (this.allowScripts)
html = ASPxClientHtmlEditor.DepreserveTagsByName("script", html);
if (this.IsDesignView()) {
if (this.updateDeprecatedElements)
html = ASPxClientHtmlProcessingUtils.ReplaceFontWithSpanTag(html);
html = ASPxClientHtmlProcessingUtils.FilterHtmlToGetHtml(html);
html = ASPxClientHtmlProcessingUtils.RemoveEmptyBorderClassName(html);
}
}
html = ASPxClientHtmlEditor.RemoveSavedUrlsInHTML(html);
if(this.enterMode == ASPxHtmlEditorEnterMode.BR) {
var regExp = new RegExp(__aspxHEBogusSymbol, 'g');
html = html.replace(regExp, ' ');
}
return html;
},
SetInnerHtmlToBody: function(bodyElement, html) {
ASPxClientHtmlEditor.SetInnerHtml(bodyElement, html);
if (__aspxIE)
ASPxClientHtmlProcessingUtils.CleanWrongSizeAttribute(bodyElement);
},
Synchronize: function() {
if(this.IsControlExist()) {
this.SynchronizeContentHtml();
this.ClearFocusInput();
}
},
SynchronizeForStandardValidation: function(checkValidators) {
var contentToValidate = this.GetStandardValidationHiddenField();
if(!checkValidators || contentToValidate.Validators)
this.GetStandardValidationHiddenField().value = _aspxEncodeHtml(this.GetHtml());
},
SynchronizeContentHtml: function() {
var htmlSyncInput = this.GetHtmlSyncHiddenField();
if (_aspxIsExistsElement(htmlSyncInput)) {
var html = this.GetHtml();
this.syncronizedHtml = html;
htmlSyncInput.value = _aspxEncodeHtml(html);
}
},
IsControlExist: function() {
return _aspxIsExistsElement(this.GetMainElement());
},
IsDesignView: function(view) {
if (!view)
view = this.activeView;
return view == ASPxClientHtmlEditorView.Design;
},
IsHtmlView: function(view) {
if (!view)
view = this.activeView;
return view == ASPxClientHtmlEditorView.Html;
},
IsPreview: function(view) {
if (!view)
view = this.activeView;
return view == ASPxClientHtmlEditorView.Preview;
},
ChangeActiveView: function(activeView) {
if (activeView == this.activeView)
return;
if(activeView == ASPxClientHtmlEditorView.Design && this.cachedElementsManager)
this.cachedElementsManager.ClearSeletedElements();
this.SaveCurrentSize(true, true, false);
switch (activeView) {
case ASPxClientHtmlEditorView.Design:
this.SetDesignActiveView();
break;
case ASPxClientHtmlEditorView.Html:
this.SetHtmlActiveView();
break;
case ASPxClientHtmlEditorView.Preview:
this.SetPreviewActiveView();
break;
}
this.activeView = activeView;
},
SetDesignActiveView: function() {
this.SetClientStateFieldValue("ActiveView", "Design");
this.executingCommandName = null;
if (this.IsHtmlView())
this.ClearUndoHistory();
this.SendCallback(__aspxHESwitchToDesignViewCallbackPrefix, "", true);
},
SetHtmlActiveView: function() {
this.SetClientStateFieldValue("ActiveView", "Html");
if (this.IsDesignView())
this.ClearUndoHistory();
this.SendCallback(__aspxHESwitchToHtmlViewCallbackPrefix, "", true);
},
SetPreviewActiveView: function() {
this.SetClientStateFieldValue("ActiveView", "Preview");
this.ClearUndoHistory();
this.SendCallback(__aspxHESwitchToPreviewCallbackPrefix, "", true);
},
SwitchToDesignViewCore: function(html) {
var oldHtml = this.GetHtml();
this.SwitchToViewCore(ASPxClientHtmlEditorView.Design, html);
if (__aspxIE && __aspxBrowserMajorVersion < 9)
ASPxClientHtmlProcessingUtils.CleanWrongSizeAttribute(this.GetDesignViewIFrameDocumentBody());
this.SetDesignModeAttribute();
var savedSelection = this.selection;
if(oldHtml != this.GetHtml())
this.OnHtmlChanged(false);
this.selection = savedSelection;
},
SwitchToHtmlViewCore: function(html) {
this.SwitchToViewCore(ASPxClientHtmlEditorView.Html, html);
},
SwitchToPreviewCore: function(html) {
this.SwitchToViewCore(ASPxClientHtmlEditorView.Preview, html);
},
SwitchToViewCore: function(view, html) {
if(__aspxWebKitFamily)
this.SaveCurrentSize(true, true, false);
this.UpdateLayout(view);
this.CorrectSizeOnSwitchToView();
this.SetHtmlInternal(html, view);
if (this.IsPreview(view))
this.RemoveFocus();
else
this.SetFocus();
},
CorrectSizeOnSwitchToView: function(view) {
var editArea = this.GetEditAreaCell();
editArea.style.height = "100%";
editArea.style.width = "100%";
this.SetWidthInternal(this.currentWidth, false, false);
this.SetHeightInternal(this.currentHeight, false, false);
},
ExecuteCommand: function(commandName, parameter, addToUndoHistory) {
addToUndoHistory = _aspxIsExists(addToUndoHistory) ? addToUndoHistory : true;
var isSuccessfully = false;
if (commandName.indexOf(";") > -1) {
var commandParts = commandName.split(";");
commandName = commandParts[0];
parameter = commandParts[1];
}
var cmd = ASPxHtmlEditorCommandList[commandName];
var nonClientCommand = cmd && !cmd.IsClientCommand();
if(nonClientCommand) {
isSuccessfully = cmd.Execute(parameter, this);
this.RaiseCommandExecuted(commandName, parameter, isSuccessfully);
}
else if (this.IsDesignView() && this.GetEnabled()) {
this.RestoreSelectionForPopup();
if(__aspxWebKitFamily && !this.isFocusedOnce) {
this.isFocusedOnce = true;
this.RemoveFocus(true);
this.GetDesignViewIFrameDocumentBody().focus();
}
this.CallSuspendedHtmlChangedEvt();
if (cmd != null) {
if(!this.commandManager) return;
this.executingCommandName = commandName;
var contentHtml = this.GetHtmlInternal();
var isSuccessfully = this.commandManager.ExecuteCommand(commandName, parameter, addToUndoHistory);
if (!cmd.IsImmediateExecution())
this.executingCommandName = null;
if (contentHtml != this.GetHtmlInternal())
this.OnHtmlChanged(false);
else
if (isSuccessfully)
this.OnSelectionChanged();
this.RaiseCommandExecuted(commandName, parameter, isSuccessfully);
}
else {
if (!this.CustomCommand.IsEmpty()) {
if(__aspxIE) {
var selection = this.selection;
if(!selection || __aspxBrowserMajorVersion >= 9 || !selection.GetIsControlSelected())
this.RestoreSelection();
}
else
this.RestoreSelection();
var contentHtml = this.GetHtmlInternal();
isSuccessfully = this.RaiseCustomCommand(commandName, parameter);
var htmlChanged = contentHtml != this.GetHtmlInternal();
this.OnHtmlChanged(htmlChanged, !htmlChanged);
this.RaiseCommandExecuted(commandName, parameter, isSuccessfully);
}
else
alert('Command not found');
}
}
return isSuccessfully;
},
SaveToUndoHistory: function() {
this.ExecuteCommand(ASPxClientCommandConsts.SAVESTATEUNDOREDOSTACK_COMMAND, null);
},
PasteHtml: function(htmlText) {
return this.ExecuteCommand(ASPxClientCommandConsts.PASTEHTML_COMMAND, htmlText);
},
InsertLink: function(url, text, target, title) {
var value = {
url: url,
text: text,
target: target,
title: title
};
this.ExecuteCommand(ASPxClientCommandConsts.INSERTLINK_COMMAND, value);
},
InsertImage: function(params) {
this.ExecuteCommand(ASPxClientCommandConsts.INSERTIMAGE_COMMAND, params);
},
ChangeImage: function(imageElement, params) {
params.imageElement = imageElement;
this.ExecuteCommand(ASPxClientCommandConsts.CHANGEIMAGE_COMMAND, params);
},
CheckSpelling: function() {
this.spellCheckerHelper.CheckSpelling();
},
Print: function() {
var window = this.GetDesignViewIFrameWindow();
if (window) {
if(__aspxIE)
window.focus();
window.print();
}
},
Undo: function() {
if (this.IsUndoAvailable())
return this.commandManager.Undo(1);
return false;
},
Redo: function() {
if (this.IsRedoAvailable())
return this.commandManager.Redo(1);
return false;
},
GetSelection: function() {
if(!this.IsDesignView() || !this.GetEnabled()) return null;
var selection = new ASPxClientHtmlEditorSelection(this);
if(!selection.selectedElement) {
this.RestoreSelection();
selection = new ASPxClientHtmlEditorSelection(this);
}
return selection;
},
RestoreSelection: function() {
if(!this.IsDesignView() || !this.GetEnabled())
return;
if((__aspxIE && this.inRestoreSelectionProcess) || (__aspxOpera && this.isInFocus))
return true;
if(this.PreventSelectionProcessing())
return false;
this.inRestoreSelectionProcess = true;
this.isSelectionRestored = true;
this.SetFocus();
var _this = this;
setTimeout(function() {
_this.inRestoreSelectionProcess = false;
}, 100);
try {
this.SetSelection(this.selection);
return true;
}
catch(e) {
return false;
}
},
RestoreSelectionByTimer: function() {
var self = this;
var handler = function() {
self.RestoreSelection();
};
window.setTimeout(handler, 0);
},
SaveSelection: function() {
try {
var selection = this.GetSelection();
if(__aspxWebKitFamily && !selection.selectedElement) {
this.selection = null;
return;
}
else if(__aspxIE && __aspxBrowserMajorVersion > 8) {
var selection = this.GetSelection();
if(!this.PreventSelectionProcessing())
this.selection = selection;
}
else
this.selection = this.GetSelection();
} catch(e) { }
},
PreventSelectionProcessing: function() {
if(__aspxIE && __aspxBrowserMajorVersion > 8) {
var element = this.GetSelection().GetSelectedElement();
while(element && element.tagName != "BODY") {
if(element.tagName == "DIV") {
var divStyle = _aspxGetCurrentStyle(element);
if(divStyle.float != "none" || divStyle.width != "auto" || divStyle.height != "auto" || divStyle.overflow == "hidden")
return true;
}
element = element.parentNode;
}
}
return false;
},
SetSelection: function(selection) {
if (__aspxNetscapeFamily)
this.SetFocus();
if(selection)
selection.Apply();
},
GetSelectedElement: function(name) {
return this.cachedElementsManager.GetSeletedElement(name);
},
SetSelectedElement: function(name, element) {
return this.cachedElementsManager.SetSelectedElement(name, element);
},
NeedGetElementFromSelection: function(name) {
return this.cachedElementsManager.NeedGetElementFromSelection(name);
},
RestoreLastSelection: function(selectionObj) {
if (selectionObj != null) {
this.SetFocus();
selectionObj.Restore();
}
if(__aspxIE && __aspxBrowserMajorVersion < 9)
this.SaveSelection();
},
SaveLastSelection: function() {
var selectionObj = ASPxClientHtmlEditorSelection.Create(this);
selectionObj.Save();
return selectionObj;
},
CreateRestoreSelectionForDialog: function() {
var selectionObj = __aspxIE ? new ASPxClientDialogSelectionIE(this.GetDesignViewIFrameWindow()) :
new ASPxClientSelectionNSOpera(this.GetDesignViewIFrameWindow());
selectionObj.Save();
return selectionObj;
},
UpdateContextMenu: function() {
if(this.GetEnabled() && this.allowContextMenu == true && this.GetContextMenu().GetVisible())
this.GetContextMenu().SetVisible(false);
},
ShowContextMenu: function(evt) {
if(this.GetEnabled()) {
this.SaveSelectionForPopup();
if (!this.GetContextMenu().GetVisible()) {
this.UpdateContextMenuItemsState();
this.RaiseContextMenuShowing();
var scrollX = _aspxGetDocumentScrollLeft();
var scrollY = _aspxGetDocumentScrollTop();
var x = _aspxGetEventX(evt) + _aspxGetAbsoluteX(this.GetDesignViewIFrameElement()) - scrollX;
var y = _aspxGetEventY(evt) + _aspxGetAbsoluteY(this.GetDesignViewIFrameElement()) - scrollY;
this.GetContextMenu().ShowAtPos(x + 8, y + 8);
if(__aspxIE)
this.isPreventKeyPressOnShowContextMenu = true;
}
}
},
UpdateContextMenuItemsState: function() {
var popupMenu = this.GetContextMenu();
for (var i = 0; i < popupMenu.GetItemCount(); i++) {
var item = popupMenu.GetItem(i);
var command = ASPxHtmlEditorCommandList[item.name];
if (command)
item.SetVisible(!command.IsLocked(this));
}
},
UpdateToolbar: function() {
if (this.toolbar)
this.toolbar.UpdateItems();
},
UpdateToolbarImmediately: function() {
if (this.toolbar){
this.toolbar.AdjustControls();
if(!this.clientEnabled)
this.toolbar.SetEnabled(false);
this.toolbar.DoUpdateItems();
}
},
OnToolbarCustomComboBoxInit: function(combobox) {
this.customComboBoxCollection[combobox.commandName] = combobox;
},
SetToolbarComboBoxValue: function(commandName, value) {
if(this.customComboBoxCollection[commandName])
this.customComboBoxCollection[commandName].SetValue(value);
},
SendCallback: function(prefix, arg, showLoadingPanel) {
if (showLoadingPanel)
this.ShowLoadingPanel();
this.CreateCallback(_aspxFormatCallbackArg(prefix, arg));
},
SendFileManagerCallback: function(fileManager, callbackString) {
this.callbackOwner = fileManager;
this.CreateCallback(_aspxFormatCallbackArg(__aspxHEFileManagerCallbackPrefix, callbackString));
},
SendSpellCheckerCallback: function(spellChecker, callbackString) {
this.callbackOwner = spellChecker;
this.CreateCallback(_aspxFormatCallbackArg(__aspxHESpellCheckingCallbackPrefix, callbackString));
},
ClearOwnerControlCallback: function() {
this.callbackOwner = null;
},
OnCallback: function(result) {
if (this.callbackOwner != null)
this.callbackOwner.OnCallback(result);
else
this.OnHtmlEditorCallback(result.action, result.html, result.spellcheck, result.allowScripts, result.spellcheckerloadcontrol);
},
OnCallbackError: function(result, data) {
if (this.callbackOwner != null)
this.callbackOwner.OnCallbackError(result);
else
this.RollbackActiveView();
this.isErrorOnCallback = true;
this.constructor.prototype.OnCallbackError.call(this, result, data);
},
DoEndCallback: function() {
this.constructor.prototype.DoEndCallback.call(this);
if (this.callbackOwner != null && !this.isErrorOnCallback)
this.callbackOwner.OnEndCallback();
this.isErrorOnCallback = false;
},
OnHtmlEditorCallback: function(prefix, result, spellCheckResult, allowScripts, spellcheckerloadcontrol) {
this.allowScripts = Boolean(allowScripts);
switch (prefix) {
case __aspxHESwitchToDesignViewCallbackPrefix:
this.SwitchToDesignViewCore(result);
break;
case __aspxHESwitchToHtmlViewCallbackPrefix:
this.SwitchToHtmlViewCore(result);
break;
case __aspxHESwitchToPreviewCallbackPrefix:
this.SwitchToPreviewCore(result);
break;
case __aspxHESpellCheckingLoadControlCallbackPrefix:
case __aspxHESpellCheckingCallbackPrefix:
case __aspxHESpellCheckerOptionsCallbackPrefix:
this.spellCheckerHelper.OnHtmlEditorCallback(prefix, result, spellCheckResult, allowScripts, spellcheckerloadcontrol);
break;
default:
throw "Unexpected callback prefix.";
break;
}
},
RollbackActiveView: function() {
if (this.allowDesignView) {
this.activeView = ASPxClientHtmlEditorView.Design;
this.SwitchToDesignViewCore(this.GetHtml());
}
else if (this.allowHtmlView) {
this.activeView = ASPxClientHtmlEditorView.Html;
this.SwitchToHtmlViewCore(this.GetHtml());
}
else if (this.allowPreview) {
this.activeView = ASPxClientHtmlEditorView.Preview;
this.SwitchToPreviewCore(this.GetHtml());
}
var tabControl = this.GetTabControl();
if (tabControl != null)
tabControl.SetActiveTab(tabControl.GetTab(0));
},
ConvertToEmptyHtml: function(html) {
var emptyTagsRegExp = new RegExp(__aspxHEEmptyTagsRegExpPattern, "ig");
var emptyHtmlRegExp = new RegExp(__aspxHEEmptyHtmlRegExpPattern, "ig");
var processedHtml = _aspxTrim(html);
if (emptyTagsRegExp.test(processedHtml) || emptyHtmlRegExp.test(processedHtml))
html = "";
return html;
},
MaskComments: function (html) {
var comments = [];
var match = null;
var i = 0;
while ((match = html.match("")) !== null) {
var comment = match[0];
comments.push(comment);
var mask = "";
html = html.replace(comment, mask);
i++;
}
return { html: html, comments: comments };
},
UnMaskComments: function (html, comments) {
for (var i = 0, l = comments.length; i < l; i++) {
var mask = "";
html = html.replace(mask, comments[i]);
}
return html;
},
CreatePasteContainer: function() {
var divElem = document.createElement("DIV");
divElem.style.overflow = "hidden";
divElem.style.width = "1px";
divElem.style.height = "1px";
divElem.contentEditable = true;
document.body.appendChild(divElem);
return divElem;
},
IsExistsWindowInIFrame: function(iframeName) {
try {
return !!ASPxIFrame.GetWindow(iframeName);
}
catch (e) {
return false;
}
},
GetIFrameDocumentHtml: function(bodyContentHtml) {
var html = "";
if (__aspxIE)
html += " " +
" window.document.onkeydown = function() {" +
" if(event.keyCode == 121) {" +
" window.parent.FocusActiveEditorToolbar();" +
" event.keyCode = 0;" +
" return false;" +
" }" +
" }" +
" ";
html += "";
if (bodyContentHtml)
html += bodyContentHtml;
html += "";
return html;
},
ClearUndoHistory: function() {
if (this.allowDesignView)
this.commandManager.ClearUndoHistory();
},
ClearKeyDownInfo: function() {
this.keyDownInfo = null;
},
IsDefaultActionCommand: function(cmdID) {
var cmd = ASPxHtmlEditorCommandList[cmdID];
return cmd && cmd.IsDefaultAction(this);
},
IsDeleting: function() {
return this.commandManager.IsDeleting() && this.keyDownInfo && this.keyDownInfo.isDeleteOrBackSpaceKey;
},
IsSpacing: function() {
return this.keyDownInfo && this.keyDownInfo.isSpaceKey;
},
IsHtmlChangeableCommand: function(cmdID) {
var cmd = ASPxHtmlEditorCommandList[cmdID];
return cmd && cmd.IsHtmlChangeable();
},
IsShortcut: function() {
return !!this.shortcutCmdID;
},
IsTextTyping: function() {
return this.executingCommandName
&& this.executingCommandName == ASPxClientCommandConsts.TEXTTYPE_COMMAND
&& this.keyDownInfo && !this.keyDownInfo.isSystemKey;
},
IsRedoAvailable: function() {
return this.commandManager.IsRedoAvailable();
},
IsUndoAvailable: function() {
return this.commandManager.IsUndoAvailable();
},
OnSelectionChanged: function() {
this.cachedElementsManager.ClearSeletedElements();
this.UpdateToolbar();
if(__aspxIE && __aspxBrowserMajorVersion < 9) {
var _this = this;
setTimeout(function() {
_this.UpdateToolbar();
}, 200);
}
this.UpdateContextMenu();
this.RaiseSelectionChanged();
if(!(__aspxIE && __aspxBrowserMajorVersion == 9) || this.isInFocus)
this.SaveSelection();
},
OnHtmlChanged: function(saveSelectionAndHtml, preventEvent) {
if(this.suspendHCEvt > -1) {
if(this.IsTextTyping()) {
this.suspendHCEvt = this.suspendHCEvt == 2 || saveSelectionAndHtml ? 2 : 1;
return;
}
else {
saveSelectionAndHtml = saveSelectionAndHtml || this.suspendHCEvt == 2;
this.suspendHCEvt = -1;
}
}
this.OnHtmlChangedInternal(saveSelectionAndHtml, preventEvent);
if(this.IsTextTyping()) {
this.suspendHCEvt = 0;
var _this = this;
setTimeout(function() {
if(_this.suspendHCEvt > 0)
_this.OnHtmlChangedInternal(_this.suspendHCEvt == 2, preventEvent);
_this.suspendHCEvt = -1;
}, 300);
}
},
CallSuspendedHtmlChangedEvt: function() {
if(this.suspendHCEvt > 0) {
this.OnHtmlChangedInternal(this.suspendHCEvt == 2);
this.suspendHCEvt = -1;
}
},
OnHtmlChangedInternal: function(saveSelectionAndHtml, preventEvent) {
this.htmlBackup = this.GetHtmlInternal();
if (saveSelectionAndHtml && this.IsDesignView())
this.commandManager.UpdateLastRestoreSelectionAndHTML();
if(!preventEvent)
this.RaiseHtmlChanged();
if (this.IsDesignView())
this.OnSelectionChanged();
if(this.IsStandardValidationEnabled())
this.SynchronizeForStandardValidation(true);
},
FocusToolbar: function() {
this.GetToolbar().Focus();
},
FocusLastToolbar: function() {
this.GetToolbar().FocusLastToolbar();
},
ProcessTabOnKeyDown: function(evt) {
if (__aspxIE && evt.keyCode == ASPxKey.Tab) {
try {
if (evt.shiftKey) {
this.FocusLastToolbar();
ASPxClientHtmlEditor.PreventEventIE(evt);
}
}
catch (e) { }
}
},
OnKeyDown: function(evt) {
if(__aspxIE && this.isPreventKeyPressOnShowContextMenu) {
_aspxPreventEventAndBubble(evt);
return false;
}
this.shortcutCmdID = this.keyboardManager.GetShortcutCommand(evt);
this.isAllowToPreventShortcut = false;
this.ProcessTabOnKeyDown(evt);
if(!this.IsShortcut())
this.beforePopupSelection = null;
if(!__aspxIE && evt.keyCode == ASPxKey.F10) {
ASPxHtmlEditorsCollection.Get().FocusActiveEditorToolbar();
return _aspxPreventEvent(evt);
}
else if(this.IsShortcut()) {
this.ExecuteCommand(this.shortcutCmdID, null);
this.isAllowToPreventShortcut = !this.IsDefaultActionCommand(this.shortcutCmdID);
}
else if(this.keyboardManager.IsBrowserShortcut(evt))
return _aspxPreventEvent(evt);
else {
this.keyDownInfo = this.keyboardManager.GetKeyDownInfo(evt);
if(this.keyDownInfo.isSystemKey) {
if(this.keyDownInfo.isDeleteOrBackSpaceKey) {
if((__aspxIE || __aspxOpera) && !this.keyDownInfo.isBackSpaceKey && !this.GetSelection().GetHtml()) {
this.ExecuteCommand(ASPxClientCommandConsts.DELETE_COMMAND, null);
_aspxPreventEvent(evt);
}
else {
this.ExecuteCommand(ASPxClientCommandConsts.KBDELETE_COMMAND, null);
this.commandManager.UpdateLastRestoreHtml();
}
}
}
else if(!this.keyDownInfo.isCursorMovingKey && !this.IsTextTyping())
this.ExecuteCommand(ASPxClientCommandConsts.TEXTTYPE_COMMAND, null);
}
if (this.IsShortcut() && (__aspxIE || __aspxWebKitFamily) && this.isAllowToPreventShortcut)
ASPxClientHtmlEditor.PreventEventIE(evt);
},
OnKeyUp: function(evt) {
if(__aspxIE && this.isPreventKeyPressOnShowContextMenu) {
_aspxPreventEventAndBubble(evt);
return false;
}
if(!this.IsShortcut()) {
if (this.IsDeleting())
var emptyDeleted = this.commandManager.CleanEmptyRestoreHtml();
if (this.IsTextTyping() || (this.IsDeleting() && !emptyDeleted) || this.IsSpacing())
this.OnHtmlChanged(true);
else
this.OnSelectionChanged();
this.ClearKeyDownInfo();
} else if(this.IsDefaultActionCommand(this.shortcutCmdID) && this.IsHtmlChangeableCommand(this.shortcutCmdID)) {
if(evt.keyCode == ASPxKey.Enter && !this.isAllowToPreventShortcut)
this.SaveToUndoHistory();
this.OnHtmlChanged(true);
}
else
this.OnSelectionChanged();
},
OnKeyPress: function(evt) {
if(__aspxIE && this.isPreventKeyPressOnShowContextMenu) {
_aspxPreventEventAndBubble(evt);
return false;
}
if (this.IsShortcut(evt) && this.isAllowToPreventShortcut) {
this.shortcutCmdID = null;
return _aspxPreventEvent(evt);
}
},
OnDblClick: function(evt) {
if(__aspxIE)
this.isPreventKeyPressOnShowContextMenu = false;
var source = _aspxGetEventSource(evt);
if (!source)
return;
if (source.tagName == "IMG") {
if (__aspxWebKitFamily)
ASPxClientHtmlEditorSelection.SelectElement(source, this);
this.ExecuteCommand(ASPxClientCommandConsts.CHANGEIMAGE_DIALOG_COMMAND);
}
},
OnMouseDown: function(evt) {
if(__aspxIE)
this.isPreventKeyPressOnShowContextMenu = false;
var toolBar = this.GetToolbar();
if (toolBar)
toolBar.HideAllPopups();
if (__aspxWebKitFamily) {
var source = _aspxGetEventSource(evt);
if (source && source.tagName == "IMG")
ASPxClientHtmlEditorSelection.SelectElement(source, this);
}
this.isMouseDown = true;
if(__aspxNetscapeFamily && !this.isInFocus) {
var source = _aspxGetEventSource(evt);
if (source && source.tagName == "IMG") {
this.SetFocus();
return _aspxPreventEvent(evt);
}
}
},
OnMouseUp: function(evt) {
if((__aspxIE && evt.button != 2) || (__aspxWebKitFamily && _aspxGetIsLeftButtonPressed(evt))) {
var self = this;
var handler = function() {
self.OnSelectionChanged();
};
window.setTimeout(handler, (__aspxIE && __aspxBrowserMajorVersion >= 9) ? 100 : 0);
}
else
this.OnSelectionChanged();
this.isMouseDown = false;
},
OnFocus: function() {
ASPxClientTouchUI.removeDocumentTouchEventHandlers();
if (!this.isInitialized || this.isInFocus || !this.IsDesignView())
return;
this.isInFocus = true;
if(!this.isSelectionRestored) {
if(__aspxWebKitFamily)
this.RestoreSelectionByTimer();
else
this.RestoreSelection();
}
this.RaiseFocus();
},
OnLostFocus: function() {
ASPxClientTouchUI.restoreDocumentTouchEventHandlers();
if (!this.isInitialized || !this.isInFocus || !this.IsDesignView())
return;
this.isInFocus = false;
this.isSelectionRestored = false;
this.RaiseLostFocus();
},
OnErrorFrameCloseButtonClick: function() {
this.SaveCurrentSize(false, true);
this.isValid = true;
this.UpdateErrorFrame();
this.UpdateClientValidationState();
this.SetFocus();
this.SetHeightInternal(this.currentHeight);
},
OnDesignViewIframeLoad: function() {
var designViewIframe = document.getElementById(this.GetDesignViewIFrameName());
if (designViewIframe && !designViewIframe.isLoaded) {
designViewIframe.isLoaded = true;
this.InitAreas();
this.UpdateLayout();
this.InitializeManagers();
this.AdjustControlCore();
}
},
ClearDragDropTimer: function() {
if (this.dragDropTimerID)
_aspxClearTimer(this.dragDropTimerID);
},
OnAfterDocumentObjectDragEnd: function() {
this.isDropExternalContentExecuted = false;
this.OnHtmlChanged(true);
this.ClearDragDropTimer();
},
OnAfterDocumentObjectDragEndCallWithDelay: function() {
var callStr = "aspxHEAfterDocumentObjectDragEnd(\"" + this.name + "\")";
this.dragDropTimerID = _aspxSetTimeout(callStr, __aspxHEDragDropDelay);
},
OnAfterObjectDragEnd: function() {
this.OnHtmlChanged(true);
this.ClearDragDropTimer();
},
OnAfterObjectDragEndWithDelay: function() {
var callStr = "aspxHEAfterObjectDragEnd(\"" + this.name + "\")";
this.dragDropTimerID = _aspxSetTimeout(callStr, __aspxHEDragDropDelay);
},
OnDocumentObjectDragEnd: function() {
if (this.isDropExternalContentExecuted)
this.OnAfterDocumentObjectDragEnd();
},
OnObjectDragStart: function(evt) {
if (!this.isDraggingInsideEditor && !__aspxHEIsDocumentDragOver ) {
this.isDraggingInsideEditor = true;
this.ExecuteCommand(ASPxClientCommandConsts.DRAGDROPOBJECT_COMMAND, null);
}
},
OnObjectDrop: function(evt) {
if (!this.isDraggingInsideEditor) {
this.isDropExternalContentExecuted = true;
this.ExecuteCommand(ASPxClientCommandConsts.DROPOBJECTFROMEXTERNAL_COMMAND, null);
if (__aspxHEIsDocumentDragOver) {
__aspxHEIsDocumentDragOver = false;
this.OnAfterDocumentObjectDragEndCallWithDelay();
}
}
if (__aspxNetscapeFamily)
this.OnObjectDragEnd();
},
OnObjectDragEnd: function() {
if (this.isDraggingInsideEditor) {
this.isDraggingInsideEditor = false;
this.OnAfterObjectDragEndWithDelay();
}
},
OnObjectResizeStart: function(evt) {
this.ExecuteCommand(ASPxClientCommandConsts.RESIZEOBJECT_COMMAND, null);
},
OnObjectResizeEnd: function(evt) {
this.OnHtmlChanged(true);
},
OnContextMenuItemClick: function(item) {
this.RestoreSelectionForPopup();
if(__aspxIE)
this.isPreventKeyPressOnShowContextMenu = false;
var instance = this;
window.setTimeout(function() {
instance.ExecuteCommand(item.name, null);
}, 0);
},
SaveSelectionForPopup: function() {
this.beforePopupSelection = this.GetSelection().clientSelection;
if (__aspxIE)
this.selectionBookmark = this.beforePopupSelection.GetExtendedBookmark();
else
this.beforePopupSelection.Save();
},
RestoreSelectionForPopup: function() {
if(!__aspxOpera) {
if (this.beforePopupSelection) {
if (__aspxIE && this.selectionBookmark) {
this.beforePopupSelection.SelectExtendedBookmark(this.selectionBookmark);
this.selectionBookmark = null;
}
else
this.beforePopupSelection.Restore();
this.beforePopupSelection = null;
}
}
},
OnContextMenuCloseUp: function() {
if (this.beforePopupSelection)
this.selectionBookmark = this.beforePopupSelection.RemoveExtendedBookmark(this.selectionBookmark);
},
OnContextMenu: function(evt) {
if (this.allowContextMenu == true)
this.ShowContextMenu(evt);
if (__aspxIE && __aspxBrowserMajorVersion < 9)
evt.returnValue = false;
else
evt.preventDefault();
},
OnToolbarDropDownItemCloseUp: function() {
this.RestoreSelectionForPopup();
},
OnPasteIE: function() {
if(this.IsDesignView()) {
var body = this.GetDesignViewIFrameDocumentBody();
ASPxClientHtmlEditor.RestoreUrlsInDOM(body);
if(__aspxBrowserVersion == 8) {
var selection = this.GetSelection();
body.innerHTML = body.innerHTML;
this.SetSelection(selection);
}
}
},
OnPasteWebKit: function(evt) {
var target = evt.target;
if(evt.clipboardData.getData('text/html') && _aspxGetCurrentStyle(target).display != 'block') {
this.WebKitProcessPasteInTableCell(target);
}
},
WebKitProcessPasteInTableCell: function(target) {
var tableCell = ASPxClientUtils.GetParentByTagName(target, 'TD');
if(tableCell == null) {
return;
}
var doc = this.GetDesignViewDocument();
var selection = this.GetSelection().clientSelection;
var bookmark = selection.GetExtendedBookmark();
tableCell.normalize();
var iterator = doc.createNodeIterator(tableCell, NodeFilter.SHOW_TEXT, null, false);
var analyzer = doc.createElement('span');
var textNode;
while(textNode = iterator.nextNode()) {
analyzer.textContent = textNode.nodeValue;
analyzer.innerHTML = analyzer.innerHTML.replace(/\s{2,}/g, ' ');
textNode.nodeValue = analyzer.textContent;
}
var contentWrapper = doc.createElement('div');
for(var child; child = tableCell.firstChild; ) {
contentWrapper.appendChild(child);
}
tableCell.appendChild(contentWrapper);
selection.SelectExtendedBookmark(bookmark, true);
var instance = this;
var cleanupCallback = function () {
var selection = instance.GetSelection().clientSelection;
var bookmark = selection.GetExtendedBookmark();
for(var child; child = contentWrapper.firstChild; ) {
tableCell.appendChild(child);
}
_aspxRemoveElement(contentWrapper);
selection.SelectExtendedBookmark(bookmark, true);
};
setTimeout(cleanupCallback, 0);
},
CreateErrorFrames: function() {
if(this.GetTemplateErrorFrame() == null)
return;
var designViewCell = this.GetDesignViewCell();
if(designViewCell != null) {
var errorFrame = this.CreateErrorFrame(this.GetErrorFrameID(ASPxClientHtmlEditorView.Design),
this.GetErrorTextCellID(ASPxClientHtmlEditorView.Design),
this.GetErrorFrameCloseButtonCellID(ASPxClientHtmlEditorView.Design));
designViewCell.insertBefore(errorFrame, designViewCell.firstChild);
}
var htmlViewCell = this.GetHtmlViewEditCell();
if(htmlViewCell != null) {
var errorFrame = this.CreateErrorFrame(this.GetErrorFrameID(ASPxClientHtmlEditorView.Html),
this.GetErrorTextCellID(ASPxClientHtmlEditorView.Html),
this.GetErrorFrameCloseButtonCellID(ASPxClientHtmlEditorView.Html));
htmlViewCell.insertBefore(errorFrame, htmlViewCell.firstChild);
}
var previewViewCell = this.GetPreviewCell();
if(previewViewCell != null) {
var errorFrame = this.CreateErrorFrame(this.GetErrorFrameID(ASPxClientHtmlEditorView.Preview),
this.GetErrorTextCellID(ASPxClientHtmlEditorView.Preview),
this.GetErrorFrameCloseButtonCellID(ASPxClientHtmlEditorView.Preview));
previewViewCell.insertBefore(errorFrame, previewViewCell.firstChild);
}
},
CreateErrorFrame: function(errorFrameId, errorTextCellId, errorFrameCloseButtonCellId) {
var errorFrame = this.GetTemplateErrorFrame().cloneNode(true);
errorFrame.id = errorFrameId;
errorTable = _aspxGetChildByTagName(errorFrame, "TABLE", 0);
var errorTextCell = _aspxGetChildByTagName(errorTable, "TD", 0);
errorTextCell.id = errorTextCellId;
errorButtonTable = _aspxGetChildByTagName(errorTable, "TABLE", 0);
var errorFrameCloseButtonCell = _aspxGetChildByTagName(errorButtonTable, "TD", 0);
errorFrameCloseButtonCell.id = errorFrameCloseButtonCellId;
var errorFrameCloseButtonImage = _aspxGetChildByTagName(errorFrameCloseButtonCell, "IMG", 0);
errorFrameCloseButtonImage.id = errorFrameCloseButtonCellId + ASPxClientHtmlEditorIDSuffix.ButtonImageIdPostfix;
this.CreateErrorFrameCloseButtonHoverState(errorFrameCloseButtonCell.id);
return errorFrame;
},
CreateErrorFrameCloseButtonHoverState: function(buttonID) {
if (this.templateHoverErrorFrameCloseButton) {
aspxGetStateController().AddHoverItem(buttonID,
this.templateHoverErrorFrameCloseButton.className, this.templateHoverErrorFrameCloseButton.cssText,
this.templateHoverErrorFrameCloseButton.postfixes, this.templateHoverErrorFrameCloseButton.imageUrls,
this.templateHoverErrorFrameCloseButton.imagePostfixes);
}
},
GetIsValid: function(){
return this.isValid;
},
GetErrorText: function(){
return this.errorText;
},
SetIsValid: function(isValid, validating){
if(this.clientValidationEnabled) {
this.isValid = isValid;
this.UpdateErrorFrame();
this.UpdateClientValidationState();
if(!validating)
this.UpdateValidationSummaries(ASPxValidationType.PersonalViaScript);
}
},
SetErrorText: function(errorText, validating){
if(this.clientValidationEnabled) {
this.errorText = errorText;
this.UpdateErrorFrame();
this.UpdateClientValidationState();
if(!validating)
this.UpdateValidationSummaries(ASPxValidationType.PersonalViaScript);
}
},
Validate: function() {
this.OnValidation(ASPxValidationType.PersonalViaScript);
},
BeginErrorFrameUpdate: function() {
if(!this.errorFrameUpdateLocked)
this.errorFrameUpdateLocked = true;
},
EndErrorFrameUpdate: function() {
this.errorFrameUpdateLocked = false;
this.UpdateErrorFrame();
},
OnValidation: function(validationType) {
if(this.clientValidationEnabled && this.isInitialized) {
this.BeginErrorFrameUpdate();
this.SetIsValid(true, true );
this.SetErrorText(this.initialErrorText, true );
this.isValid = this.ValidateWithPatterns();
if(this.isValid) {
var currentHtml = this.GetHtml();
var args = this.RaiseValidation(currentHtml, this.isValid, this.errorText);
if(currentHtml != args.html)
this.SetHtml(args.html);
this.SetIsValid(args.isValid, true );
this.SetErrorText(args.errorText, true );
}
this.EndErrorFrameUpdate();
this.UpdateClientValidationState();
this.UpdateValidationSummaries(validationType);
return this.isValid;
}
else
return true;
},
ValidateWithPatterns: function() {
if(this.validationPatterns.length > 0) {
var html = this.GetHtml();
for(var i = 0; i < this.validationPatterns.length; i++) {
var validator = this.validationPatterns[i];
if (!validator.EvaluateIsValid(html)) {
this.SetIsValid(false, true );
this.SetErrorText(validator.errorText, true );
return false;
}
}
}
return true;
},
UpdateErrorFrame: function() {
if(this.errorFrameUpdateLocked)
return;
this.SaveCurrentSize(false, true);
var errorTextCell = this.GetErrorTextCell(this.activeView);
if(errorTextCell != null)
errorTextCell.innerHTML = this.errorText;
if(!this.isValid)
this.ShowErrorFrame();
else
this.HideErrorFrame();
this.SetHeightInternal(this.currentHeight);
},
ShowErrorFrame: function() {
var errorFrame = this.GetErrorFrame(this.activeView);
if(errorFrame != null)
_aspxSetElementDisplay(errorFrame, true);
},
HideErrorFrame: function() {
var errorFrame = this.GetErrorFrame(this.activeView);
if(errorFrame != null)
_aspxSetElementDisplay(errorFrame, false);
},
UpdateClientValidationState: function() {
var hfValidationState = this.GetValidationStateHiddenField();
if(typeof(hfValidationState) != "undefined" && hfValidationState != null)
hfValidationState.value = _aspxEncodeHtml(!this.isValid ? this.errorText : "");
},
UpdateValidationSummaries: function(validationType, initializing) {
if(typeof(ASPxClientValidationSummary) != "undefined") {
var summaryCollection = aspxGetClientValidationSummaryCollection();
if(summaryCollection != null)
summaryCollection.OnEditorIsValidStateChanged(this, validationType, initializing && this.notifyValidationSummariesToAcceptNewError);
}
},
OnSizeGripMouseDown: function(evt) {
this.resizeTempVars.isInResize = false;
if(this.GetEnabled()) {
this.SetResizingPanelVisibility(true);
this.SaveCurrentSizeGripPosition(evt, true);
this.SaveStartSize();
_aspxChangeStyleAttribute(this.resizingPanel, "cursor", this.rtl ? "ne-resize" : "se-resize");
this.resizeTempVars.isInMove = true;
}
},
OnSizeGripMouseUp: function(evt) {
if(!this.resizeTempVars.isInMove)
return;
this.SetResizingPanelVisibility(false);
_aspxRestoreStyleAttribute(this.resizingPanel, "cursor");
this.SaveCurrentSize(true, true, true, true);
this.resizeTempVars.isInMove = false;
this.resizeTempVars.isInResize = false;
this.resizeTempVars = {};
},
OnSizeGripMouseMove: function(evt) {
if(!this.resizeTempVars.isInMove || this.resizeTempVars.isInResize)
return;
if(__aspxIE && !_aspxGetIsLeftButtonPressed(evt)) {
this.OnSizeGripMouseUp(evt);
return;
}
this.isWidthDefinedInPercent = false;
this.resizeTempVars.isInResize = true;
this.SaveCurrentSizeGripPosition(evt);
this.SetDeltaSize();
this.resizeTempVars.isInResize = false;
},
SetDeltaSize: function() {
this.SetDeltaWidthInternal(this.rtl
? this.resizeTempVars.startSizeGripXPos - this.resizeTempVars.currentSizeGripXPos
: this.resizeTempVars.currentSizeGripXPos - this.resizeTempVars.startSizeGripXPos
);
this.SetDeltaHeightInternal(this.resizeTempVars.currentSizeGripYPos - this.resizeTempVars.startSizeGripYPos);
},
SetDeltaWidthInternal: function(delta, isCheckRanges) {
isCheckRanges = _aspxIsExists(isCheckRanges) ? isCheckRanges : true;
var lastMainElementHeight = this.GetMainElement().offsetHeight;
if(isCheckRanges)
var width = this.GetSizeInRanges(this.minWidth, this.maxWidth, this.resizeTempVars.startMainWidth, this.resizeTempVars.startResizeElWidth, delta);
else
var width = this.resizeTempVars.startResizeElWidth + delta;
this.GetMainElement().style.width = "";
this.GetCurrentEditElement().style.width = "100%";
this.GetMainCell().firstChild.style.width = Math.max(width, 1) + "px";
var mainElementDeltaHeight = this.GetMainElement().offsetHeight - lastMainElementHeight;
if(mainElementDeltaHeight != 0){
this.SetDeltaHeightInternal(-mainElementDeltaHeight);
this.resizeTempVars.startResizeElHeight -= mainElementDeltaHeight;
}
},
SetDeltaHeightInternal: function(delta, isCheckRanges) {
isCheckRanges = _aspxIsExists(isCheckRanges) ? isCheckRanges : true;
if(isCheckRanges)
var height = this.GetSizeInRanges(this.minHeight, this.maxHeight, this.resizeTempVars.startMainHeight, this.resizeTempVars.startResizeElHeight, delta);
else
var height = this.resizeTempVars.startResizeElHeight + delta;
this.GetMainElement().style.height = "";
this.GetEditAreaCell().style.height = "";
this.GetCurrentEditElement().style.height = Math.max(height, 5) + "px";
},
GetSizeInRanges: function(minSize, maxSize, startMainElementSize, startResizeElementSize, delta) {
var size = startResizeElementSize + delta;
if(maxSize > 0 && delta > 0 && startMainElementSize + delta > maxSize){
size = (maxSize - startMainElementSize + startResizeElementSize);
}
if(minSize > 0 && delta < 0 && startMainElementSize + delta < minSize){
size = (minSize - startMainElementSize + startResizeElementSize);
}
return size;
},
SaveCurrentSizeGripPosition: function(evt, isSaveStart) {
this.resizeTempVars.currentSizeGripXPos = _aspxGetEventX(evt);
this.resizeTempVars.currentSizeGripYPos = _aspxGetEventY(evt);
if(isSaveStart) {
this.resizeTempVars.startSizeGripXPos = this.resizeTempVars.currentSizeGripXPos;
this.resizeTempVars.startSizeGripYPos = this.resizeTempVars.currentSizeGripYPos;
}
},
SaveStartSize: function() {
this.resizeTempVars.startResizeElWidth = _aspxGetClearClientWidth(this.GetMainCell().firstChild);
var resizeElStyleHeight = _aspxPxToInt(this.GetCurrentEditElement().style.height);
var resizeElClientHeight = this.GetCurrentEditElement().clientHeight;
this.resizeTempVars.startResizeElHeight = (resizeElStyleHeight < 1 && resizeElClientHeight >= 0) ? resizeElClientHeight : resizeElStyleHeight;
this.resizeTempVars.startMainWidth = this.GetMainElement().offsetWidth;
this.resizeTempVars.startMainHeight = this.GetMainElement().offsetHeight;
},
SetResizingPanelVisibility: function(visible) {
if(!this.resizingPanel) {
this.resizingPanel = _aspxCreateHtmlElementFromString("");
this.GetStatusBarCell().appendChild(this.resizingPanel);
}
if(visible) {
_aspxSetAbsoluteX(this.resizingPanel, 0);
_aspxSetAbsoluteY(this.resizingPanel, 0);
_aspxSetStyleSize(this.resizingPanel, _aspxGetDocumentWidth(), _aspxGetDocumentHeight());
}
_aspxSetElementDisplay(this.resizingPanel, visible);
},
GetCurrentEditElement: function() {
if(this.IsDesignView())
return this.GetDesignViewCell();
if(this.IsHtmlView())
return this.GetHtmlViewEdit().GetInputElement();
return this.GetPreviewCell();
},
SetResizeRanges: function(minWidth, minHeight, maxWidth, maxHeight) {
this.minWidth = minWidth;
this.minHeight = minHeight;
this.maxWidth = maxWidth;
this.maxHeight = maxHeight;
},
RaiseCommandExecuted: function(commandName, parameter, isSuccessful) {
this.RaiseEventWithArgsInternal(
"CommandExecuted",
new ASPxClientHtmlEditorCommandEventArgs(commandName, parameter, isSuccessful, this)
);
},
RaiseCustomCommand: function(commandName, parameter) {
if (!this.CustomCommand.IsEmpty()) {
var args = new ASPxClientHtmlEditorCommandEventArgs(commandName, parameter, true, this);
this.CustomCommand.FireEvent(this, args);
return args.isSuccessful;
}
return true;
},
RaiseEventWithArgsInternal: function(eventName, args) {
var evt = this[eventName];
if(!evt.IsEmpty())
evt.FireEvent(this, args);
return args;
},
RaiseEventInternal: function(eventName) {
this.RaiseEventWithArgsInternal(eventName, new ASPxClientEventArgs());
},
RaiseFocus: function() {
this.RaiseEventInternal("GotFocus");
},
RaiseLostFocus: function() {
this.RaiseEventInternal("LostFocus");
},
RaiseHtmlChanged: function() {
this.RaiseEventInternal("HtmlChanged");
},
RaiseSelectionChanged: function() {
this.RaiseEventInternal("SelectionChanged");
},
RaiseCustomDialogOpened: function(name) {
this.RaiseEventWithArgsInternal(
"CustomDialogOpened",
new ASPxClientHtmlEditorCustomDialogEventArgs(name)
);
},
RaiseCustomDialogClosing: function(name, status) {
return this.RaiseEventWithArgsInternal(
"CustomDialogClosing",
new ASPxClientHtmlEditorCustomDialogClosingEventArgs(name, status)
).handled;
},
RaiseCustomDialogClosed: function(name, status, data) {
this.RaiseEventWithArgsInternal(
"CustomDialogClosed",
new ASPxClientHtmlEditorCustomDialogClosedEventArgs(name, status, data)
);
},
RaiseValidation: function(html, isValid, errorText) {
return this.RaiseEventWithArgsInternal(
"Validation",
new ASPxClientHtmlEditorValidationEventArgs(html, isValid, errorText)
);
},
RaiseContextMenuShowing: function() {
this.RaiseEventInternal("ContextMenuShowing");
},
raiseSpellingChecked: function() {
this.RaiseEventInternal("SpellingChecked");
},
SetHeight: function(height) {
if(this.isFullscreenMode) {
this.fullscreenTempVars.savedCurrentHeight = height;
}
else {
this.SetHeightInternal(height, true);
this.resizeTempVars = {};
}
},
SetWidth: function(width) {
this.isWidthDefinedInPercent = false;
if(this.isFullscreenMode) {
this.fullscreenTempVars.savedCurrentWidth = width;
}
else {
this.SetWidthInternal(width, true);
this.resizeTempVars = {};
}
},
SetHeightInternal: function(height, isCheckRanges, isSaveSize) {
if(this.currentHeight == 0 && this.currentWidth == 0)
return;
if(this.GetCurrentEditElement().offsetHeight < 5)
this.GetCurrentEditElement().style.height = "5px";
isSaveSize = _aspxIsExists(isSaveSize) ? isSaveSize : true;
this.SaveStartSize();
this.SetDeltaHeightInternal(height - this.resizeTempVars.startMainHeight, isCheckRanges);
if(isSaveSize)
this.SaveCurrentSize(false, true, true);
},
SetWidthInternal: function(width, isCheckRanges, isSaveSize) {
if(this.currentHeight == 0 && this.currentWidht == 0)
return;
isSaveSize = _aspxIsExists(isSaveSize) ? isSaveSize : true;
this.SaveStartSize();
this.SetDeltaWidthInternal(width - this.resizeTempVars.startMainWidth, isCheckRanges);
if(isSaveSize)
this.SaveCurrentSize(true, false, true);
},
SaveCurrentSize: function(saveWidth, saveHeight, updateClientState, saveToCookie) {
var mainElement = this.GetMainElement();
if(saveWidth){
var currentWidth = mainElement.offsetWidth;
if(currentWidth > 0){
this.currentWidth = currentWidth;
if(updateClientState){
this.SetClientStateFieldValue("CurrentWidth", this.isWidthDefinedInPercent
? Math.round(_aspxPercentageToFloat(this.initialMainElementWidth)*100)
: this.currentWidth, saveToCookie);
this.SetClientStateFieldValue("IsPercentWidth", this.isWidthDefinedInPercent ? 1 : 0, saveToCookie);
}
}
}
if(saveHeight){
var currentHeight = mainElement.offsetHeight;
if(currentHeight > 0){
this.currentHeight = currentHeight;
if(updateClientState){
this.SetClientStateFieldValue("CurrentHeight", this.currentHeight, saveToCookie);
}
}
}
},
SetFullscreenMode: function(enable) {
enable = _aspxIsExists(enable) ? enable : !this.isFullscreenMode;
var sizeGrip = this.GetSizeGrip();
this.isFullscreenMode = enable;
if(enable){
_aspxChangeStyleAttribute(this.GetMainElement(), __aspxIE ? "borderTopWidth" : "border-top-width", "0px");
_aspxChangeStyleAttribute(this.GetMainElement(), __aspxIE ? "borderLeftWidth" : "border-left-width", "0px");
_aspxChangeStyleAttribute(this.GetMainElement(), __aspxIE ? "borderRightWidth" : "border-right-width", "0px");
_aspxChangeStyleAttribute(this.GetMainElement(), __aspxIE ? "borderBottomWidth" : "border-bottom-width", "0px");
this.fullscreenTempVars.savedBodyScrollTop = _aspxGetDocumentScrollTop();
this.fullscreenTempVars.savedBodyScrollLeft = _aspxGetDocumentScrollLeft();
this.ShowPlaceholderDiv(true);
if(__aspxIE && __aspxBrowserMajorVersion < 7){
_aspxChangeStyleAttribute(this.GetMainElement(), "position", "absolute");
_aspxChangeStyleAttribute(this.GetMainElement(), "top", -_aspxGetPositionElementOffset(this.GetMainElement(), false) + "px");
_aspxChangeStyleAttribute(this.GetMainElement(), "left", -_aspxGetPositionElementOffset(this.GetMainElement(), true) + "px");
}
else {
_aspxChangeStyleAttribute(this.GetMainElement(), "position", "fixed");
_aspxChangeStyleAttribute(this.GetMainElement(), "top", "0px");
_aspxChangeStyleAttribute(this.GetMainElement(), "left", "0px");
}
_aspxChangeStyleAttribute(this.GetMainElement(), __aspxIE ? "zIndex" : "z-index", 10001);
_aspxChangeStyleAttribute(document.documentElement, "position", "static");
_aspxChangeStyleAttribute(document.documentElement, "overflow", "hidden");
this.fullscreenTempVars.savedBodyMargin = document.body.style.margin;
document.body.style.margin = 0;
if(__aspxIE && __aspxBrowserMajorVersion < 7)
_aspxChangeAttribute(document.body, "scroll", "no");
if(__aspxIE && __aspxBrowserMajorVersion < 8){
document.documentElement.scrollTop = 0;
document.documentElement.scrollLeft = 0;
}
this.fullscreenTempVars.savedCurrentWidth = this.currentWidth;
this.fullscreenTempVars.savedCurrentHeight = this.currentHeight;
if(sizeGrip)
sizeGrip.style.visibility = "hidden";
this.ShowCoverDiv(true);
this.AdjustSizeInFullscreen();
}
else {
this.ShowCoverDiv(false);
_aspxRestoreStyleAttribute(this.GetMainElement(), "left");
_aspxRestoreStyleAttribute(this.GetMainElement(), "top");
_aspxRestoreStyleAttribute(document.documentElement, "overflow");
_aspxRestoreStyleAttribute(document.documentElement, "position");
_aspxRestoreStyleAttribute(this.GetMainElement(), __aspxIE ? "zIndex" : "z-index");
document.body.style.margin = this.fullscreenTempVars.savedBodyMargin;
_aspxRestoreStyleAttribute(this.GetMainElement(), "position");
_aspxRestoreStyleAttribute(this.GetMainElement(), __aspxIE ? "borderTopWidth" : "border-top-width");
_aspxRestoreStyleAttribute(this.GetMainElement(), __aspxIE ? "borderLeftWidth" : "border-left-width");
_aspxRestoreStyleAttribute(this.GetMainElement(), __aspxIE ? "borderRightWidth" : "border-right-width");
_aspxRestoreStyleAttribute(this.GetMainElement(), __aspxIE ? "borderBottomWidth" : "border-bottom-width");
this.SetHeightInternal(this.fullscreenTempVars.savedCurrentHeight, false, false);
this.SetWidthInternal(this.fullscreenTempVars.savedCurrentWidth, false, false);
this.currentWidth = this.fullscreenTempVars.savedCurrentWidth;
this.currentHeight = this.fullscreenTempVars.savedCurrentHeight;
document.body.style.margin = this.fullscreenTempVars.savedBodyMargin;
if(__aspxIE && __aspxBrowserMajorVersion < 7)
_aspxRestoreAttribute(document.body, "scroll");
document.documentElement.scrollTop = this.fullscreenTempVars.savedBodyScrollTop;
document.documentElement.scrollLeft = this.fullscreenTempVars.savedBodyScrollTop;
this.ShowPlaceholderDiv(false);
if(sizeGrip)
sizeGrip.style.visibility = "";
}
this.RemoveFocus(true);
this.SetFocus();
return enable;
},
AdjustSizeInFullscreen: function() {
this.SetWidthInternal(_aspxGetDocumentClientWidth(), false, false);
this.SetHeightInternal(_aspxGetDocumentClientHeight(), false, false);
},
ShowCoverDiv: function(isShow) {
if(!this.coverDiv) {
this.coverDiv = _aspxCreateHtmlElementFromString(
""
);
this.GetMainElement().parentNode.insertBefore(this.coverDiv, this.GetMainElement());
}
this.coverDiv.style.display = isShow ? "block" : "none";
if(__aspxIE && __aspxBrowserMajorVersion < 7){
this.coverDiv.style.position = "absolute";
_aspxSetAbsoluteX(this.coverDiv, 0);
_aspxSetAbsoluteY(this.coverDiv, 0);
}
},
ShowPlaceholderDiv: function(isShow) {
if(!this.placeholderDiv) {
this.placeholderDiv = _aspxCreateHtmlElementFromString("");
_aspxInsertElementAfter(this.placeholderDiv, this.GetMainElement());
_aspxSetStyleSize(this.placeholderDiv, this.GetWidth(), this.GetHeight());
}
this.placeholderDiv.style.display = isShow ? "block" : "none";
},
OnBrowserWindowResizeInternal: function(evt) {
if(this.isInitialized && (this.isLoaded || !this.NeedToolbarRtlPrecorrection()))
this.AdjustControlCore();
},
Export: function(format) {
this.SendPostBack("Export_" + format);
},
NeedToolbarRtlPrecorrection: function() {
return __aspxIE && __aspxBrowserMajorVersion < 8 && this.rtl;
}
});
ASPxClientHtmlEditor.Cast = ASPxClientControl.Cast;
ASPxClientHtmlEditor.SpellCheckerHelper = _aspxCreateClass(null, {
constructor: function(htmlEditor) {
this.htmlEditor = htmlEditor;
this.scInitialized = false;
this.scStartOptions = "";
this.scCallbackResult = "";
this.scCallbackSpellCheckResult = "";
this.areDictionariesAssigned = true;
},
GetSpellCheckerClientInstance: function(checkExistance) {
var collection = aspxGetControlCollection();
var instanceName = this.htmlEditor.name + ASPxClientHtmlEditorIDSuffix.SpellChecker;
var instance = collection.Get(instanceName);
if(instance) {
if(!checkExistance || _aspxIsExistsElement(instance.GetOptionsHiddenField()))
return instance;
collection.Remove(instance);
}
return null;
},
InitializeSpellChecker: function() {
var spellChecker = this.GetSpellCheckerClientInstance();
if (spellChecker && !this.scInitialized) {
var he = this.htmlEditor;
spellChecker.WordChanged.AddHandler(function(sender, args) {
aspxHESpellCheckerWordChanged(he.name, sender, args);
});
spellChecker.ReCheck = function(text) {
he.SendCallback(__aspxHESpellCheckingCallbackPrefix, spellChecker.CreateCallbackArgumentToCheckText(""), false);
spellChecker.ShowLoadingPanel();
}
spellChecker.htmlEditor = he;
this.scInitialized = true;
}
},
CheckSpelling: function() {
var spellChecker = this.GetSpellCheckerClientInstance(true);
var htmlEditor = this.htmlEditor;
if (!this.areDictionariesAssigned)
alert("No dictionaries are specified for the built-in spell checker.");
if (!spellChecker)
htmlEditor.SendCallback(__aspxHESpellCheckingLoadControlCallbackPrefix, ASPxClientSpellChecker.GetCallbackArgumentToCheckText("", this.scStartOptions), true);
else
htmlEditor.SendCallback(__aspxHESpellCheckingCallbackPrefix, spellChecker.CreateCallbackArgumentToCheckText(""), true);
},
OnWordChanged: function(sender, args) {
this.htmlEditor.ExecuteCommand(ASPxClientCommandConsts.CheckSpellingCore_COMMAND, args.checkedText);
},
DoInitOnCallback: function() {
var spellChecker = this.GetSpellCheckerClientInstance();
var he = this.htmlEditor;
if (spellChecker) {
this.InitializeSpellChecker();
spellChecker.CheckByCallbackResult(this.scCallbackResult, this.scCallbackSpellCheckResult, he.GetMainElement());
spellChecker.HideLoadingPanelCore();
_aspxProcessScriptsAndLinks(spellChecker.name);
he.RemoveFocus();
}
},
OnHtmlEditorCallback: function(prefix, result, spellCheckResult, allowScripts, spellcheckerloadcontrol) {
this.allowScripts = Boolean(allowScripts);
var he = this.htmlEditor;
switch (prefix) {
case __aspxHESpellCheckingLoadControlCallbackPrefix:
var scDiv = _aspxCreateHtmlElementFromString("");
he.GetMainElement().parentNode.appendChild(scDiv);
scDiv.innerHTML = spellcheckerloadcontrol;
this.UpdatePopupControlBackground(scDiv);
_aspxProcessScriptsAndLinks(he.name);
prefix = __aspxHESpellCheckingCallbackPrefix;
case __aspxHESpellCheckingCallbackPrefix:
he.ClearUndoHistory();
he.SetHtmlInternal(result);
this.scCallbackResult = result;
this.scCallbackSpellCheckResult = spellCheckResult;
var _this = this;
window.setTimeout(function() {
_this.DoInitOnCallback();
}, 0);
break;
case __aspxHESpellCheckerOptionsCallbackPrefix:
var spellChecker = this.GetSpellCheckerClientInstance();
if (spellChecker) {
spellChecker.ProcessCallbackResult(spellCheckResult);
spellChecker.HideLoadingPanelCore();
}
break;
}
},
UpdatePopupControlBackground: function(container) {
var winContentElements = _aspxGetDescendantNodes(container, function(el) {
return el.id.indexOf("CLW-1") > -1;
});
for(var i = 0, wce; wce = winContentElements[i]; i++)
wce.style.backgroundColor = "White";
}
});
ASPxClientHtmlEditor.OnCustomDialogClosing = function(sender) {
var buttonName = sender.name.substr(sender.name.length - 2) == "Ok" ? "ok" : "cancel";
var htmlEditor = ASPxDialog.GetOwnerControl();
var dialog = ASPxDialog.GetCurrentDialog();
if(htmlEditor && dialog) {
if(!htmlEditor.RaiseCustomDialogClosing(dialog.publicName, buttonName))
ASPxClientHtmlEditor.CustomDialogComplete(buttonName, null);
}
};
ASPxClientHtmlEditor.CustomDialogComplete = function(status, data) {
aspxDialogComplete(status, data);
};
ASPxClientHtmlEditor.AreEditorsValidInContainer = function(containerOrContainerId, validationGroup, checkInvisibleEditors) {
var container = typeof(containerOrContainerId) == "string" ? document.getElementById(containerOrContainerId) : containerOrContainerId;
return ASPxHtmlEditorsCollection.Get().AreEditorsValidInContainer(container, validationGroup, checkInvisibleEditors);
}
ASPxClientHtmlEditor.ClearEditorsInContainer = function(containerOrContainerId, validationGroup, clearInvisibleEditors) {
var container = typeof(containerOrContainerId) == "string" ? document.getElementById(containerOrContainerId) : containerOrContainerId;
return ASPxHtmlEditorsCollection.Get().ClearEditorsInContainer(container, validationGroup, clearInvisibleEditors);
}
ASPxClientHtmlEditor.ValidateEditorsInContainer = function(containerOrContainerId, validationGroup, validateInvisibleEditors) {
var container = typeof(containerOrContainerId) == "string" ? document.getElementById(containerOrContainerId) : containerOrContainerId;
return ASPxHtmlEditorsCollection.Get().ValidateEditorsInContainer(container, validationGroup, validateInvisibleEditors);
}
ASPxClientHtmlEditor.SetInnerHtml = function(element, html) {
if(__aspxIE)
html = ASPxClientHtmlEditor.ProtectUrlsInHTML(html);
_aspxSetInnerHtml(element, html);
if(__aspxIE)
ASPxClientHtmlEditor.RestoreUrlsInDOM(element);
};
ASPxClientHtmlEditor.ProtectUrlsInHTML = function(html) {
html = ASPxClientHtmlEditor.RemoveSavedUrlsInHTML(html);
html = html.replace(__aspxProtectUrlsARegExpPattern, '$& savedurl=$1');
html = html.replace(__aspxProtectUrlsImgRegExpPattern, '$& savedurl=$1');
html = html.replace(__aspxProtectUrlsAreaRegExpPattern, '$& savedurl=$1');
return html;
};
ASPxClientHtmlEditor.RestoreUrlsInDOM = function(element) {
ASPxClientHtmlEditor.RestoreElementsUrlsInDOM(_aspxGetElementsByTagName(element, 'A'), 'A');
ASPxClientHtmlEditor.RestoreElementsUrlsInDOM(_aspxGetElementsByTagName(element, 'IMG'), 'IMG');
ASPxClientHtmlEditor.RestoreElementsUrlsInDOM(_aspxGetElementsByTagName(element, 'AREA'), 'AREA');
};
ASPxClientHtmlEditor.RestoreElementsUrlsInDOM = function(elements, tagName) {
var attributeName = tagName == 'IMG' ? 'src' : 'href';
var savedAttributeName = 'savedurl';
for(var i = 0; i < elements.length; i++) {
var url = _aspxGetAttribute(elements[i], savedAttributeName);
if(url != null) {
var savedInnerHTML = elements[i].innerHTML;
_aspxSetAttribute(elements[i], attributeName, url);
if(__aspxIE && tagName == 'A' && elements[i].innerHTML != savedInnerHTML)
elements[i].innerHTML = savedInnerHTML;
}
}
};
ASPxClientHtmlEditor.RemoveSavedUrlsInHTML = function(html) {
return html.replace(__aspxRemoveSavedUrlsRegExpPattern, '');
};
ASPxClientHtmlEditor.CleanHtmlScripts = function(html) {
var ret = ASPxClientHtmlEditor.RemoveScriptTags(html);
return ASPxClientHtmlEditor.RemoveScriptEventHadlers(ret);
};
ASPxClientHtmlEditor.RemoveScriptTags = function(html) {
var ret = html;
var rx = new RegExp(__aspxJSTagsRegExpPattern, "gi");
if (ret != "")
ret = ret.replace(rx, "");
return ret;
};
ASPxClientHtmlEditor.PreserveTagsByName = function(tagName, html) {
var openReg = new RegExp("<" + tagName, "gi");
var closeReg = new RegExp("<" + "/" + tagName + ">", "gi");
return _aspxApplyReplacement(html, [
[openReg, "<" + "!--" + __aspxHEPreservedTagNamePrefix + tagName],
[closeReg, "" + __aspxHEPreservedTagNamePrefix + tagName + "--" + ">"]
]);
};
ASPxClientHtmlEditor.DepreserveTagsByName = function(tagName, html) {
var openReg = new RegExp("