Question
I try to create a WordPress TinyMCE plugin, that will use the Thickbox in order to display the popup dialog.
Now, I like to know if there is a way to resize the Thickbox, based on screen size, and not based on static values for width and height I can give on plugin development.
Any idea please ?
Solution
OK, I found out the solution, and I place it here for the future use of another member.
I plug the following code into the TinyMCE plugin code:
ed.addCommand(
'openPluginDialog',
function()
{
var w = window.innerWidth; // Get the inner window width
var h = window.innerHeight; // Get the inner window height
w = (w * 90) / 100; // Calculate the dialog width
h = (h * 85) / 100; // Calculate the dialog height
ed.windowManager.open(
{
file : url + '/plugin_dialog.html',
width : w, // The calculated window width
height : h, // The calculated window height
inline : 1,
title: 'Plugin dialog title'
},
{
plugin_url : url
}
);
}
);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow