Browse Source

! Font size in WYSIWYG editor not in pt first part of bug 4890

emanuele 13 years ago
parent
commit
53445a0f08
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Sources/Subs-Editor.php

+ 5 - 1
Sources/Subs-Editor.php

@@ -454,10 +454,14 @@ function html_to_bbc($text)
 		// Now work out what the attributes are.
 		$attribs = fetchTagAttributes($matches[1]);
 		$tags = array();
+		$sizes_equivalence = array(1 => '8pt', '10pt', '12pt', '14pt', '18pt', '24pt', '36pt');
 		foreach ($attribs as $s => $v)
 		{
 			if ($s == 'size')
-				$tags[] = array('[size=' . (int) trim($v) . ']', '[/size]');
+			{
+				$v = empty((int) trim($v)) ? 1 : (int) trim($v);
+				$tags[] = array('[size=' . $sizes_equivalence[$v] . ']', '[/size]');
+			}
 			elseif ($s == 'face')
 				$tags[] = array('[font=' . trim(strtolower($v)) . ']', '[/font]');
 			elseif ($s == 'color')