A new CKEditor Plugin that allows users to browse and embed any NetLogo Web model that is currently available in the official NLW Models Library.
Functionality is pretty simple:
-
There's a new CKEditor toolbar button (for Page editor and Question editor) (see
settings.py
) -
When a user clicks on the toolbar button, they're presented with the usual CKEditor dialog pop-up with a single Selector. This selector is populated directly from
www.netlogoweb.org/model/models.json
(for NLW models) and fromwww.github.com/NetLogo/nt-models/library.json
(for NetTango models) on plugin load. This means each time the plugin is instantiated, we get the live, most-up-to-date versions of each model from the libraries (and prune those that don't compile in NLW currently -- this is also live updated so no manual updating as NLW features are added). -
As of v2, there are now 2 tabs, one for the NetLogo Web Models Library (default) and one for the NetTango models library.
-
A searchbox in each tab is populated with all available models in each library. Users can type into each searchbox using any keyword that might appear in the model's title (or in the case of the NLW models, the folder in which the model lives). This means, users looking for Biology models need only type
Biology
and see what models are available. -
When you select one, the dialog resizes and allows you to preview the model. NetLogo Web NetTango
-
When the user clicks
Insert Model
, the model is embedded as aniframe
into the appropriate CKEditor at the cursor point. Note, it directly embeds a link to the live versions of the library models rather than uploading the model to the CT-STEM site. This has the advantage that every time the model loads, you get the newest version of both the model and NLW.
This has been tested and deployed on CKEditor 4 (specifically on Django-CKEditor). Note, that it also requires the ajax
and iframedialog
plugins to be installed and enabled on your CKEditor deployment.
To install, make sure to place the plugin inside your static hosted files or directly into your CKEditor package. As with all CKEditor plugins, the plugin must be in a folder with the NLModels
name exactly.
Finally, add the plugin to your toolbar using the NLModels
tool.
Feel free to open an issue on this repo or send me an email at [email protected] with [NLW CKEditor]
in the subject line.