penguin/AstroJS

Javascript framework for my blog

botanjs/src/Astro/Blog/AstroEdit/SmartInput/CandidateAction/Heading.js

raw ยท 660 bytes

(function ()
{
	var ns = __namespace( "Astro.Blog.AstroEdit.SmartInput.CandidateAction" );

	/** @type {Astro.Blog.AstroEdit.SmartInput.ICandidateAction} */
	var Heading = function ( visualizer, key )
	{
		this.visualizer = visualizer;
		this.key = key;
	};

	Heading.prototype.GetCandidates = function( handler )
	{
		handler( false );
	};

	Heading.prototype.Process = function( content )
	{
		this.visualizer.insertSnippet( "heading", { "size": this.key, "value": content } );
	};

	Heading.prototype.Retreat = function( sender, e )
	{
		return sender.value == "" && e.keyCode == 8; // Backspace
	};

	ns[ NS_EXPORT ]( EX_CLASS, "Heading", Heading );
})();