ASP.NET 3.5 and above only

Obout.Ajax.UI Controls - HTML Editor - Customize Spell Checker in client-side

This example demonstrates how to custimize popups in client-side.
Here we removed the "Add custom" button from the Spell checker popup.
Click the button and you will not see this button in the Spell checker popup:
Aa
ASP.NET
<%@ Register Assembly="Obout.Ajax.UI" Namespace="Obout.Ajax.UI.HTMLEditor" TagPrefix="obout" %>
<%@ Register Assembly="Obout.Ajax.UI" Namespace="Obout.Ajax.UI.HTMLEditor.ToolbarButton" TagPrefix="obout" %>
...
<script type="text/javascript">
function
popupStateChanged(sender, args) {
    // on popup loaded only
    if (args.get_state() == Obout.Ajax.UI.HTMLEditor.PopupStateType.LoadEnd) {
        // 'Spell checker' popup only
        if (args.get_name().split(",")[0] == "Obout.Ajax.UI.HTMLEditor.Popups.SpellCheckPopup") {
            // find the popup component
            var popup = $find(sender.findPopup(args.get_name()).clientID);
            // save the original 'onReload' function
            popup.onReload_original = popup.onReload;
            // when popup's content will be complete
            popup.onReload = function(contentWindow) {
                // call the original 'onReload' function
                this.onReload_original(contentWindow);
                // get the "Add Custom" button's handler
                var add_to_dictionaryHandler = contentWindow.popupMediator.getHandler("add_to_dictionary");
                // get the element of the handler in the popup
                var element = contentWindow.document.getElementById(add_to_dictionaryHandler.get_id());
                // make it invisible
                element.style.display = "none";
            };
            // if popup load fired already (IE)
            if (typeof popup._iframe.contentWindow.popupMediator != "undefined") {
                popup.onReload(popup._iframe.contentWindow);
            }
        }
    }
}
</script>
...
<obout:Editor runat="server" Id="editor" EditPanel-Height="280px" TopToolbar-PreservePlace="true" Width="100%">
    <
TopToolbar Appearance="Lite" >
        <
AddButtons>
            <
obout:HorizontalSeparator runat="server" />
            <
obout:SpellCheck runat="server" />
        </
AddButtons>
    </
TopToolbar
    <
PopupHolder OnClientPopupStateChanged="popupStateChanged" />
</
obout:Editor>

"Everything is almost a perfection... Great Job!! Keep up the good work!!"

Abhisek

Random testimonial   All testimonials