From e9268976618e1bdb09d7ab695fa0f1aecf017819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nico=20St=C3=BCber?= <47348788+nstueber@users.noreply.github.com> Date: Mon, 25 Mar 2019 07:22:53 +0100 Subject: [PATCH] Added "height" Added support to set a container height in syntax --- helper.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/helper.php b/helper.php index 13620d4..0d8e59d 100644 --- a/helper.php +++ b/helper.php @@ -53,9 +53,13 @@ function getAttributes($data, $useNoPrefix=true) { foreach ($tokens as $token) { - //get width + //get width or/and height if (preg_match('/^\d*\.?\d+(%|px|em|rem|ex|ch|vw|vh|pt|pc|cm|mm|in)$/', $token)) { - $attr['width'] = $token; + if (strlen($attr['width']) > 0){ + $attr['height'] = $token; + } else { + $attr['width'] = $token; + } continue; } @@ -118,10 +122,18 @@ function buildAttributes($data, $addClass='', $mode='xhtml') { // width on spans normally doesn't make much sense, but in the case of floating elements it could be used if($attr['width']) { if (strpos($attr['width'],'%') !== false) { - $out .= ' style="width: '.hsc($attr['width']).';"'; + if($attr['height']){ + $out .= ' style="width: '.hsc($attr['width']).'; height: '.hsc($attr['height']).'; overflow: auto;"'; + }else { + $out .= ' style="width: '.hsc($attr['width']).';"'; + } } else { // anything but % should be 100% when the screen gets smaller - $out .= ' style="width: '.hsc($attr['width']).'; max-width: 100%;"'; + if($attr['height']){ + $out .= ' style="width: '.hsc($attr['width']).'; height: '.hsc($attr['height']).'; overflow: auto; max-width: 100%;"'; + }else { + $out .= ' style="width: '.hsc($attr['width']).'; max-width: 100%;"'; + } } } // only write lang if it's a language in lang2dir.conf