Plugin Factory

The add button inserts a Factory item which can then replace itself with an item of the user's choice. Here we consider how that mechanism can be enhanced to support many more plugin kinds with much more widely varied initialization needs.

The Text Editor also instantiates items. Specifically Paragraph items, the only kind it will split.

The Transport plugin instantiates items of whatever kind it sees fit as it builds the page it is transporting.

The nascent Plugmatic plugin locates plugins and can link to About Pages that it finds within them.

About Pages include examples of plugins already instantiated that can be dragged into new use.

# Initialization

The 'factory' metaphor borrows from industry the separation of the thing made from the place of manufacture. Object-oriented programming conventions allows some by the thing when it instructs the new object to 'initialize'.

The MorseTeacher Plugin offers an extreme case where it only teaches the familiar morse when it has been initialized with markup for each of the letters as dots and dashes. Markup also captures order of letter introduction and the students observed proficiency when introduced. All this makes good use of markup editing and makes the training session serve as an editing session. But it makes no sense for a Factory to instantiate an empty MorseTeacher.

Notice that at the time of writing this server has been configured with various optional plugins and that many, including the MorseTeacher, appear in the right hand 'other' column of the Factory.

Our lack of initialization interacts poorly with our deletion practice in all but the simplest cases. No markup means delete item. This makes sense only for text formatting plugins where no markup leaves nothing to be formatted.

Aside: Having looked at the code I see that any text, if not recognized as alphabet, will be interpreted as a mini-alphabet of the letters 'cq'. I also notice that focus-out will save the current alphabet and error estimate but that backspacing away from a page will not produce a reliable focus-out.

# Mechanisms

We consider how this situation might be improved.

The Factory could look for the example on an about page and copy that rather than making new.

The Factory could invoke a new plugin entry point once the plugin is loaded. But the async nature of loading will make this challenging.

A newly instantiated item could be recognized as such by the plugin code when it is loaded. We would have to check when this happens given that the TextEditor is the first thing rendered for a new item.

The Factory menu machinery could be extended with additional properties suggesting how initialization should proceed. The server collects the menu data from installed plugin packages before they ever run.

The How To Wiki pages could include some curated list of plugins with instructions as to how to initialize them manually.

About page examples would be more useful if we could Search for About Pages as if they were part of the origin's sitemap.