Skip to content

Commit

Permalink
fix default width for Parson's to 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
smmercuri committed Nov 9, 2023
1 parent d50de9b commit f6f7c71
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions stack/cas/castext2/blocks/parsons.block.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ public function compile($format, $options): ? MP_Node {
if (isset($xpars['overridecss'])) {
unset($xpars['overridecss']);
}

// Set default width and height here, we want to push forward to overwrite the iframe defaults
$width = "100%";
$height = "400px";
if (array_key_exists('width', $xpars)) {
$width = $xpars['width'];
}
if (array_key_exists('height', $xpars)) {
$height = $xpars['height'];
}
$xpars['width'] = $width;
$xpars['height'] = $height;

// Set a title.
$xpars['title'] = 'STACK Parsons ///PARSONS_COUNT///';
Expand Down Expand Up @@ -82,16 +94,7 @@ public function compile($format, $options): ? MP_Node {
]);

// We need to define a size for the inner content.
$width = '100%';
$height = '100px';
$aspectratio = false;
if (array_key_exists('width', $xpars)) {
$width = $xpars['width'];
}
if (array_key_exists('height', $xpars)) {
$height = $xpars['height'];
}

$astyle = "width:calc($width - 3px);height:calc($height - 3px);";

if (array_key_exists('aspect-ratio', $xpars)) {
Expand Down

0 comments on commit f6f7c71

Please sign in to comment.