By Michael Ge (@hahakumquat)
As a followup to yesterday's post, here is an Ace Editor extension that allows you to write and test extensions! Gone are the days of including extensions in HTML files. Finally, we can run extensions, even the ones discussed on this blog, just by copy-and-pasting into the editor.
Before we take a look, just a warning that, as always, using eval() is a dangerous design decision on a public website! This is more for developers to try out extensions themselves.
Some key points in the code. I assumed the name of the extension was always "test". Here is how you remove an old extension and load a new one from the Ace Editor:
Many people might be using Philippe's Viewer Factory to create the Viewer in an index.js file. If you want debug information as found in this demo, you'll have to modify the index file to define an eventCallback function in the viewer's options.
Someone please write an (extension that makes an (extension that makes an extension)) and tell me how it goes.
Source here!
Comments