Hello,
This is another blog post on TinyMCE editor in ExtJs application, Have you ever noticed that If you use TinyMce editor in ExtJs application there are some issues with height. Sometimes it takes more height then you specified and that might destroy your layout completely. This is due to internal calculations and logic of TinyMCE editor.
The logic is wrong in two ways. First thing is that it always assume that minimum height of TinyMCE editor should be 100 so if you give height less then 100. It will always take it as 100 and hence your layout is wrong. Because outer div of editor will show the height which you gave but it's actual height would be different.
Second issue is that it does not take care of editor's tool bar where you have all the controls. Actually editor's height should be height which you specified minus height of control toolbar. Which actually is not the case. It gives separate height to toolbar. For example if you set height of your editor to 100. It actually set height to 128. 100px height of editor and 28px height of toolbar controls so it's totally wrong. So what is the solution?
Well the solution is in the TinyMCE src file. You will have tiny_mce_src.js file in your app. There go to line no 13301 approximately. There you will see following line.
mh = s.min_height || 100;
This is where the issue is. If you give height less then 100 it will always take 100 as minimum height. So change it as follow.
mh = s.min_height || s.height;
Now it will take minimum height which you specified. Now go to line no 13426 approximately. Here change the height from
height : h
to
height : h-28
That's it and all your issues related to heights are resolved.
It took 4 hours for me to find the solution so I hope this post saves your time.
Thanks.
This is another blog post on TinyMCE editor in ExtJs application, Have you ever noticed that If you use TinyMce editor in ExtJs application there are some issues with height. Sometimes it takes more height then you specified and that might destroy your layout completely. This is due to internal calculations and logic of TinyMCE editor.
The logic is wrong in two ways. First thing is that it always assume that minimum height of TinyMCE editor should be 100 so if you give height less then 100. It will always take it as 100 and hence your layout is wrong. Because outer div of editor will show the height which you gave but it's actual height would be different.
Second issue is that it does not take care of editor's tool bar where you have all the controls. Actually editor's height should be height which you specified minus height of control toolbar. Which actually is not the case. It gives separate height to toolbar. For example if you set height of your editor to 100. It actually set height to 128. 100px height of editor and 28px height of toolbar controls so it's totally wrong. So what is the solution?
Well the solution is in the TinyMCE src file. You will have tiny_mce_src.js file in your app. There go to line no 13301 approximately. There you will see following line.
mh = s.min_height || 100;
This is where the issue is. If you give height less then 100 it will always take 100 as minimum height. So change it as follow.
mh = s.min_height || s.height;
Now it will take minimum height which you specified. Now go to line no 13426 approximately. Here change the height from
height : h
to
height : h-28
That's it and all your issues related to heights are resolved.
It took 4 hours for me to find the solution so I hope this post saves your time.
Thanks.
hi sir what is TinyMCE editor??
ReplyDeleteIt is rich HMTL editor for ExtJs.
Delete