From 2778e12f38b7c3e1648aff3718de6dd4f82e3ff8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= <tgckpg@gmail.com>
Date: Wed, 21 Oct 2015 02:22:49 +0800
Subject: [PATCH] minor bug fixes

---
 .../Blog/AstroEdit/Visualizer/Snippet/Code.js |  2 +-
 .../AstroEdit/Visualizer/Snippet/SiteFile.js  | 46 ++++++++++++-------
 .../Astro/Blog/AstroEdit/Visualizer/_this.css |  5 ++
 .../src/Astro/Blog/Components/Entry/Block.css |  2 +-
 4 files changed, 37 insertions(+), 18 deletions(-)

diff --git a/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/Code.js b/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/Code.js
index 205ca1b1..564ef6df 100644
--- a/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/Code.js
+++ b/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/Code.js
@@ -23,7 +23,7 @@
 			, "AS3"        , "as3"
 			, "bash"       , "bash"
 			, "C#"         , "csharp"
-			, "C/C++"      , "c"
+			, "C/C++"      , "cpp"
 			, "CSS"        , "css"
 			, "php"        , "php"
 			, "Python"     , "python"
diff --git a/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/SiteFile.js b/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/SiteFile.js
index 58712220..5395c1c7 100644
--- a/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/SiteFile.js
+++ b/botanjs/src/Astro/Blog/AstroEdit/Visualizer/Snippet/SiteFile.js
@@ -75,22 +75,22 @@
 					var keys = [ new IKey( "type", "radio" ), new IKey( "name", "size_grp" + Perf.uuid ) ];
 					var sid;
 					var selectionChanged = function ()
+					{
+						_stage.setAttribute( new DataKey( "size", this.size ) );
+						//// Handles the size selection
+						switch(this.size)
 						{
-							_stage.setAttribute( new DataKey( "size", this.size ) );
-							//// Handles the size selection
-							switch(this.size)
-							{
-								case "small":
-									_image.setAttribute( "src", config.path.image.small + _hash + ".jpg" );
-									break;
-								case "medium":
-									_image.setAttribute( "src", config.path.image.medium + _hash + ".jpg" );
-									break;
-								case "large":
-									_image.setAttribute( "src", config.path.image.large + _hash + ".jpg" );
-									break;
-							}
-						};
+							case "small":
+								_image.setAttribute( "src", config.path.image.small + _hash + ".jpg" );
+								break;
+							case "medium":
+								_image.setAttribute( "src", config.path.image.medium + _hash + ".jpg" );
+								break;
+							case "large":
+								_image.setAttribute( "src", config.path.image.large + _hash + ".jpg" );
+								break;
+						}
+					};
 
 					this.stage.insertBefore( _image, desc );
 
@@ -111,6 +111,20 @@
 					IDOMElement(s).addEventListener("Change", selectionChanged.bind({size: "small"}));
 					IDOMElement(m).addEventListener("Change", selectionChanged.bind({size: "medium"}));
 					IDOMElement(l).addEventListener("Change", selectionChanged.bind({size: "large"}));
+
+					var hasValue = _stage.getDAttribute( "size" );
+					if( hasValue )
+					{
+						switch( hasValue )
+						{
+							case "small": s.checked = 1; break;
+							case "medium": m.checked = 1; break;
+							case "large": l.checked = 1; break;
+						}
+
+						selectionChanged.bind({ size: hasValue })();
+					}
+
 					break;
 				case "audio":
 					// TODO
@@ -143,7 +157,7 @@
 					]
 					, [
 						new DataKey( "value", hash )
-						, new DataKey( "size", "large" )
+						, new DataKey( "size", override.size || "large" )
 						, new IKey( "style", "max-height: 150px;" )
 					]
 				);
diff --git a/botanjs/src/Astro/Blog/AstroEdit/Visualizer/_this.css b/botanjs/src/Astro/Blog/AstroEdit/Visualizer/_this.css
index 0dfa89cc..e4c92dff 100644
--- a/botanjs/src/Astro/Blog/AstroEdit/Visualizer/_this.css
+++ b/botanjs/src/Astro/Blog/AstroEdit/Visualizer/_this.css
@@ -48,6 +48,11 @@
 	margin-bottom: 0.5em;
 }
 
+textarea.v_snippet_input {
+	font-family: monospace;
+	font-size: 1em;
+}
+
 .v_instruction {
 	padding: 0.2em 0;
 }
diff --git a/botanjs/src/Astro/Blog/Components/Entry/Block.css b/botanjs/src/Astro/Blog/Components/Entry/Block.css
index 32328792..631502e2 100644
--- a/botanjs/src/Astro/Blog/Components/Entry/Block.css
+++ b/botanjs/src/Astro/Blog/Components/Entry/Block.css
@@ -4,7 +4,7 @@
 	width: 225px;
 	height: 325px;
 
-	margin: 1em;
+	margin: 0 2em 2em 0;
 
 	position: relative;