penguin/AstroJS

Javascript framework for my blog

commit a5cffc11e3426c4feb5bedcf43cf04b96fe929f6

author斟酌 鵬兄 <tgckpg@gmail.com>
date2016-02-23T04:33:51Z
subjectDestruct bug fix
commit a5cffc11e3426c4feb5bedcf43cf04b96fe929f6
Author: 斟酌 鵬兄 <tgckpg@gmail.com>
Date:   2016-02-23T04:33:51Z

    Destruct bug fix
---
 .../AstroEdit/SmartInput/CandidateAction/Heading.js    |  4 ++--
 botanjs/src/Astro/Blog/AstroEdit/SmartInput/_this.js   | 18 +++++++++++++-----
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/botanjs/src/Astro/Blog/AstroEdit/SmartInput/CandidateAction/Heading.js b/botanjs/src/Astro/Blog/AstroEdit/SmartInput/CandidateAction/Heading.js
index 854bb1b..22620ab 100644
--- a/botanjs/src/Astro/Blog/AstroEdit/SmartInput/CandidateAction/Heading.js
+++ b/botanjs/src/Astro/Blog/AstroEdit/SmartInput/CandidateAction/Heading.js
@@ -23,9 +23,9 @@
 		return null;
 	};
 
-	Heading.prototype.Process = function( key )
+	Heading.prototype.Process = function( content )
 	{
-		this.visualizer.insertSnippet( "heading", { "value": key } );
+		this.visualizer.insertSnippet( "heading", { "size": this.key, "value": content } );
 	};
 
 	Heading.prototype.Retreat = function( sender, e )
diff --git a/botanjs/src/Astro/Blog/AstroEdit/SmartInput/_this.js b/botanjs/src/Astro/Blog/AstroEdit/SmartInput/_this.js
index 6c9fcc3..284810e 100644
--- a/botanjs/src/Astro/Blog/AstroEdit/SmartInput/_this.js
+++ b/botanjs/src/Astro/Blog/AstroEdit/SmartInput/_this.js
@@ -229,10 +229,14 @@
 
 					// Hitting ` twice escapes the ` character itself
 					var v = sender.value.substr( 1 );
-					if( v == "" ) insert = function() { return Dand.textNode( "`" ); };
-
-					sender.BindingBox.close( true );
+					if( v == "" )
+					{
+						insert = function() { return Dand.textNode( "`" ); };
+						sender.BindingBox.close( true );
+						break;
+					}
 
+					sender.BindingBox.close();
 					// Insert the code snippet with inline flag
 					visualizer.insertSnippet( "code", { "inline": "on", "lang": "plain", "value": v } );
 					break;
@@ -245,6 +249,7 @@
 					if( ModLevels.Cands().Empty && 1 < ModLevels.length )
 					{
 						ModLevels.Action()( sender.value );
+						sender.BindingBox.close();
 						break;
 					}
 
@@ -355,13 +360,16 @@
 
 		var ClosePanel = function( confirmed )
 		{
-			Cycle.next( function() { _self.Present = false; } );
 			visualizer.restoreSelection();
 
 			if( confirmed && insert != undefined )
 				visualizer.insertAtCaret( insert() );
 
-			destructor.Destruct();
+			// Posponing this prevents the BackQuoteBinding firing
+			Cycle.next( function() {
+				_self.Present = false;
+				destructor.Destruct();
+			} );
 		};
 
 		// Advance the input level by CandidateAction