penguin/AstroJS

Javascript framework for my blog

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

raw ยท 1091 bytes

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

	/** @type {System.utils.IKey} */
	var IKey                              = __import( "System.utils.IKey" );
	/** @type {System.utils.DataKey} */
	var DataKey                           = __import( "System.utils.DataKey" );
	/** @type {Dandelion.IDOMElement} */
	var IDOMElement                       = __import( "Dandelion.IDOMElement" );
	/** @type {Dandelion} */
	var Dand                              = __import( "Dandelion" );

	/** @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 );
})();