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

increase height of texteditor using javascript

3 Answers 78 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Harbinder Khera
Top achievements
Rank 1
Harbinder Khera asked on 18 Oct 2010, 12:46 PM
i want to increase height and width of editor using javascript.
i tried it using 
var RadEditor2_contentIframe = getObject("RadEditor2_contentIframe")
and then increasing height of RadEditor2_contentIframe using javascript.
it is working fine for me in all the browsers. but when i m switching between the modes like design, code and preview my window size shrinks in IE n chrome.
i tried var RadEditor2_contentArea = $find(radEditorClientId).get_contentArea(), but still result is same.

thanks
    

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 19 Oct 2010, 05:14 PM
Hello Harbinder,

You should use the editor's setSize method to increase the editor's dimensions.


Kind 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
0
Harbinder Khera
Top achievements
Rank 1
answered on 27 Oct 2010, 02:47 AM
hi rumen,
i tried using setsize method,
problems i am facing are :
1) setSize changes size of radeditor including the lower tool design,html and preview buttons. i want only editor area to increase.
2) if i decrease the size of radeditor less than 150, it is not decreasing size to 150.
0
Rumen
Telerik team
answered on 27 Oct 2010, 01:06 PM
Hi Harbinder,

You can use the following code as a base to implement a fix for the resizing problem described in your first post:

The function below should be attached to the OnClientLoad event of RadEditor:

<script type="text/javascript"> 
        function onClientLoad(editor, args) { 
            var contentArea = editor.get_contentAreaElement(); //return a reference to content area iframe
 
            if (contentArea.offsetHeight == 0) { 
                var height = editor.get_toolContainer().parentNode.offsetHeight; 
 
                if ($telerik.isFirefox) { 
                    contentArea.style.height = height + 60 + 'px'; 
                    editor.add_modeChange(function() { 
                        if (editor.get_mode() == Telerik.Web.UI.EditModes.Html) { 
                            editor._getTextIframe().style.height = height + 60 + 'px'; 
                        } 
                    }); 
                } 
            } 
        }   
    </script> 

If you are unable to solve the problem, please, isolate it in a sample working project and send it for examination through a new support ticket.

Sincerely yours,
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
Harbinder Khera
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Harbinder Khera
Top achievements
Rank 1
Share this question
or