forked from Botanical/BotanJS
		
	Early dynamic module loading for SmartInput
This commit is contained in:
		@@ -0,0 +1,29 @@
 | 
			
		||||
(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 )
 | 
			
		||||
	{
 | 
			
		||||
		this.visualizer = visualizer;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	Heading.prototype.GetCandidates = function( handler )
 | 
			
		||||
	{
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	Heading.prototype.Process = function( key )
 | 
			
		||||
	{
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	ns[ NS_EXPORT ]( EX_CLASS, "Heading", Heading );
 | 
			
		||||
})();
 | 
			
		||||
@@ -11,14 +11,12 @@
 | 
			
		||||
	var Cycle                                   = __import( "System.Cycle" );
 | 
			
		||||
	/** @type {System.Debug} */
 | 
			
		||||
	var debug                                   = __import( "System.Debug" );
 | 
			
		||||
	/** @type {System.Net.ClassLoader} */
 | 
			
		||||
	var Loader                                  = __import( "System.Net.ClassLoader" );
 | 
			
		||||
	/** @type {System.utils} */
 | 
			
		||||
	var utils                                   = __import( "System.utils" );
 | 
			
		||||
	/** @type {System.utils.Perf} */
 | 
			
		||||
	var Perf                                    = __import( "System.utils.Perf" );
 | 
			
		||||
	/** @type {System.utils.DataKey} */
 | 
			
		||||
	var DataKey                                 = __import( "System.utils.DataKey" );
 | 
			
		||||
	/** @type {System.utils.EventKey} */
 | 
			
		||||
	var EventKey                                = __import( "System.utils.EventKey" );
 | 
			
		||||
	/** @type {System.utils.IKey} */
 | 
			
		||||
	var IKey                                    = __import( "System.utils.IKey" );
 | 
			
		||||
	/** @type {Components.MessageBox} */
 | 
			
		||||
@@ -26,6 +24,9 @@
 | 
			
		||||
	/** @type {Astro.Blog.Config} */
 | 
			
		||||
	var Config                                  = __import( "Astro.Blog.Config" );
 | 
			
		||||
 | 
			
		||||
	var moduleNs = "Astro.Blog.AstroEdit.SmartInput.CandidateAction.";
 | 
			
		||||
	var service_uri = Config.get( "ServiceUri" );
 | 
			
		||||
 | 
			
		||||
	var KeyHandler = function( sender, handler )
 | 
			
		||||
	{
 | 
			
		||||
		return function( e )
 | 
			
		||||
@@ -38,6 +39,12 @@
 | 
			
		||||
		};
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	var LoadModule = function( mod, handler )
 | 
			
		||||
	{
 | 
			
		||||
		var ldr = new Loader( service_uri );
 | 
			
		||||
		ldr.load( moduleNs + mod, handler );
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	/** @param {Astro.Blog.AstroEdit.Visualizer} */
 | 
			
		||||
	var SmartInput = function ( visualizer, CandidatesOvd )
 | 
			
		||||
	{
 | 
			
		||||
@@ -117,6 +124,14 @@
 | 
			
		||||
			return null;
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		var ModuleLoaded = function( e )
 | 
			
		||||
		{
 | 
			
		||||
			/** @type {Astro.Blog.AstroEdit.SmartInput.ICandidateAction} */
 | 
			
		||||
			var module = new ( __import( e ) )( visualizer );
 | 
			
		||||
 | 
			
		||||
			// XXX
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		var HandleInput = function( sender, e )
 | 
			
		||||
		{
 | 
			
		||||
			// Don't handle if holding shift or ctrl key
 | 
			
		||||
@@ -154,9 +169,9 @@
 | 
			
		||||
					if( selected )
 | 
			
		||||
					{
 | 
			
		||||
						insert = undefined;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
						sender.BindingBox.close();
 | 
			
		||||
 | 
			
		||||
						LoadModule( Cands[ selected.getDAttribute( "key" ) ].module, ModuleLoaded );
 | 
			
		||||
					}
 | 
			
		||||
					else
 | 
			
		||||
					{
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,6 @@
 | 
			
		||||
/** @constructor */
 | 
			
		||||
Astro.Blog.AstroEdit.SmartInput.ICandidateAction = function(){};
 | 
			
		||||
/** @type {function} */
 | 
			
		||||
Astro.Blog.AstroEdit.SmartInput.ICandidateAction.GetCandidates;
 | 
			
		||||
/** @type {function} */
 | 
			
		||||
Astro.Blog.AstroEdit.SmartInput.ICandidateAction.Process;
 | 
			
		||||
		Reference in New Issue
	
	Block a user