Commit cf8cb98a authored by Francois Marier's avatar Francois Marier Committed by Gerrit Code Review
Browse files

Merge "text block: add option for larger tinymce editor"

parents 83381911 1b231d76
......@@ -72,12 +72,16 @@ class PluginBlocktypeTextbox extends SystemBlocktype {
public static function instance_config_form($instance) {
$configdata = $instance->get('configdata');
if (!$height = get_config('blockeditorheight')) {
$cfheight = param_integer('cfheight', 0);
$height = $cfheight ? $cfheight * 0.7 : 150;
}
return array(
'text' => array(
'type' => 'wysiwyg',
'title' => get_string('blockcontent', 'blocktype.textbox'),
'width' => '100%',
'height' => '150px',
'height' => $height . 'px',
'defaultvalue' => isset($configdata['text']) ? $configdata['text'] : '',
'rules' => array('maxlength' => 65536),
),
......
......@@ -295,6 +295,11 @@ function ViewManager() {
var contentDiv = getFirstElementByTagAndClassName('div', 'blockinstance-content', blockinstance);
var pd = {'id': $('viewid').value, 'change': 1};
if (config.blockeditormaxwidth) {
// Shouldn't have to pass browser window dimensions here, but can't find
// another way to get tinymce elements to use up the available height.
pd['cfheight'] = getViewportDimensions().h - 100;
}
pd[getNodeAttribute(button, 'name')] = 1;
var oldContent = contentDiv.innerHTML;
......@@ -384,6 +389,7 @@ function ViewManager() {
var w = Math.max(d.w, 500);
if (config.blockeditormaxwidth && getFirstElementByTagAndClassName('textarea', 'wysiwyg', newblock)) {
w = vpdim.w - 80;
style.height = h + 'px';
}
var tborder = parseFloat(getStyle(newblock, 'border-top-width'));
......@@ -1020,6 +1026,9 @@ function ViewManager() {
'change': 1,
'blocktype': getFirstElementByTagAndClassName('input', 'blocktype-radio', self.currentlyMovingObject).value
};
if (config.blockeditormaxwidth) {
pd['cfheight'] = getViewportDimensions().h - 100;
}
pd['action_addblocktype_column_' + whereTo['column'] + '_order_' + whereTo['order']] = true;
sendjsonrequest(config['wwwroot'] + 'view/blocks.json.php', pd, 'POST', function(data) {
var div = DIV();
......
......@@ -223,10 +223,14 @@ $cfg->leapovermnetloglevel = 0;
// This should normally be set to http://www.gravatar.com/avatar/
//$cfg->remoteavatarbaseurl = 'http://www.gravatar.com/avatar/';
// Option for width of wysiwyg editor in block configuration
// Options for width/height of wysiwyg editor in block configuration
// forms. Workaround for current lack of tinymce fullscreen button.
//
// Make the block config form expand to the full width of browser window
// whenever it contains a tinymce (also increases editor height in
// textbox blocktype):
// $cfg->blockeditormaxwidth = true;
//
// Set a fixed height in pixels for the tinymce editor (currently only
// affects the textbox blocktype):
// $cfg->blockeditorheight = 550;
......@@ -242,6 +242,10 @@ html>body #column-container {
width: 100%;
}
.blockinstance.configure .mceEditor {
width: 100%;
}
/* header */
.blockinstance-header {
width: 100%;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment