Destruct bug fix

This commit is contained in:
斟酌 鵬兄 2016-02-23 12:33:51 +08:00
parent ac5906de6e
commit a5cffc11e3
2 changed files with 15 additions and 7 deletions

View File

@ -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 )

View File

@ -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