This is a migrated thread and some comments may be shown as answers.

Force floating toolbar display on load

1 Answer 44 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Jeremy Zoerman
Top achievements
Rank 1
Jeremy Zoerman asked on 13 Aug 2010, 04:19 AM
Hello All,

I am aware the lazy initialization (when not in default mode) is by design. Can I force initialization/display when the page is loaded when ToolbarMode="Floating"?

I would like the toolbar to be displayed on page load rather than having to click the toggle button.

Thanks,
Jeremy

 

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 17 Aug 2010, 02:00 PM
Hi Jeremy,

You can open the Floating toolbar when the editor loads using the following code and reposition it:
<script type="text/javascript">
    // Rad Editor Extensions Initialization
    function OnNewEditorClientLoad(editor, args) {
        ToggleFloatingToolbar(editor);
    }
 
    function ToggleFloatingToolbar(editor) {
        var button = getElementsByClassName("ToggleFloatingToolbar")[0];
        setTimeout(function() {
            button.click();
            var oWnd = editor.get_toolAdapter().get_window();
            oWnd.moveTo(0, 100);
        }, 10);
    }
    function getElementsByClassName(classname, node) {
        if (!node) node = document.getElementsByTagName("body")[0];
        var a = [];
        var re = new RegExp('\\b' + classname + '\\b');
        var els = node.getElementsByTagName("*");
        for (var i = 0, j = els.length; i < j; i++)
            if (re.test(els[i].className)) a.push(els[i]);
        return a;
    }
    //simulate InternetExplorer's click() method
    if (!document.all) {
        HTMLElement.prototype.click = function() {
            var evt = this.ownerDocument.createEvent('MouseEvents');
            evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
            this.dispatchEvent(evt);
        }
    }
  
</script>
<telerik:RadEditor runat="server" id="RadEditor1" toolbarmode="Floating" onclientload="OnNewEditorClientLoad"></telerik:RadEditor>


Best regards,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Editor
Asked by
Jeremy Zoerman
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or